public final class StreamingRecognizeResponse extends GeneratedMessageV3 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.StreamingRecognizeResponse| Modifier and Type | Class and Description |
|---|---|
static class |
StreamingRecognizeResponse.Builder
`StreamingRecognizeResponse` is the only message returned to the client by
`StreamingRecognize`.
|
static class |
StreamingRecognizeResponse.SpeechEventType
Indicates the type of speech event.
|
GeneratedMessageV3.BuilderParent, GeneratedMessageV3.ExtendableBuilder<MessageType extends GeneratedMessageV3.ExtendableMessage,BuilderType extends GeneratedMessageV3.ExtendableBuilder<MessageType,BuilderType>>, GeneratedMessageV3.ExtendableMessage<MessageType extends GeneratedMessageV3.ExtendableMessage>, GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends GeneratedMessageV3.ExtendableMessage>, GeneratedMessageV3.FieldAccessorTable| Modifier and Type | Field and Description |
|---|---|
static int |
ERROR_FIELD_NUMBER |
static int |
RESULTS_FIELD_NUMBER |
static int |
SPEECH_EVENT_TYPE_FIELD_NUMBER |
alwaysUseFieldBuilders, unknownFieldsmemoizedSizememoizedHashCodecanUseUnsafe, computeStringSize, computeStringSizeNoTag, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, makeExtensionsImmutable, newBuilderForType, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTagfindInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toStringaddAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitfindInitializationErrors, getAllFields, getDescriptorForType, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneoftoByteArray, toByteString, writeDelimitedTo, writeTopublic static final int ERROR_FIELD_NUMBER
public static final int RESULTS_FIELD_NUMBER
public static final int SPEECH_EVENT_TYPE_FIELD_NUMBER
public final UnknownFieldSet getUnknownFields()
getUnknownFields in interface MessageOrBuildergetUnknownFields in class GeneratedMessageV3public static final Descriptors.Descriptor getDescriptor()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class GeneratedMessageV3public 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 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 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 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 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 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.SpeechEventType getSpeechEventType()
Output only. Indicates the type of speech event.
.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4;getSpeechEventType in interface StreamingRecognizeResponseOrBuilderpublic final boolean isInitialized()
isInitialized in interface MessageLiteOrBuilderisInitialized in class GeneratedMessageV3public void writeTo(CodedOutputStream output) throws java.io.IOException
writeTo in interface MessageLitewriteTo in class GeneratedMessageV3java.io.IOExceptionpublic int getSerializedSize()
getSerializedSize in interface MessageLitegetSerializedSize in class GeneratedMessageV3public boolean equals(java.lang.Object obj)
equals in interface Messageequals in class AbstractMessagepublic int hashCode()
hashCode in interface MessagehashCode in class AbstractMessagepublic static StreamingRecognizeResponse parseFrom(java.nio.ByteBuffer data) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static StreamingRecognizeResponse parseFrom(java.nio.ByteBuffer data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static StreamingRecognizeResponse parseFrom(ByteString data) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static StreamingRecognizeResponse parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static StreamingRecognizeResponse parseFrom(byte[] data) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static StreamingRecognizeResponse parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionpublic static StreamingRecognizeResponse parseFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptionpublic static StreamingRecognizeResponse parseFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic static StreamingRecognizeResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptionpublic static StreamingRecognizeResponse parseDelimitedFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic static StreamingRecognizeResponse parseFrom(CodedInputStream input) throws java.io.IOException
java.io.IOExceptionpublic static StreamingRecognizeResponse parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic StreamingRecognizeResponse.Builder newBuilderForType()
newBuilderForType in interface MessagenewBuilderForType in interface MessageLitepublic static StreamingRecognizeResponse.Builder newBuilder()
public static StreamingRecognizeResponse.Builder newBuilder(StreamingRecognizeResponse prototype)
public StreamingRecognizeResponse.Builder toBuilder()
toBuilder in interface MessagetoBuilder in interface MessageLiteprotected StreamingRecognizeResponse.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
newBuilderForType in class GeneratedMessageV3public static StreamingRecognizeResponse getDefaultInstance()
public static Parser<StreamingRecognizeResponse> parser()
public Parser<StreamingRecognizeResponse> getParserForType()
getParserForType in interface MessagegetParserForType in interface MessageLitegetParserForType in class GeneratedMessageV3public StreamingRecognizeResponse getDefaultInstanceForType()
getDefaultInstanceForType in interface MessageLiteOrBuildergetDefaultInstanceForType in interface MessageOrBuilder