Class RecognitionConfig (4.49.0)

public final class RecognitionConfig extends GeneratedMessageV3 implements RecognitionConfigOrBuilder

Provides information to the Recognizer that specifies how to process the recognition request.

Protobuf type google.cloud.speech.v2.RecognitionConfig

Static Fields

ADAPTATION_FIELD_NUMBER

public static final int ADAPTATION_FIELD_NUMBER
Field Value
Type Description
int

AUTO_DECODING_CONFIG_FIELD_NUMBER

public static final int AUTO_DECODING_CONFIG_FIELD_NUMBER
Field Value
Type Description
int

EXPLICIT_DECODING_CONFIG_FIELD_NUMBER

public static final int EXPLICIT_DECODING_CONFIG_FIELD_NUMBER
Field Value
Type Description
int

FEATURES_FIELD_NUMBER

public static final int FEATURES_FIELD_NUMBER
Field Value
Type Description
int

LANGUAGE_CODES_FIELD_NUMBER

public static final int LANGUAGE_CODES_FIELD_NUMBER
Field Value
Type Description
int

MODEL_FIELD_NUMBER

public static final int MODEL_FIELD_NUMBER
Field Value
Type Description
int

TRANSCRIPT_NORMALIZATION_FIELD_NUMBER

public static final int TRANSCRIPT_NORMALIZATION_FIELD_NUMBER
Field Value
Type Description
int

TRANSLATION_CONFIG_FIELD_NUMBER

public static final int TRANSLATION_CONFIG_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static RecognitionConfig getDefaultInstance()
Returns
Type Description
RecognitionConfig

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

newBuilder()

public static RecognitionConfig.Builder newBuilder()
Returns
Type Description
RecognitionConfig.Builder

newBuilder(RecognitionConfig prototype)

public static RecognitionConfig.Builder newBuilder(RecognitionConfig prototype)
Parameter
Name Description
prototype RecognitionConfig
Returns
Type Description
RecognitionConfig.Builder

parseDelimitedFrom(InputStream input)

public static RecognitionConfig parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
RecognitionConfig
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static RecognitionConfig parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
RecognitionConfig
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static RecognitionConfig parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
RecognitionConfig
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static RecognitionConfig parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
RecognitionConfig
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static RecognitionConfig parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
RecognitionConfig
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static RecognitionConfig parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
RecognitionConfig
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static RecognitionConfig parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
RecognitionConfig
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static RecognitionConfig parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
RecognitionConfig
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static RecognitionConfig parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
RecognitionConfig
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static RecognitionConfig parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
RecognitionConfig
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static RecognitionConfig parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
RecognitionConfig
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static RecognitionConfig parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
RecognitionConfig
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<RecognitionConfig> parser()
Returns
Type Description
Parser<RecognitionConfig>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getAdaptation()

public SpeechAdaptation getAdaptation()

Speech adaptation context that weights recognizer predictions for specific words and phrases.

.google.cloud.speech.v2.SpeechAdaptation adaptation = 6;

Returns
Type Description
SpeechAdaptation

The adaptation.

getAdaptationOrBuilder()

public SpeechAdaptationOrBuilder getAdaptationOrBuilder()

Speech adaptation context that weights recognizer predictions for specific words and phrases.

.google.cloud.speech.v2.SpeechAdaptation adaptation = 6;

Returns
Type Description
SpeechAdaptationOrBuilder

getAutoDecodingConfig()

public AutoDetectDecodingConfig getAutoDecodingConfig()

Automatically detect decoding parameters. Preferred for supported formats.

.google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7;

Returns
Type Description
AutoDetectDecodingConfig

The autoDecodingConfig.

getAutoDecodingConfigOrBuilder()

public AutoDetectDecodingConfigOrBuilder getAutoDecodingConfigOrBuilder()

Automatically detect decoding parameters. Preferred for supported formats.

.google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7;

Returns
Type Description
AutoDetectDecodingConfigOrBuilder

getDecodingConfigCase()

public RecognitionConfig.DecodingConfigCase getDecodingConfigCase()
Returns
Type Description
RecognitionConfig.DecodingConfigCase

getDefaultInstanceForType()

public RecognitionConfig getDefaultInstanceForType()
Returns
Type Description
RecognitionConfig

getExplicitDecodingConfig()

public ExplicitDecodingConfig getExplicitDecodingConfig()

Explicitly specified decoding parameters. Required if using headerless PCM audio (linear16, mulaw, alaw).

.google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8;

Returns
Type Description
ExplicitDecodingConfig

The explicitDecodingConfig.

getExplicitDecodingConfigOrBuilder()

public ExplicitDecodingConfigOrBuilder getExplicitDecodingConfigOrBuilder()

Explicitly specified decoding parameters. Required if using headerless PCM audio (linear16, mulaw, alaw).

.google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8;

Returns
Type Description
ExplicitDecodingConfigOrBuilder

getFeatures()

public RecognitionFeatures getFeatures()

Speech recognition features to enable.

.google.cloud.speech.v2.RecognitionFeatures features = 2;

Returns
Type Description
RecognitionFeatures

The features.

getFeaturesOrBuilder()

public RecognitionFeaturesOrBuilder getFeaturesOrBuilder()

Speech recognition features to enable.

.google.cloud.speech.v2.RecognitionFeatures features = 2;

Returns
Type Description
RecognitionFeaturesOrBuilder

getLanguageCodes(int index)

public String getLanguageCodes(int index)

Optional. The language of the supplied audio as a BCP-47 language tag. Language tags are normalized to BCP-47 before they are used eg "en-us" becomes "en-US".

Supported languages for each model are listed in the Table of Supported Models.

If additional languages are provided, recognition result will contain recognition in the most likely language detected. The recognition result will include the language tag of the language detected in the audio.

repeated string language_codes = 10 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The languageCodes at the given index.

getLanguageCodesBytes(int index)

public ByteString getLanguageCodesBytes(int index)

Optional. The language of the supplied audio as a BCP-47 language tag. Language tags are normalized to BCP-47 before they are used eg "en-us" becomes "en-US".

Supported languages for each model are listed in the Table of Supported Models.

If additional languages are provided, recognition result will contain recognition in the most likely language detected. The recognition result will include the language tag of the language detected in the audio.

repeated string language_codes = 10 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the languageCodes at the given index.

getLanguageCodesCount()

public int getLanguageCodesCount()

Optional. The language of the supplied audio as a BCP-47 language tag. Language tags are normalized to BCP-47 before they are used eg "en-us" becomes "en-US".

Supported languages for each model are listed in the Table of Supported Models.

If additional languages are provided, recognition result will contain recognition in the most likely language detected. The recognition result will include the language tag of the language detected in the audio.

repeated string language_codes = 10 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
int

The count of languageCodes.

getLanguageCodesList()

public ProtocolStringList getLanguageCodesList()

Optional. The language of the supplied audio as a BCP-47 language tag. Language tags are normalized to BCP-47 before they are used eg "en-us" becomes "en-US".

Supported languages for each model are listed in the Table of Supported Models.

If additional languages are provided, recognition result will contain recognition in the most likely language detected. The recognition result will include the language tag of the language detected in the audio.

repeated string language_codes = 10 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ProtocolStringList

A list containing the languageCodes.

getModel()

public String getModel()

Optional. Which model to use for recognition requests. Select the model best suited to your domain to get best results.

Guidance for choosing which model to use can be found in the Transcription Models Documentation and the models supported in each region can be found in the Table Of Supported Models.

string model = 9 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
String

The model.

getModelBytes()

public ByteString getModelBytes()

Optional. Which model to use for recognition requests. Select the model best suited to your domain to get best results.

Guidance for choosing which model to use can be found in the Transcription Models Documentation and the models supported in each region can be found in the Table Of Supported Models.

string model = 9 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
ByteString

The bytes for model.

getParserForType()

public Parser<RecognitionConfig> getParserForType()
Returns
Type Description
Parser<RecognitionConfig>
Overrides

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

getTranscriptNormalization()

public TranscriptNormalization getTranscriptNormalization()

Optional. Use transcription normalization to automatically replace parts of the transcript with phrases of your choosing. For StreamingRecognize, this normalization only applies to stable partial transcripts (stability > 0.8) and final transcripts.

.google.cloud.speech.v2.TranscriptNormalization transcript_normalization = 11 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
TranscriptNormalization

The transcriptNormalization.

getTranscriptNormalizationOrBuilder()

public TranscriptNormalizationOrBuilder getTranscriptNormalizationOrBuilder()

Optional. Use transcription normalization to automatically replace parts of the transcript with phrases of your choosing. For StreamingRecognize, this normalization only applies to stable partial transcripts (stability > 0.8) and final transcripts.

.google.cloud.speech.v2.TranscriptNormalization transcript_normalization = 11 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
TranscriptNormalizationOrBuilder

getTranslationConfig()

public TranslationConfig getTranslationConfig()

Optional. Optional configuration used to automatically run translation on the given audio to the desired language for supported models.

.google.cloud.speech.v2.TranslationConfig translation_config = 15 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
TranslationConfig

The translationConfig.

getTranslationConfigOrBuilder()

public TranslationConfigOrBuilder getTranslationConfigOrBuilder()

Optional. Optional configuration used to automatically run translation on the given audio to the desired language for supported models.

.google.cloud.speech.v2.TranslationConfig translation_config = 15 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
TranslationConfigOrBuilder

hasAdaptation()

public boolean hasAdaptation()

Speech adaptation context that weights recognizer predictions for specific words and phrases.

.google.cloud.speech.v2.SpeechAdaptation adaptation = 6;

Returns
Type Description
boolean

Whether the adaptation field is set.

hasAutoDecodingConfig()

public boolean hasAutoDecodingConfig()

Automatically detect decoding parameters. Preferred for supported formats.

.google.cloud.speech.v2.AutoDetectDecodingConfig auto_decoding_config = 7;

Returns
Type Description
boolean

Whether the autoDecodingConfig field is set.

hasExplicitDecodingConfig()

public boolean hasExplicitDecodingConfig()

Explicitly specified decoding parameters. Required if using headerless PCM audio (linear16, mulaw, alaw).

.google.cloud.speech.v2.ExplicitDecodingConfig explicit_decoding_config = 8;

Returns
Type Description
boolean

Whether the explicitDecodingConfig field is set.

hasFeatures()

public boolean hasFeatures()

Speech recognition features to enable.

.google.cloud.speech.v2.RecognitionFeatures features = 2;

Returns
Type Description
boolean

Whether the features field is set.

hasTranscriptNormalization()

public boolean hasTranscriptNormalization()

Optional. Use transcription normalization to automatically replace parts of the transcript with phrases of your choosing. For StreamingRecognize, this normalization only applies to stable partial transcripts (stability > 0.8) and final transcripts.

.google.cloud.speech.v2.TranscriptNormalization transcript_normalization = 11 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the transcriptNormalization field is set.

hasTranslationConfig()

public boolean hasTranslationConfig()

Optional. Optional configuration used to automatically run translation on the given audio to the desired language for supported models.

.google.cloud.speech.v2.TranslationConfig translation_config = 15 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the translationConfig field is set.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public RecognitionConfig.Builder newBuilderForType()
Returns
Type Description
RecognitionConfig.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected RecognitionConfig.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
RecognitionConfig.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public RecognitionConfig.Builder toBuilder()
Returns
Type Description
RecognitionConfig.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException