google_speech 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/google_speech/transcriber.rb +8 -4
- data/lib/google_speech/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDVkYmNiZGJiNGY2Y2Y2NmY2YjAwZThhNGMwMGY5MzM4MzE5MTAzMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWIwYzg5YTM0YmYwNjcwMThjYWNlMTExZjQ1NWM1ODcwYmNjZjljYQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzZlMzVkNzFkZTNmODc1ZTdhYTJlYTA0ZWExOGFiMDliNWJhYmRmZDhiY2Rj
|
10
|
+
ODgwODJkN2UyY2VmZmZjNTJiY2Y4YjFhYzAxY2ZkYmQ1ZmI1YjMyNWQ1MDNi
|
11
|
+
OWQ2ODVjNjQwYWQ5ODY3YTMxYTg4YjlhYjY2YmVlMDEwMmUwODM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDIwMWY5OWNjNmE3ZDIxYmIxOWRlMjBlYWIwMDk3YTdkZjkwMDU3ZDA3MmU3
|
14
|
+
ZDQ2NWZkMDhkZTViZjRhYTBiMWFiMDYxZDk2ZWZkMWU1ZTAxZjg4ZTg0YjMy
|
15
|
+
MDhhZDk2YWRmOGEzOTdkOTI0YzRmMDFjMDYxZjZiZWIyYjJhNjg=
|
@@ -43,10 +43,14 @@ module GoogleSpeech
|
|
43
43
|
|
44
44
|
def extract_result(transcripts)
|
45
45
|
results = transcripts.map{|t| result_from_transcript(t)}.compact
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
}
|
46
|
+
|
47
|
+
return {:text => '', :confidence => 0} if results.size == 0
|
48
|
+
|
49
|
+
t = results.collect {|t| t[:text] }.join(' ')
|
50
|
+
c = results.inject(0.0) {|s, t| s.to_f + t[:confidence].to_f } / results.size.to_f
|
51
|
+
c = 0 if c.nan? || c.infinite?
|
52
|
+
|
53
|
+
{ :text => t, :confidence => c }
|
50
54
|
end
|
51
55
|
|
52
56
|
def result_from_transcript(transcript)
|