public final class StreamingRecognizeResponse extends GeneratedMessageV3 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 `StreamingRecognizeResponse`s 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:
- 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".
- 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`.
- The specific `stability` and `confidence` values shown above are only for
illustrative purposes. Actual values may vary.
- 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| Modifier and Type | Class and Description |
|---|---|
static class |
StreamingRecognizeResponse.Builder
`StreamingRecognizeResponse` is the only message returned to the client by
`StreamingRecognize`.
|
static class |
StreamingRecognizeResponse.EndpointerType
Indicates the type of endpointer 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 |
ENDPOINTER_TYPE_FIELD_NUMBER |
static int |
ERROR_FIELD_NUMBER |
static int |
RESULT_INDEX_FIELD_NUMBER |
static int |
RESULTS_FIELD_NUMBER |
alwaysUseFieldBuilders, unknownFieldsmemoizedSizememoizedHashCode| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
static StreamingRecognizeResponse |
getDefaultInstance() |
StreamingRecognizeResponse |
getDefaultInstanceForType() |
static Descriptors.Descriptor |
getDescriptor() |
StreamingRecognizeResponse.EndpointerType |
getEndpointerType()
*Output-only* Indicates the type of endpointer event.
|
int |
getEndpointerTypeValue()
*Output-only* Indicates the type of endpointer event.
|
Status |
getError()
*Output-only* If set, returns a [google.rpc.Status][google.rpc.Status] message that
specifies the error for the operation.
|
StatusOrBuilder |
getErrorOrBuilder()
*Output-only* If set, returns a [google.rpc.Status][google.rpc.Status] message that
specifies the error for the operation.
|
Parser<StreamingRecognizeResponse> |
getParserForType() |
int |
getResultIndex()
*Output-only* Indicates the lowest index in the `results` array that has
changed.
|
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.
|
int |
getResultsCount()
*Output-only* This repeated list contains zero or more results that
correspond to consecutive portions of the audio currently being processed.
|
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.
|
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.
|
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.
|
int |
getSerializedSize() |
UnknownFieldSet |
getUnknownFields() |
boolean |
hasError()
*Output-only* If set, returns a [google.rpc.Status][google.rpc.Status] message that
specifies the error for the operation.
|
int |
hashCode() |
protected GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
static StreamingRecognizeResponse.Builder |
newBuilder() |
static StreamingRecognizeResponse.Builder |
newBuilder(StreamingRecognizeResponse prototype) |
StreamingRecognizeResponse.Builder |
newBuilderForType() |
protected StreamingRecognizeResponse.Builder |
newBuilderForType(GeneratedMessageV3.BuilderParent parent) |
static StreamingRecognizeResponse |
parseDelimitedFrom(java.io.InputStream input) |
static StreamingRecognizeResponse |
parseDelimitedFrom(java.io.InputStream input,
ExtensionRegistryLite extensionRegistry) |
static StreamingRecognizeResponse |
parseFrom(byte[] data) |
static StreamingRecognizeResponse |
parseFrom(byte[] data,
ExtensionRegistryLite extensionRegistry) |
static StreamingRecognizeResponse |
parseFrom(java.nio.ByteBuffer data) |
static StreamingRecognizeResponse |
parseFrom(java.nio.ByteBuffer data,
ExtensionRegistryLite extensionRegistry) |
static StreamingRecognizeResponse |
parseFrom(ByteString data) |
static StreamingRecognizeResponse |
parseFrom(ByteString data,
ExtensionRegistryLite extensionRegistry) |
static StreamingRecognizeResponse |
parseFrom(CodedInputStream input) |
static StreamingRecognizeResponse |
parseFrom(CodedInputStream input,
ExtensionRegistryLite extensionRegistry) |
static StreamingRecognizeResponse |
parseFrom(java.io.InputStream input) |
static StreamingRecognizeResponse |
parseFrom(java.io.InputStream input,
ExtensionRegistryLite extensionRegistry) |
static Parser<StreamingRecognizeResponse> |
parser() |
StreamingRecognizeResponse.Builder |
toBuilder() |
void |
writeTo(CodedOutputStream output) |
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, 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 RESULT_INDEX_FIELD_NUMBER
public static final int ENDPOINTER_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.
repeated .google.cloud.speech.v1beta1.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.
repeated .google.cloud.speech.v1beta1.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.
repeated .google.cloud.speech.v1beta1.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.
repeated .google.cloud.speech.v1beta1.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.
repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;getResultsOrBuilder in interface StreamingRecognizeResponseOrBuilderpublic 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;getResultIndex in interface StreamingRecognizeResponseOrBuilderpublic int getEndpointerTypeValue()
*Output-only* Indicates the type of endpointer event.
.google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;getEndpointerTypeValue in interface StreamingRecognizeResponseOrBuilderpublic StreamingRecognizeResponse.EndpointerType getEndpointerType()
*Output-only* Indicates the type of endpointer event.
.google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;getEndpointerType 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