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, unknownFields
memoizedSize
memoizedHashCode
canUseUnsafe, 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, writeStringNoTag
findInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toString
addAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
findInitializationErrors, getAllFields, getDescriptorForType, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof
toByteArray, toByteString, writeDelimitedTo, writeTo
public 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 MessageOrBuilder
getUnknownFields
in class GeneratedMessageV3
public static final Descriptors.Descriptor getDescriptor()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable
in class GeneratedMessageV3
public 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 StreamingRecognizeResponseOrBuilder
public 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 StreamingRecognizeResponseOrBuilder
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 StreamingRecognizeResponseOrBuilder
public 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 StreamingRecognizeResponseOrBuilder
public 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 StreamingRecognizeResponseOrBuilder
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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;
getResultsCount
in interface StreamingRecognizeResponseOrBuilder
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 (the interim results).
repeated .google.cloud.speech.v1p1beta1.StreamingRecognitionResult results = 2;
getResults
in interface StreamingRecognizeResponseOrBuilder
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 StreamingRecognizeResponseOrBuilder
public int getSpeechEventTypeValue()
Output only. Indicates the type of speech event.
.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4;
getSpeechEventTypeValue
in interface StreamingRecognizeResponseOrBuilder
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 StreamingRecognizeResponseOrBuilder
public final boolean isInitialized()
isInitialized
in interface MessageLiteOrBuilder
isInitialized
in class GeneratedMessageV3
public void writeTo(CodedOutputStream output) throws java.io.IOException
writeTo
in interface MessageLite
writeTo
in class GeneratedMessageV3
java.io.IOException
public int getSerializedSize()
getSerializedSize
in interface MessageLite
getSerializedSize
in class GeneratedMessageV3
public boolean equals(java.lang.Object obj)
equals
in interface Message
equals
in class AbstractMessage
public int hashCode()
hashCode
in interface Message
hashCode
in class AbstractMessage
public static StreamingRecognizeResponse parseFrom(java.nio.ByteBuffer data) throws InvalidProtocolBufferException
InvalidProtocolBufferException
public static StreamingRecognizeResponse parseFrom(java.nio.ByteBuffer data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferException
public static StreamingRecognizeResponse parseFrom(ByteString data) throws InvalidProtocolBufferException
InvalidProtocolBufferException
public static StreamingRecognizeResponse parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferException
public static StreamingRecognizeResponse parseFrom(byte[] data) throws InvalidProtocolBufferException
InvalidProtocolBufferException
public static StreamingRecognizeResponse parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferException
public static StreamingRecognizeResponse parseFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static StreamingRecognizeResponse parseFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOException
public static StreamingRecognizeResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public static StreamingRecognizeResponse parseDelimitedFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOException
public static StreamingRecognizeResponse parseFrom(CodedInputStream input) throws java.io.IOException
java.io.IOException
public static StreamingRecognizeResponse parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOException
public StreamingRecognizeResponse.Builder newBuilderForType()
newBuilderForType
in interface Message
newBuilderForType
in interface MessageLite
public static StreamingRecognizeResponse.Builder newBuilder()
public static StreamingRecognizeResponse.Builder newBuilder(StreamingRecognizeResponse prototype)
public StreamingRecognizeResponse.Builder toBuilder()
toBuilder
in interface Message
toBuilder
in interface MessageLite
protected StreamingRecognizeResponse.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
newBuilderForType
in class GeneratedMessageV3
public static StreamingRecognizeResponse getDefaultInstance()
public static Parser<StreamingRecognizeResponse> parser()
public Parser<StreamingRecognizeResponse> getParserForType()
getParserForType
in interface Message
getParserForType
in interface MessageLite
getParserForType
in class GeneratedMessageV3
public StreamingRecognizeResponse getDefaultInstanceForType()
getDefaultInstanceForType
in interface MessageLiteOrBuilder
getDefaultInstanceForType
in interface MessageOrBuilder