Class SpeechRecognitionResult.Builder (4.4.0)

public static final class SpeechRecognitionResult.Builder extends GeneratedMessageV3.Builder<SpeechRecognitionResult.Builder> implements SpeechRecognitionResultOrBuilder

A speech recognition result corresponding to a portion of the audio.

Protobuf type google.cloud.speech.v2.SpeechRecognitionResult

com.google.protobuf.GeneratedMessageV3.Builder.getUnknownFieldSetBuilder()
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownLengthDelimitedField(int,com.google.protobuf.ByteString)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownVarintField(int,int)
com.google.protobuf.GeneratedMessageV3.Builder.parseUnknownField(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,int)
com.google.protobuf.GeneratedMessageV3.Builder.setUnknownFieldSetBuilder(com.google.protobuf.UnknownFieldSet.Builder)

Static Methods

getDescriptor()

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

Methods

addAllAlternatives(Iterable<? extends SpeechRecognitionAlternative> values)

public SpeechRecognitionResult.Builder addAllAlternatives(Iterable<? extends SpeechRecognitionAlternative> values)

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
valuesIterable<? extends com.google.cloud.speech.v2.SpeechRecognitionAlternative>
Returns

addAlternatives(SpeechRecognitionAlternative value)

public SpeechRecognitionResult.Builder addAlternatives(SpeechRecognitionAlternative value)

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
valueSpeechRecognitionAlternative
Returns

addAlternatives(SpeechRecognitionAlternative.Builder builderForValue)

public SpeechRecognitionResult.Builder addAlternatives(SpeechRecognitionAlternative.Builder builderForValue)

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
builderForValueSpeechRecognitionAlternative.Builder
Returns

addAlternatives(int index, SpeechRecognitionAlternative value)

public SpeechRecognitionResult.Builder addAlternatives(int index, SpeechRecognitionAlternative value)

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Parameters
NameDescription
indexint
valueSpeechRecognitionAlternative
Returns

addAlternatives(int index, SpeechRecognitionAlternative.Builder builderForValue)

public SpeechRecognitionResult.Builder addAlternatives(int index, SpeechRecognitionAlternative.Builder builderForValue)

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Parameters
NameDescription
indexint
builderForValueSpeechRecognitionAlternative.Builder
Returns

addAlternativesBuilder()

public SpeechRecognitionAlternative.Builder addAlternativesBuilder()

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Returns

addAlternativesBuilder(int index)

public SpeechRecognitionAlternative.Builder addAlternativesBuilder(int index)

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
indexint
Returns

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

build()

public SpeechRecognitionResult build()
Returns

buildPartial()

public SpeechRecognitionResult buildPartial()
Returns

clear()

public SpeechRecognitionResult.Builder clear()
Returns Overrides

clearAlternatives()

public SpeechRecognitionResult.Builder clearAlternatives()

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Returns

clearChannelTag()

public SpeechRecognitionResult.Builder clearChannelTag()

For multi-channel audio, this is the channel number corresponding to the recognized result for the audio from that channel. For audio_channel_count = N, its output values can range from 1 to N.

int32 channel_tag = 2;

Returns
TypeDescription
SpeechRecognitionResult.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

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

clearLanguageCode()

public SpeechRecognitionResult.Builder clearLanguageCode()

Output only. The BCP-47 language tag of the language in this result. This language code was detected to have the most likelihood of being spoken in the audio.

string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
SpeechRecognitionResult.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

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

clearResultEndOffset()

public SpeechRecognitionResult.Builder clearResultEndOffset()

Time offset of the end of this result relative to the beginning of the audio.

.google.protobuf.Duration result_end_offset = 4;

Returns

clone()

public SpeechRecognitionResult.Builder clone()
Returns Overrides

getAlternatives(int index)

public SpeechRecognitionAlternative getAlternatives(int index)

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
indexint
Returns

getAlternativesBuilder(int index)

public SpeechRecognitionAlternative.Builder getAlternativesBuilder(int index)

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
indexint
Returns

getAlternativesBuilderList()

public List<SpeechRecognitionAlternative.Builder> getAlternativesBuilderList()

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Returns
TypeDescription
List<Builder>

getAlternativesCount()

public int getAlternativesCount()

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Returns
TypeDescription
int

getAlternativesList()

public List<SpeechRecognitionAlternative> getAlternativesList()

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Returns

getAlternativesOrBuilder(int index)

public SpeechRecognitionAlternativeOrBuilder getAlternativesOrBuilder(int index)

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
indexint
Returns

getAlternativesOrBuilderList()

public List<? extends SpeechRecognitionAlternativeOrBuilder> getAlternativesOrBuilderList()

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Returns
TypeDescription
List<? extends com.google.cloud.speech.v2.SpeechRecognitionAlternativeOrBuilder>

getChannelTag()

public int getChannelTag()

For multi-channel audio, this is the channel number corresponding to the recognized result for the audio from that channel. For audio_channel_count = N, its output values can range from 1 to N.

int32 channel_tag = 2;

Returns
TypeDescription
int

The channelTag.

getDefaultInstanceForType()

public SpeechRecognitionResult getDefaultInstanceForType()
Returns

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getLanguageCode()

public String getLanguageCode()

Output only. The BCP-47 language tag of the language in this result. This language code was detected to have the most likelihood of being spoken in the audio.

string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
String

The languageCode.

getLanguageCodeBytes()

public ByteString getLanguageCodeBytes()

Output only. The BCP-47 language tag of the language in this result. This language code was detected to have the most likelihood of being spoken in the audio.

string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
ByteString

The bytes for languageCode.

getResultEndOffset()

public Duration getResultEndOffset()

Time offset of the end of this result relative to the beginning of the audio.

.google.protobuf.Duration result_end_offset = 4;

Returns
TypeDescription
Duration

The resultEndOffset.

getResultEndOffsetBuilder()

public Duration.Builder getResultEndOffsetBuilder()

Time offset of the end of this result relative to the beginning of the audio.

.google.protobuf.Duration result_end_offset = 4;

Returns
TypeDescription
Builder

getResultEndOffsetOrBuilder()

public DurationOrBuilder getResultEndOffsetOrBuilder()

Time offset of the end of this result relative to the beginning of the audio.

.google.protobuf.Duration result_end_offset = 4;

Returns
TypeDescription
DurationOrBuilder

hasResultEndOffset()

public boolean hasResultEndOffset()

Time offset of the end of this result relative to the beginning of the audio.

.google.protobuf.Duration result_end_offset = 4;

Returns
TypeDescription
boolean

Whether the resultEndOffset field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(SpeechRecognitionResult other)

public SpeechRecognitionResult.Builder mergeFrom(SpeechRecognitionResult other)
Parameter
NameDescription
otherSpeechRecognitionResult
Returns

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

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

mergeResultEndOffset(Duration value)

public SpeechRecognitionResult.Builder mergeResultEndOffset(Duration value)

Time offset of the end of this result relative to the beginning of the audio.

.google.protobuf.Duration result_end_offset = 4;

Parameter
NameDescription
valueDuration
Returns

mergeUnknownFields(UnknownFieldSet unknownFields)

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

removeAlternatives(int index)

public SpeechRecognitionResult.Builder removeAlternatives(int index)

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
indexint
Returns

setAlternatives(int index, SpeechRecognitionAlternative value)

public SpeechRecognitionResult.Builder setAlternatives(int index, SpeechRecognitionAlternative value)

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Parameters
NameDescription
indexint
valueSpeechRecognitionAlternative
Returns

setAlternatives(int index, SpeechRecognitionAlternative.Builder builderForValue)

public SpeechRecognitionResult.Builder setAlternatives(int index, SpeechRecognitionAlternative.Builder builderForValue)

May contain one or more recognition hypotheses. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

repeated .google.cloud.speech.v2.SpeechRecognitionAlternative alternatives = 1;

Parameters
NameDescription
indexint
builderForValueSpeechRecognitionAlternative.Builder
Returns

setChannelTag(int value)

public SpeechRecognitionResult.Builder setChannelTag(int value)

For multi-channel audio, this is the channel number corresponding to the recognized result for the audio from that channel. For audio_channel_count = N, its output values can range from 1 to N.

int32 channel_tag = 2;

Parameter
NameDescription
valueint

The channelTag to set.

Returns
TypeDescription
SpeechRecognitionResult.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

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

setLanguageCode(String value)

public SpeechRecognitionResult.Builder setLanguageCode(String value)

Output only. The BCP-47 language tag of the language in this result. This language code was detected to have the most likelihood of being spoken in the audio.

string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valueString

The languageCode to set.

Returns
TypeDescription
SpeechRecognitionResult.Builder

This builder for chaining.

setLanguageCodeBytes(ByteString value)

public SpeechRecognitionResult.Builder setLanguageCodeBytes(ByteString value)

Output only. The BCP-47 language tag of the language in this result. This language code was detected to have the most likelihood of being spoken in the audio.

string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valueByteString

The bytes for languageCode to set.

Returns
TypeDescription
SpeechRecognitionResult.Builder

This builder for chaining.

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

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

setResultEndOffset(Duration value)

public SpeechRecognitionResult.Builder setResultEndOffset(Duration value)

Time offset of the end of this result relative to the beginning of the audio.

.google.protobuf.Duration result_end_offset = 4;

Parameter
NameDescription
valueDuration
Returns

setResultEndOffset(Duration.Builder builderForValue)

public SpeechRecognitionResult.Builder setResultEndOffset(Duration.Builder builderForValue)

Time offset of the end of this result relative to the beginning of the audio.

.google.protobuf.Duration result_end_offset = 4;

Parameter
NameDescription
builderForValueBuilder
Returns

setUnknownFields(UnknownFieldSet unknownFields)

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