speechmatics 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea017673d556033401c14696044da5138ea16a07
4
- data.tar.gz: 8d2130263ec30cd9c30176ca1aabc67ff7fe5c73
3
+ metadata.gz: ec521f15165eb5671307764e769b2d06650fe094
4
+ data.tar.gz: d9ffee30ce7281635338fbdd10593ae9e1070f2d
5
5
  SHA512:
6
- metadata.gz: 58542c658db617cf6170385b8b0a34a0af186f3dd46008b1d8c337df918709446eb27c356fa5b04eb9d525a361997e722091baaf574ad094dbbb7f7b78bd140c
7
- data.tar.gz: 25bf87cc0aea2f8f330edbd2984726cba0942114dc842cfeb23c71186ee02870889719da8fb45f78cc6151d572c23464de9bd4476635f942b9bfb7765364186c
6
+ metadata.gz: e64b84ee8115088b7f3f03f4dbe42dc195101232cb5fd90ae2a4df5d67bb7389251861053a0f4e78446aa87b3154d4c88ff9890522ae395bf1023c7abe2592ac
7
+ data.tar.gz: a99c7b5633fa325e24d35111d375dcbefaf4836105f5b893ad39da0c5afdf36f7e22b05af7ffed178b542d35dff93a7e1bcb16933e56095d13b97146ed589a89
data/README.md CHANGED
@@ -73,6 +73,9 @@ trans = c.user.jobs.transcript(5678)
73
73
 
74
74
  ## Changes
75
75
 
76
+ * 0.1.4 - 8/21/2015
77
+ - Add support for video files.
78
+
76
79
  * 0.1.3 - 6/10/2015
77
80
  - Add default timeout of 120 seconds.
78
81
 
@@ -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
- connection.response :json
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[:model] ||= 'en-US'
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
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module Speechmatics
4
- VERSION = '0.1.4'
4
+ VERSION = '0.2.0'
5
5
  end
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.1.4
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: 2015-08-21 00:00:00.000000000 Z
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.5
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'