google-cloud-speech 0.30.1 → 0.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/README.md +6 -6
- data/lib/google/cloud/speech.rb +11 -5
- data/lib/google/cloud/speech/v1.rb +11 -5
- data/lib/google/cloud/speech/v1/cloud_speech_pb.rb +5 -0
- data/lib/google/cloud/speech/v1/cloud_speech_services_pb.rb +3 -1
- data/lib/google/cloud/speech/v1/credentials.rb +1 -0
- data/lib/google/cloud/speech/v1/doc/google/cloud/speech/v1/cloud_speech.rb +117 -42
- data/lib/google/cloud/speech/v1/doc/google/longrunning/operations.rb +1 -0
- data/lib/google/cloud/speech/v1/doc/google/protobuf/any.rb +14 -8
- data/lib/google/cloud/speech/v1/doc/google/protobuf/duration.rb +1 -0
- data/lib/google/cloud/speech/v1/doc/google/rpc/status.rb +1 -0
- data/lib/google/cloud/speech/v1/doc/overview.rb +1 -0
- data/lib/google/cloud/speech/v1/helpers.rb +43 -0
- data/lib/google/cloud/speech/v1/speech_client.rb +2 -0
- data/lib/google/cloud/speech/v1p1beta1.rb +6 -0
- data/lib/google/cloud/speech/v1p1beta1/cloud_speech_pb.rb +1 -0
- data/lib/google/cloud/speech/v1p1beta1/cloud_speech_services_pb.rb +1 -0
- data/lib/google/cloud/speech/v1p1beta1/credentials.rb +1 -0
- data/lib/google/cloud/speech/v1p1beta1/doc/google/cloud/speech/v1p1beta1/cloud_speech.rb +1 -0
- data/lib/google/cloud/speech/v1p1beta1/doc/google/longrunning/operations.rb +1 -0
- data/lib/google/cloud/speech/v1p1beta1/doc/google/protobuf/any.rb +14 -8
- data/lib/google/cloud/speech/v1p1beta1/doc/google/protobuf/duration.rb +1 -0
- data/lib/google/cloud/speech/v1p1beta1/doc/google/rpc/status.rb +1 -0
- data/lib/google/cloud/speech/v1p1beta1/doc/overview.rb +1 -0
- data/lib/google/cloud/speech/v1p1beta1/helpers.rb +43 -0
- data/lib/google/cloud/speech/v1p1beta1/speech_client.rb +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1f6841b6663a41af690badb830dba6d4d026a54422fe038f8a47c42a3581695
|
4
|
+
data.tar.gz: 3dad21f40f438e0341dab5b64ef2a77b852727a8e6c3fe188f7d91abb4a8e85e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 262d2526c67d467a16eea712289f3890769503d5ebfa44b20099305eb4493fc0a69af06aa7858d62d78fcaf043b6b144f800e6b9135b697ed00890e778be8342
|
7
|
+
data.tar.gz: 61afa7f82629b83bd46f09532567554836fd4833d133f6fb49c4db90406f6b88b97c6287be41894b0e42ec8dc308ce1c93d6c2f9f1e631b72a7623049cba9e4f
|
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# Ruby Client for
|
1
|
+
# Ruby Client for Cloud Speech API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
2
2
|
|
3
|
-
[
|
4
|
-
|
3
|
+
[Cloud Speech API][Product Documentation]:
|
4
|
+
Converts audio to text by applying powerful neural network models.
|
5
5
|
- [Client Library Documentation][]
|
6
6
|
- [Product Documentation][]
|
7
7
|
|
@@ -11,7 +11,7 @@ steps:
|
|
11
11
|
|
12
12
|
1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
13
13
|
2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
14
|
-
3. [Enable the
|
14
|
+
3. [Enable the Cloud Speech API.](https://console.cloud.google.com/apis/library/speech.googleapis.com)
|
15
15
|
4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
16
16
|
|
17
17
|
### Installation
|
@@ -46,9 +46,9 @@ response = speech_client.recognize(config, audio)
|
|
46
46
|
```
|
47
47
|
|
48
48
|
### Next Steps
|
49
|
-
- Read the [Client Library Documentation][] for
|
49
|
+
- Read the [Client Library Documentation][] for Cloud Speech API
|
50
50
|
to see other available methods on the client.
|
51
|
-
- Read the [
|
51
|
+
- Read the [Cloud Speech API Product documentation][Product Documentation]
|
52
52
|
to learn more about the product and see How-to Guides.
|
53
53
|
- View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
54
54
|
to see the full list of Cloud APIs that we cover.
|
data/lib/google/cloud/speech.rb
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
require "google/gax"
|
16
17
|
require "pathname"
|
17
18
|
|
@@ -20,10 +21,10 @@ module Google
|
|
20
21
|
# rubocop:disable LineLength
|
21
22
|
|
22
23
|
##
|
23
|
-
# # Ruby Client for
|
24
|
+
# # Ruby Client for Cloud Speech API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
24
25
|
#
|
25
|
-
# [
|
26
|
-
#
|
26
|
+
# [Cloud Speech API][Product Documentation]:
|
27
|
+
# Converts audio to text by applying powerful neural network models.
|
27
28
|
# - [Product Documentation][]
|
28
29
|
#
|
29
30
|
# ## Quick Start
|
@@ -32,9 +33,14 @@ module Google
|
|
32
33
|
#
|
33
34
|
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
34
35
|
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
35
|
-
# 3. [Enable the
|
36
|
+
# 3. [Enable the Cloud Speech API.](https://console.cloud.google.com/apis/library/speech.googleapis.com)
|
36
37
|
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
37
38
|
#
|
39
|
+
# ### Installation
|
40
|
+
# ```
|
41
|
+
# $ gem install google-cloud-speech
|
42
|
+
# ```
|
43
|
+
#
|
38
44
|
# ### Migration Guide
|
39
45
|
#
|
40
46
|
# The 0.30.0 release introduced breaking changes relative to the previous
|
@@ -62,7 +68,7 @@ module Google
|
|
62
68
|
# ```
|
63
69
|
#
|
64
70
|
# ### Next Steps
|
65
|
-
# - Read the [
|
71
|
+
# - Read the [Cloud Speech API Product documentation][Product Documentation]
|
66
72
|
# to learn more about the product and see How-to Guides.
|
67
73
|
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
68
74
|
# to see the full list of Cloud APIs that we cover.
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
require "google/cloud/speech/v1/speech_client"
|
16
17
|
require "google/cloud/speech/v1/helpers"
|
17
18
|
|
@@ -21,10 +22,10 @@ module Google
|
|
21
22
|
# rubocop:disable LineLength
|
22
23
|
|
23
24
|
##
|
24
|
-
# # Ruby Client for
|
25
|
+
# # Ruby Client for Cloud Speech API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
25
26
|
#
|
26
|
-
# [
|
27
|
-
#
|
27
|
+
# [Cloud Speech API][Product Documentation]:
|
28
|
+
# Converts audio to text by applying powerful neural network models.
|
28
29
|
# - [Product Documentation][]
|
29
30
|
#
|
30
31
|
# ## Quick Start
|
@@ -33,9 +34,14 @@ module Google
|
|
33
34
|
#
|
34
35
|
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
35
36
|
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
36
|
-
# 3. [Enable the
|
37
|
+
# 3. [Enable the Cloud Speech API.](https://console.cloud.google.com/apis/library/speech.googleapis.com)
|
37
38
|
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
38
39
|
#
|
40
|
+
# ### Installation
|
41
|
+
# ```
|
42
|
+
# $ gem install google-cloud-speech
|
43
|
+
# ```
|
44
|
+
#
|
39
45
|
# ### Preview
|
40
46
|
# #### SpeechClient
|
41
47
|
# ```rb
|
@@ -56,7 +62,7 @@ module Google
|
|
56
62
|
# ```
|
57
63
|
#
|
58
64
|
# ### Next Steps
|
59
|
-
# - Read the [
|
65
|
+
# - Read the [Cloud Speech API Product documentation][Product Documentation]
|
60
66
|
# to learn more about the product and see How-to Guides.
|
61
67
|
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
62
68
|
# to see the full list of Cloud APIs that we cover.
|
@@ -1,12 +1,14 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# source: google/cloud/speech/v1/cloud_speech.proto
|
3
3
|
|
4
|
+
|
4
5
|
require 'google/protobuf'
|
5
6
|
|
6
7
|
require 'google/api/annotations_pb'
|
7
8
|
require 'google/longrunning/operations_pb'
|
8
9
|
require 'google/protobuf/any_pb'
|
9
10
|
require 'google/protobuf/duration_pb'
|
11
|
+
require 'google/protobuf/empty_pb'
|
10
12
|
require 'google/protobuf/timestamp_pb'
|
11
13
|
require 'google/rpc/status_pb'
|
12
14
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
@@ -37,6 +39,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
37
39
|
optional :profanity_filter, :bool, 5
|
38
40
|
repeated :speech_contexts, :message, 6, "google.cloud.speech.v1.SpeechContext"
|
39
41
|
optional :enable_word_time_offsets, :bool, 8
|
42
|
+
optional :enable_automatic_punctuation, :bool, 11
|
43
|
+
optional :model, :string, 13
|
44
|
+
optional :use_enhanced, :bool, 14
|
40
45
|
end
|
41
46
|
add_enum "google.cloud.speech.v1.RecognitionConfig.AudioEncoding" do
|
42
47
|
value :ENCODING_UNSPECIFIED, 0
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# Source: google/cloud/speech/v1/cloud_speech.proto for package 'google.cloud.speech.v1'
|
3
3
|
# Original file comments:
|
4
|
-
# Copyright
|
4
|
+
# Copyright 2018 Google LLC.
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
@@ -15,6 +15,8 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
+
#
|
19
|
+
|
18
20
|
|
19
21
|
require 'grpc'
|
20
22
|
require 'google/cloud/speech/v1/cloud_speech_pb'
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
module Google
|
16
17
|
module Cloud
|
17
18
|
module Speech
|
@@ -56,7 +57,7 @@ module Google
|
|
56
57
|
# +audio_content+ data. The audio bytes must be encoded as specified in
|
57
58
|
# +RecognitionConfig+. Note: as with all bytes fields, protobuffers use a
|
58
59
|
# pure binary representation (not base64). See
|
59
|
-
# [
|
60
|
+
# [content limits](https://cloud.google.com/speech-to-text/quotas#content).
|
60
61
|
class StreamingRecognizeRequest; end
|
61
62
|
|
62
63
|
# Provides information to the recognizer that specifies how to process the
|
@@ -90,20 +91,24 @@ module Google
|
|
90
91
|
# request.
|
91
92
|
# @!attribute [rw] encoding
|
92
93
|
# @return [Google::Cloud::Speech::V1::RecognitionConfig::AudioEncoding]
|
93
|
-
#
|
94
|
+
# Encoding of audio data sent in all +RecognitionAudio+ messages.
|
95
|
+
# This field is optional for +FLAC+ and +WAV+ audio files and required
|
96
|
+
# for all other audio formats. For details, see {Google::Cloud::Speech::V1::RecognitionConfig::AudioEncoding AudioEncoding}.
|
94
97
|
# @!attribute [rw] sample_rate_hertz
|
95
98
|
# @return [Integer]
|
96
|
-
#
|
99
|
+
# Sample rate in Hertz of the audio data sent in all
|
97
100
|
# +RecognitionAudio+ messages. Valid values are: 8000-48000.
|
98
101
|
# 16000 is optimal. For best results, set the sampling rate of the audio
|
99
102
|
# source to 16000 Hz. If that's not possible, use the native sample rate of
|
100
103
|
# the audio source (instead of re-sampling).
|
104
|
+
# This field is optional for +FLAC+ and +WAV+ audio files and required
|
105
|
+
# for all other audio formats. For details, see {Google::Cloud::Speech::V1::RecognitionConfig::AudioEncoding AudioEncoding}.
|
101
106
|
# @!attribute [rw] language_code
|
102
107
|
# @return [String]
|
103
108
|
# *Required* The language of the supplied audio as a
|
104
109
|
# [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
|
105
110
|
# Example: "en-US".
|
106
|
-
# See [Language Support](https://cloud.google.com/speech/docs/languages)
|
111
|
+
# See [Language Support](https://cloud.google.com/speech-to-text/docs/languages)
|
107
112
|
# for a list of the currently supported language codes.
|
108
113
|
# @!attribute [rw] max_alternatives
|
109
114
|
# @return [Integer]
|
@@ -121,32 +126,100 @@ module Google
|
|
121
126
|
# won't be filtered out.
|
122
127
|
# @!attribute [rw] speech_contexts
|
123
128
|
# @return [Array<Google::Cloud::Speech::V1::SpeechContext>]
|
124
|
-
# *Optional*
|
129
|
+
# *Optional* array of {Google::Cloud::Speech::V1::SpeechContext SpeechContext}.
|
130
|
+
# A means to provide context to assist the speech recognition. For more
|
131
|
+
# information, see [Phrase Hints](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints).
|
125
132
|
# @!attribute [rw] enable_word_time_offsets
|
126
133
|
# @return [true, false]
|
127
134
|
# *Optional* If +true+, the top result includes a list of words and
|
128
135
|
# the start and end time offsets (timestamps) for those words. If
|
129
136
|
# +false+, no word-level time offset information is returned. The default is
|
130
137
|
# +false+.
|
138
|
+
# @!attribute [rw] enable_automatic_punctuation
|
139
|
+
# @return [true, false]
|
140
|
+
# *Optional* If 'true', adds punctuation to recognition result hypotheses.
|
141
|
+
# This feature is only available in select languages. Setting this for
|
142
|
+
# requests in other languages has no effect at all.
|
143
|
+
# The default 'false' value does not add punctuation to result hypotheses.
|
144
|
+
# Note: This is currently offered as an experimental service, complimentary
|
145
|
+
# to all users. In the future this may be exclusively available as a
|
146
|
+
# premium feature.
|
147
|
+
# @!attribute [rw] model
|
148
|
+
# @return [String]
|
149
|
+
# *Optional* Which model to select for the given request. Select the model
|
150
|
+
# best suited to your domain to get best results. If a model is not
|
151
|
+
# explicitly specified, then we auto-select a model based on the parameters
|
152
|
+
# in the RecognitionConfig.
|
153
|
+
# <table>
|
154
|
+
# <tr>
|
155
|
+
# <td><b>Model</b></td>
|
156
|
+
# <td><b>Description</b></td>
|
157
|
+
# </tr>
|
158
|
+
# <tr>
|
159
|
+
# <td><code>command_and_search</code></td>
|
160
|
+
# <td>Best for short queries such as voice commands or voice search.</td>
|
161
|
+
# </tr>
|
162
|
+
# <tr>
|
163
|
+
# <td><code>phone_call</code></td>
|
164
|
+
# <td>Best for audio that originated from a phone call (typically
|
165
|
+
# recorded at an 8khz sampling rate).</td>
|
166
|
+
# </tr>
|
167
|
+
# <tr>
|
168
|
+
# <td><code>video</code></td>
|
169
|
+
# <td>Best for audio that originated from from video or includes multiple
|
170
|
+
# speakers. Ideally the audio is recorded at a 16khz or greater
|
171
|
+
# sampling rate. This is a premium model that costs more than the
|
172
|
+
# standard rate.</td>
|
173
|
+
# </tr>
|
174
|
+
# <tr>
|
175
|
+
# <td><code>default</code></td>
|
176
|
+
# <td>Best for audio that is not one of the specific audio models.
|
177
|
+
# For example, long-form audio. Ideally the audio is high-fidelity,
|
178
|
+
# recorded at a 16khz or greater sampling rate.</td>
|
179
|
+
# </tr>
|
180
|
+
# </table>
|
181
|
+
# @!attribute [rw] use_enhanced
|
182
|
+
# @return [true, false]
|
183
|
+
# *Optional* Set to true to use an enhanced model for speech recognition.
|
184
|
+
# You must also set the +model+ field to a valid, enhanced model. If
|
185
|
+
# +use_enhanced+ is set to true and the +model+ field is not set, then
|
186
|
+
# +use_enhanced+ is ignored. If +use_enhanced+ is true and an enhanced
|
187
|
+
# version of the specified model does not exist, then the speech is
|
188
|
+
# recognized using the standard version of the specified model.
|
189
|
+
#
|
190
|
+
# Enhanced speech models require that you opt-in to data logging using
|
191
|
+
# instructions in the [documentation](https://cloud.google.com/speech-to-text/enable-data-logging).
|
192
|
+
# If you set +use_enhanced+ to true and you have not enabled audio logging,
|
193
|
+
# then you will receive an error.
|
131
194
|
class RecognitionConfig
|
132
|
-
#
|
133
|
-
#
|
134
|
-
#
|
135
|
-
# are raw audio bytes with no header.
|
195
|
+
# The encoding of the audio data sent in the request.
|
196
|
+
#
|
197
|
+
# All encodings support only 1 channel (mono) audio.
|
136
198
|
#
|
137
199
|
# For best results, the audio source should be captured and transmitted using
|
138
|
-
# a lossless encoding (+FLAC+ or +LINEAR16+).
|
139
|
-
# reduced if lossy codecs
|
140
|
-
#
|
141
|
-
#
|
200
|
+
# a lossless encoding (+FLAC+ or +LINEAR16+). The accuracy of the speech
|
201
|
+
# recognition can be reduced if lossy codecs are used to capture or transmit
|
202
|
+
# audio, particularly if background noise is present. Lossy codecs include
|
203
|
+
# +MULAW+, +AMR+, +AMR_WB+, +OGG_OPUS+, and +SPEEX_WITH_HEADER_BYTE+.
|
204
|
+
#
|
205
|
+
# The +FLAC+ and +WAV+ audio file formats include a header that describes the
|
206
|
+
# included audio content. You can request recognition for +WAV+ files that
|
207
|
+
# contain either +LINEAR16+ or +MULAW+ encoded audio.
|
208
|
+
# If you send +FLAC+ or +WAV+ audio file format in
|
209
|
+
# your request, you do not need to specify an +AudioEncoding+; the audio
|
210
|
+
# encoding format is determined from the file header. If you specify
|
211
|
+
# an +AudioEncoding+ when you send send +FLAC+ or +WAV+ audio, the
|
212
|
+
# encoding configuration must match the encoding described in the audio
|
213
|
+
# header; otherwise the request returns an
|
214
|
+
# {Google::Rpc::Code::INVALID_ARGUMENT} error code.
|
142
215
|
module AudioEncoding
|
143
|
-
# Not specified.
|
216
|
+
# Not specified.
|
144
217
|
ENCODING_UNSPECIFIED = 0
|
145
218
|
|
146
219
|
# Uncompressed 16-bit signed little-endian samples (Linear PCM).
|
147
220
|
LINEAR16 = 1
|
148
221
|
|
149
|
-
#
|
222
|
+
# +FLAC+ (Free Lossless Audio
|
150
223
|
# Codec) is the recommended encoding because it is
|
151
224
|
# lossless--therefore recognition is not compromised--and
|
152
225
|
# requires only about half the bandwidth of +LINEAR16+. +FLAC+ stream
|
@@ -165,7 +238,7 @@ module Google
|
|
165
238
|
|
166
239
|
# Opus encoded audio frames in Ogg container
|
167
240
|
# ([OggOpus](https://wiki.xiph.org/OggOpus)).
|
168
|
-
# +sample_rate_hertz+ must be 16000.
|
241
|
+
# +sample_rate_hertz+ must be one of 8000, 12000, 16000, 24000, or 48000.
|
169
242
|
OGG_OPUS = 6
|
170
243
|
|
171
244
|
# Although the use of lossy encodings is not recommended, if a very low
|
@@ -194,13 +267,13 @@ module Google
|
|
194
267
|
# to improve the accuracy for specific words and phrases, for example, if
|
195
268
|
# specific commands are typically spoken by the user. This can also be used
|
196
269
|
# to add additional words to the vocabulary of the recognizer. See
|
197
|
-
# [usage limits](https://cloud.google.com/speech/
|
270
|
+
# [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
|
198
271
|
class SpeechContext; end
|
199
272
|
|
200
273
|
# Contains audio data in the encoding specified in the +RecognitionConfig+.
|
201
274
|
# Either +content+ or +uri+ must be supplied. Supplying both or neither
|
202
275
|
# returns {Google::Rpc::Code::INVALID_ARGUMENT}. See
|
203
|
-
# [
|
276
|
+
# [content limits](https://cloud.google.com/speech-to-text/quotas#content).
|
204
277
|
# @!attribute [rw] content
|
205
278
|
# @return [String]
|
206
279
|
# The audio data bytes encoded as specified in
|
@@ -209,7 +282,8 @@ module Google
|
|
209
282
|
# @!attribute [rw] uri
|
210
283
|
# @return [String]
|
211
284
|
# URI that points to a file that contains audio data bytes as specified in
|
212
|
-
# +RecognitionConfig+.
|
285
|
+
# +RecognitionConfig+. The file must not be compressed (for example, gzip).
|
286
|
+
# Currently, only Google Cloud Storage URIs are
|
213
287
|
# supported, which must be specified in the following format:
|
214
288
|
# +gs://bucket_name/object_name+ (other URI formats return
|
215
289
|
# {Google::Rpc::Code::INVALID_ARGUMENT}). For more information, see
|
@@ -221,7 +295,7 @@ module Google
|
|
221
295
|
# messages.
|
222
296
|
# @!attribute [rw] results
|
223
297
|
# @return [Array<Google::Cloud::Speech::V1::SpeechRecognitionResult>]
|
224
|
-
#
|
298
|
+
# Output only. Sequential list of transcription results corresponding to
|
225
299
|
# sequential portions of audio.
|
226
300
|
class RecognizeResponse; end
|
227
301
|
|
@@ -232,7 +306,7 @@ module Google
|
|
232
306
|
# service.
|
233
307
|
# @!attribute [rw] results
|
234
308
|
# @return [Array<Google::Cloud::Speech::V1::SpeechRecognitionResult>]
|
235
|
-
#
|
309
|
+
# Output only. Sequential list of transcription results corresponding to
|
236
310
|
# sequential portions of audio.
|
237
311
|
class LongRunningRecognizeResponse; end
|
238
312
|
|
@@ -302,17 +376,17 @@ module Google
|
|
302
376
|
# one or more (repeated) +results+.
|
303
377
|
# @!attribute [rw] error
|
304
378
|
# @return [Google::Rpc::Status]
|
305
|
-
#
|
379
|
+
# Output only. If set, returns a {Google::Rpc::Status} message that
|
306
380
|
# specifies the error for the operation.
|
307
381
|
# @!attribute [rw] results
|
308
382
|
# @return [Array<Google::Cloud::Speech::V1::StreamingRecognitionResult>]
|
309
|
-
#
|
383
|
+
# Output only. This repeated list contains zero or more results that
|
310
384
|
# correspond to consecutive portions of the audio currently being processed.
|
311
|
-
# It contains zero or
|
312
|
-
# +is_final=
|
385
|
+
# It contains zero or one +is_final=true+ result (the newly settled portion),
|
386
|
+
# followed by zero or more +is_final=false+ results (the interim results).
|
313
387
|
# @!attribute [rw] speech_event_type
|
314
388
|
# @return [Google::Cloud::Speech::V1::StreamingRecognizeResponse::SpeechEventType]
|
315
|
-
#
|
389
|
+
# Output only. Indicates the type of speech event.
|
316
390
|
class StreamingRecognizeResponse
|
317
391
|
# Indicates the type of speech event.
|
318
392
|
module SpeechEventType
|
@@ -334,18 +408,20 @@ module Google
|
|
334
408
|
# that is currently being processed.
|
335
409
|
# @!attribute [rw] alternatives
|
336
410
|
# @return [Array<Google::Cloud::Speech::V1::SpeechRecognitionAlternative>]
|
337
|
-
#
|
411
|
+
# Output only. May contain one or more recognition hypotheses (up to the
|
338
412
|
# maximum specified in +max_alternatives+).
|
413
|
+
# These alternatives are ordered in terms of accuracy, with the top (first)
|
414
|
+
# alternative being the most probable, as ranked by the recognizer.
|
339
415
|
# @!attribute [rw] is_final
|
340
416
|
# @return [true, false]
|
341
|
-
#
|
417
|
+
# Output only. If +false+, this +StreamingRecognitionResult+ represents an
|
342
418
|
# interim result that may change. If +true+, this is the final time the
|
343
419
|
# speech service will return this particular +StreamingRecognitionResult+,
|
344
420
|
# the recognizer will not return any further hypotheses for this portion of
|
345
421
|
# the transcript and corresponding audio.
|
346
422
|
# @!attribute [rw] stability
|
347
423
|
# @return [Float]
|
348
|
-
#
|
424
|
+
# Output only. An estimate of the likelihood that the recognizer will not
|
349
425
|
# change its guess about this interim result. Values range from 0.0
|
350
426
|
# (completely unstable) to 1.0 (completely stable).
|
351
427
|
# This field is only provided for interim results (+is_final=false+).
|
@@ -355,7 +431,7 @@ module Google
|
|
355
431
|
# A speech recognition result corresponding to a portion of the audio.
|
356
432
|
# @!attribute [rw] alternatives
|
357
433
|
# @return [Array<Google::Cloud::Speech::V1::SpeechRecognitionAlternative>]
|
358
|
-
#
|
434
|
+
# Output only. May contain one or more recognition hypotheses (up to the
|
359
435
|
# maximum specified in +max_alternatives+).
|
360
436
|
# These alternatives are ordered in terms of accuracy, with the top (first)
|
361
437
|
# alternative being the most probable, as ranked by the recognizer.
|
@@ -364,26 +440,25 @@ module Google
|
|
364
440
|
# Alternative hypotheses (a.k.a. n-best list).
|
365
441
|
# @!attribute [rw] transcript
|
366
442
|
# @return [String]
|
367
|
-
#
|
443
|
+
# Output only. Transcript text representing the words that the user spoke.
|
368
444
|
# @!attribute [rw] confidence
|
369
445
|
# @return [Float]
|
370
|
-
#
|
446
|
+
# Output only. The confidence estimate between 0.0 and 1.0. A higher number
|
371
447
|
# indicates an estimated greater likelihood that the recognized words are
|
372
|
-
# correct. This field is
|
373
|
-
#
|
374
|
-
#
|
448
|
+
# correct. This field is set only for the top alternative of a non-streaming
|
449
|
+
# result or, of a streaming result where +is_final=true+.
|
450
|
+
# This field is not guaranteed to be accurate and users should not rely on it
|
451
|
+
# to be always provided.
|
375
452
|
# The default of 0.0 is a sentinel value indicating +confidence+ was not set.
|
376
453
|
# @!attribute [rw] words
|
377
454
|
# @return [Array<Google::Cloud::Speech::V1::WordInfo>]
|
378
|
-
#
|
455
|
+
# Output only. A list of word-specific information for each recognized word.
|
379
456
|
class SpeechRecognitionAlternative; end
|
380
457
|
|
381
|
-
# Word-specific information for recognized words.
|
382
|
-
# included in the response when certain request parameters are set, such
|
383
|
-
# as +enable_word_time_offsets+.
|
458
|
+
# Word-specific information for recognized words.
|
384
459
|
# @!attribute [rw] start_time
|
385
460
|
# @return [Google::Protobuf::Duration]
|
386
|
-
#
|
461
|
+
# Output only. Time offset relative to the beginning of the audio,
|
387
462
|
# and corresponding to the start of the spoken word.
|
388
463
|
# This field is only set if +enable_word_time_offsets=true+ and only
|
389
464
|
# in the top hypothesis.
|
@@ -391,7 +466,7 @@ module Google
|
|
391
466
|
# vary.
|
392
467
|
# @!attribute [rw] end_time
|
393
468
|
# @return [Google::Protobuf::Duration]
|
394
|
-
#
|
469
|
+
# Output only. Time offset relative to the beginning of the audio,
|
395
470
|
# and corresponding to the end of the spoken word.
|
396
471
|
# This field is only set if +enable_word_time_offsets=true+ and only
|
397
472
|
# in the top hypothesis.
|
@@ -399,7 +474,7 @@ module Google
|
|
399
474
|
# vary.
|
400
475
|
# @!attribute [rw] word
|
401
476
|
# @return [String]
|
402
|
-
#
|
477
|
+
# Output only. The word corresponding to this set of information.
|
403
478
|
class WordInfo; end
|
404
479
|
end
|
405
480
|
end
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
module Google
|
16
17
|
module Protobuf
|
17
18
|
# +Any+ contains an arbitrary serialized protocol buffer message along with a
|
@@ -95,17 +96,18 @@ module Google
|
|
95
96
|
# }
|
96
97
|
# @!attribute [rw] type_url
|
97
98
|
# @return [String]
|
98
|
-
# A URL/resource name
|
99
|
-
#
|
99
|
+
# A URL/resource name that uniquely identifies the type of the serialized
|
100
|
+
# protocol buffer message. The last segment of the URL's path must represent
|
101
|
+
# the fully qualified name of the type (as in
|
102
|
+
# +path/google.protobuf.Duration+). The name should be in a canonical form
|
103
|
+
# (e.g., leading "." is not accepted).
|
100
104
|
#
|
101
|
-
#
|
102
|
-
#
|
105
|
+
# In practice, teams usually precompile into the binary all types that they
|
106
|
+
# expect it to use in the context of Any. However, for URLs which use the
|
107
|
+
# scheme +http+, +https+, or no scheme, one can optionally set up a type
|
108
|
+
# server that maps type URLs to message definitions as follows:
|
103
109
|
#
|
104
110
|
# * If no scheme is provided, +https+ is assumed.
|
105
|
-
# * The last segment of the URL's path must represent the fully
|
106
|
-
# qualified name of the type (as in +path/google.protobuf.Duration+).
|
107
|
-
# The name should be in a canonical form (e.g., leading "." is
|
108
|
-
# not accepted).
|
109
111
|
# * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
|
110
112
|
# value in binary format, or produce an error.
|
111
113
|
# * Applications are allowed to cache lookup results based on the
|
@@ -114,6 +116,10 @@ module Google
|
|
114
116
|
# on changes to types. (Use versioned type names to manage
|
115
117
|
# breaking changes.)
|
116
118
|
#
|
119
|
+
# Note: this functionality is not currently available in the official
|
120
|
+
# protobuf release, and it is not used for type URLs beginning with
|
121
|
+
# type.googleapis.com.
|
122
|
+
#
|
117
123
|
# Schemes other than +http+, +https+ (or the empty scheme) might be
|
118
124
|
# used with implementation specific semantics.
|
119
125
|
# @!attribute [rw] value
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
require "google/cloud/speech/v1/speech_client"
|
16
17
|
require "google/cloud/speech/v1/stream"
|
17
18
|
|
@@ -86,6 +87,48 @@ module Google
|
|
86
87
|
end
|
87
88
|
)
|
88
89
|
end
|
90
|
+
|
91
|
+
##
|
92
|
+
# Gets the latest state of a long-running operation. Clients can use
|
93
|
+
# this method to poll the operation result at intervals as recommended
|
94
|
+
# by the API service.
|
95
|
+
#
|
96
|
+
# @param name [String]
|
97
|
+
# The name of the operation resource.
|
98
|
+
# @param options [Google::Gax::CallOptions]
|
99
|
+
# Overrides the default settings for this call, e.g, timeout,
|
100
|
+
# retries, etc.
|
101
|
+
# @return [Google::Gax::Operation]
|
102
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
103
|
+
# @example
|
104
|
+
# require "google/cloud/speech"
|
105
|
+
#
|
106
|
+
# speech_client = Google::Cloud::Speech.new version: :v1
|
107
|
+
#
|
108
|
+
# op = speech_client.get_operation "-"
|
109
|
+
#
|
110
|
+
# # Process error operations.
|
111
|
+
# log_error op.error if op.error?
|
112
|
+
#
|
113
|
+
# if op.done?
|
114
|
+
# # Process completed operations.
|
115
|
+
# log_finished op.response, op.metadata
|
116
|
+
# else
|
117
|
+
# # Process pending operations.
|
118
|
+
# log_pending op.name, op.metadata
|
119
|
+
# end
|
120
|
+
#
|
121
|
+
def get_operation name, options: nil
|
122
|
+
proto_op = @operations_client.get_operation name, options: options
|
123
|
+
|
124
|
+
Google::Gax::Operation.new(
|
125
|
+
proto_op,
|
126
|
+
@operations_client,
|
127
|
+
Google::Cloud::Speech::V1::LongRunningRecognizeResponse,
|
128
|
+
Google::Cloud::Speech::V1::LongRunningRecognizeMetadata,
|
129
|
+
call_options: options
|
130
|
+
)
|
131
|
+
end
|
89
132
|
end
|
90
133
|
end
|
91
134
|
end
|
@@ -19,6 +19,7 @@
|
|
19
19
|
# For the short term, the refresh process will only be runnable by Google
|
20
20
|
# engineers.
|
21
21
|
|
22
|
+
|
22
23
|
require "json"
|
23
24
|
require "pathname"
|
24
25
|
|
@@ -38,6 +39,7 @@ module Google
|
|
38
39
|
# @!attribute [r] speech_stub
|
39
40
|
# @return [Google::Cloud::Speech::V1::Speech::Stub]
|
40
41
|
class SpeechClient
|
42
|
+
# @private
|
41
43
|
attr_reader :speech_stub
|
42
44
|
|
43
45
|
# The default address of the service.
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
require "google/cloud/speech/v1p1beta1/speech_client"
|
16
17
|
require "google/cloud/speech/v1p1beta1/helpers"
|
17
18
|
|
@@ -36,6 +37,11 @@ module Google
|
|
36
37
|
# 3. [Enable the Cloud Speech API.](https://console.cloud.google.com/apis/library/speech.googleapis.com)
|
37
38
|
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
38
39
|
#
|
40
|
+
# ### Installation
|
41
|
+
# ```
|
42
|
+
# $ gem install google-cloud-speech
|
43
|
+
# ```
|
44
|
+
#
|
39
45
|
# ### Preview
|
40
46
|
# #### SpeechClient
|
41
47
|
# ```rb
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
module Google
|
16
17
|
module Protobuf
|
17
18
|
# +Any+ contains an arbitrary serialized protocol buffer message along with a
|
@@ -95,17 +96,18 @@ module Google
|
|
95
96
|
# }
|
96
97
|
# @!attribute [rw] type_url
|
97
98
|
# @return [String]
|
98
|
-
# A URL/resource name
|
99
|
-
#
|
99
|
+
# A URL/resource name that uniquely identifies the type of the serialized
|
100
|
+
# protocol buffer message. The last segment of the URL's path must represent
|
101
|
+
# the fully qualified name of the type (as in
|
102
|
+
# +path/google.protobuf.Duration+). The name should be in a canonical form
|
103
|
+
# (e.g., leading "." is not accepted).
|
100
104
|
#
|
101
|
-
#
|
102
|
-
#
|
105
|
+
# In practice, teams usually precompile into the binary all types that they
|
106
|
+
# expect it to use in the context of Any. However, for URLs which use the
|
107
|
+
# scheme +http+, +https+, or no scheme, one can optionally set up a type
|
108
|
+
# server that maps type URLs to message definitions as follows:
|
103
109
|
#
|
104
110
|
# * If no scheme is provided, +https+ is assumed.
|
105
|
-
# * The last segment of the URL's path must represent the fully
|
106
|
-
# qualified name of the type (as in +path/google.protobuf.Duration+).
|
107
|
-
# The name should be in a canonical form (e.g., leading "." is
|
108
|
-
# not accepted).
|
109
111
|
# * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
|
110
112
|
# value in binary format, or produce an error.
|
111
113
|
# * Applications are allowed to cache lookup results based on the
|
@@ -114,6 +116,10 @@ module Google
|
|
114
116
|
# on changes to types. (Use versioned type names to manage
|
115
117
|
# breaking changes.)
|
116
118
|
#
|
119
|
+
# Note: this functionality is not currently available in the official
|
120
|
+
# protobuf release, and it is not used for type URLs beginning with
|
121
|
+
# type.googleapis.com.
|
122
|
+
#
|
117
123
|
# Schemes other than +http+, +https+ (or the empty scheme) might be
|
118
124
|
# used with implementation specific semantics.
|
119
125
|
# @!attribute [rw] value
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
require "google/cloud/speech/v1p1beta1/speech_client"
|
16
17
|
require "google/cloud/speech/v1p1beta1/stream"
|
17
18
|
|
@@ -86,6 +87,48 @@ module Google
|
|
86
87
|
end
|
87
88
|
)
|
88
89
|
end
|
90
|
+
|
91
|
+
##
|
92
|
+
# Gets the latest state of a long-running operation. Clients can use
|
93
|
+
# this method to poll the operation result at intervals as recommended
|
94
|
+
# by the API service.
|
95
|
+
#
|
96
|
+
# @param name [String]
|
97
|
+
# The name of the operation resource.
|
98
|
+
# @param options [Google::Gax::CallOptions]
|
99
|
+
# Overrides the default settings for this call, e.g, timeout,
|
100
|
+
# retries, etc.
|
101
|
+
# @return [Google::Gax::Operation]
|
102
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
103
|
+
# @example
|
104
|
+
# require "google/cloud/speech"
|
105
|
+
#
|
106
|
+
# speech_client = Google::Cloud::Speech.new version: :v1p1beta1
|
107
|
+
#
|
108
|
+
# op = speech_client.get_operation "-"
|
109
|
+
#
|
110
|
+
# # Process error operations.
|
111
|
+
# log_error op.error if op.error?
|
112
|
+
#
|
113
|
+
# if op.done?
|
114
|
+
# # Process completed operations.
|
115
|
+
# log_finished op.response, op.metadata
|
116
|
+
# else
|
117
|
+
# # Process pending operations.
|
118
|
+
# log_pending op.name, op.metadata
|
119
|
+
# end
|
120
|
+
#
|
121
|
+
def get_operation name, options: nil
|
122
|
+
proto_op = @operations_client.get_operation name, options: options
|
123
|
+
|
124
|
+
Google::Gax::Operation.new(
|
125
|
+
proto_op,
|
126
|
+
@operations_client,
|
127
|
+
Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeResponse,
|
128
|
+
Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeMetadata,
|
129
|
+
call_options: options
|
130
|
+
)
|
131
|
+
end
|
89
132
|
end
|
90
133
|
end
|
91
134
|
end
|
@@ -19,6 +19,7 @@
|
|
19
19
|
# For the short term, the refresh process will only be runnable by Google
|
20
20
|
# engineers.
|
21
21
|
|
22
|
+
|
22
23
|
require "json"
|
23
24
|
require "pathname"
|
24
25
|
|
@@ -38,6 +39,7 @@ module Google
|
|
38
39
|
# @!attribute [r] speech_stub
|
39
40
|
# @return [Google::Cloud::Speech::V1p1beta1::Speech::Stub]
|
40
41
|
class SpeechClient
|
42
|
+
# @private
|
41
43
|
attr_reader :speech_stub
|
42
44
|
|
43
45
|
# The default address of the service.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-speech
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.31.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-gax
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.9'
|
97
|
-
description: google-cloud-speech is the official library for
|
97
|
+
description: google-cloud-speech is the official library for Cloud Speech API.
|
98
98
|
email: googleapis-packages@google.com
|
99
99
|
executables: []
|
100
100
|
extensions: []
|
@@ -157,5 +157,5 @@ rubyforge_project:
|
|
157
157
|
rubygems_version: 2.7.7
|
158
158
|
signing_key:
|
159
159
|
specification_version: 4
|
160
|
-
summary: API Client library for
|
160
|
+
summary: API Client library for Cloud Speech API
|
161
161
|
test_files: []
|