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 zero or more `StreamingRecognizeResponse`
messages are streamed back to the client. If there is no recognizable
audio, and `single_utterance` is set to false, then no messages are streamed
back to the client.
Here's an example of a series of ten `StreamingRecognizeResponse`s that might
be returned while processing audio:
1. results { alternatives { transcript: "tube" } stability: 0.01 }
2. results { alternatives { transcript: "to be a" } stability: 0.01 }
3. results { alternatives { transcript: "to be" } stability: 0.9 }
results { alternatives { transcript: " or not to be" } stability: 0.01 }
4. results { alternatives { transcript: "to be or not to be"
confidence: 0.92 }
alternatives { transcript: "to bee or not to bee" }
is_final: true }
5. results { alternatives { transcript: " that's" } stability: 0.01 }
6. results { alternatives { transcript: " that is" } stability: 0.9 }
results { alternatives { transcript: " the question" } stability: 0.01 }
7. results { alternatives { transcript: " that is the question"
confidence: 0.98 }
alternatives { transcript: " that was the question" }
is_final: true }
Notes:
- Only two of the above responses #4 and #7 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".
- The others contain interim `results`. #3 and #6 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`.
- The specific `stability` and `confidence` values shown above are only for
illustrative purposes. Actual values may vary.
- In each response, only one of these fields will be set:
`error`,
`speech_event_type`, or
one or more (repeated) `results`.
Protobuf type google.cloud.speech.v1p1beta1.StreamingRecognizeResponsegetAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, newBuilderForField, onBuilt, onChanged, setUnknownFieldsProto3findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringaddAll, addAll, mergeFrom, newUninitializedMessageExceptionequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfindInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneofmergeFrompublic static final Descriptors.Descriptor getDescriptor()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class GeneratedMessageV3.Builder<StreamingRecognizeResponse.Builder>public StreamingRecognizeResponse.Builder clear()
clear in interface Message.Builderclear in interface MessageLite.Builderclear in class GeneratedMessageV3.Builder<StreamingRecognizeResponse.Builder>public Descriptors.Descriptor getDescriptorForType()
getDescriptorForType in interface Message.BuildergetDescriptorForType in interface MessageOrBuildergetDescriptorForType in class GeneratedMessageV3.Builder<StreamingRecognizeResponse.Builder>public StreamingRecognizeResponse getDefaultInstanceForType()
getDefaultInstanceForType in interface MessageLiteOrBuildergetDefaultInstanceForType in interface MessageOrBuilderpublic StreamingRecognizeResponse build()
build in interface Message.Builderbuild in interface MessageLite.Builderpublic StreamingRecognizeResponse buildPartial()
buildPartial in interface Message.BuilderbuildPartial in interface MessageLite.Builderpublic StreamingRecognizeResponse.Builder clone()
clone in interface Message.Builderclone in interface MessageLite.Builderclone in class GeneratedMessageV3.Builder<StreamingRecognizeResponse.Builder>public StreamingRecognizeResponse.Builder setField(Descriptors.FieldDescriptor field, java.lang.Object value)
setField in interface Message.BuildersetField in class GeneratedMessageV3.Builder<StreamingRecognizeResponse.Builder>public StreamingRecognizeResponse.Builder clearField(Descriptors.FieldDescriptor field)
clearField in interface Message.BuilderclearField in class GeneratedMessageV3.Builder<StreamingRecognizeResponse.Builder>public StreamingRecognizeResponse.Builder clearOneof(Descriptors.OneofDescriptor oneof)
clearOneof in interface Message.BuilderclearOneof in class GeneratedMessageV3.Builder<StreamingRecognizeResponse.Builder>public StreamingRecognizeResponse.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, java.lang.Object value)
setRepeatedField in interface Message.BuildersetRepeatedField in class GeneratedMessageV3.Builder<StreamingRecognizeResponse.Builder>public StreamingRecognizeResponse.Builder addRepeatedField(Descriptors.FieldDescriptor field, java.lang.Object value)
addRepeatedField in interface Message.BuilderaddRepeatedField in class GeneratedMessageV3.Builder<StreamingRecognizeResponse.Builder>public StreamingRecognizeResponse.Builder mergeFrom(Message other)
mergeFrom in interface Message.BuildermergeFrom in class AbstractMessage.Builder<StreamingRecognizeResponse.Builder>public StreamingRecognizeResponse.Builder mergeFrom(StreamingRecognizeResponse other)
public final boolean isInitialized()
isInitialized in interface MessageLiteOrBuilderisInitialized in class GeneratedMessageV3.Builder<StreamingRecognizeResponse.Builder>public StreamingRecognizeResponse.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
mergeFrom in interface Message.BuildermergeFrom in interface MessageLite.BuildermergeFrom in class AbstractMessage.Builder<StreamingRecognizeResponse.Builder>java.io.IOExceptionpublic boolean hasError()
Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that specifies the error for the operation.
.google.rpc.Status error = 1;hasError in interface StreamingRecognizeResponseOrBuilderpublic Status getError()
Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that specifies the error for the operation.
.google.rpc.Status error = 1;getError in interface StreamingRecognizeResponseOrBuilderpublic StreamingRecognizeResponse.Builder setError(Status value)
Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that specifies the error for the operation.
.google.rpc.Status error = 1;public StreamingRecognizeResponse.Builder setError(Status.Builder builderForValue)
Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that specifies the error for the operation.
.google.rpc.Status error = 1;public StreamingRecognizeResponse.Builder mergeError(Status value)
Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that specifies the error for the operation.
.google.rpc.Status error = 1;public StreamingRecognizeResponse.Builder clearError()
Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that specifies the error for the operation.
.google.rpc.Status error = 1;public Status.Builder getErrorBuilder()
Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that specifies the error for the operation.
.google.rpc.Status error = 1;public StatusOrBuilder getErrorOrBuilder()
Output only. If set, returns a [google.rpc.Status][google.rpc.Status] message that specifies the error for the operation.
.google.rpc.Status error = 1;getErrorOrBuilder in interface StreamingRecognizeResponseOrBuilderpublic java.util.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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;getResultsList in interface StreamingRecognizeResponseOrBuilderpublic 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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;getResultsCount in interface StreamingRecognizeResponseOrBuilderpublic 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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;getResults in interface StreamingRecognizeResponseOrBuilderpublic 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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;public StreamingRecognizeResponse.Builder addAllResults(java.lang.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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;getResultsOrBuilder in interface StreamingRecognizeResponseOrBuilderpublic java.util.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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;getResultsOrBuilderList in interface StreamingRecognizeResponseOrBuilderpublic 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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;public java.util.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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;public int getSpeechEventTypeValue()
Output only. Indicates the type of speech event.
.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4;getSpeechEventTypeValue in interface StreamingRecognizeResponseOrBuilderpublic StreamingRecognizeResponse.Builder setSpeechEventTypeValue(int value)
Output only. Indicates the type of speech event.
.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4;public StreamingRecognizeResponse.SpeechEventType getSpeechEventType()
Output only. Indicates the type of speech event.
.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4;getSpeechEventType in interface StreamingRecognizeResponseOrBuilderpublic StreamingRecognizeResponse.Builder setSpeechEventType(StreamingRecognizeResponse.SpeechEventType value)
Output only. Indicates the type of speech event.
.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4;public StreamingRecognizeResponse.Builder clearSpeechEventType()
Output only. Indicates the type of speech event.
.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4;public final StreamingRecognizeResponse.Builder setUnknownFields(UnknownFieldSet unknownFields)
setUnknownFields in interface Message.BuildersetUnknownFields in class GeneratedMessageV3.Builder<StreamingRecognizeResponse.Builder>public final StreamingRecognizeResponse.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
mergeUnknownFields in interface Message.BuildermergeUnknownFields in class GeneratedMessageV3.Builder<StreamingRecognizeResponse.Builder>