Class RecognitionConfig.Builder (4.18.0)

public static final class RecognitionConfig.Builder extends GeneratedMessageV3.Builder<RecognitionConfig.Builder> implements RecognitionConfigOrBuilder

Provides information to the recognizer that specifies how to process the request.

Protobuf type google.cloud.speech.v1beta1.RecognitionConfig

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public RecognitionConfig.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
RecognitionConfig.Builder
Overrides

build()

public RecognitionConfig build()
Returns
TypeDescription
RecognitionConfig

buildPartial()

public RecognitionConfig buildPartial()
Returns
TypeDescription
RecognitionConfig

clear()

public RecognitionConfig.Builder clear()
Returns
TypeDescription
RecognitionConfig.Builder
Overrides

clearEncoding()

public RecognitionConfig.Builder clearEncoding()

Required Encoding of audio data sent in all RecognitionAudio messages.

.google.cloud.speech.v1beta1.RecognitionConfig.AudioEncoding encoding = 1;

Returns
TypeDescription
RecognitionConfig.Builder

clearField(Descriptors.FieldDescriptor field)

public RecognitionConfig.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
RecognitionConfig.Builder
Overrides

clearLanguageCode()

public RecognitionConfig.Builder clearLanguageCode()

Optional The language of the supplied audio as a BCP-47 language tag. Example: "en-GB" https://www.rfc-editor.org/rfc/bcp/bcp47.txt If omitted, defaults to "en-US". See Language Support for a list of the currently supported language codes.

string language_code = 3;

Returns
TypeDescription
RecognitionConfig.Builder

clearMaxAlternatives()

public RecognitionConfig.Builder clearMaxAlternatives()

Optional Maximum number of recognition hypotheses to be returned. Specifically, the maximum number of SpeechRecognitionAlternative messages within each SpeechRecognitionResult. The server may return fewer than max_alternatives. Valid values are 0-30. A value of 0 or 1 will return a maximum of one. If omitted, will return a maximum of one.

int32 max_alternatives = 4;

Returns
TypeDescription
RecognitionConfig.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public RecognitionConfig.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
RecognitionConfig.Builder
Overrides

clearProfanityFilter()

public RecognitionConfig.Builder clearProfanityFilter()

Optional If set to true, the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks, e.g. "f***". If set to false or omitted, profanities won't be filtered out.

bool profanity_filter = 5;

Returns
TypeDescription
RecognitionConfig.Builder

clearSampleRate()

public RecognitionConfig.Builder clearSampleRate()

Required Sample rate in Hertz of the audio data sent in all RecognitionAudio messages. Valid values are: 8000-48000. 16000 is optimal. For best results, set the sampling rate of the audio source to 16000 Hz. If that's not possible, use the native sample rate of the audio source (instead of re-sampling).

int32 sample_rate = 2;

Returns
TypeDescription
RecognitionConfig.Builder

clearSpeechContext()

public RecognitionConfig.Builder clearSpeechContext()

Optional A means to provide context to assist the speech recognition.

.google.cloud.speech.v1beta1.SpeechContext speech_context = 6;

Returns
TypeDescription
RecognitionConfig.Builder

clone()

public RecognitionConfig.Builder clone()
Returns
TypeDescription
RecognitionConfig.Builder
Overrides

getDefaultInstanceForType()

public RecognitionConfig getDefaultInstanceForType()
Returns
TypeDescription
RecognitionConfig

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getEncoding()

public RecognitionConfig.AudioEncoding getEncoding()

Required Encoding of audio data sent in all RecognitionAudio messages.

.google.cloud.speech.v1beta1.RecognitionConfig.AudioEncoding encoding = 1;

Returns
TypeDescription
RecognitionConfig.AudioEncoding

getEncodingValue()

public int getEncodingValue()

Required Encoding of audio data sent in all RecognitionAudio messages.

.google.cloud.speech.v1beta1.RecognitionConfig.AudioEncoding encoding = 1;

Returns
TypeDescription
int

getLanguageCode()

public String getLanguageCode()

Optional The language of the supplied audio as a BCP-47 language tag. Example: "en-GB" https://www.rfc-editor.org/rfc/bcp/bcp47.txt If omitted, defaults to "en-US". See Language Support for a list of the currently supported language codes.

string language_code = 3;

Returns
TypeDescription
String

getLanguageCodeBytes()

public ByteString getLanguageCodeBytes()

Optional The language of the supplied audio as a BCP-47 language tag. Example: "en-GB" https://www.rfc-editor.org/rfc/bcp/bcp47.txt If omitted, defaults to "en-US". See Language Support for a list of the currently supported language codes.

string language_code = 3;

Returns
TypeDescription
ByteString

getMaxAlternatives()

public int getMaxAlternatives()

Optional Maximum number of recognition hypotheses to be returned. Specifically, the maximum number of SpeechRecognitionAlternative messages within each SpeechRecognitionResult. The server may return fewer than max_alternatives. Valid values are 0-30. A value of 0 or 1 will return a maximum of one. If omitted, will return a maximum of one.

int32 max_alternatives = 4;

Returns
TypeDescription
int

getProfanityFilter()

public boolean getProfanityFilter()

Optional If set to true, the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks, e.g. "f***". If set to false or omitted, profanities won't be filtered out.

bool profanity_filter = 5;

Returns
TypeDescription
boolean

getSampleRate()

public int getSampleRate()

Required Sample rate in Hertz of the audio data sent in all RecognitionAudio messages. Valid values are: 8000-48000. 16000 is optimal. For best results, set the sampling rate of the audio source to 16000 Hz. If that's not possible, use the native sample rate of the audio source (instead of re-sampling).

int32 sample_rate = 2;

Returns
TypeDescription
int

getSpeechContext()

public SpeechContext getSpeechContext()

Optional A means to provide context to assist the speech recognition.

.google.cloud.speech.v1beta1.SpeechContext speech_context = 6;

Returns
TypeDescription
SpeechContext

getSpeechContextBuilder()

public SpeechContext.Builder getSpeechContextBuilder()

Optional A means to provide context to assist the speech recognition.

.google.cloud.speech.v1beta1.SpeechContext speech_context = 6;

Returns
TypeDescription
SpeechContext.Builder

getSpeechContextOrBuilder()

public SpeechContextOrBuilder getSpeechContextOrBuilder()

Optional A means to provide context to assist the speech recognition.

.google.cloud.speech.v1beta1.SpeechContext speech_context = 6;

Returns
TypeDescription
SpeechContextOrBuilder

hasSpeechContext()

public boolean hasSpeechContext()

Optional A means to provide context to assist the speech recognition.

.google.cloud.speech.v1beta1.SpeechContext speech_context = 6;

Returns
TypeDescription
boolean

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(RecognitionConfig other)

public RecognitionConfig.Builder mergeFrom(RecognitionConfig other)
Parameter
NameDescription
otherRecognitionConfig
Returns
TypeDescription
RecognitionConfig.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public RecognitionConfig.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
RecognitionConfig.Builder
Overrides
Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public RecognitionConfig.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
RecognitionConfig.Builder
Overrides

mergeSpeechContext(SpeechContext value)

public RecognitionConfig.Builder mergeSpeechContext(SpeechContext value)

Optional A means to provide context to assist the speech recognition.

.google.cloud.speech.v1beta1.SpeechContext speech_context = 6;

Parameter
NameDescription
valueSpeechContext
Returns
TypeDescription
RecognitionConfig.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final RecognitionConfig.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
RecognitionConfig.Builder
Overrides

setEncoding(RecognitionConfig.AudioEncoding value)

public RecognitionConfig.Builder setEncoding(RecognitionConfig.AudioEncoding value)

Required Encoding of audio data sent in all RecognitionAudio messages.

.google.cloud.speech.v1beta1.RecognitionConfig.AudioEncoding encoding = 1;

Parameter
NameDescription
valueRecognitionConfig.AudioEncoding
Returns
TypeDescription
RecognitionConfig.Builder

setEncodingValue(int value)

public RecognitionConfig.Builder setEncodingValue(int value)

Required Encoding of audio data sent in all RecognitionAudio messages.

.google.cloud.speech.v1beta1.RecognitionConfig.AudioEncoding encoding = 1;

Parameter
NameDescription
valueint
Returns
TypeDescription
RecognitionConfig.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public RecognitionConfig.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
RecognitionConfig.Builder
Overrides

setLanguageCode(String value)

public RecognitionConfig.Builder setLanguageCode(String value)

Optional The language of the supplied audio as a BCP-47 language tag. Example: "en-GB" https://www.rfc-editor.org/rfc/bcp/bcp47.txt If omitted, defaults to "en-US". See Language Support for a list of the currently supported language codes.

string language_code = 3;

Parameter
NameDescription
valueString
Returns
TypeDescription
RecognitionConfig.Builder

setLanguageCodeBytes(ByteString value)

public RecognitionConfig.Builder setLanguageCodeBytes(ByteString value)

Optional The language of the supplied audio as a BCP-47 language tag. Example: "en-GB" https://www.rfc-editor.org/rfc/bcp/bcp47.txt If omitted, defaults to "en-US". See Language Support for a list of the currently supported language codes.

string language_code = 3;

Parameter
NameDescription
valueByteString
Returns
TypeDescription
RecognitionConfig.Builder

setMaxAlternatives(int value)

public RecognitionConfig.Builder setMaxAlternatives(int value)

Optional Maximum number of recognition hypotheses to be returned. Specifically, the maximum number of SpeechRecognitionAlternative messages within each SpeechRecognitionResult. The server may return fewer than max_alternatives. Valid values are 0-30. A value of 0 or 1 will return a maximum of one. If omitted, will return a maximum of one.

int32 max_alternatives = 4;

Parameter
NameDescription
valueint
Returns
TypeDescription
RecognitionConfig.Builder

setProfanityFilter(boolean value)

public RecognitionConfig.Builder setProfanityFilter(boolean value)

Optional If set to true, the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks, e.g. "f***". If set to false or omitted, profanities won't be filtered out.

bool profanity_filter = 5;

Parameter
NameDescription
valueboolean
Returns
TypeDescription
RecognitionConfig.Builder

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public RecognitionConfig.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
RecognitionConfig.Builder
Overrides

setSampleRate(int value)

public RecognitionConfig.Builder setSampleRate(int value)

Required Sample rate in Hertz of the audio data sent in all RecognitionAudio messages. Valid values are: 8000-48000. 16000 is optimal. For best results, set the sampling rate of the audio source to 16000 Hz. If that's not possible, use the native sample rate of the audio source (instead of re-sampling).

int32 sample_rate = 2;

Parameter
NameDescription
valueint
Returns
TypeDescription
RecognitionConfig.Builder

setSpeechContext(SpeechContext value)

public RecognitionConfig.Builder setSpeechContext(SpeechContext value)

Optional A means to provide context to assist the speech recognition.

.google.cloud.speech.v1beta1.SpeechContext speech_context = 6;

Parameter
NameDescription
valueSpeechContext
Returns
TypeDescription
RecognitionConfig.Builder

setSpeechContext(SpeechContext.Builder builderForValue)

public RecognitionConfig.Builder setSpeechContext(SpeechContext.Builder builderForValue)

Optional A means to provide context to assist the speech recognition.

.google.cloud.speech.v1beta1.SpeechContext speech_context = 6;

Parameter
NameDescription
builderForValueSpeechContext.Builder
Returns
TypeDescription
RecognitionConfig.Builder

setUnknownFields(UnknownFieldSet unknownFields)

public final RecognitionConfig.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
RecognitionConfig.Builder
Overrides