speechmatics 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/speechmatics/api.rb +1 -1
- data/lib/speechmatics/connection.rb +11 -2
- data/lib/speechmatics/user/jobs.rb +16 -1
- data/lib/speechmatics/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec521f15165eb5671307764e769b2d06650fe094
|
4
|
+
data.tar.gz: d9ffee30ce7281635338fbdd10593ae9e1070f2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e64b84ee8115088b7f3f03f4dbe42dc195101232cb5fd90ae2a4df5d67bb7389251861053a0f4e78446aa87b3154d4c88ff9890522ae395bf1023c7abe2592ac
|
7
|
+
data.tar.gz: a99c7b5633fa325e24d35111d375dcbefaf4836105f5b893ad39da0c5afdf36f7e22b05af7ffed178b542d35dff93a7e1bcb16933e56095d13b97146ed589a89
|
data/README.md
CHANGED
data/lib/speechmatics/api.rb
CHANGED
@@ -37,7 +37,7 @@ module Speechmatics
|
|
37
37
|
end
|
38
38
|
|
39
39
|
conn = connection((params[:options] || {}).merge(current_options))
|
40
|
-
request_path = (conn.path_prefix + '/' + path).gsub(/\/+/, '/')
|
40
|
+
request_path = (conn.path_prefix + '/' + path).gsub(/\/+/, '/')
|
41
41
|
|
42
42
|
response = conn.send(method) do |request|
|
43
43
|
case method.to_sym
|
@@ -30,6 +30,12 @@ module Speechmatics
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def connection(options={})
|
33
|
+
if options[:allow_text]
|
34
|
+
allow_text = true
|
35
|
+
options.delete(:allow_text)
|
36
|
+
else
|
37
|
+
allow_text =false
|
38
|
+
end
|
33
39
|
opts = merge_default_options(options)
|
34
40
|
|
35
41
|
@conn ||= Faraday::Connection.new(opts) do |connection|
|
@@ -49,8 +55,11 @@ module Speechmatics
|
|
49
55
|
|
50
56
|
connection.response :mashify
|
51
57
|
connection.response :logger if ENV['DEBUG']
|
52
|
-
|
53
|
-
|
58
|
+
if allow_text
|
59
|
+
connection.response :json, :content_type => /\bjson$/
|
60
|
+
else
|
61
|
+
connection.response :json
|
62
|
+
end
|
54
63
|
connection.adapter(*adapter)
|
55
64
|
end
|
56
65
|
end
|
@@ -8,6 +8,7 @@ module Speechmatics
|
|
8
8
|
|
9
9
|
def create(params={})
|
10
10
|
attach_audio(params)
|
11
|
+
attach_text(params) if params[:text_file]
|
11
12
|
set_mode(params)
|
12
13
|
super
|
13
14
|
end
|
@@ -17,8 +18,15 @@ module Speechmatics
|
|
17
18
|
request(:get, "#{base_path}/transcript")
|
18
19
|
end
|
19
20
|
|
21
|
+
def alignment(params={})
|
22
|
+
self.current_options = current_options.merge(args_to_options(params))
|
23
|
+
request(:get, "#{base_path}/alignment", {:options => {:allow_text => true}})
|
24
|
+
end
|
25
|
+
|
20
26
|
def set_mode(params={})
|
21
|
-
params[:
|
27
|
+
unless params[:text_file]
|
28
|
+
params[:model] ||= 'en-US'
|
29
|
+
end
|
22
30
|
params
|
23
31
|
end
|
24
32
|
|
@@ -35,5 +43,12 @@ module Speechmatics
|
|
35
43
|
params
|
36
44
|
end
|
37
45
|
|
46
|
+
def attach_text(params={})
|
47
|
+
file_path = params[:text_file]
|
48
|
+
raise "No file exists at path '#{file_path}'" unless File.exists?(file_path)
|
49
|
+
params[:text_file] = Faraday::UploadIO.new(file_path, "text/plain; charset=utf-8",)
|
50
|
+
params
|
51
|
+
end
|
52
|
+
|
38
53
|
end
|
39
54
|
end
|
data/lib/speechmatics/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: speechmatics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kuklewicz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
217
|
rubyforge_project:
|
218
|
-
rubygems_version: 2.4
|
218
|
+
rubygems_version: 2.6.4
|
219
219
|
signing_key:
|
220
220
|
specification_version: 4
|
221
221
|
summary: 'Ruby client for Speechmatics API: https://speechmatics.com/api-details'
|