google_speech 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/lib/google_speech/transcriber.rb +3 -3
- data/lib/google_speech/utility.rb +2 -2
- data/lib/google_speech/version.rb +1 -1
- data/spec/transcriber_spec.rb +3 -3
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MzMxOGYzMTcyMDcwYmNhMTI1OTI4ZWZmZDA0NjlmYmRjNWEzMjBkNjkzYzM5
|
10
|
-
YmMyZjdjZDEyZmIyZDJjNGE1ZmZmODE5ZDBlYWE4ZjQzZWZmMDYyNzY2ZDc3
|
11
|
-
ODQwMTMyZDY3ZGExZGM0ZmY1ZDZmZmNkZjg1ZjdhMWE1ODQ5ZWQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YTc2ZWVkNTAwNDdiNTQ3OWFmYzY2MGQxYzliYmMzZDVmMjg1MGJjZmZiNGE3
|
14
|
-
NTBiY2RjODM4YzlmZWZjYjRlMWZlM2EzNDE1MWVkZDUxYjRhMmI5Zjg0MjNk
|
15
|
-
MzVhYzhkZDI2ZjJmZjQ3MjU5NWVlYjI3OWU0YmRjMjRiM2NiZDU=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b1bce8c353b7d08b07ee1a1347467798892e5901
|
4
|
+
data.tar.gz: 485519ee0d04a58bccb17c84aefdc8aa43898211
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 852dd2b57c980bd31881a2ea9f5c54d6ea5599dede6068f15d31593d5b377cf8c18b074013febdd463c3a7c8bb39e93939d17ebcea499271bcf443553ef22a98
|
7
|
+
data.tar.gz: 2cce04f52058ee5c5af6ba6c7906b4f51d0f693be3350c85a23d6e2ea07e331e0ca912875fed7f41c7d799f991a31ac295e7da7c48045eeea484bbba0b4fbf71
|
@@ -65,13 +65,13 @@ module GoogleSpeech
|
|
65
65
|
def transcribe_data(data)
|
66
66
|
params = {
|
67
67
|
:path => "/speech-api/v1/recognize",
|
68
|
-
:query => "xjerr=1&client=
|
68
|
+
:query => "xjerr=1&client=chromium&lang=#{options[:language]}&maxresults=#{options[:max_results].to_i}&pfilter=#{pfilter}",
|
69
69
|
:body => data,
|
70
70
|
:method => 'POST',
|
71
71
|
:headers => {
|
72
|
-
'Content-Type' => 'audio/x-flac; rate=
|
72
|
+
'Content-Type' => 'audio/x-flac; rate=8000',
|
73
73
|
'Content-Length' => data.bytesize,
|
74
|
-
'User-Agent' => "
|
74
|
+
'User-Agent' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36"
|
75
75
|
}
|
76
76
|
}
|
77
77
|
retry_max = options[:retry_max] ? [options[:retry_max].to_i, 1].max : 3
|
@@ -22,9 +22,9 @@ module GoogleSpeech
|
|
22
22
|
def trim_to_flac(wav_path, duration, flac_path, start, length)
|
23
23
|
check_local_file(wav_path)
|
24
24
|
|
25
|
-
command = "sox -t wav '#{wav_path}' -r
|
25
|
+
command = "sox -t wav '#{wav_path}' -r 8000 -c 1 -t flac '#{flac_path}' trim #{start} #{length} compand .5,2 -80,-80,-75,-50,-30,-15,0,0 norm -0.1"
|
26
26
|
|
27
|
-
# command = "sox -t wav '#{wav_path}' -t flac '#{flac_path}' trim #{start} #{length} rate
|
27
|
+
# command = "sox -t wav '#{wav_path}' -t flac '#{flac_path}' trim #{start} #{length} rate 8000"
|
28
28
|
|
29
29
|
out, err = run_command(command)
|
30
30
|
response = out + err
|
data/spec/transcriber_spec.rb
CHANGED
@@ -9,11 +9,11 @@ describe GoogleSpeech::Transcriber do
|
|
9
9
|
|
10
10
|
transcriber = GoogleSpeech::Transcriber.new(f)
|
11
11
|
t = transcriber.transcribe
|
12
|
-
# puts t.inspect
|
12
|
+
# puts "\n\nt: #{t.inspect}\n\n"
|
13
13
|
|
14
|
-
t.size.must_equal
|
14
|
+
t.size.must_equal 2
|
15
15
|
t.first[:start_time].must_equal 0
|
16
|
-
t.first[:end_time].must_equal 5
|
16
|
+
t.first[:end_time].must_equal 5.5
|
17
17
|
t.first[:text].wont_be_nil
|
18
18
|
t.first[:confidence].wont_be_nil
|
19
19
|
end
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_speech
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.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:
|
11
|
+
date: 2014-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: This is a gem to call the google speech api.
|
@@ -86,17 +86,17 @@ require_paths:
|
|
86
86
|
- lib
|
87
87
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- -
|
89
|
+
- - '>='
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.1.11
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: This is a gem to call the google speech api.
|