google-cloud-speech-v1 0.5.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32fb963c0e02669938526abd3241241465046de0f5cb320644874e55479b34a5
4
- data.tar.gz: 707e29cffcbcf6560a5ad8774fad318be9278364c1bc9bc4f892900294885d3f
3
+ metadata.gz: f4f4458eaa956cfde1d9bd8c759ed88a33daf4a516b270c6003295f838e8cd7e
4
+ data.tar.gz: 5f9e342ac68671de24cf879c903f41cbb41a8c4490d3099694b805c95e357072
5
5
  SHA512:
6
- metadata.gz: 0ae89b74fd8ea88efdc44bdbea1005ba934ce8b8454cda66444e3ac7b23e7420b544de55e937ef9e62495c3eeb9fbb9233886452e9ba9296022b1bcbf048189e
7
- data.tar.gz: 82cca01db0ee32d9d6b952cc12b622ad54152c6f36eae94436a9eb5b97881cab75db5015d0ed1e2b9ec112e8c878cfa1bea70b0f719f59d938102cd75cab9d12
6
+ metadata.gz: 003e9c30b3e4da197bea62ef13f4add4ecbbe6eb9c2d58d72c2fef97b726cb91f57972adf000378b1901c24ca0e56e73fab3d2d204bb4554764ac79eb2a57928
7
+ data.tar.gz: 686409bbfb90c992e7ace57be9c9e1351c278420665d941f3feb886ea33f89d73515a1337f1e1960189c1acc21ed24ab8417b3f5cc4d4537e95ba4ce62424658
data/.yardopts CHANGED
@@ -1,5 +1,5 @@
1
1
  --no-private
2
- --title=Cloud Speech-to-Text V1 API
2
+ --title="Cloud Speech-to-Text V1 API"
3
3
  --exclude _pb\.rb$
4
4
  --markup markdown
5
5
  --markup-provider redcarpet
data/AUTHENTICATION.md CHANGED
@@ -120,15 +120,6 @@ To configure your system for this, simply:
120
120
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
121
121
  *should* only be used during development.
122
122
 
123
- [gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
124
- [dev-console]: https://console.cloud.google.com/project
125
-
126
- [enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
127
-
128
- [create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
129
- [create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
130
- [reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
131
-
132
123
  ## Creating a Service Account
133
124
 
134
125
  Google Cloud requires **Service Account Credentials** to
@@ -139,31 +130,22 @@ If you are not running this client within
139
130
  [Google Cloud Platform environments](#google-cloud-platform-environments), you
140
131
  need a Google Developers service account.
141
132
 
142
- 1. Visit the [Google Developers Console][dev-console].
133
+ 1. Visit the [Google Cloud Console](https://console.cloud.google.com/project).
143
134
  2. Create a new project or click on an existing project.
144
- 3. Activate the slide-out navigation tray and select **API Manager**. From
135
+ 3. Activate the menu in the upper left and select **APIs & Services**. From
145
136
  here, you will enable the APIs that your application requires.
146
137
 
147
- ![Enable the APIs that your application requires][enable-apis]
148
-
149
138
  *Note: You may need to enable billing in order to use these services.*
150
139
 
151
140
  4. Select **Credentials** from the side navigation.
152
141
 
153
- You should see a screen like one of the following.
154
-
155
- ![Create a new service account][create-new-service-account]
156
-
157
- ![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
158
-
159
- Find the "Add credentials" drop down and select "Service account" to be
160
- guided through downloading a new JSON key file.
142
+ Find the "Create credentials" drop down near the top of the page, and select
143
+ "Service account" to be guided through downloading a new JSON key file.
161
144
 
162
145
  If you want to re-use an existing service account, you can easily generate a
163
- new key file. Just select the account you wish to re-use, and click "Generate
164
- new JSON key":
165
-
166
- ![Re-use an existing service account][reuse-service-account]
146
+ new key file. Just select the account you wish to re-use, click the pencil
147
+ tool on the right side to edit the service account, select the **Keys** tab,
148
+ and then select **Add Key**.
167
149
 
168
150
  The key file you download will be used by this library to authenticate API
169
151
  requests and should be stored in a secure location.
@@ -1,17 +1,18 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/cloud/speech/v1/cloud_speech.proto
3
3
 
4
- require 'google/protobuf'
5
-
6
4
  require 'google/api/annotations_pb'
7
5
  require 'google/api/client_pb'
8
6
  require 'google/api/field_behavior_pb'
7
+ require 'google/cloud/speech/v1/resource_pb'
9
8
  require 'google/longrunning/operations_pb'
10
9
  require 'google/protobuf/any_pb'
11
10
  require 'google/protobuf/duration_pb'
12
11
  require 'google/protobuf/timestamp_pb'
13
12
  require 'google/protobuf/wrappers_pb'
14
13
  require 'google/rpc/status_pb'
14
+ require 'google/protobuf'
15
+
15
16
  Google::Protobuf::DescriptorPool.generated_pool.build do
16
17
  add_file("google/cloud/speech/v1/cloud_speech.proto", :syntax => :proto3) do
17
18
  add_message "google.cloud.speech.v1.RecognizeRequest" do
@@ -21,6 +22,12 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
21
22
  add_message "google.cloud.speech.v1.LongRunningRecognizeRequest" do
22
23
  optional :config, :message, 1, "google.cloud.speech.v1.RecognitionConfig"
23
24
  optional :audio, :message, 2, "google.cloud.speech.v1.RecognitionAudio"
25
+ optional :output_config, :message, 4, "google.cloud.speech.v1.TranscriptOutputConfig"
26
+ end
27
+ add_message "google.cloud.speech.v1.TranscriptOutputConfig" do
28
+ oneof :output_type do
29
+ optional :gcs_uri, :string, 1
30
+ end
24
31
  end
25
32
  add_message "google.cloud.speech.v1.StreamingRecognizeRequest" do
26
33
  oneof :streaming_request do
@@ -39,11 +46,16 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
39
46
  optional :audio_channel_count, :int32, 7
40
47
  optional :enable_separate_recognition_per_channel, :bool, 12
41
48
  optional :language_code, :string, 3
49
+ repeated :alternative_language_codes, :string, 18
42
50
  optional :max_alternatives, :int32, 4
43
51
  optional :profanity_filter, :bool, 5
52
+ optional :adaptation, :message, 20, "google.cloud.speech.v1.SpeechAdaptation"
44
53
  repeated :speech_contexts, :message, 6, "google.cloud.speech.v1.SpeechContext"
45
54
  optional :enable_word_time_offsets, :bool, 8
55
+ optional :enable_word_confidence, :bool, 15
46
56
  optional :enable_automatic_punctuation, :bool, 11
57
+ optional :enable_spoken_punctuation, :message, 22, "google.protobuf.BoolValue"
58
+ optional :enable_spoken_emojis, :message, 23, "google.protobuf.BoolValue"
47
59
  optional :diarization_config, :message, 19, "google.cloud.speech.v1.SpeakerDiarizationConfig"
48
60
  optional :metadata, :message, 9, "google.cloud.speech.v1.RecognitionMetadata"
49
61
  optional :model, :string, 13
@@ -58,6 +70,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
58
70
  value :AMR_WB, 5
59
71
  value :OGG_OPUS, 6
60
72
  value :SPEEX_WITH_HEADER_BYTE, 7
73
+ value :WEBM_OPUS, 9
61
74
  end
62
75
  add_message "google.cloud.speech.v1.SpeakerDiarizationConfig" do
63
76
  optional :enable_speaker_diarization, :bool, 1
@@ -108,6 +121,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
108
121
  end
109
122
  add_message "google.cloud.speech.v1.SpeechContext" do
110
123
  repeated :phrases, :string, 1
124
+ optional :boost, :float, 4
111
125
  end
112
126
  add_message "google.cloud.speech.v1.RecognitionAudio" do
113
127
  oneof :audio_source do
@@ -122,6 +136,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
122
136
  add_message "google.cloud.speech.v1.LongRunningRecognizeResponse" do
123
137
  repeated :results, :message, 2, "google.cloud.speech.v1.SpeechRecognitionResult"
124
138
  optional :total_billed_time, :message, 3, "google.protobuf.Duration"
139
+ optional :output_config, :message, 6, "google.cloud.speech.v1.TranscriptOutputConfig"
140
+ optional :output_error, :message, 7, "google.rpc.Status"
125
141
  end
126
142
  add_message "google.cloud.speech.v1.LongRunningRecognizeMetadata" do
127
143
  optional :progress_percent, :int32, 1
@@ -150,6 +166,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
150
166
  add_message "google.cloud.speech.v1.SpeechRecognitionResult" do
151
167
  repeated :alternatives, :message, 1, "google.cloud.speech.v1.SpeechRecognitionAlternative"
152
168
  optional :channel_tag, :int32, 2
169
+ optional :result_end_time, :message, 4, "google.protobuf.Duration"
170
+ optional :language_code, :string, 5
153
171
  end
154
172
  add_message "google.cloud.speech.v1.SpeechRecognitionAlternative" do
155
173
  optional :transcript, :string, 1
@@ -160,6 +178,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
160
178
  optional :start_time, :message, 1, "google.protobuf.Duration"
161
179
  optional :end_time, :message, 2, "google.protobuf.Duration"
162
180
  optional :word, :string, 3
181
+ optional :confidence, :float, 4
163
182
  optional :speaker_tag, :int32, 5
164
183
  end
165
184
  end
@@ -171,6 +190,7 @@ module Google
171
190
  module V1
172
191
  RecognizeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.RecognizeRequest").msgclass
173
192
  LongRunningRecognizeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.LongRunningRecognizeRequest").msgclass
193
+ TranscriptOutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.TranscriptOutputConfig").msgclass
174
194
  StreamingRecognizeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.StreamingRecognizeRequest").msgclass
175
195
  StreamingRecognitionConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.StreamingRecognitionConfig").msgclass
176
196
  RecognitionConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.RecognitionConfig").msgclass
@@ -27,7 +27,7 @@ module Google
27
27
  # Service that implements Google Cloud Speech API.
28
28
  class Service
29
29
 
30
- include GRPC::GenericService
30
+ include ::GRPC::GenericService
31
31
 
32
32
  self.marshal_class_method = :encode
33
33
  self.unmarshal_class_method = :decode
@@ -0,0 +1,48 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/speech/v1/resource.proto
3
+
4
+ require 'google/api/resource_pb'
5
+ require 'google/protobuf/timestamp_pb'
6
+ require 'google/api/annotations_pb'
7
+ require 'google/protobuf'
8
+
9
+ Google::Protobuf::DescriptorPool.generated_pool.build do
10
+ add_file("google/cloud/speech/v1/resource.proto", :syntax => :proto3) do
11
+ add_message "google.cloud.speech.v1.CustomClass" do
12
+ optional :name, :string, 1
13
+ optional :custom_class_id, :string, 2
14
+ repeated :items, :message, 3, "google.cloud.speech.v1.CustomClass.ClassItem"
15
+ end
16
+ add_message "google.cloud.speech.v1.CustomClass.ClassItem" do
17
+ optional :value, :string, 1
18
+ end
19
+ add_message "google.cloud.speech.v1.PhraseSet" do
20
+ optional :name, :string, 1
21
+ repeated :phrases, :message, 2, "google.cloud.speech.v1.PhraseSet.Phrase"
22
+ optional :boost, :float, 4
23
+ end
24
+ add_message "google.cloud.speech.v1.PhraseSet.Phrase" do
25
+ optional :value, :string, 1
26
+ optional :boost, :float, 2
27
+ end
28
+ add_message "google.cloud.speech.v1.SpeechAdaptation" do
29
+ repeated :phrase_sets, :message, 1, "google.cloud.speech.v1.PhraseSet"
30
+ repeated :phrase_set_references, :string, 2
31
+ repeated :custom_classes, :message, 3, "google.cloud.speech.v1.CustomClass"
32
+ end
33
+ end
34
+ end
35
+
36
+ module Google
37
+ module Cloud
38
+ module Speech
39
+ module V1
40
+ CustomClass = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.CustomClass").msgclass
41
+ CustomClass::ClassItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.CustomClass.ClassItem").msgclass
42
+ PhraseSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.PhraseSet").msgclass
43
+ PhraseSet::Phrase = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.PhraseSet.Phrase").msgclass
44
+ SpeechAdaptation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.speech.v1.SpeechAdaptation").msgclass
45
+ end
46
+ end
47
+ end
48
+ end
@@ -30,6 +30,8 @@ module Google
30
30
  # Service that implements Google Cloud Speech API.
31
31
  #
32
32
  class Client
33
+ include Paths
34
+
33
35
  # @private
34
36
  attr_reader :speech_stub
35
37
 
@@ -145,6 +147,7 @@ module Google
145
147
 
146
148
  @operations_client = Operations.new do |config|
147
149
  config.credentials = credentials
150
+ config.quota_project = @quota_project_id
148
151
  config.endpoint = @config.endpoint
149
152
  end
150
153
 
@@ -199,6 +202,21 @@ module Google
199
202
  #
200
203
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
201
204
  #
205
+ # @example Basic example
206
+ # require "google/cloud/speech/v1"
207
+ #
208
+ # # Create a client object. The client can be reused for multiple calls.
209
+ # client = Google::Cloud::Speech::V1::Speech::Client.new
210
+ #
211
+ # # Create a request. To set request fields, pass in keyword arguments.
212
+ # request = Google::Cloud::Speech::V1::RecognizeRequest.new
213
+ #
214
+ # # Call the recognize method.
215
+ # result = client.recognize request
216
+ #
217
+ # # The returned object is of type Google::Cloud::Speech::V1::RecognizeResponse.
218
+ # p result
219
+ #
202
220
  def recognize request, options = nil
203
221
  raise ::ArgumentError, "request must be provided" if request.nil?
204
222
 
@@ -250,7 +268,7 @@ module Google
250
268
  # @param options [::Gapic::CallOptions, ::Hash]
251
269
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
252
270
  #
253
- # @overload long_running_recognize(config: nil, audio: nil)
271
+ # @overload long_running_recognize(config: nil, audio: nil, output_config: nil)
254
272
  # Pass arguments to `long_running_recognize` via keyword arguments. Note that at
255
273
  # least one keyword argument is required. To specify no parameters, or to keep all
256
274
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -260,6 +278,8 @@ module Google
260
278
  # process the request.
261
279
  # @param audio [::Google::Cloud::Speech::V1::RecognitionAudio, ::Hash]
262
280
  # Required. The audio data to be recognized.
281
+ # @param output_config [::Google::Cloud::Speech::V1::TranscriptOutputConfig, ::Hash]
282
+ # Optional. Specifies an optional destination for the recognition results.
263
283
  #
264
284
  # @yield [response, operation] Access the result along with the RPC operation
265
285
  # @yieldparam response [::Gapic::Operation]
@@ -269,6 +289,28 @@ module Google
269
289
  #
270
290
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
271
291
  #
292
+ # @example Basic example
293
+ # require "google/cloud/speech/v1"
294
+ #
295
+ # # Create a client object. The client can be reused for multiple calls.
296
+ # client = Google::Cloud::Speech::V1::Speech::Client.new
297
+ #
298
+ # # Create a request. To set request fields, pass in keyword arguments.
299
+ # request = Google::Cloud::Speech::V1::LongRunningRecognizeRequest.new
300
+ #
301
+ # # Call the long_running_recognize method.
302
+ # result = client.long_running_recognize request
303
+ #
304
+ # # The returned object is of type Gapic::Operation. You can use this
305
+ # # object to check the status of an operation, cancel it, or wait
306
+ # # for results. Here is how to block until completion:
307
+ # result.wait_until_done! timeout: 60
308
+ # if result.response?
309
+ # p result.response
310
+ # else
311
+ # puts "Error!"
312
+ # end
313
+ #
272
314
  def long_running_recognize request, options = nil
273
315
  raise ::ArgumentError, "request must be provided" if request.nil?
274
316
 
@@ -320,6 +362,30 @@ module Google
320
362
  #
321
363
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
322
364
  #
365
+ # @example Basic example
366
+ # require "google/cloud/speech/v1"
367
+ #
368
+ # # Create a client object. The client can be reused for multiple calls.
369
+ # client = Google::Cloud::Speech::V1::Speech::Client.new
370
+ #
371
+ # # Create an input stream
372
+ # input = Gapic::StreamInput.new
373
+ #
374
+ # # Call the streaming_recognize method to start streaming.
375
+ # output = client.streaming_recognize input
376
+ #
377
+ # # Send requests on the stream. For each request, pass in keyword
378
+ # # arguments to set fields. Be sure to close the stream when done.
379
+ # input << Google::Cloud::Speech::V1::StreamingRecognizeRequest.new
380
+ # input << Google::Cloud::Speech::V1::StreamingRecognizeRequest.new
381
+ # input.close
382
+ #
383
+ # # Handle streamed responses. These may be interleaved with inputs.
384
+ # # Each response is of type ::Google::Cloud::Speech::V1::StreamingRecognizeResponse.
385
+ # output.each do |response|
386
+ # p response
387
+ # end
388
+ #
323
389
  def streaming_recognize request, options = nil
324
390
  unless request.is_a? ::Enumerable
325
391
  raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
@@ -143,6 +143,27 @@ module Google
143
143
  #
144
144
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
145
145
  #
146
+ # @example Basic example
147
+ # require "google/longrunning"
148
+ #
149
+ # # Create a client object. The client can be reused for multiple calls.
150
+ # client = Google::Longrunning::Operations::Client.new
151
+ #
152
+ # # Create a request. To set request fields, pass in keyword arguments.
153
+ # request = Google::Longrunning::ListOperationsRequest.new
154
+ #
155
+ # # Call the list_operations method.
156
+ # result = client.list_operations request
157
+ #
158
+ # # The returned object is of type Gapic::PagedEnumerable. You can
159
+ # # iterate over all elements by calling #each, and the enumerable
160
+ # # will lazily make API calls to fetch subsequent pages. Other
161
+ # # methods are also available for managing paging directly.
162
+ # result.each do |response|
163
+ # # Each element is of type ::Google::Longrunning::Operation.
164
+ # p response
165
+ # end
166
+ #
146
167
  def list_operations request, options = nil
147
168
  raise ::ArgumentError, "request must be provided" if request.nil?
148
169
 
@@ -160,9 +181,11 @@ module Google
160
181
  gapic_version: ::Google::Cloud::Speech::V1::VERSION
161
182
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
162
183
 
163
- header_params = {
164
- "name" => request.name
165
- }
184
+ header_params = {}
185
+ if request.name
186
+ header_params["name"] = request.name
187
+ end
188
+
166
189
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
167
190
  metadata[:"x-goog-request-params"] ||= request_params_header
168
191
 
@@ -215,6 +238,28 @@ module Google
215
238
  #
216
239
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
217
240
  #
241
+ # @example Basic example
242
+ # require "google/longrunning"
243
+ #
244
+ # # Create a client object. The client can be reused for multiple calls.
245
+ # client = Google::Longrunning::Operations::Client.new
246
+ #
247
+ # # Create a request. To set request fields, pass in keyword arguments.
248
+ # request = Google::Longrunning::GetOperationRequest.new
249
+ #
250
+ # # Call the get_operation method.
251
+ # result = client.get_operation request
252
+ #
253
+ # # The returned object is of type Gapic::Operation. You can use this
254
+ # # object to check the status of an operation, cancel it, or wait
255
+ # # for results. Here is how to block until completion:
256
+ # result.wait_until_done! timeout: 60
257
+ # if result.response?
258
+ # p result.response
259
+ # else
260
+ # puts "Error!"
261
+ # end
262
+ #
218
263
  def get_operation request, options = nil
219
264
  raise ::ArgumentError, "request must be provided" if request.nil?
220
265
 
@@ -232,9 +277,11 @@ module Google
232
277
  gapic_version: ::Google::Cloud::Speech::V1::VERSION
233
278
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
234
279
 
235
- header_params = {
236
- "name" => request.name
237
- }
280
+ header_params = {}
281
+ if request.name
282
+ header_params["name"] = request.name
283
+ end
284
+
238
285
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
239
286
  metadata[:"x-goog-request-params"] ||= request_params_header
240
287
 
@@ -287,6 +334,21 @@ module Google
287
334
  #
288
335
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
289
336
  #
337
+ # @example Basic example
338
+ # require "google/longrunning"
339
+ #
340
+ # # Create a client object. The client can be reused for multiple calls.
341
+ # client = Google::Longrunning::Operations::Client.new
342
+ #
343
+ # # Create a request. To set request fields, pass in keyword arguments.
344
+ # request = Google::Longrunning::DeleteOperationRequest.new
345
+ #
346
+ # # Call the delete_operation method.
347
+ # result = client.delete_operation request
348
+ #
349
+ # # The returned object is of type Google::Protobuf::Empty.
350
+ # p result
351
+ #
290
352
  def delete_operation request, options = nil
291
353
  raise ::ArgumentError, "request must be provided" if request.nil?
292
354
 
@@ -304,9 +366,11 @@ module Google
304
366
  gapic_version: ::Google::Cloud::Speech::V1::VERSION
305
367
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
306
368
 
307
- header_params = {
308
- "name" => request.name
309
- }
369
+ header_params = {}
370
+ if request.name
371
+ header_params["name"] = request.name
372
+ end
373
+
310
374
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
311
375
  metadata[:"x-goog-request-params"] ||= request_params_header
312
376
 
@@ -364,6 +428,21 @@ module Google
364
428
  #
365
429
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
366
430
  #
431
+ # @example Basic example
432
+ # require "google/longrunning"
433
+ #
434
+ # # Create a client object. The client can be reused for multiple calls.
435
+ # client = Google::Longrunning::Operations::Client.new
436
+ #
437
+ # # Create a request. To set request fields, pass in keyword arguments.
438
+ # request = Google::Longrunning::CancelOperationRequest.new
439
+ #
440
+ # # Call the cancel_operation method.
441
+ # result = client.cancel_operation request
442
+ #
443
+ # # The returned object is of type Google::Protobuf::Empty.
444
+ # p result
445
+ #
367
446
  def cancel_operation request, options = nil
368
447
  raise ::ArgumentError, "request must be provided" if request.nil?
369
448
 
@@ -381,9 +460,11 @@ module Google
381
460
  gapic_version: ::Google::Cloud::Speech::V1::VERSION
382
461
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
383
462
 
384
- header_params = {
385
- "name" => request.name
386
- }
463
+ header_params = {}
464
+ if request.name
465
+ header_params["name"] = request.name
466
+ end
467
+
387
468
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
388
469
  metadata[:"x-goog-request-params"] ||= request_params_header
389
470
 
@@ -444,6 +525,28 @@ module Google
444
525
  #
445
526
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
446
527
  #
528
+ # @example Basic example
529
+ # require "google/longrunning"
530
+ #
531
+ # # Create a client object. The client can be reused for multiple calls.
532
+ # client = Google::Longrunning::Operations::Client.new
533
+ #
534
+ # # Create a request. To set request fields, pass in keyword arguments.
535
+ # request = Google::Longrunning::WaitOperationRequest.new
536
+ #
537
+ # # Call the wait_operation method.
538
+ # result = client.wait_operation request
539
+ #
540
+ # # The returned object is of type Gapic::Operation. You can use this
541
+ # # object to check the status of an operation, cancel it, or wait
542
+ # # for results. Here is how to block until completion:
543
+ # result.wait_until_done! timeout: 60
544
+ # if result.response?
545
+ # p result.response
546
+ # else
547
+ # puts "Error!"
548
+ # end
549
+ #
447
550
  def wait_operation request, options = nil
448
551
  raise ::ArgumentError, "request must be provided" if request.nil?
449
552
 
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Speech
23
+ module V1
24
+ module Speech
25
+ # Path helper methods for the Speech API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified CustomClass resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}/locations/{location}/customClasses/{custom_class}`
33
+ #
34
+ # @param project [String]
35
+ # @param location [String]
36
+ # @param custom_class [String]
37
+ #
38
+ # @return [::String]
39
+ def custom_class_path project:, location:, custom_class:
40
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
41
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
42
+
43
+ "projects/#{project}/locations/#{location}/customClasses/#{custom_class}"
44
+ end
45
+
46
+ ##
47
+ # Create a fully-qualified PhraseSet resource string.
48
+ #
49
+ # The resource will be in the following format:
50
+ #
51
+ # `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
52
+ #
53
+ # @param project [String]
54
+ # @param location [String]
55
+ # @param phrase_set [String]
56
+ #
57
+ # @return [::String]
58
+ def phrase_set_path project:, location:, phrase_set:
59
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
60
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
61
+
62
+ "projects/#{project}/locations/#{location}/phraseSets/#{phrase_set}"
63
+ end
64
+
65
+ extend self
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -23,6 +23,7 @@ require "gapic/config/method"
23
23
  require "google/cloud/speech/v1/version"
24
24
 
25
25
  require "google/cloud/speech/v1/speech/credentials"
26
+ require "google/cloud/speech/v1/speech/paths"
26
27
  require "google/cloud/speech/v1/speech/operations"
27
28
  require "google/cloud/speech/v1/speech/client"
28
29
 
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Speech
23
23
  module V1
24
- VERSION = "0.5.0"
24
+ VERSION = "0.7.1"
25
25
  end
26
26
  end
27
27
  end
@@ -33,11 +33,7 @@ module Google
33
33
  # // For Kubernetes resources, the format is {api group}/{kind}.
34
34
  # option (google.api.resource) = {
35
35
  # type: "pubsub.googleapis.com/Topic"
36
- # name_descriptor: {
37
- # pattern: "projects/{project}/topics/{topic}"
38
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
39
- # parent_name_extractor: "projects/{project}"
40
- # }
36
+ # pattern: "projects/{project}/topics/{topic}"
41
37
  # };
42
38
  # }
43
39
  #
@@ -45,10 +41,7 @@ module Google
45
41
  #
46
42
  # resources:
47
43
  # - type: "pubsub.googleapis.com/Topic"
48
- # name_descriptor:
49
- # - pattern: "projects/{project}/topics/{topic}"
50
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
51
- # parent_name_extractor: "projects/{project}"
44
+ # pattern: "projects/{project}/topics/{topic}"
52
45
  #
53
46
  # Sometimes, resources have multiple patterns, typically because they can
54
47
  # live under multiple parents.
@@ -58,26 +51,10 @@ module Google
58
51
  # message LogEntry {
59
52
  # option (google.api.resource) = {
60
53
  # type: "logging.googleapis.com/LogEntry"
61
- # name_descriptor: {
62
- # pattern: "projects/{project}/logs/{log}"
63
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
64
- # parent_name_extractor: "projects/{project}"
65
- # }
66
- # name_descriptor: {
67
- # pattern: "folders/{folder}/logs/{log}"
68
- # parent_type: "cloudresourcemanager.googleapis.com/Folder"
69
- # parent_name_extractor: "folders/{folder}"
70
- # }
71
- # name_descriptor: {
72
- # pattern: "organizations/{organization}/logs/{log}"
73
- # parent_type: "cloudresourcemanager.googleapis.com/Organization"
74
- # parent_name_extractor: "organizations/{organization}"
75
- # }
76
- # name_descriptor: {
77
- # pattern: "billingAccounts/{billing_account}/logs/{log}"
78
- # parent_type: "billing.googleapis.com/BillingAccount"
79
- # parent_name_extractor: "billingAccounts/{billing_account}"
80
- # }
54
+ # pattern: "projects/{project}/logs/{log}"
55
+ # pattern: "folders/{folder}/logs/{log}"
56
+ # pattern: "organizations/{organization}/logs/{log}"
57
+ # pattern: "billingAccounts/{billing_account}/logs/{log}"
81
58
  # };
82
59
  # }
83
60
  #
@@ -85,48 +62,10 @@ module Google
85
62
  #
86
63
  # resources:
87
64
  # - type: 'logging.googleapis.com/LogEntry'
88
- # name_descriptor:
89
- # - pattern: "projects/{project}/logs/{log}"
90
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
91
- # parent_name_extractor: "projects/{project}"
92
- # - pattern: "folders/{folder}/logs/{log}"
93
- # parent_type: "cloudresourcemanager.googleapis.com/Folder"
94
- # parent_name_extractor: "folders/{folder}"
95
- # - pattern: "organizations/{organization}/logs/{log}"
96
- # parent_type: "cloudresourcemanager.googleapis.com/Organization"
97
- # parent_name_extractor: "organizations/{organization}"
98
- # - pattern: "billingAccounts/{billing_account}/logs/{log}"
99
- # parent_type: "billing.googleapis.com/BillingAccount"
100
- # parent_name_extractor: "billingAccounts/{billing_account}"
101
- #
102
- # For flexible resources, the resource name doesn't contain parent names, but
103
- # the resource itself has parents for policy evaluation.
104
- #
105
- # Example:
106
- #
107
- # message Shelf {
108
- # option (google.api.resource) = {
109
- # type: "library.googleapis.com/Shelf"
110
- # name_descriptor: {
111
- # pattern: "shelves/{shelf}"
112
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
113
- # }
114
- # name_descriptor: {
115
- # pattern: "shelves/{shelf}"
116
- # parent_type: "cloudresourcemanager.googleapis.com/Folder"
117
- # }
118
- # };
119
- # }
120
- #
121
- # The ResourceDescriptor Yaml config will look like:
122
- #
123
- # resources:
124
- # - type: 'library.googleapis.com/Shelf'
125
- # name_descriptor:
126
- # - pattern: "shelves/{shelf}"
127
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
128
- # - pattern: "shelves/{shelf}"
129
- # parent_type: "cloudresourcemanager.googleapis.com/Folder"
65
+ # pattern: "projects/{project}/logs/{log}"
66
+ # pattern: "folders/{folder}/logs/{log}"
67
+ # pattern: "organizations/{organization}/logs/{log}"
68
+ # pattern: "billingAccounts/{billing_account}/logs/{log}"
130
69
  # @!attribute [rw] type
131
70
  # @return [::String]
132
71
  # The resource type. It must be in the format of
@@ -43,11 +43,25 @@ module Google
43
43
  # @!attribute [rw] audio
44
44
  # @return [::Google::Cloud::Speech::V1::RecognitionAudio]
45
45
  # Required. The audio data to be recognized.
46
+ # @!attribute [rw] output_config
47
+ # @return [::Google::Cloud::Speech::V1::TranscriptOutputConfig]
48
+ # Optional. Specifies an optional destination for the recognition results.
46
49
  class LongRunningRecognizeRequest
47
50
  include ::Google::Protobuf::MessageExts
48
51
  extend ::Google::Protobuf::MessageExts::ClassMethods
49
52
  end
50
53
 
54
+ # Specifies an optional destination for the recognition results.
55
+ # @!attribute [rw] gcs_uri
56
+ # @return [::String]
57
+ # Specifies a Cloud Storage URI for the recognition results. Must be
58
+ # specified in the format: `gs://bucket_name/object_name`, and the bucket
59
+ # must already exist.
60
+ class TranscriptOutputConfig
61
+ include ::Google::Protobuf::MessageExts
62
+ extend ::Google::Protobuf::MessageExts::ClassMethods
63
+ end
64
+
51
65
  # The top-level message sent by the client for the `StreamingRecognize` method.
52
66
  # Multiple `StreamingRecognizeRequest` messages are sent. The first message
53
67
  # must contain a `streaming_config` message and must not contain
@@ -156,6 +170,20 @@ module Google
156
170
  # See [Language
157
171
  # Support](https://cloud.google.com/speech-to-text/docs/languages) for a list
158
172
  # of the currently supported language codes.
173
+ # @!attribute [rw] alternative_language_codes
174
+ # @return [::Array<::String>]
175
+ # A list of up to 3 additional
176
+ # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags,
177
+ # listing possible alternative languages of the supplied audio.
178
+ # See [Language
179
+ # Support](https://cloud.google.com/speech-to-text/docs/languages) for a list
180
+ # of the currently supported language codes. If alternative languages are
181
+ # listed, recognition result will contain recognition in the most likely
182
+ # language detected including the main language_code. The recognition result
183
+ # will include the language tag of the language detected in the audio. Note:
184
+ # This feature is only supported for Voice Command and Voice Search use cases
185
+ # and performance may vary for other use cases (e.g., phone call
186
+ # transcription).
159
187
  # @!attribute [rw] max_alternatives
160
188
  # @return [::Integer]
161
189
  # Maximum number of recognition hypotheses to be returned.
@@ -170,6 +198,13 @@ module Google
170
198
  # profanities, replacing all but the initial character in each filtered word
171
199
  # with asterisks, e.g. "f***". If set to `false` or omitted, profanities
172
200
  # won't be filtered out.
201
+ # @!attribute [rw] adaptation
202
+ # @return [::Google::Cloud::Speech::V1::SpeechAdaptation]
203
+ # Speech adaptation configuration improves the accuracy of speech
204
+ # recognition. For more information, see the [speech
205
+ # adaptation](https://cloud.google.com/speech-to-text/docs/adaptation)
206
+ # documentation.
207
+ # When speech adaptation is set it supersedes the `speech_contexts` field.
173
208
  # @!attribute [rw] speech_contexts
174
209
  # @return [::Array<::Google::Cloud::Speech::V1::SpeechContext>]
175
210
  # Array of {::Google::Cloud::Speech::V1::SpeechContext SpeechContext}.
@@ -183,12 +218,33 @@ module Google
183
218
  # the start and end time offsets (timestamps) for those words. If
184
219
  # `false`, no word-level time offset information is returned. The default is
185
220
  # `false`.
221
+ # @!attribute [rw] enable_word_confidence
222
+ # @return [::Boolean]
223
+ # If `true`, the top result includes a list of words and the
224
+ # confidence for those words. If `false`, no word-level confidence
225
+ # information is returned. The default is `false`.
186
226
  # @!attribute [rw] enable_automatic_punctuation
187
227
  # @return [::Boolean]
188
228
  # If 'true', adds punctuation to recognition result hypotheses.
189
229
  # This feature is only available in select languages. Setting this for
190
230
  # requests in other languages has no effect at all.
191
231
  # The default 'false' value does not add punctuation to result hypotheses.
232
+ # @!attribute [rw] enable_spoken_punctuation
233
+ # @return [::Google::Protobuf::BoolValue]
234
+ # The spoken punctuation behavior for the call
235
+ # If not set, uses default behavior based on model of choice
236
+ # e.g. command_and_search will enable spoken punctuation by default
237
+ # If 'true', replaces spoken punctuation with the corresponding symbols in
238
+ # the request. For example, "how are you question mark" becomes "how are
239
+ # you?". See https://cloud.google.com/speech-to-text/docs/spoken-punctuation
240
+ # for support. If 'false', spoken punctuation is not replaced.
241
+ # @!attribute [rw] enable_spoken_emojis
242
+ # @return [::Google::Protobuf::BoolValue]
243
+ # The spoken emoji behavior for the call
244
+ # If not set, uses default behavior based on model of choice
245
+ # If 'true', adds spoken emoji formatting for the request. This will replace
246
+ # spoken emojis with the corresponding Unicode symbols in the final
247
+ # transcript. If 'false', spoken emojis are not replaced.
192
248
  # @!attribute [rw] diarization_config
193
249
  # @return [::Google::Cloud::Speech::V1::SpeakerDiarizationConfig]
194
250
  # Config to enable speaker diarization and set additional
@@ -260,7 +316,8 @@ module Google
260
316
  # a lossless encoding (`FLAC` or `LINEAR16`). The accuracy of the speech
261
317
  # recognition can be reduced if lossy codecs are used to capture or transmit
262
318
  # audio, particularly if background noise is present. Lossy codecs include
263
- # `MULAW`, `AMR`, `AMR_WB`, `OGG_OPUS`, `SPEEX_WITH_HEADER_BYTE`, `MP3`.
319
+ # `MULAW`, `AMR`, `AMR_WB`, `OGG_OPUS`, `SPEEX_WITH_HEADER_BYTE`, `MP3`,
320
+ # and `WEBM_OPUS`.
264
321
  #
265
322
  # The `FLAC` and `WAV` audio file formats include a header that describes the
266
323
  # included audio content. You can request recognition for `WAV` files that
@@ -315,6 +372,11 @@ module Google
315
372
  # is replaced with a single byte containing the block length. Only Speex
316
373
  # wideband is supported. `sample_rate_hertz` must be 16000.
317
374
  SPEEX_WITH_HEADER_BYTE = 7
375
+
376
+ # Opus encoded audio frames in WebM container
377
+ # ([OggOpus](https://wiki.xiph.org/OggOpus)). `sample_rate_hertz` must be
378
+ # one of 8000, 12000, 16000, 24000, or 48000.
379
+ WEBM_OPUS = 9
318
380
  end
319
381
  end
320
382
 
@@ -488,6 +550,16 @@ module Google
488
550
  # providing phrase hints for every month of the year, using the $MONTH class
489
551
  # improves the likelihood of correctly transcribing audio that includes
490
552
  # months.
553
+ # @!attribute [rw] boost
554
+ # @return [::Float]
555
+ # Hint Boost. Positive value will increase the probability that a specific
556
+ # phrase will be recognized over other similar sounding phrases. The higher
557
+ # the boost, the higher the chance of false positive recognition as well.
558
+ # Negative boost values would correspond to anti-biasing. Anti-biasing is not
559
+ # enabled, so negative boost will simply be ignored. Though `boost` can
560
+ # accept a wide range of positive values, most use cases are best served with
561
+ # values between 0 and 20. We recommend using a binary search approach to
562
+ # finding the optimal value for your use case.
491
563
  class SpeechContext
492
564
  include ::Google::Protobuf::MessageExts
493
565
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -543,6 +615,12 @@ module Google
543
615
  # @!attribute [rw] total_billed_time
544
616
  # @return [::Google::Protobuf::Duration]
545
617
  # When available, billed audio seconds for the corresponding request.
618
+ # @!attribute [rw] output_config
619
+ # @return [::Google::Cloud::Speech::V1::TranscriptOutputConfig]
620
+ # Original output config if present in the request.
621
+ # @!attribute [rw] output_error
622
+ # @return [::Google::Rpc::Status]
623
+ # If the transcript output fails this field contains the relevant error.
546
624
  class LongRunningRecognizeResponse
547
625
  include ::Google::Protobuf::MessageExts
548
626
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -689,9 +767,9 @@ module Google
689
767
  # For audio_channel_count = N, its output values can range from '1' to 'N'.
690
768
  # @!attribute [r] language_code
691
769
  # @return [::String]
692
- # The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag of
693
- # the language in this result. This language code was detected to have the
694
- # most likelihood of being spoken in the audio.
770
+ # Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag
771
+ # of the language in this result. This language code was detected to have
772
+ # the most likelihood of being spoken in the audio.
695
773
  class StreamingRecognitionResult
696
774
  include ::Google::Protobuf::MessageExts
697
775
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -709,6 +787,15 @@ module Google
709
787
  # For multi-channel audio, this is the channel number corresponding to the
710
788
  # recognized result for the audio from that channel.
711
789
  # For audio_channel_count = N, its output values can range from '1' to 'N'.
790
+ # @!attribute [rw] result_end_time
791
+ # @return [::Google::Protobuf::Duration]
792
+ # Time offset of the end of this result relative to the
793
+ # beginning of the audio.
794
+ # @!attribute [r] language_code
795
+ # @return [::String]
796
+ # Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag
797
+ # of the language in this result. This language code was detected to have
798
+ # the most likelihood of being spoken in the audio.
712
799
  class SpeechRecognitionResult
713
800
  include ::Google::Protobuf::MessageExts
714
801
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -757,6 +844,15 @@ module Google
757
844
  # @!attribute [rw] word
758
845
  # @return [::String]
759
846
  # The word corresponding to this set of information.
847
+ # @!attribute [rw] confidence
848
+ # @return [::Float]
849
+ # The confidence estimate between 0.0 and 1.0. A higher number
850
+ # indicates an estimated greater likelihood that the recognized words are
851
+ # correct. This field is set only for the top alternative of a non-streaming
852
+ # result or, of a streaming result where `is_final=true`.
853
+ # This field is not guaranteed to be accurate and users should not rely on it
854
+ # to be always provided.
855
+ # The default of 0.0 is a sentinel value indicating `confidence` was not set.
760
856
  # @!attribute [r] speaker_tag
761
857
  # @return [::Integer]
762
858
  # Output only. A distinct integer value is assigned for every speaker within
@@ -0,0 +1,141 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Speech
23
+ module V1
24
+ # A set of words or phrases that represents a common concept likely to appear
25
+ # in your audio, for example a list of passenger ship names. CustomClass items
26
+ # can be substituted into placeholders that you set in PhraseSet phrases.
27
+ # @!attribute [rw] name
28
+ # @return [::String]
29
+ # The resource name of the custom class.
30
+ # @!attribute [rw] custom_class_id
31
+ # @return [::String]
32
+ # If this custom class is a resource, the custom_class_id is the resource id
33
+ # of the CustomClass. Case sensitive.
34
+ # @!attribute [rw] items
35
+ # @return [::Array<::Google::Cloud::Speech::V1::CustomClass::ClassItem>]
36
+ # A collection of class items.
37
+ class CustomClass
38
+ include ::Google::Protobuf::MessageExts
39
+ extend ::Google::Protobuf::MessageExts::ClassMethods
40
+
41
+ # An item of the class.
42
+ # @!attribute [rw] value
43
+ # @return [::String]
44
+ # The class item's value.
45
+ class ClassItem
46
+ include ::Google::Protobuf::MessageExts
47
+ extend ::Google::Protobuf::MessageExts::ClassMethods
48
+ end
49
+ end
50
+
51
+ # Provides "hints" to the speech recognizer to favor specific words and phrases
52
+ # in the results.
53
+ # @!attribute [rw] name
54
+ # @return [::String]
55
+ # The resource name of the phrase set.
56
+ # @!attribute [rw] phrases
57
+ # @return [::Array<::Google::Cloud::Speech::V1::PhraseSet::Phrase>]
58
+ # A list of word and phrases.
59
+ # @!attribute [rw] boost
60
+ # @return [::Float]
61
+ # Hint Boost. Positive value will increase the probability that a specific
62
+ # phrase will be recognized over other similar sounding phrases. The higher
63
+ # the boost, the higher the chance of false positive recognition as well.
64
+ # Negative boost values would correspond to anti-biasing. Anti-biasing is not
65
+ # enabled, so negative boost will simply be ignored. Though `boost` can
66
+ # accept a wide range of positive values, most use cases are best served with
67
+ # values between 0 (exclusive) and 20. We recommend using a binary search
68
+ # approach to finding the optimal value for your use case. Speech recognition
69
+ # will skip PhraseSets with a boost value of 0.
70
+ class PhraseSet
71
+ include ::Google::Protobuf::MessageExts
72
+ extend ::Google::Protobuf::MessageExts::ClassMethods
73
+
74
+ # A phrases containing words and phrase "hints" so that
75
+ # the speech recognition is more likely to recognize them. This can be used
76
+ # to improve the accuracy for specific words and phrases, for example, if
77
+ # specific commands are typically spoken by the user. This can also be used
78
+ # to add additional words to the vocabulary of the recognizer. See
79
+ # [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
80
+ #
81
+ # List items can also include pre-built or custom classes containing groups
82
+ # of words that represent common concepts that occur in natural language. For
83
+ # example, rather than providing a phrase hint for every month of the
84
+ # year (e.g. "i was born in january", "i was born in febuary", ...), use the
85
+ # pre-built `$MONTH` class improves the likelihood of correctly transcribing
86
+ # audio that includes months (e.g. "i was born in $month").
87
+ # To refer to pre-built classes, use the class' symbol prepended with `$`
88
+ # e.g. `$MONTH`. To refer to custom classes that were defined inline in the
89
+ # request, set the class's `custom_class_id` to a string unique to all class
90
+ # resources and inline classes. Then use the class' id wrapped in $`{...}`
91
+ # e.g. "$\\{my-months}". To refer to custom classes resources, use the class'
92
+ # id wrapped in `${}` (e.g. `${my-months}`).
93
+ #
94
+ # Speech-to-Text supports three locations: `global`, `us` (US North America),
95
+ # and `eu` (Europe). If you are calling the `speech.googleapis.com`
96
+ # endpoint, use the `global` location. To specify a region, use a
97
+ # [regional endpoint](/speech-to-text/docs/endpoints) with matching `us` or
98
+ # `eu` location value.
99
+ # @!attribute [rw] value
100
+ # @return [::String]
101
+ # The phrase itself.
102
+ # @!attribute [rw] boost
103
+ # @return [::Float]
104
+ # Hint Boost. Overrides the boost set at the phrase set level.
105
+ # Positive value will increase the probability that a specific phrase will
106
+ # be recognized over other similar sounding phrases. The higher the boost,
107
+ # the higher the chance of false positive recognition as well. Negative
108
+ # boost will simply be ignored. Though `boost` can accept a wide range of
109
+ # positive values, most use cases are best served
110
+ # with values between 0 and 20. We recommend using a binary search approach
111
+ # to finding the optimal value for your use case. Speech recognition
112
+ # will skip PhraseSets with a boost value of 0.
113
+ class Phrase
114
+ include ::Google::Protobuf::MessageExts
115
+ extend ::Google::Protobuf::MessageExts::ClassMethods
116
+ end
117
+ end
118
+
119
+ # Speech adaptation configuration.
120
+ # @!attribute [rw] phrase_sets
121
+ # @return [::Array<::Google::Cloud::Speech::V1::PhraseSet>]
122
+ # A collection of phrase sets. To specify the hints inline, leave the
123
+ # phrase set's `name` blank and fill in the rest of its fields. Any
124
+ # phrase set can use any custom class.
125
+ # @!attribute [rw] phrase_set_references
126
+ # @return [::Array<::String>]
127
+ # A collection of phrase set resource names to use.
128
+ # @!attribute [rw] custom_classes
129
+ # @return [::Array<::Google::Cloud::Speech::V1::CustomClass>]
130
+ # A collection of custom classes. To specify the classes inline, leave the
131
+ # class' `name` blank and fill in the rest of its fields, giving it a unique
132
+ # `custom_class_id`. Refer to the inline defined class in phrase hints by its
133
+ # `custom_class_id`.
134
+ class SpeechAdaptation
135
+ include ::Google::Protobuf::MessageExts
136
+ extend ::Google::Protobuf::MessageExts::ClassMethods
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-speech-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-11 00:00:00.000000000 Z
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
@@ -177,15 +177,18 @@ files:
177
177
  - lib/google/cloud/speech/v1.rb
178
178
  - lib/google/cloud/speech/v1/cloud_speech_pb.rb
179
179
  - lib/google/cloud/speech/v1/cloud_speech_services_pb.rb
180
+ - lib/google/cloud/speech/v1/resource_pb.rb
180
181
  - lib/google/cloud/speech/v1/speech.rb
181
182
  - lib/google/cloud/speech/v1/speech/client.rb
182
183
  - lib/google/cloud/speech/v1/speech/credentials.rb
183
184
  - lib/google/cloud/speech/v1/speech/operations.rb
185
+ - lib/google/cloud/speech/v1/speech/paths.rb
184
186
  - lib/google/cloud/speech/v1/version.rb
185
187
  - proto_docs/README.md
186
188
  - proto_docs/google/api/field_behavior.rb
187
189
  - proto_docs/google/api/resource.rb
188
190
  - proto_docs/google/cloud/speech/v1/cloud_speech.rb
191
+ - proto_docs/google/cloud/speech/v1/resource.rb
189
192
  - proto_docs/google/longrunning/operations.rb
190
193
  - proto_docs/google/protobuf/any.rb
191
194
  - proto_docs/google/protobuf/duration.rb
@@ -212,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
215
  - !ruby/object:Gem::Version
213
216
  version: '0'
214
217
  requirements: []
215
- rubygems_version: 3.2.17
218
+ rubygems_version: 3.3.4
216
219
  signing_key:
217
220
  specification_version: 4
218
221
  summary: API Client library for the Cloud Speech-to-Text V1 API