att_speech 0.0.5 → 0.0.6
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/.gitignore +51 -0
- data/.travis.yml +0 -1
- data/Gemfile +1 -14
- data/README.md +10 -4
- data/att_speech.gemspec +19 -67
- data/lib/att_speech/att_speech.rb +43 -39
- data/lib/core_ext/att_multipart.rb +8 -0
- data/spec/att_speech_spec.rb +8 -40
- metadata +42 -44
- data/Gemfile.lock +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0690de4e08cd6d303cb4694021ef554ecb155d7
|
4
|
+
data.tar.gz: 6d6009a9c67a86bf0dfb9028f452220e4f7bd4b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c51a000b86573bed51cb2045c792a5a80921ba45dd76e3e1a76ee02a5f2268d2ffb47a46f7bb476bb2e2c742a2e5b82cf841a137cc7557609fc08883626f641d
|
7
|
+
data.tar.gz: 3debb96f08b5b685eaa608908e9f2832cf02e851ea56e86333ce0f9ebb3ee1d9b006ae2d2583012965fa63439fe082d5fdbfc04c0d77a516db44bad2b827bc16
|
data/.gitignore
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
coverage.data
|
4
|
+
|
5
|
+
# rdoc generated
|
6
|
+
rdoc
|
7
|
+
|
8
|
+
# yard generated
|
9
|
+
doc
|
10
|
+
.yardoc
|
11
|
+
|
12
|
+
# bundler
|
13
|
+
.bundle
|
14
|
+
|
15
|
+
# jeweler generated
|
16
|
+
pkg
|
17
|
+
|
18
|
+
Gemfile.lock
|
19
|
+
|
20
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
21
|
+
#
|
22
|
+
# * Create a file at ~/.gitignore
|
23
|
+
# * Include files you want ignored
|
24
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
25
|
+
#
|
26
|
+
# After doing this, these files will be ignored in all your git projects,
|
27
|
+
# saving you from having to 'pollute' every project you touch with them
|
28
|
+
#
|
29
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
30
|
+
#
|
31
|
+
# For MacOS:
|
32
|
+
#
|
33
|
+
.DS_Store
|
34
|
+
|
35
|
+
# For TextMate
|
36
|
+
#*.tmproj
|
37
|
+
#tmtags
|
38
|
+
|
39
|
+
# For emacs:
|
40
|
+
#*~
|
41
|
+
#\#*
|
42
|
+
#.\#*
|
43
|
+
|
44
|
+
# For vim:
|
45
|
+
.*.sw*
|
46
|
+
|
47
|
+
# For redcar:
|
48
|
+
#.redcar
|
49
|
+
|
50
|
+
# For rubinius:
|
51
|
+
#*.rbc
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,15 +1,2 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
|
3
|
-
gem "celluloid", ">= 0.11.1", "< 0.14.0"
|
4
|
-
gem "hashie", ">= 1.2.0"
|
5
|
-
gem "activesupport"
|
6
|
-
|
7
|
-
group :development do
|
8
|
-
gem "rspec", ">= 2.8.0"
|
9
|
-
gem "yard", ">= 0.7"
|
10
|
-
gem "rdoc", ">= 3.12"
|
11
|
-
gem "bundler", ">= 1.0.0"
|
12
|
-
gem "jeweler", ">= 1.8.4"
|
13
|
-
gem "simplecov", ">= 0"
|
14
|
-
gem "fakeweb"
|
15
|
-
end
|
2
|
+
gemspec
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ require 'att_speech'
|
|
17
17
|
|
18
18
|
att_speech = ATTSpeech.new({ :api_key => ENV['ATT_SPEECH_KEY'],
|
19
19
|
:secret_key => ENV['ATT_SPEECH_SECRET'],
|
20
|
-
:scope => 'SPEECH' })
|
20
|
+
:scope => 'SPEECH' })
|
21
21
|
|
22
22
|
# Read the audio file contents
|
23
23
|
file_contents = File.read(File.expand_path(File.dirname(File.dirname(__FILE__))) + "/bostonSeltics.wav")
|
@@ -35,9 +35,13 @@ p future.value
|
|
35
35
|
# from the calling context, better to have discreet actions contained in the block, such as inserting in a
|
36
36
|
# datastore
|
37
37
|
sleep 2
|
38
|
-
|
38
|
+
supervisor = ATTSpeech.supervise({ :api_key => ENV['ATT_SPEECH_KEY'],
|
39
|
+
:secret_key => ENV['ATT_SPEECH_SECRET'],
|
40
|
+
:scope => 'SPEECH' })
|
41
|
+
supervisor.future.speech_to_text(file_contents)
|
42
|
+
# do other stuff here
|
39
43
|
sleep 5
|
40
|
-
|
44
|
+
transcription = supervisor.value # returns immediately if the operation is complete, otherwise blocks until the value is ready
|
41
45
|
|
42
46
|
def write_wav_file(audio_bytes)
|
43
47
|
file_name = "ret_audio-#{Time.now.strftime('%Y%m%d-%H%M%S')}.wav"
|
@@ -66,4 +70,6 @@ write_wav_file(future.value)
|
|
66
70
|
|
67
71
|
## Copyright
|
68
72
|
|
69
|
-
Copyright (c) 2013 Jason Goecke.
|
73
|
+
Copyright (c) 2013 Jason Goecke.
|
74
|
+
Copyright (c) 2014 Ben Klang.
|
75
|
+
See LICENSE.txt for further details.
|
data/att_speech.gemspec
CHANGED
@@ -5,83 +5,35 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "att_speech"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.6"
|
9
9
|
|
10
|
-
s.
|
11
|
-
s.authors = ["Jason Goecke, Peter Wilson"]
|
12
|
-
s.date = "2013-05-09"
|
10
|
+
s.authors = ["Jason Goecke", "Peter Wilson", "Ben Klang"]
|
13
11
|
s.description = "A Ruby library for consuming v3 of the AT&T Speech API for speech->text, and text->speech. Takes in either .wav or specific other audio files, and returns a text string of the spoken words. Can also take in either a text string or .txt file and returns a string of bytes from which a .wav file can be created of the spoken text."
|
14
|
-
s.email = "
|
12
|
+
s.email = "dev&adhearsion.com"
|
15
13
|
s.extra_rdoc_files = [
|
16
14
|
"LICENSE.txt",
|
17
15
|
"README.md"
|
18
16
|
]
|
19
|
-
s.files
|
20
|
-
"
|
21
|
-
|
22
|
-
|
23
|
-
"Gemfile",
|
24
|
-
"Gemfile.lock",
|
25
|
-
"LICENSE.txt",
|
26
|
-
"README.md",
|
27
|
-
"Rakefile",
|
28
|
-
"VERSION",
|
29
|
-
"att_speech.gemspec",
|
30
|
-
"examples/bostonSeltics.wav",
|
31
|
-
"examples/example.rb",
|
32
|
-
"examples/helloWorld.txt",
|
33
|
-
"lib/att_speech.rb",
|
34
|
-
"lib/att_speech/att_speech.rb",
|
35
|
-
"lib/att_speech/version.rb",
|
36
|
-
"spec/att_speech_spec.rb",
|
37
|
-
"spec/spec_helper.rb"
|
38
|
-
]
|
39
|
-
s.homepage = "http://github.com/jsgoecke/att_speech"
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.homepage = "http://github.com/adhearsion/att_speech"
|
40
21
|
s.licenses = ["MIT"]
|
41
22
|
s.require_paths = ["lib"]
|
42
|
-
s.
|
23
|
+
s.required_ruby_version = '>= 1.9.3'
|
43
24
|
s.summary = "A Ruby library for consuming the AT&T Speech API https://developer.att.com/developer/forward.jsp?passedItemId=12500023 for speech->text, and text->speech."
|
44
25
|
|
45
|
-
|
46
|
-
|
26
|
+
s.add_runtime_dependency(%q<faraday>, ["~> 0.8.1"])
|
27
|
+
s.add_runtime_dependency(%q<celluloid>, [">= 0.11.1"])
|
28
|
+
s.add_runtime_dependency(%q<hashie>, [">= 1.2.0"])
|
29
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
47
30
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
s.add_development_dependency(%q<rdoc>, [">= 3.12"])
|
56
|
-
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
57
|
-
s.add_development_dependency(%q<jeweler>, [">= 1.8.4"])
|
58
|
-
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
59
|
-
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
60
|
-
else
|
61
|
-
s.add_dependency(%q<faraday>, [">= 0.8.1"])
|
62
|
-
s.add_dependency(%q<celluloid>, ["< 0.14.0", ">= 0.11.1"])
|
63
|
-
s.add_dependency(%q<hashie>, [">= 1.2.0"])
|
64
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
65
|
-
s.add_dependency(%q<rspec>, [">= 2.8.0"])
|
66
|
-
s.add_dependency(%q<yard>, [">= 0.7"])
|
67
|
-
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
68
|
-
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
69
|
-
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
70
|
-
s.add_dependency(%q<simplecov>, [">= 0"])
|
71
|
-
s.add_dependency(%q<fakeweb>, [">= 0"])
|
72
|
-
end
|
73
|
-
else
|
74
|
-
s.add_dependency(%q<faraday>, [">= 0.8.1"])
|
75
|
-
s.add_dependency(%q<celluloid>, ["< 0.14.0", ">= 0.11.1"])
|
76
|
-
s.add_dependency(%q<hashie>, [">= 1.2.0"])
|
77
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
78
|
-
s.add_dependency(%q<rspec>, [">= 2.8.0"])
|
79
|
-
s.add_dependency(%q<yard>, [">= 0.7"])
|
80
|
-
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
81
|
-
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
82
|
-
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
83
|
-
s.add_dependency(%q<simplecov>, [">= 0"])
|
84
|
-
s.add_dependency(%q<fakeweb>, [">= 0"])
|
85
|
-
end
|
31
|
+
s.add_development_dependency(%q<rspec>, [">= 2.8.0"])
|
32
|
+
s.add_development_dependency(%q<yard>, [">= 0.7"])
|
33
|
+
s.add_development_dependency(%q<rdoc>, [">= 3.12"])
|
34
|
+
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
35
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.8.4"])
|
36
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
37
|
+
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
86
38
|
end
|
87
39
|
|
@@ -1,8 +1,12 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'core_ext/att_multipart'
|
4
|
+
|
1
5
|
class ATTSpeech
|
2
6
|
include Celluloid
|
3
7
|
Celluloid.logger = nil
|
4
8
|
|
5
|
-
attr_reader :api_key, :secret_key, :access_token, :refresh_token, :base_url, :ssl_verify
|
9
|
+
attr_reader :api_key, :secret_key, :access_token, :refresh_token, :base_url, :ssl_verify
|
6
10
|
|
7
11
|
##
|
8
12
|
# Creates an ATTSpeech object
|
@@ -11,47 +15,38 @@ class ATTSpeech
|
|
11
15
|
# @param [Hash] args the options to intantiate with
|
12
16
|
# @option args [String] :api_key the AT&T Speech API Key
|
13
17
|
# @option args [String] :secret_key the AT&T Speech API Secret Key
|
14
|
-
# @option args [String] :scope the Authorization Scope for the AT&T Speech API
|
15
18
|
# @option args [String] :base_url the url for the AT&T Speech API, default is 'https://api.att.com'
|
16
19
|
# @option args [Boolean] :ssl_verify determines if the peer Cert is verified for SSL, default is true
|
17
20
|
# @overload initialize(api_key, secret_key, base_url='https://api.att.com')
|
18
21
|
# @param [String] api_key the AT&T Speech API Key
|
19
22
|
# @param [String] secret_key the AT&T Speech API Secret Key
|
20
|
-
# @param [String] scope the Authorization Scope for the AT&T Speech API
|
21
23
|
# @param [String] base_url the url for the AT&T Speech API, default is 'https://api.att.com'
|
22
24
|
# @param [Boolean] ssl_verify determines if the peer Cert is verified for SSL, default is true
|
23
25
|
#
|
24
26
|
# @return [Object] an instance of ATTSpeech
|
25
27
|
def initialize(*args)
|
26
|
-
raise ArgumentError, "Requires at least the api_key
|
28
|
+
raise ArgumentError, "Requires at least the api_key and secret_key when instatiating" if args.size == 0
|
27
29
|
|
28
30
|
base_url = 'https://api.att.com'
|
29
31
|
|
30
32
|
if args.size == 1 && args[0].instance_of?(Hash)
|
31
|
-
|
32
|
-
@
|
33
|
-
@
|
34
|
-
@base_url = args[
|
35
|
-
set_ssl_verify args[
|
33
|
+
args = args.shift
|
34
|
+
@api_key = args[:api_key]
|
35
|
+
@secret_key = args[:secret_key]
|
36
|
+
@base_url = args[:base_url] || base_url
|
37
|
+
set_ssl_verify args[:ssl_verify]
|
36
38
|
else
|
37
|
-
@api_key = args
|
38
|
-
@secret_key = args
|
39
|
-
@
|
40
|
-
|
41
|
-
set_ssl_verify args[4]
|
39
|
+
@api_key = args.shift
|
40
|
+
@secret_key = args.shift
|
41
|
+
@base_url = args.shift || base_url
|
42
|
+
set_ssl_verify args.shift
|
42
43
|
end
|
43
44
|
|
44
|
-
raise ArgumentError, "scope must be either 'SPEECH' or 'TTS'" unless (@scope == 'SPEECH') || (@scope == 'TTS')
|
45
|
-
|
46
45
|
@grant_type = 'client_credentials'
|
47
46
|
@access_token = ''
|
48
47
|
@refresh_token = ''
|
49
48
|
|
50
|
-
|
51
|
-
create_connection 'application/json'
|
52
|
-
else
|
53
|
-
create_connection 'audio/x-wav'
|
54
|
-
end
|
49
|
+
create_connection 'application/json'
|
55
50
|
|
56
51
|
get_tokens
|
57
52
|
|
@@ -63,31 +58,39 @@ class ATTSpeech
|
|
63
58
|
# @param [String] file_contents to be processed
|
64
59
|
# @param [String] type of file to be processed, may be audio/wav, application/octet-stream or audio/amr
|
65
60
|
# @param [String] speech_context to use to evaluate the audio BusinessSearch, Gaming, Generic, QuestionAndAnswer, SMS, SocialMedia, TV, VoiceMail, WebSearch
|
66
|
-
# @param [Block] block to be called when the transcription completes
|
67
61
|
#
|
68
62
|
# @return [Hash] the resulting response from the AT&T Speech API
|
69
|
-
def speech_to_text(file_contents, type='audio/wav', speech_context='Generic',
|
63
|
+
def speech_to_text(file_contents, type='audio/wav', speech_context='Generic', options = {})
|
70
64
|
resource = "/speech/v3/speechToText"
|
71
65
|
|
66
|
+
# FIXME: Is this necessary?
|
72
67
|
if type == "application/octet-stream"
|
73
68
|
type = "audio/amr"
|
74
69
|
end
|
75
70
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
71
|
+
headers = {
|
72
|
+
:Authorization => "Bearer #{@access_token}",
|
73
|
+
:Content_Transfer_Encoding => 'chunked',
|
74
|
+
:Accept => 'application/json'
|
75
|
+
}
|
76
|
+
|
77
|
+
if options.has_key?(:grammar)
|
78
|
+
# Assume this is a Speech-To-Text-Custom query
|
79
|
+
resource << 'Custom'
|
80
|
+
options[:grammar] = "<?xml version=\"1.0\"?>\n#{options[:grammar]}"
|
81
|
+
body = {
|
82
|
+
'x-grammar' => Faraday::UploadIO.new(StringIO.new(options[:grammar]), 'application/srgs+xml'),
|
83
|
+
'x-voice' => Faraday::UploadIO.new(StringIO.new(file_contents), type)
|
84
|
+
}
|
85
|
+
else
|
86
|
+
headers[:X_SpeechContext] = speech_context
|
87
|
+
body = file_contents
|
90
88
|
end
|
89
|
+
|
90
|
+
response = @connection.post resource, body, headers
|
91
|
+
|
92
|
+
result = process_response(response)
|
93
|
+
result
|
91
94
|
end
|
92
95
|
|
93
96
|
|
@@ -121,7 +124,8 @@ class ATTSpeech
|
|
121
124
|
def create_connection(accept_type='application/json')
|
122
125
|
@connection = Faraday.new(:url => @base_url, :ssl => { :verify => @ssl_verify }) do |faraday|
|
123
126
|
faraday.headers['Accept'] = accept_type
|
124
|
-
faraday.
|
127
|
+
faraday.request :att_multipart
|
128
|
+
faraday.adapter Faraday.default_adapter
|
125
129
|
end
|
126
130
|
end
|
127
131
|
|
@@ -135,7 +139,7 @@ class ATTSpeech
|
|
135
139
|
request.params['client_id'] = @api_key
|
136
140
|
request.params['client_secret'] = @secret_key
|
137
141
|
request.params['grant_type'] = @grant_type
|
138
|
-
request.params['scope'] =
|
142
|
+
request.params['scope'] = 'SPEECH,STTC,TTS'
|
139
143
|
end
|
140
144
|
|
141
145
|
result = process_response(response)
|
data/spec/att_speech_spec.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
|
+
SCOPES = 'SPEECH%2CSTTC%2CTTS'
|
4
|
+
|
3
5
|
describe "AttSpeech" do
|
4
6
|
FakeWeb.allow_net_connect = false
|
5
7
|
|
6
8
|
FakeWeb.register_uri(:post,
|
7
|
-
"https://api.att.com/oauth/access_token?client_id=1234&client_secret=abcd&grant_type=client_credentials&scope
|
9
|
+
"https://api.att.com/oauth/access_token?client_id=1234&client_secret=abcd&grant_type=client_credentials&scope=#{SCOPES}",
|
8
10
|
:status => ['200', 'OK'],
|
9
11
|
:body => '{"access_token":"5678","refresh_token":"wxyz"}')
|
10
12
|
|
11
13
|
FakeWeb.register_uri(:post,
|
12
|
-
"http://foobar.com/oauth/access_token?client_id=1234&client_secret=abcd&grant_type=client_credentials&scope
|
14
|
+
"http://foobar.com/oauth/access_token?client_id=1234&client_secret=abcd&grant_type=client_credentials&scope=#{SCOPES}",
|
13
15
|
:status => ['200', 'OK'],
|
14
16
|
:body => '{"access_token":"5678","refresh_token":"wxyz"}')
|
15
17
|
|
@@ -23,10 +25,9 @@ describe "AttSpeech" do
|
|
23
25
|
:status => ['200', 'OK'],
|
24
26
|
:body => nil )
|
25
27
|
|
26
|
-
let(:att_speech) { att_speech = ATTSpeech.new('1234', 'abcd'
|
28
|
+
let(:att_speech) { att_speech = ATTSpeech.new('1234', 'abcd') }
|
27
29
|
let(:att_speech_hash) { att_speech = ATTSpeech.new({ :api_key => '1234',
|
28
|
-
:secret_key => 'abcd'
|
29
|
-
:scope => 'SPEECH' })}
|
30
|
+
:secret_key => 'abcd' })}
|
30
31
|
|
31
32
|
|
32
33
|
describe 'initializing' do
|
@@ -34,23 +35,7 @@ describe "AttSpeech" do
|
|
34
35
|
begin
|
35
36
|
ATTSpeech.new
|
36
37
|
rescue => e
|
37
|
-
e.to_s.should eql "Requires at least the api_key
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
it "shoud raise an error of wrong scope when creating object without scope" do
|
42
|
-
begin
|
43
|
-
ATTSpeech.new('1234', 'abcd')
|
44
|
-
rescue => e
|
45
|
-
e.to_s.should eql "scope must be either 'SPEECH' or 'TTS'"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
it "shoud raise an error of wrong scope when creating object with misspelled scope" do
|
50
|
-
begin
|
51
|
-
ATTSpeech.new('1234', 'abcd', 'misspelled scope')
|
52
|
-
rescue => e
|
53
|
-
e.to_s.should eql "scope must be either 'SPEECH' or 'TTS'"
|
38
|
+
e.to_s.should eql "Requires at least the api_key and secret_key when instatiating"
|
54
39
|
end
|
55
40
|
end
|
56
41
|
|
@@ -60,13 +45,12 @@ describe "AttSpeech" do
|
|
60
45
|
end
|
61
46
|
|
62
47
|
it 'should set the url to something different' do
|
63
|
-
as = ATTSpeech.new('1234', 'abcd', '
|
48
|
+
as = ATTSpeech.new('1234', 'abcd', 'http://foobar.com', false)
|
64
49
|
as.base_url.should == 'http://foobar.com'
|
65
50
|
as.ssl_verify.should == false
|
66
51
|
|
67
52
|
as = ATTSpeech.new({ :api_key => '1234',
|
68
53
|
:secret_key => 'abcd',
|
69
|
-
:scope => 'SPEECH',
|
70
54
|
:base_url => 'http://foobar.com',
|
71
55
|
:ssl_verify => false })
|
72
56
|
as.base_url.should == 'http://foobar.com'
|
@@ -126,22 +110,6 @@ describe "AttSpeech" do
|
|
126
110
|
end
|
127
111
|
end
|
128
112
|
|
129
|
-
describe 'non-blocking call with a block' do
|
130
|
-
it "should allow us to use a future to process an audio file and pass a block" do
|
131
|
-
result = nil
|
132
|
-
att_speech.speech_to_text!('spec/spec_helper.rb') { |transcription| result = transcription }
|
133
|
-
sleep 0.5
|
134
|
-
result[:recognition][:response_id].should eql '2b0bdcf4301f5c4aba57e2765b59bcbe'
|
135
|
-
result[:recognition][:n_best][:confidence].should eql 1
|
136
|
-
|
137
|
-
result = nil
|
138
|
-
att_speech_hash.speech_to_text!('spec/spec_helper.rb') { |transcription| result = transcription }
|
139
|
-
sleep 0.5
|
140
|
-
result[:recognition][:response_id].should eql '2b0bdcf4301f5c4aba57e2765b59bcbe'
|
141
|
-
result[:recognition][:n_best][:confidence].should eql 1
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
113
|
context 'text to speech' do
|
146
114
|
it 'should request a TTS transaction' do
|
147
115
|
text = 'Hello brown cow'
|
metadata
CHANGED
@@ -1,173 +1,169 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: att_speech
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Jason Goecke
|
7
|
+
- Jason Goecke
|
8
|
+
- Peter Wilson
|
9
|
+
- Ben Klang
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
date:
|
13
|
+
date: 2014-03-21 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: faraday
|
15
17
|
requirement: !ruby/object:Gem::Requirement
|
16
18
|
requirements:
|
17
|
-
- -
|
19
|
+
- - "~>"
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: 0.8.1
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
23
25
|
requirements:
|
24
|
-
- -
|
26
|
+
- - "~>"
|
25
27
|
- !ruby/object:Gem::Version
|
26
28
|
version: 0.8.1
|
27
29
|
- !ruby/object:Gem::Dependency
|
28
30
|
name: celluloid
|
29
31
|
requirement: !ruby/object:Gem::Requirement
|
30
32
|
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.14.0
|
34
|
-
- - '>='
|
33
|
+
- - ">="
|
35
34
|
- !ruby/object:Gem::Version
|
36
35
|
version: 0.11.1
|
37
36
|
type: :runtime
|
38
37
|
prerelease: false
|
39
38
|
version_requirements: !ruby/object:Gem::Requirement
|
40
39
|
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 0.14.0
|
44
|
-
- - '>='
|
40
|
+
- - ">="
|
45
41
|
- !ruby/object:Gem::Version
|
46
42
|
version: 0.11.1
|
47
43
|
- !ruby/object:Gem::Dependency
|
48
44
|
name: hashie
|
49
45
|
requirement: !ruby/object:Gem::Requirement
|
50
46
|
requirements:
|
51
|
-
- -
|
47
|
+
- - ">="
|
52
48
|
- !ruby/object:Gem::Version
|
53
49
|
version: 1.2.0
|
54
50
|
type: :runtime
|
55
51
|
prerelease: false
|
56
52
|
version_requirements: !ruby/object:Gem::Requirement
|
57
53
|
requirements:
|
58
|
-
- -
|
54
|
+
- - ">="
|
59
55
|
- !ruby/object:Gem::Version
|
60
56
|
version: 1.2.0
|
61
57
|
- !ruby/object:Gem::Dependency
|
62
58
|
name: activesupport
|
63
59
|
requirement: !ruby/object:Gem::Requirement
|
64
60
|
requirements:
|
65
|
-
- -
|
61
|
+
- - ">="
|
66
62
|
- !ruby/object:Gem::Version
|
67
63
|
version: '0'
|
68
64
|
type: :runtime
|
69
65
|
prerelease: false
|
70
66
|
version_requirements: !ruby/object:Gem::Requirement
|
71
67
|
requirements:
|
72
|
-
- -
|
68
|
+
- - ">="
|
73
69
|
- !ruby/object:Gem::Version
|
74
70
|
version: '0'
|
75
71
|
- !ruby/object:Gem::Dependency
|
76
72
|
name: rspec
|
77
73
|
requirement: !ruby/object:Gem::Requirement
|
78
74
|
requirements:
|
79
|
-
- -
|
75
|
+
- - ">="
|
80
76
|
- !ruby/object:Gem::Version
|
81
77
|
version: 2.8.0
|
82
78
|
type: :development
|
83
79
|
prerelease: false
|
84
80
|
version_requirements: !ruby/object:Gem::Requirement
|
85
81
|
requirements:
|
86
|
-
- -
|
82
|
+
- - ">="
|
87
83
|
- !ruby/object:Gem::Version
|
88
84
|
version: 2.8.0
|
89
85
|
- !ruby/object:Gem::Dependency
|
90
86
|
name: yard
|
91
87
|
requirement: !ruby/object:Gem::Requirement
|
92
88
|
requirements:
|
93
|
-
- -
|
89
|
+
- - ">="
|
94
90
|
- !ruby/object:Gem::Version
|
95
91
|
version: '0.7'
|
96
92
|
type: :development
|
97
93
|
prerelease: false
|
98
94
|
version_requirements: !ruby/object:Gem::Requirement
|
99
95
|
requirements:
|
100
|
-
- -
|
96
|
+
- - ">="
|
101
97
|
- !ruby/object:Gem::Version
|
102
98
|
version: '0.7'
|
103
99
|
- !ruby/object:Gem::Dependency
|
104
100
|
name: rdoc
|
105
101
|
requirement: !ruby/object:Gem::Requirement
|
106
102
|
requirements:
|
107
|
-
- -
|
103
|
+
- - ">="
|
108
104
|
- !ruby/object:Gem::Version
|
109
105
|
version: '3.12'
|
110
106
|
type: :development
|
111
107
|
prerelease: false
|
112
108
|
version_requirements: !ruby/object:Gem::Requirement
|
113
109
|
requirements:
|
114
|
-
- -
|
110
|
+
- - ">="
|
115
111
|
- !ruby/object:Gem::Version
|
116
112
|
version: '3.12'
|
117
113
|
- !ruby/object:Gem::Dependency
|
118
114
|
name: bundler
|
119
115
|
requirement: !ruby/object:Gem::Requirement
|
120
116
|
requirements:
|
121
|
-
- -
|
117
|
+
- - ">="
|
122
118
|
- !ruby/object:Gem::Version
|
123
119
|
version: 1.0.0
|
124
120
|
type: :development
|
125
121
|
prerelease: false
|
126
122
|
version_requirements: !ruby/object:Gem::Requirement
|
127
123
|
requirements:
|
128
|
-
- -
|
124
|
+
- - ">="
|
129
125
|
- !ruby/object:Gem::Version
|
130
126
|
version: 1.0.0
|
131
127
|
- !ruby/object:Gem::Dependency
|
132
128
|
name: jeweler
|
133
129
|
requirement: !ruby/object:Gem::Requirement
|
134
130
|
requirements:
|
135
|
-
- -
|
131
|
+
- - ">="
|
136
132
|
- !ruby/object:Gem::Version
|
137
133
|
version: 1.8.4
|
138
134
|
type: :development
|
139
135
|
prerelease: false
|
140
136
|
version_requirements: !ruby/object:Gem::Requirement
|
141
137
|
requirements:
|
142
|
-
- -
|
138
|
+
- - ">="
|
143
139
|
- !ruby/object:Gem::Version
|
144
140
|
version: 1.8.4
|
145
141
|
- !ruby/object:Gem::Dependency
|
146
142
|
name: simplecov
|
147
143
|
requirement: !ruby/object:Gem::Requirement
|
148
144
|
requirements:
|
149
|
-
- -
|
145
|
+
- - ">="
|
150
146
|
- !ruby/object:Gem::Version
|
151
147
|
version: '0'
|
152
148
|
type: :development
|
153
149
|
prerelease: false
|
154
150
|
version_requirements: !ruby/object:Gem::Requirement
|
155
151
|
requirements:
|
156
|
-
- -
|
152
|
+
- - ">="
|
157
153
|
- !ruby/object:Gem::Version
|
158
154
|
version: '0'
|
159
155
|
- !ruby/object:Gem::Dependency
|
160
156
|
name: fakeweb
|
161
157
|
requirement: !ruby/object:Gem::Requirement
|
162
158
|
requirements:
|
163
|
-
- -
|
159
|
+
- - ">="
|
164
160
|
- !ruby/object:Gem::Version
|
165
161
|
version: '0'
|
166
162
|
type: :development
|
167
163
|
prerelease: false
|
168
164
|
version_requirements: !ruby/object:Gem::Requirement
|
169
165
|
requirements:
|
170
|
-
- -
|
166
|
+
- - ">="
|
171
167
|
- !ruby/object:Gem::Version
|
172
168
|
version: '0'
|
173
169
|
description: A Ruby library for consuming v3 of the AT&T Speech API for speech->text,
|
@@ -175,18 +171,18 @@ description: A Ruby library for consuming v3 of the AT&T Speech API for speech->
|
|
175
171
|
a text string of the spoken words. Can also take in either a text string or .txt
|
176
172
|
file and returns a string of bytes from which a .wav file can be created of the
|
177
173
|
spoken text.
|
178
|
-
email:
|
174
|
+
email: dev&adhearsion.com
|
179
175
|
executables: []
|
180
176
|
extensions: []
|
181
177
|
extra_rdoc_files:
|
182
178
|
- LICENSE.txt
|
183
179
|
- README.md
|
184
180
|
files:
|
185
|
-
- .document
|
186
|
-
- .
|
187
|
-
- .
|
181
|
+
- ".document"
|
182
|
+
- ".gitignore"
|
183
|
+
- ".rspec"
|
184
|
+
- ".travis.yml"
|
188
185
|
- Gemfile
|
189
|
-
- Gemfile.lock
|
190
186
|
- LICENSE.txt
|
191
187
|
- README.md
|
192
188
|
- Rakefile
|
@@ -198,9 +194,10 @@ files:
|
|
198
194
|
- lib/att_speech.rb
|
199
195
|
- lib/att_speech/att_speech.rb
|
200
196
|
- lib/att_speech/version.rb
|
197
|
+
- lib/core_ext/att_multipart.rb
|
201
198
|
- spec/att_speech_spec.rb
|
202
199
|
- spec/spec_helper.rb
|
203
|
-
homepage: http://github.com/
|
200
|
+
homepage: http://github.com/adhearsion/att_speech
|
204
201
|
licenses:
|
205
202
|
- MIT
|
206
203
|
metadata: {}
|
@@ -210,20 +207,21 @@ require_paths:
|
|
210
207
|
- lib
|
211
208
|
required_ruby_version: !ruby/object:Gem::Requirement
|
212
209
|
requirements:
|
213
|
-
- -
|
210
|
+
- - ">="
|
214
211
|
- !ruby/object:Gem::Version
|
215
|
-
version:
|
212
|
+
version: 1.9.3
|
216
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
214
|
requirements:
|
218
|
-
- -
|
215
|
+
- - ">="
|
219
216
|
- !ruby/object:Gem::Version
|
220
217
|
version: '0'
|
221
218
|
requirements: []
|
222
219
|
rubyforge_project:
|
223
|
-
rubygems_version: 2.
|
220
|
+
rubygems_version: 2.2.2
|
224
221
|
signing_key:
|
225
|
-
specification_version:
|
222
|
+
specification_version: 4
|
226
223
|
summary: A Ruby library for consuming the AT&T Speech API https://developer.att.com/developer/forward.jsp?passedItemId=12500023
|
227
224
|
for speech->text, and text->speech.
|
228
|
-
test_files:
|
229
|
-
|
225
|
+
test_files:
|
226
|
+
- spec/att_speech_spec.rb
|
227
|
+
- spec/spec_helper.rb
|
data/Gemfile.lock
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activesupport (3.2.13)
|
5
|
-
i18n (= 0.6.1)
|
6
|
-
multi_json (~> 1.0)
|
7
|
-
celluloid (0.13.0)
|
8
|
-
timers (>= 1.0.0)
|
9
|
-
diff-lcs (1.2.4)
|
10
|
-
fakeweb (1.3.0)
|
11
|
-
faraday (0.8.7)
|
12
|
-
multipart-post (~> 1.1)
|
13
|
-
git (1.2.5)
|
14
|
-
hashie (2.0.4)
|
15
|
-
i18n (0.6.1)
|
16
|
-
jeweler (1.8.4)
|
17
|
-
bundler (~> 1.0)
|
18
|
-
git (>= 1.2.5)
|
19
|
-
rake
|
20
|
-
rdoc
|
21
|
-
json (1.7.7)
|
22
|
-
json (1.7.7-java)
|
23
|
-
multi_json (1.7.3)
|
24
|
-
multipart-post (1.2.0)
|
25
|
-
rake (10.0.4)
|
26
|
-
rdoc (4.0.1)
|
27
|
-
json (~> 1.4)
|
28
|
-
rspec (2.13.0)
|
29
|
-
rspec-core (~> 2.13.0)
|
30
|
-
rspec-expectations (~> 2.13.0)
|
31
|
-
rspec-mocks (~> 2.13.0)
|
32
|
-
rspec-core (2.13.1)
|
33
|
-
rspec-expectations (2.13.0)
|
34
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
35
|
-
rspec-mocks (2.13.1)
|
36
|
-
simplecov (0.7.1)
|
37
|
-
multi_json (~> 1.0)
|
38
|
-
simplecov-html (~> 0.7.1)
|
39
|
-
simplecov-html (0.7.1)
|
40
|
-
timers (1.1.0)
|
41
|
-
yard (0.8.6.1)
|
42
|
-
|
43
|
-
PLATFORMS
|
44
|
-
java
|
45
|
-
ruby
|
46
|
-
|
47
|
-
DEPENDENCIES
|
48
|
-
activesupport
|
49
|
-
bundler (>= 1.0.0)
|
50
|
-
celluloid (>= 0.11.1, < 0.14.0)
|
51
|
-
fakeweb
|
52
|
-
faraday (>= 0.8.1)
|
53
|
-
hashie (>= 1.2.0)
|
54
|
-
jeweler (>= 1.8.4)
|
55
|
-
rdoc (>= 3.12)
|
56
|
-
rspec (>= 2.8.0)
|
57
|
-
simplecov
|
58
|
-
yard (>= 0.7)
|