public final class StreamingRecognizeResponse extends com.google.protobuf.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 `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.
|
com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage,BuilderType extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType,BuilderType>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.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 |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
static StreamingRecognizeResponse |
getDefaultInstance() |
StreamingRecognizeResponse |
getDefaultInstanceForType() |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
StreamingRecognizeResponse.EndpointerType |
getEndpointerType()
[Output-only] Indicates the type of endpointer event.
|
int |
getEndpointerTypeValue()
[Output-only] Indicates the type of endpointer event.
|
com.google.rpc.Status |
getError()
[Output-only] If set, returns a [google.rpc.Status][] message that
specifies the error for the operation.
|
com.google.rpc.StatusOrBuilder |
getErrorOrBuilder()
[Output-only] If set, returns a [google.rpc.Status][] message that
specifies the error for the operation.
|
com.google.protobuf.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() |
com.google.protobuf.UnknownFieldSet |
getUnknownFields() |
boolean |
hasError()
[Output-only] If set, returns a [google.rpc.Status][] message that
specifies the error for the operation.
|
int |
hashCode() |
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
static StreamingRecognizeResponse.Builder |
newBuilder() |
static StreamingRecognizeResponse.Builder |
newBuilder(StreamingRecognizeResponse prototype) |
StreamingRecognizeResponse.Builder |
newBuilderForType() |
protected StreamingRecognizeResponse.Builder |
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) |
static StreamingRecognizeResponse |
parseDelimitedFrom(java.io.InputStream input) |
static StreamingRecognizeResponse |
parseDelimitedFrom(java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static StreamingRecognizeResponse |
parseFrom(byte[] data) |
static StreamingRecognizeResponse |
parseFrom(byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static StreamingRecognizeResponse |
parseFrom(com.google.protobuf.ByteString data) |
static StreamingRecognizeResponse |
parseFrom(com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static StreamingRecognizeResponse |
parseFrom(com.google.protobuf.CodedInputStream input) |
static StreamingRecognizeResponse |
parseFrom(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static StreamingRecognizeResponse |
parseFrom(java.io.InputStream input) |
static StreamingRecognizeResponse |
parseFrom(java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static com.google.protobuf.Parser<StreamingRecognizeResponse> |
parser() |
StreamingRecognizeResponse.Builder |
toBuilder() |
void |
writeTo(com.google.protobuf.CodedOutputStream output) |
computeStringSize, computeStringSizeNoTag, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, makeExtensionsImmutable, newBuilderForType, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, writeReplace, writeString, writeStringNoTagfindInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toStringaddAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic 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 com.google.protobuf.UnknownFieldSet getUnknownFields()
getUnknownFields in interface com.google.protobuf.MessageOrBuildergetUnknownFields in class com.google.protobuf.GeneratedMessageV3public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3public boolean hasError()
[Output-only] If set, returns a [google.rpc.Status][] message that specifies the error for the operation.
optional .google.rpc.Status error = 1;hasError in interface StreamingRecognizeResponseOrBuilderpublic com.google.rpc.Status getError()
[Output-only] If set, returns a [google.rpc.Status][] message that specifies the error for the operation.
optional .google.rpc.Status error = 1;getError in interface StreamingRecognizeResponseOrBuilderpublic com.google.rpc.StatusOrBuilder getErrorOrBuilder()
[Output-only] If set, returns a [google.rpc.Status][] message that specifies the error for the operation.
optional .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.
optional int32 result_index = 3;getResultIndex in interface StreamingRecognizeResponseOrBuilderpublic int getEndpointerTypeValue()
[Output-only] Indicates the type of endpointer event.
optional .google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;getEndpointerTypeValue in interface StreamingRecognizeResponseOrBuilderpublic StreamingRecognizeResponse.EndpointerType getEndpointerType()
[Output-only] Indicates the type of endpointer event.
optional .google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;getEndpointerType in interface StreamingRecognizeResponseOrBuilderpublic final boolean isInitialized()
isInitialized in interface com.google.protobuf.MessageLiteOrBuilderisInitialized in class com.google.protobuf.GeneratedMessageV3public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException
writeTo in interface com.google.protobuf.MessageLitewriteTo in class com.google.protobuf.GeneratedMessageV3java.io.IOExceptionpublic int getSerializedSize()
getSerializedSize in interface com.google.protobuf.MessageLitegetSerializedSize in class com.google.protobuf.GeneratedMessageV3public boolean equals(java.lang.Object obj)
equals in interface com.google.protobuf.Messageequals in class com.google.protobuf.AbstractMessagepublic int hashCode()
hashCode in interface com.google.protobuf.MessagehashCode in class com.google.protobuf.AbstractMessagepublic static StreamingRecognizeResponse parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static StreamingRecognizeResponse parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static StreamingRecognizeResponse parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static StreamingRecognizeResponse parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static StreamingRecognizeResponse parseFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptionpublic static StreamingRecognizeResponse parseFrom(java.io.InputStream input, com.google.protobuf.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, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic static StreamingRecognizeResponse parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException
java.io.IOExceptionpublic static StreamingRecognizeResponse parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic StreamingRecognizeResponse.Builder newBuilderForType()
newBuilderForType in interface com.google.protobuf.MessagenewBuilderForType in interface com.google.protobuf.MessageLitepublic static StreamingRecognizeResponse.Builder newBuilder()
public static StreamingRecognizeResponse.Builder newBuilder(StreamingRecognizeResponse prototype)
public StreamingRecognizeResponse.Builder toBuilder()
toBuilder in interface com.google.protobuf.MessagetoBuilder in interface com.google.protobuf.MessageLiteprotected StreamingRecognizeResponse.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
newBuilderForType in class com.google.protobuf.GeneratedMessageV3public static StreamingRecognizeResponse getDefaultInstance()
public static com.google.protobuf.Parser<StreamingRecognizeResponse> parser()
public com.google.protobuf.Parser<StreamingRecognizeResponse> getParserForType()
getParserForType in interface com.google.protobuf.MessagegetParserForType in interface com.google.protobuf.MessageLitegetParserForType in class com.google.protobuf.GeneratedMessageV3public StreamingRecognizeResponse getDefaultInstanceForType()
getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuildergetDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder