Class StreamingRecognitionResult.Builder (2.5.1)

public static final class StreamingRecognitionResult.Builder extends GeneratedMessageV3.Builder<StreamingRecognitionResult.Builder> implements StreamingRecognitionResultOrBuilder

A streaming speech recognition result corresponding to a portion of the audio that is currently being processed.

Protobuf type google.cloud.speech.v1p1beta1.StreamingRecognitionResult

Static Methods

getDescriptor()

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

Methods

addAllAlternatives(Iterable<? extends SpeechRecognitionAlternative> values)

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

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
valuesIterable<? extends com.google.cloud.speech.v1p1beta1.SpeechRecognitionAlternative>
Returns
TypeDescription
StreamingRecognitionResult.Builder

addAlternatives(SpeechRecognitionAlternative value)

public StreamingRecognitionResult.Builder addAlternatives(SpeechRecognitionAlternative value)

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
valueSpeechRecognitionAlternative
Returns
TypeDescription
StreamingRecognitionResult.Builder

addAlternatives(SpeechRecognitionAlternative.Builder builderForValue)

public StreamingRecognitionResult.Builder addAlternatives(SpeechRecognitionAlternative.Builder builderForValue)

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
builderForValueSpeechRecognitionAlternative.Builder
Returns
TypeDescription
StreamingRecognitionResult.Builder

addAlternatives(int index, SpeechRecognitionAlternative value)

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

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Parameters
NameDescription
indexint
valueSpeechRecognitionAlternative
Returns
TypeDescription
StreamingRecognitionResult.Builder

addAlternatives(int index, SpeechRecognitionAlternative.Builder builderForValue)

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

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Parameters
NameDescription
indexint
builderForValueSpeechRecognitionAlternative.Builder
Returns
TypeDescription
StreamingRecognitionResult.Builder

addAlternativesBuilder()

public SpeechRecognitionAlternative.Builder addAlternativesBuilder()

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Returns
TypeDescription
SpeechRecognitionAlternative.Builder

addAlternativesBuilder(int index)

public SpeechRecognitionAlternative.Builder addAlternativesBuilder(int index)

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
indexint
Returns
TypeDescription
SpeechRecognitionAlternative.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

build()

public StreamingRecognitionResult build()
Returns
TypeDescription
StreamingRecognitionResult

buildPartial()

public StreamingRecognitionResult buildPartial()
Returns
TypeDescription
StreamingRecognitionResult

clear()

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

clearAlternatives()

public StreamingRecognitionResult.Builder clearAlternatives()

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Returns
TypeDescription
StreamingRecognitionResult.Builder

clearChannelTag()

public StreamingRecognitionResult.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 = 5;

Returns
TypeDescription
StreamingRecognitionResult.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

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

clearIsFinal()

public StreamingRecognitionResult.Builder clearIsFinal()

If false, this StreamingRecognitionResult represents an interim result that may change. If true, this is the final time the speech service will return this particular StreamingRecognitionResult, the recognizer will not return any further hypotheses for this portion of the transcript and corresponding audio.

bool is_final = 2;

Returns
TypeDescription
StreamingRecognitionResult.Builder

This builder for chaining.

clearLanguageCode()

public StreamingRecognitionResult.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 = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
StreamingRecognitionResult.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

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

clearResultEndTime()

public StreamingRecognitionResult.Builder clearResultEndTime()

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

.google.protobuf.Duration result_end_time = 4;

Returns
TypeDescription
StreamingRecognitionResult.Builder

clearStability()

public StreamingRecognitionResult.Builder clearStability()

An estimate of the likelihood that the recognizer will not change its guess about this interim result. Values range from 0.0 (completely unstable) to 1.0 (completely stable). This field is only provided for interim results (is_final=false). The default of 0.0 is a sentinel value indicating stability was not set.

float stability = 3;

Returns
TypeDescription
StreamingRecognitionResult.Builder

This builder for chaining.

clone()

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

getAlternatives(int index)

public SpeechRecognitionAlternative getAlternatives(int index)

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
indexint
Returns
TypeDescription
SpeechRecognitionAlternative

getAlternativesBuilder(int index)

public SpeechRecognitionAlternative.Builder getAlternativesBuilder(int index)

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
indexint
Returns
TypeDescription
SpeechRecognitionAlternative.Builder

getAlternativesBuilderList()

public List<SpeechRecognitionAlternative.Builder> getAlternativesBuilderList()

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Returns
TypeDescription
List<Builder>

getAlternativesCount()

public int getAlternativesCount()

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Returns
TypeDescription
int

getAlternativesList()

public List<SpeechRecognitionAlternative> getAlternativesList()

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Returns
TypeDescription
List<SpeechRecognitionAlternative>

getAlternativesOrBuilder(int index)

public SpeechRecognitionAlternativeOrBuilder getAlternativesOrBuilder(int index)

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
indexint
Returns
TypeDescription
SpeechRecognitionAlternativeOrBuilder

getAlternativesOrBuilderList()

public List<? extends SpeechRecognitionAlternativeOrBuilder> getAlternativesOrBuilderList()

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Returns
TypeDescription
List<? extends com.google.cloud.speech.v1p1beta1.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 = 5;

Returns
TypeDescription
int

The channelTag.

getDefaultInstanceForType()

public StreamingRecognitionResult getDefaultInstanceForType()
Returns
TypeDescription
StreamingRecognitionResult

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getIsFinal()

public boolean getIsFinal()

If false, this StreamingRecognitionResult represents an interim result that may change. If true, this is the final time the speech service will return this particular StreamingRecognitionResult, the recognizer will not return any further hypotheses for this portion of the transcript and corresponding audio.

bool is_final = 2;

Returns
TypeDescription
boolean

The isFinal.

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 = 6 [(.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 = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
ByteString

The bytes for languageCode.

getResultEndTime()

public Duration getResultEndTime()

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

.google.protobuf.Duration result_end_time = 4;

Returns
TypeDescription
Duration

The resultEndTime.

getResultEndTimeBuilder()

public Duration.Builder getResultEndTimeBuilder()

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

.google.protobuf.Duration result_end_time = 4;

Returns
TypeDescription
Builder

getResultEndTimeOrBuilder()

public DurationOrBuilder getResultEndTimeOrBuilder()

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

.google.protobuf.Duration result_end_time = 4;

Returns
TypeDescription
DurationOrBuilder

getStability()

public float getStability()

An estimate of the likelihood that the recognizer will not change its guess about this interim result. Values range from 0.0 (completely unstable) to 1.0 (completely stable). This field is only provided for interim results (is_final=false). The default of 0.0 is a sentinel value indicating stability was not set.

float stability = 3;

Returns
TypeDescription
float

The stability.

hasResultEndTime()

public boolean hasResultEndTime()

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

.google.protobuf.Duration result_end_time = 4;

Returns
TypeDescription
boolean

Whether the resultEndTime field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(StreamingRecognitionResult other)

public StreamingRecognitionResult.Builder mergeFrom(StreamingRecognitionResult other)
Parameter
NameDescription
otherStreamingRecognitionResult
Returns
TypeDescription
StreamingRecognitionResult.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

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

mergeResultEndTime(Duration value)

public StreamingRecognitionResult.Builder mergeResultEndTime(Duration value)

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

.google.protobuf.Duration result_end_time = 4;

Parameter
NameDescription
valueDuration
Returns
TypeDescription
StreamingRecognitionResult.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

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

removeAlternatives(int index)

public StreamingRecognitionResult.Builder removeAlternatives(int index)

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
indexint
Returns
TypeDescription
StreamingRecognitionResult.Builder

setAlternatives(int index, SpeechRecognitionAlternative value)

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

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Parameters
NameDescription
indexint
valueSpeechRecognitionAlternative
Returns
TypeDescription
StreamingRecognitionResult.Builder

setAlternatives(int index, SpeechRecognitionAlternative.Builder builderForValue)

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

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). 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.v1p1beta1.SpeechRecognitionAlternative alternatives = 1;

Parameters
NameDescription
indexint
builderForValueSpeechRecognitionAlternative.Builder
Returns
TypeDescription
StreamingRecognitionResult.Builder

setChannelTag(int value)

public StreamingRecognitionResult.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 = 5;

Parameter
NameDescription
valueint

The channelTag to set.

Returns
TypeDescription
StreamingRecognitionResult.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

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

setIsFinal(boolean value)

public StreamingRecognitionResult.Builder setIsFinal(boolean value)

If false, this StreamingRecognitionResult represents an interim result that may change. If true, this is the final time the speech service will return this particular StreamingRecognitionResult, the recognizer will not return any further hypotheses for this portion of the transcript and corresponding audio.

bool is_final = 2;

Parameter
NameDescription
valueboolean

The isFinal to set.

Returns
TypeDescription
StreamingRecognitionResult.Builder

This builder for chaining.

setLanguageCode(String value)

public StreamingRecognitionResult.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 = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valueString

The languageCode to set.

Returns
TypeDescription
StreamingRecognitionResult.Builder

This builder for chaining.

setLanguageCodeBytes(ByteString value)

public StreamingRecognitionResult.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 = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valueByteString

The bytes for languageCode to set.

Returns
TypeDescription
StreamingRecognitionResult.Builder

This builder for chaining.

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

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

setResultEndTime(Duration value)

public StreamingRecognitionResult.Builder setResultEndTime(Duration value)

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

.google.protobuf.Duration result_end_time = 4;

Parameter
NameDescription
valueDuration
Returns
TypeDescription
StreamingRecognitionResult.Builder

setResultEndTime(Duration.Builder builderForValue)

public StreamingRecognitionResult.Builder setResultEndTime(Duration.Builder builderForValue)

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

.google.protobuf.Duration result_end_time = 4;

Parameter
NameDescription
builderForValueBuilder
Returns
TypeDescription
StreamingRecognitionResult.Builder

setStability(float value)

public StreamingRecognitionResult.Builder setStability(float value)

An estimate of the likelihood that the recognizer will not change its guess about this interim result. Values range from 0.0 (completely unstable) to 1.0 (completely stable). This field is only provided for interim results (is_final=false). The default of 0.0 is a sentinel value indicating stability was not set.

float stability = 3;

Parameter
NameDescription
valuefloat

The stability to set.

Returns
TypeDescription
StreamingRecognitionResult.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

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