google_speech 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +14 -6
- data/Rakefile +4 -1
- data/google_speech.gemspec +1 -0
- data/lib/google_speech/chunk.rb +1 -1
- data/lib/google_speech/version.rb +1 -1
- data/{test/test_helper.rb → spec/spec_helper.rb} +4 -0
- data/spec/test.wav +0 -0
- data/spec/transcriber_spec.rb +21 -0
- metadata +25 -7
- data/test/transcriber_test.rb +0 -29
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -26,21 +26,29 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
## Usage
|
28
28
|
|
29
|
+
As a gem in yourt code:
|
30
|
+
|
31
|
+
|
29
32
|
require 'google_speech'
|
30
33
|
|
31
34
|
f = File.open '/Users/you/Downloads/audio.wav'
|
32
35
|
transcriber = GoogleSpeech::Transcriber.new(f)
|
33
36
|
t = transcriber.transcribe
|
34
37
|
|
38
|
+
As a command line tool
|
39
|
+
|
40
|
+
> google_speech somefile.wav
|
41
|
+
|
35
42
|
Options:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
43
|
+
* language - what language is the speech in
|
44
|
+
* chunk_duration - length in seconds for each audio chunk of the wav to send
|
45
|
+
* overlap - chunking does not respect word boundaries; overlap can compensate
|
46
|
+
* max_results - # of results to request of speech api
|
47
|
+
* request_pause - sleep seconds between chunk transcription requests
|
48
|
+
* profanity_filter - google by default filters profanity; this gem does not.
|
42
49
|
|
43
50
|
Default option values:
|
51
|
+
|
44
52
|
{
|
45
53
|
:language => 'en-US',
|
46
54
|
:chunk_duration => 8,
|
data/Rakefile
CHANGED
data/google_speech.gemspec
CHANGED
data/lib/google_speech/chunk.rb
CHANGED
data/spec/test.wav
ADDED
Binary file
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe GoogleSpeech::Transcriber do
|
6
|
+
|
7
|
+
it 'transcribes a file' do
|
8
|
+
f = File.open(File.join(File.dirname(__FILE__), 'test.wav'))
|
9
|
+
|
10
|
+
transcriber = GoogleSpeech::Transcriber.new(f)
|
11
|
+
t = transcriber.transcribe
|
12
|
+
# puts t.inspect
|
13
|
+
|
14
|
+
t.size.must_equal 1
|
15
|
+
t.first[:start_time].must_equal 0
|
16
|
+
t.first[:end_time].must_equal 5
|
17
|
+
t.first[:text].wont_be_nil
|
18
|
+
t.first[:confidence].wont_be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_speech
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: minitest
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
description: This is a gem to call the google speech api.
|
47
63
|
email:
|
48
64
|
- andrew@prx.org
|
@@ -64,8 +80,9 @@ files:
|
|
64
80
|
- lib/google_speech/transcriber.rb
|
65
81
|
- lib/google_speech/utility.rb
|
66
82
|
- lib/google_speech/version.rb
|
67
|
-
-
|
68
|
-
- test
|
83
|
+
- spec/spec_helper.rb
|
84
|
+
- spec/test.wav
|
85
|
+
- spec/transcriber_spec.rb
|
69
86
|
homepage: ''
|
70
87
|
licenses: []
|
71
88
|
post_install_message:
|
@@ -80,7 +97,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
97
|
version: '0'
|
81
98
|
segments:
|
82
99
|
- 0
|
83
|
-
hash: -
|
100
|
+
hash: -2552710546043608877
|
84
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
102
|
none: false
|
86
103
|
requirements:
|
@@ -89,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
106
|
version: '0'
|
90
107
|
segments:
|
91
108
|
- 0
|
92
|
-
hash: -
|
109
|
+
hash: -2552710546043608877
|
93
110
|
requirements: []
|
94
111
|
rubyforge_project:
|
95
112
|
rubygems_version: 1.8.23
|
@@ -97,5 +114,6 @@ signing_key:
|
|
97
114
|
specification_version: 3
|
98
115
|
summary: This is a gem to call the google speech api.
|
99
116
|
test_files:
|
100
|
-
-
|
101
|
-
- test
|
117
|
+
- spec/spec_helper.rb
|
118
|
+
- spec/test.wav
|
119
|
+
- spec/transcriber_spec.rb
|
data/test/transcriber_test.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require 'test_helper.rb'
|
4
|
-
|
5
|
-
describe Transcriber do
|
6
|
-
before do
|
7
|
-
end
|
8
|
-
|
9
|
-
describe 'load file' do
|
10
|
-
f = File.open '/Users/andrew/Downloads/hive.wav'
|
11
|
-
# f = File.open('/Users/andrew/dev/projects/nu_wav/test/files/test_basic.wav')
|
12
|
-
transcriber = GoogleSpeech::Transcriber.new(f)
|
13
|
-
t = transcriber.transcribe
|
14
|
-
puts t.inspect
|
15
|
-
end
|
16
|
-
|
17
|
-
# describe "when asked about cheeseburgers" do
|
18
|
-
# it "must respond positively" do
|
19
|
-
# @meme.i_can_has_cheezburger?.must_equal "OHAI!"
|
20
|
-
# end
|
21
|
-
# end
|
22
|
-
|
23
|
-
# describe "when asked about blending possibilities" do
|
24
|
-
# it "won't say no" do
|
25
|
-
# @meme.will_it_blend?.wont_match /^no/i
|
26
|
-
# end
|
27
|
-
# end
|
28
|
-
|
29
|
-
end
|