Class StreamingRecognizeResponse.Builder (4.37.0)

public static final class StreamingRecognizeResponse.Builder extends GeneratedMessageV3.Builder<StreamingRecognizeResponse.Builder> implements StreamingRecognizeResponseOrBuilder

StreamingRecognizeResponse is the only message returned to the client by StreamingRecognize. A series of one or more StreamingRecognizeResponse messages are streamed back to the client. Here's an example of a series of ten StreamingRecognizeResponses that might be returned while processing audio:

  1. endpointer_type: START_OF_SPEECH
  2. results { alternatives { transcript: "tube" } stability: 0.01 } result_index: 0
  3. results { alternatives { transcript: "to be a" } stability: 0.01 } result_index: 0
  4. results { alternatives { transcript: "to be" } stability: 0.9 } results { alternatives { transcript: " or not to be" } stability: 0.01 } result_index: 0
  5. results { alternatives { transcript: "to be or not to be" confidence: 0.92 } alternatives { transcript: "to bee or not to bee" } is_final: true } result_index: 0
  6. results { alternatives { transcript: " that's" } stability: 0.01 } result_index: 1
  7. results { alternatives { transcript: " that is" } stability: 0.9 } results { alternatives { transcript: " the question" } stability: 0.01 } result_index: 1
  8. endpointer_type: END_OF_SPEECH
  9. results { alternatives { transcript: " that is the question" confidence: 0.98 } alternatives { transcript: " that was the question" } is_final: true } result_index: 1
  10. endpointer_type: END_OF_AUDIO Notes:
  11. Only two of the above responses #5 and #9 contain final results, they are indicated by is_final: true. Concatenating these together generates the full transcript: "to be or not to be that is the question".
  12. The others contain interim results. #4 and #7 contain two interim results, the first portion has a high stability and is less likely to change, the second portion has a low stability and is very likely to change. A UI designer might choose to show only high stability results.
  13. The specific stability and confidence values shown above are only for illustrative purposes. Actual values may vary.
  14. The result_index indicates the portion of audio that has had final results returned, and is no longer being processed. For example, the results in #6 and later correspond to the portion of audio after "to be or not to be".

Protobuf type google.cloud.speech.v1beta1.StreamingRecognizeResponse

Static Methods

getDescriptor()

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

Methods

addAllResults(Iterable<? extends StreamingRecognitionResult> values)

public StreamingRecognizeResponse.Builder addAllResults(Iterable<? extends StreamingRecognitionResult> values)

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Parameter
Name Description
values Iterable<? extends com.google.cloud.speech.v1beta1.StreamingRecognitionResult>
Returns
Type Description
StreamingRecognizeResponse.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

addResults(StreamingRecognitionResult value)

public StreamingRecognizeResponse.Builder addResults(StreamingRecognitionResult value)

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Parameter
Name Description
value StreamingRecognitionResult
Returns
Type Description
StreamingRecognizeResponse.Builder

addResults(StreamingRecognitionResult.Builder builderForValue)

public StreamingRecognizeResponse.Builder addResults(StreamingRecognitionResult.Builder builderForValue)

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Parameter
Name Description
builderForValue StreamingRecognitionResult.Builder
Returns
Type Description
StreamingRecognizeResponse.Builder

addResults(int index, StreamingRecognitionResult value)

public StreamingRecognizeResponse.Builder addResults(int index, StreamingRecognitionResult value)

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Parameters
Name Description
index int
value StreamingRecognitionResult
Returns
Type Description
StreamingRecognizeResponse.Builder

addResults(int index, StreamingRecognitionResult.Builder builderForValue)

public StreamingRecognizeResponse.Builder addResults(int index, StreamingRecognitionResult.Builder builderForValue)

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Parameters
Name Description
index int
builderForValue StreamingRecognitionResult.Builder
Returns
Type Description
StreamingRecognizeResponse.Builder

addResultsBuilder()

public StreamingRecognitionResult.Builder addResultsBuilder()

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Returns
Type Description
StreamingRecognitionResult.Builder

addResultsBuilder(int index)

public StreamingRecognitionResult.Builder addResultsBuilder(int index)

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Parameter
Name Description
index int
Returns
Type Description
StreamingRecognitionResult.Builder

build()

public StreamingRecognizeResponse build()
Returns
Type Description
StreamingRecognizeResponse

buildPartial()

public StreamingRecognizeResponse buildPartial()
Returns
Type Description
StreamingRecognizeResponse

clear()

public StreamingRecognizeResponse.Builder clear()
Returns
Type Description
StreamingRecognizeResponse.Builder
Overrides

clearEndpointerType()

public StreamingRecognizeResponse.Builder clearEndpointerType()

Output-only Indicates the type of endpointer event.

.google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;

Returns
Type Description
StreamingRecognizeResponse.Builder

clearError()

public StreamingRecognizeResponse.Builder clearError()

Output-only If set, returns a google.rpc.Status message that specifies the error for the operation.

.google.rpc.Status error = 1;

Returns
Type Description
StreamingRecognizeResponse.Builder

clearField(Descriptors.FieldDescriptor field)

public StreamingRecognizeResponse.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
StreamingRecognizeResponse.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

public StreamingRecognizeResponse.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
StreamingRecognizeResponse.Builder
Overrides

clearResultIndex()

public StreamingRecognizeResponse.Builder clearResultIndex()

Output-only Indicates the lowest index in the results array that has changed. The repeated StreamingRecognitionResult results overwrite past results at this index and higher.

int32 result_index = 3;

Returns
Type Description
StreamingRecognizeResponse.Builder

clearResults()

public StreamingRecognizeResponse.Builder clearResults()

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Returns
Type Description
StreamingRecognizeResponse.Builder

clone()

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

getDefaultInstanceForType()

public StreamingRecognizeResponse getDefaultInstanceForType()
Returns
Type Description
StreamingRecognizeResponse

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getEndpointerType()

public StreamingRecognizeResponse.EndpointerType getEndpointerType()

Output-only Indicates the type of endpointer event.

.google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;

Returns
Type Description
StreamingRecognizeResponse.EndpointerType

getEndpointerTypeValue()

public int getEndpointerTypeValue()

Output-only Indicates the type of endpointer event.

.google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;

Returns
Type Description
int

getError()

public Status getError()

Output-only If set, returns a google.rpc.Status message that specifies the error for the operation.

.google.rpc.Status error = 1;

Returns
Type Description
com.google.rpc.Status

getErrorBuilder()

public Status.Builder getErrorBuilder()

Output-only If set, returns a google.rpc.Status message that specifies the error for the operation.

.google.rpc.Status error = 1;

Returns
Type Description
com.google.rpc.Status.Builder

getErrorOrBuilder()

public StatusOrBuilder getErrorOrBuilder()

Output-only If set, returns a google.rpc.Status message that specifies the error for the operation.

.google.rpc.Status error = 1;

Returns
Type Description
com.google.rpc.StatusOrBuilder

getResultIndex()

public int getResultIndex()

Output-only Indicates the lowest index in the results array that has changed. The repeated StreamingRecognitionResult results overwrite past results at this index and higher.

int32 result_index = 3;

Returns
Type Description
int

getResults(int index)

public StreamingRecognitionResult getResults(int index)

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Parameter
Name Description
index int
Returns
Type Description
StreamingRecognitionResult

getResultsBuilder(int index)

public StreamingRecognitionResult.Builder getResultsBuilder(int index)

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Parameter
Name Description
index int
Returns
Type Description
StreamingRecognitionResult.Builder

getResultsBuilderList()

public List<StreamingRecognitionResult.Builder> getResultsBuilderList()

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Returns
Type Description
List<Builder>

getResultsCount()

public int getResultsCount()

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Returns
Type Description
int

getResultsList()

public List<StreamingRecognitionResult> getResultsList()

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Returns
Type Description
List<StreamingRecognitionResult>

getResultsOrBuilder(int index)

public StreamingRecognitionResultOrBuilder getResultsOrBuilder(int index)

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Parameter
Name Description
index int
Returns
Type Description
StreamingRecognitionResultOrBuilder

getResultsOrBuilderList()

public List<? extends StreamingRecognitionResultOrBuilder> getResultsOrBuilderList()

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Returns
Type Description
List<? extends com.google.cloud.speech.v1beta1.StreamingRecognitionResultOrBuilder>

hasError()

public boolean hasError()

Output-only If set, returns a google.rpc.Status message that specifies the error for the operation.

.google.rpc.Status error = 1;

Returns
Type Description
boolean

internalGetFieldAccessorTable()

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

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeError(Status value)

public StreamingRecognizeResponse.Builder mergeError(Status value)

Output-only If set, returns a google.rpc.Status message that specifies the error for the operation.

.google.rpc.Status error = 1;

Parameter
Name Description
value com.google.rpc.Status
Returns
Type Description
StreamingRecognizeResponse.Builder

mergeFrom(StreamingRecognizeResponse other)

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

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

public StreamingRecognizeResponse.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
StreamingRecognizeResponse.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final StreamingRecognizeResponse.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
StreamingRecognizeResponse.Builder
Overrides

removeResults(int index)

public StreamingRecognizeResponse.Builder removeResults(int index)

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Parameter
Name Description
index int
Returns
Type Description
StreamingRecognizeResponse.Builder

setEndpointerType(StreamingRecognizeResponse.EndpointerType value)

public StreamingRecognizeResponse.Builder setEndpointerType(StreamingRecognizeResponse.EndpointerType value)

Output-only Indicates the type of endpointer event.

.google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;

Parameter
Name Description
value StreamingRecognizeResponse.EndpointerType
Returns
Type Description
StreamingRecognizeResponse.Builder

setEndpointerTypeValue(int value)

public StreamingRecognizeResponse.Builder setEndpointerTypeValue(int value)

Output-only Indicates the type of endpointer event.

.google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;

Parameter
Name Description
value int
Returns
Type Description
StreamingRecognizeResponse.Builder

setError(Status value)

public StreamingRecognizeResponse.Builder setError(Status value)

Output-only If set, returns a google.rpc.Status message that specifies the error for the operation.

.google.rpc.Status error = 1;

Parameter
Name Description
value com.google.rpc.Status
Returns
Type Description
StreamingRecognizeResponse.Builder

setError(Status.Builder builderForValue)

public StreamingRecognizeResponse.Builder setError(Status.Builder builderForValue)

Output-only If set, returns a google.rpc.Status message that specifies the error for the operation.

.google.rpc.Status error = 1;

Parameter
Name Description
builderForValue com.google.rpc.Status.Builder
Returns
Type Description
StreamingRecognizeResponse.Builder

setField(Descriptors.FieldDescriptor field, Object value)

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

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

public StreamingRecognizeResponse.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
StreamingRecognizeResponse.Builder
Overrides

setResultIndex(int value)

public StreamingRecognizeResponse.Builder setResultIndex(int value)

Output-only Indicates the lowest index in the results array that has changed. The repeated StreamingRecognitionResult results overwrite past results at this index and higher.

int32 result_index = 3;

Parameter
Name Description
value int
Returns
Type Description
StreamingRecognizeResponse.Builder

setResults(int index, StreamingRecognitionResult value)

public StreamingRecognizeResponse.Builder setResults(int index, StreamingRecognitionResult value)

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Parameters
Name Description
index int
value StreamingRecognitionResult
Returns
Type Description
StreamingRecognizeResponse.Builder

setResults(int index, StreamingRecognitionResult.Builder builderForValue)

public StreamingRecognizeResponse.Builder setResults(int index, StreamingRecognitionResult.Builder builderForValue)

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. It contains zero or one is_final=true result (the newly settled portion), followed by zero or more is_final=false results.

repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;

Parameters
Name Description
index int
builderForValue StreamingRecognitionResult.Builder
Returns
Type Description
StreamingRecognizeResponse.Builder

setUnknownFields(UnknownFieldSet unknownFields)

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