google_speech 0.0.2 → 0.1.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.
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .DS_Store
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
- * language - what language is the speech in
37
- * chunk_duration - length in seconds for each audio chunk of the wav to send
38
- * overlap - chunking does not respect word boundaries; overlap can compensate
39
- * max_results - # of results to request of speech api
40
- * request_pause - sleep seconds between chunk transcription requests
41
- * profanity_filter - google by default filters profanity, this gem does not
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
@@ -4,4 +4,7 @@ require 'rake/testtask'
4
4
  desc "Default Task (test gem)"
5
5
  task :default => :test
6
6
 
7
- Rake::TestTask.new(:test) { |t| t.test_files = FileList['test/*_test.rb'] }
7
+ Rake::TestTask.new do |t|
8
+ t.pattern = 'spec/**/*_spec.rb'
9
+ t.libs.push 'spec'
10
+ end
@@ -22,4 +22,5 @@ Gem::Specification.new do |gem|
22
22
  gem.add_dependency "excon"
23
23
 
24
24
  gem.add_development_dependency "rake"
25
+ gem.add_development_dependency "minitest"
25
26
  end
@@ -20,7 +20,7 @@ module GoogleSpeech
20
20
  def to_hash
21
21
  {
22
22
  :start_time => @start_time,
23
- :duration => @duration
23
+ :end_time => @start_time + @duration
24
24
  }
25
25
  end
26
26
 
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module GoogleSpeech
4
- VERSION = "0.0.2"
4
+ VERSION = "0.1.0"
5
5
  end
@@ -1,5 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
+ gem 'minitest'
4
+
5
+ require 'minitest/spec'
3
6
  require 'minitest/autorun'
7
+
4
8
  $:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
5
9
  require 'google_speech'
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.2
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
- - test/test_helper.rb
68
- - test/transcriber_test.rb
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: -2361961218730724122
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: -2361961218730724122
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
- - test/test_helper.rb
101
- - test/transcriber_test.rb
117
+ - spec/spec_helper.rb
118
+ - spec/test.wav
119
+ - spec/transcriber_spec.rb
@@ -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