Class RecognitionConfig.Builder (4.37.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
Type Description
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public RecognitionConfig.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
RecognitionConfig.Builder
Overrides

build()

public RecognitionConfig build()
Returns
Type Description
RecognitionConfig

buildPartial()

public RecognitionConfig buildPartial()
Returns
Type Description
RecognitionConfig

clear()

public RecognitionConfig.Builder clear()
Returns
Type Description
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
Type Description
RecognitionConfig.Builder

clearField(Descriptors.FieldDescriptor field)

public RecognitionConfig.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
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
Type Description
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
Type Description
RecognitionConfig.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public RecognitionConfig.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
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
Type Description
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
Type Description
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
Type Description
RecognitionConfig.Builder

clone()

public RecognitionConfig.Builder clone()
Returns
Type Description
RecognitionConfig.Builder
Overrides

getDefaultInstanceForType()

public RecognitionConfig getDefaultInstanceForType()
Returns
Type Description
RecognitionConfig

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
boolean

internalGetFieldAccessorTable()

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

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(RecognitionConfig other)

public RecognitionConfig.Builder mergeFrom(RecognitionConfig other)
Parameter
Name Description
other RecognitionConfig
Returns
Type Description
RecognitionConfig.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public RecognitionConfig.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
RecognitionConfig.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public RecognitionConfig.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
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
Name Description
value SpeechContext
Returns
Type Description
RecognitionConfig.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final RecognitionConfig.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
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
Name Description
value RecognitionConfig.AudioEncoding
Returns
Type Description
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
Name Description
value int
Returns
Type Description
RecognitionConfig.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public RecognitionConfig.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
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
Name Description
value String
Returns
Type Description
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
Name Description
value ByteString
Returns
Type Description
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
Name Description
value int
Returns
Type Description
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
Name Description
value boolean
Returns
Type Description
RecognitionConfig.Builder

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

public RecognitionConfig.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
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
Name Description
value int
Returns
Type Description
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
Name Description
value SpeechContext
Returns
Type Description
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
Name Description
builderForValue SpeechContext.Builder
Returns
Type Description
RecognitionConfig.Builder

setUnknownFields(UnknownFieldSet unknownFields)

public final RecognitionConfig.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
RecognitionConfig.Builder
Overrides