Cloud Speech-to-Text V1 API - Class Google::Cloud::Speech::V1::Adaptation::Client (v0.10.0)

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

Client for the Adaptation service.

Service that implements Google Cloud Speech Adaptation API.

Inherits

  • Object

Methods

.configure

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

Configure the Adaptation 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 Adaptation clients
::Google::Cloud::Speech::V1::Adaptation::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the Adaptation 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

def create_custom_class(request, options = nil) -> ::Google::Cloud::Speech::V1::CustomClass
def create_custom_class(parent: nil, custom_class_id: nil, custom_class: nil) -> ::Google::Cloud::Speech::V1::CustomClass

Create a custom class.

Overloads
def create_custom_class(request, options = nil) -> ::Google::Cloud::Speech::V1::CustomClass
Pass arguments to create_custom_class via a request object, either of type CreateCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V1::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.
def create_custom_class(parent: nil, custom_class_id: nil, custom_class: nil) -> ::Google::Cloud::Speech::V1::CustomClass
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
  • parent (::String) — Required. The parent resource where this custom class will be created. Format:

    projects/{project}/locations/{location}/customClasses

    Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

  • custom_class_id (::String) — Required. The ID to use for the custom class, which will become the final component of the custom class' resource name.

    This value should restrict to letters, numbers, and hyphens, with the first character a letter, the last a letter or a number, and be 4-63 characters.

  • custom_class (::Google::Cloud::Speech::V1::CustomClass, ::Hash) — Required. The custom class to create.
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/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V1::Adaptation::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V1::CreateCustomClassRequest.new

# Call the create_custom_class method.
result = client.create_custom_class request

# The returned object is of type Google::Cloud::Speech::V1::CustomClass.
p result

#create_phrase_set

def create_phrase_set(request, options = nil) -> ::Google::Cloud::Speech::V1::PhraseSet
def create_phrase_set(parent: nil, phrase_set_id: nil, phrase_set: nil) -> ::Google::Cloud::Speech::V1::PhraseSet

Create a set of phrase hints. Each item in the set can be a single word or a multi-word phrase. The items in the PhraseSet are favored by the recognition model when you send a call that includes the PhraseSet.

Overloads
def create_phrase_set(request, options = nil) -> ::Google::Cloud::Speech::V1::PhraseSet
Pass arguments to create_phrase_set via a request object, either of type CreatePhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V1::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.
def create_phrase_set(parent: nil, phrase_set_id: nil, phrase_set: nil) -> ::Google::Cloud::Speech::V1::PhraseSet
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
  • parent (::String) — Required. The parent resource where this phrase set will be created. Format:

    projects/{project}/locations/{location}/phraseSets

    Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

  • phrase_set_id (::String) — Required. The ID to use for the phrase set, which will become the final component of the phrase set's resource name.

    This value should restrict to letters, numbers, and hyphens, with the first character a letter, the last a letter or a number, and be 4-63 characters.

  • phrase_set (::Google::Cloud::Speech::V1::PhraseSet, ::Hash) — Required. The phrase set to create.
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/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V1::Adaptation::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V1::CreatePhraseSetRequest.new

# Call the create_phrase_set method.
result = client.create_phrase_set request

# The returned object is of type Google::Cloud::Speech::V1::PhraseSet.
p result

#delete_custom_class

def delete_custom_class(request, options = nil) -> ::Google::Protobuf::Empty
def delete_custom_class(name: nil) -> ::Google::Protobuf::Empty

Delete a custom class.

Overloads
def delete_custom_class(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_custom_class via a request object, either of type DeleteCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V1::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.
def delete_custom_class(name: nil) -> ::Google::Protobuf::Empty
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).
Parameter
  • name (::String) — Required. The name of the custom class to delete. Format:

    projects/{project}/locations/{location}/customClasses/{custom_class}

    Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

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/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V1::Adaptation::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V1::DeleteCustomClassRequest.new

# Call the delete_custom_class method.
result = client.delete_custom_class request

# The returned object is of type Google::Protobuf::Empty.
p result

#delete_phrase_set

def delete_phrase_set(request, options = nil) -> ::Google::Protobuf::Empty
def delete_phrase_set(name: nil) -> ::Google::Protobuf::Empty

Delete a phrase set.

Overloads
def delete_phrase_set(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_phrase_set via a request object, either of type DeletePhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V1::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.
def delete_phrase_set(name: nil) -> ::Google::Protobuf::Empty
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).
Parameter
  • name (::String) — Required. The name of the phrase set to delete. Format:

    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/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V1::Adaptation::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V1::DeletePhraseSetRequest.new

# Call the delete_phrase_set method.
result = client.delete_phrase_set request

# The returned object is of type Google::Protobuf::Empty.
p result

#get_custom_class

def get_custom_class(request, options = nil) -> ::Google::Cloud::Speech::V1::CustomClass
def get_custom_class(name: nil) -> ::Google::Cloud::Speech::V1::CustomClass

Get a custom class.

Overloads
def get_custom_class(request, options = nil) -> ::Google::Cloud::Speech::V1::CustomClass
Pass arguments to get_custom_class via a request object, either of type GetCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V1::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.
def get_custom_class(name: nil) -> ::Google::Cloud::Speech::V1::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 custom class to retrieve. Format:

    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/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V1::Adaptation::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V1::GetCustomClassRequest.new

# Call the get_custom_class method.
result = client.get_custom_class request

# The returned object is of type Google::Cloud::Speech::V1::CustomClass.
p result

#get_phrase_set

def get_phrase_set(request, options = nil) -> ::Google::Cloud::Speech::V1::PhraseSet
def get_phrase_set(name: nil) -> ::Google::Cloud::Speech::V1::PhraseSet

Get a phrase set.

Overloads
def get_phrase_set(request, options = nil) -> ::Google::Cloud::Speech::V1::PhraseSet
Pass arguments to get_phrase_set via a request object, either of type GetPhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V1::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.
def get_phrase_set(name: nil) -> ::Google::Cloud::Speech::V1::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 phrase set to retrieve. Format:

    projects/{project}/locations/{location}/phraseSets/{phrase_set}

    Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

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/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V1::Adaptation::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V1::GetPhraseSetRequest.new

# Call the get_phrase_set method.
result = client.get_phrase_set request

# The returned object is of type Google::Cloud::Speech::V1::PhraseSet.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new Adaptation client object.

Yields
  • (config) — Configure the Adaptation client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Speech::V1::Adaptation::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Speech::V1::Adaptation::Client.new do |config|
  config.timeout = 10.0
end

#list_custom_classes

def list_custom_classes(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Speech::V1::CustomClass>
def list_custom_classes(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Speech::V1::CustomClass>

List custom classes.

Overloads
def list_custom_classes(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Speech::V1::CustomClass>
Pass arguments to list_custom_classes via a request object, either of type ListCustomClassesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V1::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.
def list_custom_classes(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Speech::V1::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 parent, which owns this collection of custom classes. Format:

    projects/{project}/locations/{location}/customClasses

    Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

  • page_size (::Integer) — The maximum number of custom classes to return. The service may return fewer than this value. If unspecified, at most 50 custom classes will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
  • page_token (::String) — A page token, received from a previous ListCustomClass call. Provide this to retrieve the subsequent page.

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

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/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V1::Adaptation::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V1::ListCustomClassesRequest.new

# Call the list_custom_classes method.
result = client.list_custom_classes request

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::Speech::V1::CustomClass.
  p response
end

#list_phrase_set

def list_phrase_set(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Speech::V1::PhraseSet>
def list_phrase_set(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Speech::V1::PhraseSet>

List phrase sets.

Overloads
def list_phrase_set(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Speech::V1::PhraseSet>
Pass arguments to list_phrase_set via a request object, either of type ListPhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V1::ListPhraseSetRequest, ::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.
def list_phrase_set(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Speech::V1::PhraseSet>
Pass arguments to list_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
  • parent (::String) — Required. The parent, which owns this collection of phrase set. Format:

    projects/{project}/locations/{location}

    Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

  • page_size (::Integer) — The maximum number of phrase sets to return. The service may return fewer than this value. If unspecified, at most 50 phrase sets will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
  • page_token (::String) — A page token, received from a previous ListPhraseSet call. Provide this to retrieve the subsequent page.

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

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/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V1::Adaptation::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V1::ListPhraseSetRequest.new

# Call the list_phrase_set method.
result = client.list_phrase_set request

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::Speech::V1::PhraseSet.
  p response
end

#update_custom_class

def update_custom_class(request, options = nil) -> ::Google::Cloud::Speech::V1::CustomClass
def update_custom_class(custom_class: nil, update_mask: nil) -> ::Google::Cloud::Speech::V1::CustomClass

Update a custom class.

Overloads
def update_custom_class(request, options = nil) -> ::Google::Cloud::Speech::V1::CustomClass
Pass arguments to update_custom_class via a request object, either of type UpdateCustomClassRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V1::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.
def update_custom_class(custom_class: nil, update_mask: nil) -> ::Google::Cloud::Speech::V1::CustomClass
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::V1::CustomClass, ::Hash) — Required. The custom class to update.

    The custom class's name field is used to identify the custom class to be updated. Format:

    projects/{project}/locations/{location}/customClasses/{custom_class}

    Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

  • 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/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V1::Adaptation::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V1::UpdateCustomClassRequest.new

# Call the update_custom_class method.
result = client.update_custom_class request

# The returned object is of type Google::Cloud::Speech::V1::CustomClass.
p result

#update_phrase_set

def update_phrase_set(request, options = nil) -> ::Google::Cloud::Speech::V1::PhraseSet
def update_phrase_set(phrase_set: nil, update_mask: nil) -> ::Google::Cloud::Speech::V1::PhraseSet

Update a phrase set.

Overloads
def update_phrase_set(request, options = nil) -> ::Google::Cloud::Speech::V1::PhraseSet
Pass arguments to update_phrase_set via a request object, either of type UpdatePhraseSetRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Speech::V1::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.
def update_phrase_set(phrase_set: nil, update_mask: nil) -> ::Google::Cloud::Speech::V1::PhraseSet
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::V1::PhraseSet, ::Hash) — Required. The phrase set to update.

    The phrase set's name field is used to identify the set to be updated. Format:

    projects/{project}/locations/{location}/phraseSets/{phrase_set}

    Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

  • 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/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Speech::V1::Adaptation::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Speech::V1::UpdatePhraseSetRequest.new

# Call the update_phrase_set method.
result = client.update_phrase_set request

# The returned object is of type Google::Cloud::Speech::V1::PhraseSet.
p result