google_speech 0.2.2 → 0.3.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/.travis.yml +7 -0
- data/README.md +2 -0
- data/lib/google_speech/transcriber.rb +6 -5
- data/lib/google_speech/version.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e8c0b050e64d5ccc7521777e0b320f5544eff3b
|
4
|
+
data.tar.gz: 7389a2c17862a3a3e31359b721fa9d2eeb8d3c3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d33ab4b317a1ef3acaa48e9d05c9e47248a8e5b0fc19de80a32729f0b7a37de0fe0d595ea56d63fefe14a78a41ac7e0fe261e53e54f34b2bc6ccf374e7c869c
|
7
|
+
data.tar.gz: d2c37ebff2fb005d3fa8a69c860104977481f17b545be69ced5fb3c576d4a2940acf8b0ef074de8f715f2a8477dfd0a2c025e48ddf7be15dd286dade706b19ae
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -9,6 +9,7 @@ module GoogleSpeech
|
|
9
9
|
attr_accessor :original_file, :options, :results
|
10
10
|
|
11
11
|
DEFAULT_OPTIONS = {
|
12
|
+
:key => 'AIzaSyCnl6MRydhw_5fLXIdASxkLJzcJh5iX0M4',
|
12
13
|
:language => 'en-US',
|
13
14
|
:chunk_duration => 5,
|
14
15
|
:overlap => 0.5,
|
@@ -54,8 +55,8 @@ module GoogleSpeech
|
|
54
55
|
end
|
55
56
|
|
56
57
|
def result_from_transcript(transcript)
|
57
|
-
|
58
|
-
|
58
|
+
alt = transcript['result'].first['alternative'].first rescue nil
|
59
|
+
alt ? { :text => alt['transcript'], :confidence => (alt['confidence'] || '0.9') } : nil
|
59
60
|
end
|
60
61
|
|
61
62
|
def pfilter
|
@@ -64,8 +65,8 @@ module GoogleSpeech
|
|
64
65
|
|
65
66
|
def transcribe_data(data)
|
66
67
|
params = {
|
67
|
-
:path => "/speech-api/
|
68
|
-
:query => "
|
68
|
+
:path => "/speech-api/v2/recognize",
|
69
|
+
:query => "output=json&client=chromium&lang=#{options[:language]}&key=#{options[:key]}",
|
69
70
|
:body => data,
|
70
71
|
:method => 'POST',
|
71
72
|
:headers => {
|
@@ -85,7 +86,7 @@ module GoogleSpeech
|
|
85
86
|
connection = Excon.new(url)
|
86
87
|
response = connection.request(params)
|
87
88
|
# puts "response: #{response.inspect}\n\n"
|
88
|
-
# puts "response.body
|
89
|
+
# puts "response.body:\nSTART\n#{response.body}\nEND\n#{response.body.class.name}"
|
89
90
|
if response.status.to_s.start_with?('2')
|
90
91
|
result = []
|
91
92
|
if (response.body && response.body.size > 0)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_speech
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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: 2014-
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -61,6 +61,7 @@ extensions: []
|
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
63
|
- .gitignore
|
64
|
+
- .travis.yml
|
64
65
|
- Gemfile
|
65
66
|
- LICENSE.txt
|
66
67
|
- README.md
|