speechmatics 0.0.1 → 0.0.2
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 +5 -9
- data/lib/speechmatics/api.rb +2 -2
- data/lib/speechmatics/configuration.rb +1 -1
- data/lib/speechmatics/user/jobs.rb +3 -3
- data/lib/speechmatics/version.rb +1 -1
- data/speechmatics.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03fcbfa94a40fd796f8ddf6b5bed7343dc1704cb
|
4
|
+
data.tar.gz: 153f7d2c0e0de5e13d077022a69d7b082b09d207
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca3e6c88fde5975abe11dc10e6e08313cac12cc8e9eb4ab41edfaeb005c5a1ff67f26f6583e6cafad69c0ade2ab3e245395cd5930cd0b469aaf7f564a85148f5
|
7
|
+
data.tar.gz: 708dd10e6f100e1abf89a52a71525d358c8fb8d391ab398813125d7b7b8f412fb6d6f385e8f9ba36a077c43eca6adba46bdc79e860962ae88f83a0dacd19bb10
|
data/README.md
CHANGED
@@ -4,14 +4,6 @@ Speechmatics (https://speechmatics.com) provides an API for speech to text (http
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
### libmagic
|
8
|
-
|
9
|
-
This gem will attempt to derive the content type of uploaded audio files using the 'ruby-filemagic' gem (https://github.com/blackwinter/ruby-filemagic), which requires the 'libmagic' native library to be installed.
|
10
|
-
|
11
|
-
You can explicitly specify the `content_type` for the `data_file`, and libmagic will not be called.
|
12
|
-
|
13
|
-
### gem
|
14
|
-
|
15
7
|
Add this line to your application's Gemfile:
|
16
8
|
|
17
9
|
gem 'speechmatics'
|
@@ -36,7 +28,7 @@ Speechmatics.configure do |sm|
|
|
36
28
|
|
37
29
|
# these are defaults
|
38
30
|
sm.adapter = :excon
|
39
|
-
sm.endpoint = '
|
31
|
+
sm.endpoint = 'https://api.speechmatics.com/v1.0/'
|
40
32
|
sm.user_agent = "Speechmatics Ruby Gem #{Speechmatics::VERSION}"
|
41
33
|
end
|
42
34
|
|
@@ -65,9 +57,13 @@ job = c.user.jobs.find(5678)
|
|
65
57
|
|
66
58
|
# retrieve audio for a job
|
67
59
|
audio = c.user.jobs(5678).audio
|
60
|
+
# alt syntax
|
61
|
+
audio = c.user.jobs.audio(5678)
|
68
62
|
|
69
63
|
# retrieve trancript for a job
|
70
64
|
trans = c.user.jobs(5678).transcript
|
65
|
+
# alt syntax
|
66
|
+
trans = c.user.jobs.transcript(5678)
|
71
67
|
|
72
68
|
```
|
73
69
|
|
data/lib/speechmatics/api.rb
CHANGED
@@ -89,8 +89,8 @@ module Speechmatics
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def args_to_options(args)
|
92
|
-
params = if args.is_a?(String) || args.is_a?(Symbol)
|
93
|
-
{"#{self.class.name.demodulize.downcase.singularize}_id" => args}
|
92
|
+
params = if args.is_a?(String) || args.is_a?(Symbol) || args.is_a?(Numeric)
|
93
|
+
{"#{self.class.name.demodulize.downcase.singularize}_id" => args.to_s}
|
94
94
|
elsif args.is_a?(Hash)
|
95
95
|
args
|
96
96
|
end
|
@@ -15,7 +15,7 @@ module Speechmatics
|
|
15
15
|
DEFAULT_ADAPTER = :excon
|
16
16
|
|
17
17
|
# The api endpoint to get REST
|
18
|
-
DEFAULT_ENDPOINT = '
|
18
|
+
DEFAULT_ENDPOINT = 'https://api.speechmatics.com/v1.0/'.freeze
|
19
19
|
|
20
20
|
# The value sent in the http header for 'User-Agent' if none is set
|
21
21
|
DEFAULT_USER_AGENT = "Speechmatics Ruby Gem #{Speechmatics::VERSION}".freeze
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mimemagic'
|
4
4
|
|
5
5
|
module Speechmatics
|
6
6
|
class User::Jobs < API
|
@@ -23,7 +23,7 @@ module Speechmatics
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def set_mode(params={})
|
26
|
-
params[:
|
26
|
+
params[:model] ||= 'en-US'
|
27
27
|
params
|
28
28
|
end
|
29
29
|
|
@@ -32,7 +32,7 @@ module Speechmatics
|
|
32
32
|
raise "No file specified for new job, please provide a :data_file value" unless file_path
|
33
33
|
raise "No file exists at path '#{file_path}'" unless File.exists?(file_path)
|
34
34
|
|
35
|
-
content_type = params[:content_type] ||
|
35
|
+
content_type = params[:content_type] || MimeMagic.by_path(file_path).to_s
|
36
36
|
raise "No content type specified for file, please provide a :content_type value" unless content_type
|
37
37
|
raise "Content type for file '#{file_path}' is not audio, it is '#{content_type}'." unless (content_type =~ /audio/)
|
38
38
|
|
data/lib/speechmatics/version.rb
CHANGED
data/speechmatics.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_runtime_dependency('excon')
|
25
25
|
spec.add_runtime_dependency('hashie')
|
26
26
|
spec.add_runtime_dependency('activesupport')
|
27
|
-
spec.add_runtime_dependency('
|
27
|
+
spec.add_runtime_dependency('mimemagic')
|
28
28
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 1.3"
|
30
30
|
spec.add_development_dependency "rake"
|
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.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kuklewicz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07
|
11
|
+
date: 2014-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -95,19 +95,19 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: mimemagic
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0
|
103
|
+
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: bundler
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|