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, unknownFields
memoizedSize
memoizedHashCode
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, 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 RESULT_INDEX_FIELD_NUMBER
public static final int ENDPOINTER_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.
repeated .google.cloud.speech.v1beta1.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.
repeated .google.cloud.speech.v1beta1.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.
repeated .google.cloud.speech.v1beta1.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.
repeated .google.cloud.speech.v1beta1.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.
repeated .google.cloud.speech.v1beta1.StreamingRecognitionResult results = 2;
getResultsOrBuilder
in interface StreamingRecognizeResponseOrBuilder
public 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 StreamingRecognizeResponseOrBuilder
public int getEndpointerTypeValue()
*Output-only* Indicates the type of endpointer event.
.google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;
getEndpointerTypeValue
in interface StreamingRecognizeResponseOrBuilder
public StreamingRecognizeResponse.EndpointerType getEndpointerType()
*Output-only* Indicates the type of endpointer event.
.google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;
getEndpointerType
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