Cloud Speech-to-Text V2 API - Class Google::Cloud::Speech::V2::Speech::Client (v1.4.1)

Reference documentation and code samples for the Cloud Speech-to-Text V2 API class Google::Cloud::Speech::V2::Speech::Client.

Client for the Speech service.

Enables speech transcription and resource management.

Inherits

  • Object

Methods

.configure

defself.configure(){|config|...}->Client::Configuration

Configure the Speech Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all Speech clients
::Google::Cloud::Speech::V2::Speech::Client.configuredo|config|
config.timeout=10.0
end

#batch_recognize

defbatch_recognize(request,options=nil)->::Gapic::Operation
defbatch_recognize(recognizer:nil,config:nil,config_mask:nil,files:nil,recognition_output_config:nil,processing_strategy:nil)->::Gapic::Operation

Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

Overloads
defbatch_recognize(request,options=nil)->::Gapic::Operation
Pass arguments to batch_recognize via a request object, either of type BatchRecognizeRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::BatchRecognizeRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defbatch_recognize(recognizer:nil,config:nil,config_mask:nil,files:nil,recognition_output_config:nil,processing_strategy:nil)->::Gapic::Operation
Pass arguments to batch_recognize via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::BatchRecognizeRequest.new
# Call the batch_recognize method.
result=client.batch_recognizerequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#configure

defconfigure(){|config|...}->Client::Configuration

Configure the Speech Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure .

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_custom_class

defcreate_custom_class(request,options=nil)->::Gapic::Operation
defcreate_custom_class(custom_class:nil,validate_only:nil,custom_class_id:nil,parent:nil)->::Gapic::Operation

Creates a CustomClass .

Overloads
defcreate_custom_class(request,options=nil)->::Gapic::Operation
Pass arguments to create_custom_class via a request object, either of type CreateCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::CreateCustomClassRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defcreate_custom_class(custom_class:nil,validate_only:nil,custom_class_id:nil,parent:nil)->::Gapic::Operation
Pass arguments to create_custom_class via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • custom_class (::Google::Cloud::Speech::V2::CustomClass, ::Hash) — Required. The CustomClass to create.
  • validate_only (::Boolean) — If set, validate the request and preview the CustomClass, but do not actually create it.
  • custom_class_id (::String) — The ID to use for the CustomClass, which will become the final component of the CustomClass's resource name.

    This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.

  • parent (::String) — Required. The project and location where this CustomClass will be created. The expected format is projects/{project}/locations/{location}.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::CreateCustomClassRequest.new
# Call the create_custom_class method.
result=client.create_custom_classrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#create_phrase_set

defcreate_phrase_set(request,options=nil)->::Gapic::Operation
defcreate_phrase_set(phrase_set:nil,validate_only:nil,phrase_set_id:nil,parent:nil)->::Gapic::Operation

Creates a PhraseSet .

Overloads
defcreate_phrase_set(request,options=nil)->::Gapic::Operation
Pass arguments to create_phrase_set via a request object, either of type CreatePhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::CreatePhraseSetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defcreate_phrase_set(phrase_set:nil,validate_only:nil,phrase_set_id:nil,parent:nil)->::Gapic::Operation
Pass arguments to create_phrase_set via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • phrase_set (::Google::Cloud::Speech::V2::PhraseSet, ::Hash) — Required. The PhraseSet to create.
  • validate_only (::Boolean) — If set, validate the request and preview the PhraseSet, but do not actually create it.
  • phrase_set_id (::String) — The ID to use for the PhraseSet, which will become the final component of the PhraseSet's resource name.

    This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.

  • parent (::String) — Required. The project and location where this PhraseSet will be created. The expected format is projects/{project}/locations/{location}.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::CreatePhraseSetRequest.new
# Call the create_phrase_set method.
result=client.create_phrase_setrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#create_recognizer

defcreate_recognizer(request,options=nil)->::Gapic::Operation
defcreate_recognizer(recognizer:nil,validate_only:nil,recognizer_id:nil,parent:nil)->::Gapic::Operation

Creates a Recognizer .

Overloads
defcreate_recognizer(request,options=nil)->::Gapic::Operation
Pass arguments to create_recognizer via a request object, either of type CreateRecognizerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::CreateRecognizerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defcreate_recognizer(recognizer:nil,validate_only:nil,recognizer_id:nil,parent:nil)->::Gapic::Operation
Pass arguments to create_recognizer via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • recognizer (::Google::Cloud::Speech::V2::Recognizer, ::Hash) — Required. The Recognizer to create.
  • validate_only (::Boolean) — If set, validate the request and preview the Recognizer, but do not actually create it.
  • recognizer_id (::String) — The ID to use for the Recognizer, which will become the final component of the Recognizer's resource name.

    This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.

  • parent (::String) — Required. The project and location where this Recognizer will be created. The expected format is projects/{project}/locations/{location}.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::CreateRecognizerRequest.new
# Call the create_recognizer method.
result=client.create_recognizerrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#delete_custom_class

defdelete_custom_class(request,options=nil)->::Gapic::Operation
defdelete_custom_class(name:nil,validate_only:nil,allow_missing:nil,etag:nil)->::Gapic::Operation

Deletes the CustomClass .

Overloads
defdelete_custom_class(request,options=nil)->::Gapic::Operation
Pass arguments to delete_custom_class via a request object, either of type DeleteCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::DeleteCustomClassRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defdelete_custom_class(name:nil,validate_only:nil,allow_missing:nil,etag:nil)->::Gapic::Operation
Pass arguments to delete_custom_class via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The name of the CustomClass to delete. Format: projects/{project}/locations/{location}/customClasses/{custom_class}
  • validate_only (::Boolean) — If set, validate the request and preview the deleted CustomClass, but do not actually delete it.
  • allow_missing (::Boolean) — If set to true, and the CustomClass is not found, the request will succeed and be a no-op (no Operation is recorded in this case).
  • etag (::String) — This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::DeleteCustomClassRequest.new
# Call the delete_custom_class method.
result=client.delete_custom_classrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#delete_phrase_set

defdelete_phrase_set(request,options=nil)->::Gapic::Operation
defdelete_phrase_set(name:nil,validate_only:nil,allow_missing:nil,etag:nil)->::Gapic::Operation

Deletes the PhraseSet .

Overloads
defdelete_phrase_set(request,options=nil)->::Gapic::Operation
Pass arguments to delete_phrase_set via a request object, either of type DeletePhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::DeletePhraseSetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defdelete_phrase_set(name:nil,validate_only:nil,allow_missing:nil,etag:nil)->::Gapic::Operation
Pass arguments to delete_phrase_set via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The name of the PhraseSet to delete. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}
  • validate_only (::Boolean) — If set, validate the request and preview the deleted PhraseSet, but do not actually delete it.
  • allow_missing (::Boolean) — If set to true, and the PhraseSet is not found, the request will succeed and be a no-op (no Operation is recorded in this case).
  • etag (::String) — This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::DeletePhraseSetRequest.new
# Call the delete_phrase_set method.
result=client.delete_phrase_setrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#delete_recognizer

defdelete_recognizer(request,options=nil)->::Gapic::Operation
defdelete_recognizer(name:nil,validate_only:nil,allow_missing:nil,etag:nil)->::Gapic::Operation

Deletes the Recognizer .

Overloads
defdelete_recognizer(request,options=nil)->::Gapic::Operation
Pass arguments to delete_recognizer via a request object, either of type DeleteRecognizerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::DeleteRecognizerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defdelete_recognizer(name:nil,validate_only:nil,allow_missing:nil,etag:nil)->::Gapic::Operation
Pass arguments to delete_recognizer via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The name of the Recognizer to delete. Format: projects/{project}/locations/{location}/recognizers/{recognizer}
  • validate_only (::Boolean) — If set, validate the request and preview the deleted Recognizer, but do not actually delete it.
  • allow_missing (::Boolean) — If set to true, and the Recognizer is not found, the request will succeed and be a no-op (no Operation is recorded in this case).
  • etag (::String) — This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::DeleteRecognizerRequest.new
# Call the delete_recognizer method.
result=client.delete_recognizerrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#get_config

defget_config(request,options=nil)->::Google::Cloud::Speech::V2::Config
defget_config(name:nil)->::Google::Cloud::Speech::V2::Config

Returns the requested Config .

Overloads
defget_config(request,options=nil)->::Google::Cloud::Speech::V2::Config
Pass arguments to get_config via a request object, either of type GetConfigRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::GetConfigRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defget_config(name:nil)->::Google::Cloud::Speech::V2::Config
Pass arguments to get_config via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the config to retrieve. There is exactly one config resource per project per location. The expected format is projects/{project}/locations/{location}/config.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::GetConfigRequest.new
# Call the get_config method.
result=client.get_configrequest
# The returned object is of type Google::Cloud::Speech::V2::Config.
presult

#get_custom_class

defget_custom_class(request,options=nil)->::Google::Cloud::Speech::V2::CustomClass
defget_custom_class(name:nil)->::Google::Cloud::Speech::V2::CustomClass

Returns the requested CustomClass .

Overloads
defget_custom_class(request,options=nil)->::Google::Cloud::Speech::V2::CustomClass
Pass arguments to get_custom_class via a request object, either of type GetCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::GetCustomClassRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defget_custom_class(name:nil)->::Google::Cloud::Speech::V2::CustomClass
Pass arguments to get_custom_class via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the CustomClass to retrieve. The expected format is projects/{project}/locations/{location}/customClasses/{custom_class}.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::GetCustomClassRequest.new
# Call the get_custom_class method.
result=client.get_custom_classrequest
# The returned object is of type Google::Cloud::Speech::V2::CustomClass.
presult

#get_phrase_set

defget_phrase_set(request,options=nil)->::Google::Cloud::Speech::V2::PhraseSet
defget_phrase_set(name:nil)->::Google::Cloud::Speech::V2::PhraseSet

Returns the requested PhraseSet .

Overloads
defget_phrase_set(request,options=nil)->::Google::Cloud::Speech::V2::PhraseSet
Pass arguments to get_phrase_set via a request object, either of type GetPhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::GetPhraseSetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defget_phrase_set(name:nil)->::Google::Cloud::Speech::V2::PhraseSet
Pass arguments to get_phrase_set via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the PhraseSet to retrieve. The expected format is projects/{project}/locations/{location}/phraseSets/{phrase_set}.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::GetPhraseSetRequest.new
# Call the get_phrase_set method.
result=client.get_phrase_setrequest
# The returned object is of type Google::Cloud::Speech::V2::PhraseSet.
presult

#get_recognizer

defget_recognizer(request,options=nil)->::Google::Cloud::Speech::V2::Recognizer
defget_recognizer(name:nil)->::Google::Cloud::Speech::V2::Recognizer

Returns the requested Recognizer . Fails with [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested Recognizer doesn't exist.

Overloads
defget_recognizer(request,options=nil)->::Google::Cloud::Speech::V2::Recognizer
Pass arguments to get_recognizer via a request object, either of type GetRecognizerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::GetRecognizerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defget_recognizer(name:nil)->::Google::Cloud::Speech::V2::Recognizer
Pass arguments to get_recognizer via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The name of the Recognizer to retrieve. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::GetRecognizerRequest.new
# Call the get_recognizer method.
result=client.get_recognizerrequest
# The returned object is of type Google::Cloud::Speech::V2::Recognizer.
presult

#initialize

definitialize(){|config|...}->Client

Create a new Speech client object.

Yields
  • (config) — Configure the Speech client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client=::Google::Cloud::Speech::V2::Speech::Client.new
# Create a client using a custom configuration
client=::Google::Cloud::Speech::V2::Speech::Client.newdo|config|
config.timeout=10.0
end

#list_custom_classes

deflist_custom_classes(request,options=nil)->::Gapic::PagedEnumerable<::Google::Cloud::Speech::V2::CustomClass>
deflist_custom_classes(parent:nil,page_size:nil,page_token:nil,show_deleted:nil)->::Gapic::PagedEnumerable<::Google::Cloud::Speech::V2::CustomClass>

Lists CustomClasses.

Overloads
deflist_custom_classes(request,options=nil)->::Gapic::PagedEnumerable<::Google::Cloud::Speech::V2::CustomClass>
Pass arguments to list_custom_classes via a request object, either of type ListCustomClassesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::ListCustomClassesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
deflist_custom_classes(parent:nil,page_size:nil,page_token:nil,show_deleted:nil)->::Gapic::PagedEnumerable<::Google::Cloud::Speech::V2::CustomClass>
Pass arguments to list_custom_classes via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The project and location of CustomClass resources to list. The expected format is projects/{project}/locations/{location}.
  • page_size (::Integer) — Number of results per requests. A valid page_size ranges from 0 to 100 inclusive. If the page_size is zero or unspecified, a page size of 5 will be chosen. If the page size exceeds 100, it will be coerced down to 100. Note that a call might return fewer results than the requested page size.
  • page_token (::String) — A page token, received from a previous ListCustomClasses call. Provide this to retrieve the subsequent page.

    When paginating, all other parameters provided to ListCustomClasses must match the call that provided the page token.

  • show_deleted (::Boolean) — Whether, or not, to show resources that have been deleted.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::ListCustomClassesRequest.new
# Call the list_custom_classes method.
result=client.list_custom_classesrequest
# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.eachdo|item|
# Each element is of type ::Google::Cloud::Speech::V2::CustomClass.
pitem
end

#list_phrase_sets

deflist_phrase_sets(request,options=nil)->::Gapic::PagedEnumerable<::Google::Cloud::Speech::V2::PhraseSet>
deflist_phrase_sets(parent:nil,page_size:nil,page_token:nil,show_deleted:nil)->::Gapic::PagedEnumerable<::Google::Cloud::Speech::V2::PhraseSet>

Lists PhraseSets.

Overloads
deflist_phrase_sets(request,options=nil)->::Gapic::PagedEnumerable<::Google::Cloud::Speech::V2::PhraseSet>
Pass arguments to list_phrase_sets via a request object, either of type ListPhraseSetsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::ListPhraseSetsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
deflist_phrase_sets(parent:nil,page_size:nil,page_token:nil,show_deleted:nil)->::Gapic::PagedEnumerable<::Google::Cloud::Speech::V2::PhraseSet>
Pass arguments to list_phrase_sets via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The project and location of PhraseSet resources to list. The expected format is projects/{project}/locations/{location}.
  • page_size (::Integer) — The maximum number of PhraseSets to return. The service may return fewer than this value. If unspecified, at most 5 PhraseSets will be returned. The maximum value is 100; values above 100 will be coerced to 100.
  • page_token (::String) — A page token, received from a previous ListPhraseSets call. Provide this to retrieve the subsequent page.

    When paginating, all other parameters provided to ListPhraseSets must match the call that provided the page token.

  • show_deleted (::Boolean) — Whether, or not, to show resources that have been deleted.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::ListPhraseSetsRequest.new
# Call the list_phrase_sets method.
result=client.list_phrase_setsrequest
# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.eachdo|item|
# Each element is of type ::Google::Cloud::Speech::V2::PhraseSet.
pitem
end

#list_recognizers

deflist_recognizers(request,options=nil)->::Gapic::PagedEnumerable<::Google::Cloud::Speech::V2::Recognizer>
deflist_recognizers(parent:nil,page_size:nil,page_token:nil,show_deleted:nil)->::Gapic::PagedEnumerable<::Google::Cloud::Speech::V2::Recognizer>

Lists Recognizers.

Overloads
deflist_recognizers(request,options=nil)->::Gapic::PagedEnumerable<::Google::Cloud::Speech::V2::Recognizer>
Pass arguments to list_recognizers via a request object, either of type ListRecognizersRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::ListRecognizersRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
deflist_recognizers(parent:nil,page_size:nil,page_token:nil,show_deleted:nil)->::Gapic::PagedEnumerable<::Google::Cloud::Speech::V2::Recognizer>
Pass arguments to list_recognizers via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The project and location of Recognizers to list. The expected format is projects/{project}/locations/{location}.
  • page_size (::Integer) — The maximum number of Recognizers to return. The service may return fewer than this value. If unspecified, at most 5 Recognizers will be returned. The maximum value is 100; values above 100 will be coerced to 100.
  • page_token (::String) — A page token, received from a previous ListRecognizers call. Provide this to retrieve the subsequent page.

    When paginating, all other parameters provided to ListRecognizers must match the call that provided the page token.

  • show_deleted (::Boolean) — Whether, or not, to show resources that have been deleted.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::ListRecognizersRequest.new
# Call the list_recognizers method.
result=client.list_recognizersrequest
# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.eachdo|item|
# Each element is of type ::Google::Cloud::Speech::V2::Recognizer.
pitem
end

#location_client

deflocation_client()->Google::Cloud::Location::Locations::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Client)

#logger

deflogger()->Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#operations_client

defoperations_client()->::Google::Cloud::Speech::V2::Speech::Operations

Get the associated client for long-running operations.

#recognize

defrecognize(request,options=nil)->::Google::Cloud::Speech::V2::RecognizeResponse
defrecognize(recognizer:nil,config:nil,config_mask:nil,content:nil,uri:nil)->::Google::Cloud::Speech::V2::RecognizeResponse

Performs synchronous Speech recognition: receive results after all audio has been sent and processed.

Overloads
defrecognize(request,options=nil)->::Google::Cloud::Speech::V2::RecognizeResponse
Pass arguments to recognize via a request object, either of type RecognizeRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::RecognizeRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defrecognize(recognizer:nil,config:nil,config_mask:nil,content:nil,uri:nil)->::Google::Cloud::Speech::V2::RecognizeResponse
Pass arguments to recognize via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • recognizer (::String) — Required. The name of the Recognizer to use during recognition. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}. The {recognizer} segment may be set to _ to use an empty implicit Recognizer.
  • config (::Google::Cloud::Speech::V2::RecognitionConfig, ::Hash) — Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the config_mask field can be used to override parts of the default_recognition_config of the Recognizer resource.
  • config_mask (::Google::Protobuf::FieldMask, ::Hash) — The list of fields in config that override the values in the default_recognition_config of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in config override the values in the recognizer for this recognition request. If a mask is provided, only the fields listed in the mask override the config in the recognizer for this recognition request. If a wildcard (*) is provided, config completely overrides and replaces the config in the recognizer for this recognition request.
  • content (::String) — The audio data bytes encoded as specified in RecognitionConfig . As with all bytes fields, proto buffers use a pure binary representation, whereas JSON representations use base64.

    Note: The following parameters are mutually exclusive: content, uri. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.

  • uri (::String) — URI that points to a file that contains audio data bytes as specified in RecognitionConfig . The file must not be compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported, which must be specified in the following format: gs://bucket_name/object_name (other URI formats return [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see Request URIs.

    Note: The following parameters are mutually exclusive: uri, content. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::RecognizeRequest.new
# Call the recognize method.
result=client.recognizerequest
# The returned object is of type Google::Cloud::Speech::V2::RecognizeResponse.
presult

#streaming_recognize

defstreaming_recognize(request,options=nil){|response,operation|...}->::Enumerable<::Google::Cloud::Speech::V2::StreamingRecognizeResponse>

Performs bidirectional streaming speech recognition: receive results while sending audio. This method is only available via the gRPC API (not REST).

Parameters
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create an input stream.
input=Gapic::StreamInput.new
# Call the streaming_recognize method to start streaming.
output=client.streaming_recognizeinput
# Send requests on the stream. For each request object, set fields by
# passing keyword arguments. Be sure to close the stream when done.
input << Google::Cloud::Speech::V2::StreamingRecognizeRequest.new
input << Google::Cloud::Speech::V2::StreamingRecognizeRequest.new
input.close
# The returned object is a streamed enumerable yielding elements of type
# ::Google::Cloud::Speech::V2::StreamingRecognizeResponse
output.eachdo|current_response|
pcurrent_response
end

#undelete_custom_class

defundelete_custom_class(request,options=nil)->::Gapic::Operation
defundelete_custom_class(name:nil,validate_only:nil,etag:nil)->::Gapic::Operation

Undeletes the CustomClass .

Overloads
defundelete_custom_class(request,options=nil)->::Gapic::Operation
Pass arguments to undelete_custom_class via a request object, either of type UndeleteCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UndeleteCustomClassRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defundelete_custom_class(name:nil,validate_only:nil,etag:nil)->::Gapic::Operation
Pass arguments to undelete_custom_class via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The name of the CustomClass to undelete. Format: projects/{project}/locations/{location}/customClasses/{custom_class}
  • validate_only (::Boolean) — If set, validate the request and preview the undeleted CustomClass, but do not actually undelete it.
  • etag (::String) — This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::UndeleteCustomClassRequest.new
# Call the undelete_custom_class method.
result=client.undelete_custom_classrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#undelete_phrase_set

defundelete_phrase_set(request,options=nil)->::Gapic::Operation
defundelete_phrase_set(name:nil,validate_only:nil,etag:nil)->::Gapic::Operation

Undeletes the PhraseSet .

Overloads
defundelete_phrase_set(request,options=nil)->::Gapic::Operation
Pass arguments to undelete_phrase_set via a request object, either of type UndeletePhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UndeletePhraseSetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defundelete_phrase_set(name:nil,validate_only:nil,etag:nil)->::Gapic::Operation
Pass arguments to undelete_phrase_set via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The name of the PhraseSet to undelete. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}
  • validate_only (::Boolean) — If set, validate the request and preview the undeleted PhraseSet, but do not actually undelete it.
  • etag (::String) — This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::UndeletePhraseSetRequest.new
# Call the undelete_phrase_set method.
result=client.undelete_phrase_setrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#undelete_recognizer

defundelete_recognizer(request,options=nil)->::Gapic::Operation
defundelete_recognizer(name:nil,validate_only:nil,etag:nil)->::Gapic::Operation

Undeletes the Recognizer .

Overloads
defundelete_recognizer(request,options=nil)->::Gapic::Operation
Pass arguments to undelete_recognizer via a request object, either of type UndeleteRecognizerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UndeleteRecognizerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defundelete_recognizer(name:nil,validate_only:nil,etag:nil)->::Gapic::Operation
Pass arguments to undelete_recognizer via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The name of the Recognizer to undelete. Format: projects/{project}/locations/{location}/recognizers/{recognizer}
  • validate_only (::Boolean) — If set, validate the request and preview the undeleted Recognizer, but do not actually undelete it.
  • etag (::String) — This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::UndeleteRecognizerRequest.new
# Call the undelete_recognizer method.
result=client.undelete_recognizerrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#universe_domain

defuniverse_domain()->String

The effective universe domain

Returns
  • (String)

#update_config

defupdate_config(request,options=nil)->::Google::Cloud::Speech::V2::Config
defupdate_config(config:nil,update_mask:nil)->::Google::Cloud::Speech::V2::Config

Updates the Config .

Overloads
defupdate_config(request,options=nil)->::Google::Cloud::Speech::V2::Config
Pass arguments to update_config via a request object, either of type UpdateConfigRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UpdateConfigRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defupdate_config(config:nil,update_mask:nil)->::Google::Cloud::Speech::V2::Config
Pass arguments to update_config via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • config (::Google::Cloud::Speech::V2::Config, ::Hash) — Required. The config to update.

    The config's name field is used to identify the config to be updated. The expected format is projects/{project}/locations/{location}/config.

  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — The list of fields to be updated.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::UpdateConfigRequest.new
# Call the update_config method.
result=client.update_configrequest
# The returned object is of type Google::Cloud::Speech::V2::Config.
presult

#update_custom_class

defupdate_custom_class(request,options=nil)->::Gapic::Operation
defupdate_custom_class(custom_class:nil,update_mask:nil,validate_only:nil)->::Gapic::Operation

Updates the CustomClass .

Overloads
defupdate_custom_class(request,options=nil)->::Gapic::Operation
Pass arguments to update_custom_class via a request object, either of type UpdateCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UpdateCustomClassRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defupdate_custom_class(custom_class:nil,update_mask:nil,validate_only:nil)->::Gapic::Operation
Pass arguments to update_custom_class via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • custom_class (::Google::Cloud::Speech::V2::CustomClass, ::Hash) — Required. The CustomClass to update.

    The CustomClass's name field is used to identify the CustomClass to update. Format: projects/{project}/locations/{location}/customClasses/{custom_class}.

  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — The list of fields to be updated. If empty, all fields are considered for update.
  • validate_only (::Boolean) — If set, validate the request and preview the updated CustomClass, but do not actually update it.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::UpdateCustomClassRequest.new
# Call the update_custom_class method.
result=client.update_custom_classrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#update_phrase_set

defupdate_phrase_set(request,options=nil)->::Gapic::Operation
defupdate_phrase_set(phrase_set:nil,update_mask:nil,validate_only:nil)->::Gapic::Operation

Updates the PhraseSet .

Overloads
defupdate_phrase_set(request,options=nil)->::Gapic::Operation
Pass arguments to update_phrase_set via a request object, either of type UpdatePhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UpdatePhraseSetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defupdate_phrase_set(phrase_set:nil,update_mask:nil,validate_only:nil)->::Gapic::Operation
Pass arguments to update_phrase_set via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • phrase_set (::Google::Cloud::Speech::V2::PhraseSet, ::Hash) — Required. The PhraseSet to update.

    The PhraseSet's name field is used to identify the PhraseSet to update. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}.

  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — The list of fields to update. If empty, all non-default valued fields are considered for update. Use * to update the entire PhraseSet resource.
  • validate_only (::Boolean) — If set, validate the request and preview the updated PhraseSet, but do not actually update it.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::UpdatePhraseSetRequest.new
# Call the update_phrase_set method.
result=client.update_phrase_setrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

#update_recognizer

defupdate_recognizer(request,options=nil)->::Gapic::Operation
defupdate_recognizer(recognizer:nil,update_mask:nil,validate_only:nil)->::Gapic::Operation

Updates the Recognizer .

Overloads
defupdate_recognizer(request,options=nil)->::Gapic::Operation
Pass arguments to update_recognizer via a request object, either of type UpdateRecognizerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V2::UpdateRecognizerRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
defupdate_recognizer(recognizer:nil,update_mask:nil,validate_only:nil)->::Gapic::Operation
Pass arguments to update_recognizer via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • recognizer (::Google::Cloud::Speech::V2::Recognizer, ::Hash) — Required. The Recognizer to update.

    The Recognizer's name field is used to identify the Recognizer to update. Format: projects/{project}/locations/{location}/recognizers/{recognizer}.

  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — The list of fields to update. If empty, all non-default valued fields are considered for update. Use * to update the entire Recognizer resource.
  • validate_only (::Boolean) — If set, validate the request and preview the updated Recognizer, but do not actually update it.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require"google/cloud/speech/v2"
# Create a client object. The client can be reused for multiple calls.
client=Google::Cloud::Speech::V2::Speech::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request=Google::Cloud::Speech::V2::UpdateRecognizerRequest.new
# Call the update_recognizer method.
result=client.update_recognizerrequest
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done!timeout:60
ifresult.response?
presult.response
else
puts"No response received."
end

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.