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:
- endpointer_type: START_OF_SPEECH
- results { alternatives { transcript: "tube" } stability: 0.01 }
result_index: 0
- results { alternatives { transcript: "to be a" } stability: 0.01 }
result_index: 0
- results { alternatives { transcript: "to be" } stability: 0.9 }
results { alternatives { transcript: " or not to be" } stability: 0.01 }
result_index: 0
- 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
- results { alternatives { transcript: " that's" } stability: 0.01 }
result_index: 1
- results { alternatives { transcript: " that is" } stability: 0.9 }
results { alternatives { transcript: " the question" } stability: 0.01 }
result_index: 1
- endpointer_type: END_OF_SPEECH
- results { alternatives { transcript: " that is the question"
confidence: 0.98 }
alternatives { transcript: " that was the question" }
is_final: true }
result_index: 1
- 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
Static Fields
ENDPOINTER_TYPE_FIELD_NUMBER
public static final int ENDPOINTER_TYPE_FIELD_NUMBER
Field Value
ERROR_FIELD_NUMBER
public static final int ERROR_FIELD_NUMBER
Field Value
RESULTS_FIELD_NUMBER
public static final int RESULTS_FIELD_NUMBER
Field Value
RESULT_INDEX_FIELD_NUMBER
public static final int RESULT_INDEX_FIELD_NUMBER
Field Value
Static Methods
getDefaultInstance()
public static StreamingRecognizeResponse getDefaultInstance()
Returns
getDescriptor()
public static final Descriptors.Descriptor getDescriptor()
Returns
newBuilder()
public static StreamingRecognizeResponse.Builder newBuilder()
Returns
newBuilder(StreamingRecognizeResponse prototype)
public static StreamingRecognizeResponse.Builder newBuilder(StreamingRecognizeResponse prototype)
Parameter
Returns
public static StreamingRecognizeResponse parseDelimitedFrom(InputStream input)
Parameter
Returns
Exceptions
public static StreamingRecognizeResponse parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
parseFrom(byte[] data)
public static StreamingRecognizeResponse parseFrom(byte[] data)
Parameter
Name | Description |
data | byte[]
|
Returns
Exceptions
parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
public static StreamingRecognizeResponse parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
parseFrom(ByteString data)
public static StreamingRecognizeResponse parseFrom(ByteString data)
Parameter
Returns
Exceptions
parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
public static StreamingRecognizeResponse parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
public static StreamingRecognizeResponse parseFrom(CodedInputStream input)
Parameter
Returns
Exceptions
public static StreamingRecognizeResponse parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
public static StreamingRecognizeResponse parseFrom(InputStream input)
Parameter
Returns
Exceptions
public static StreamingRecognizeResponse parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
parseFrom(ByteBuffer data)
public static StreamingRecognizeResponse parseFrom(ByteBuffer data)
Parameter
Returns
Exceptions
parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
public static StreamingRecognizeResponse parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
parser()
public static Parser<StreamingRecognizeResponse> parser()
Returns
Methods
equals(Object obj)
public boolean equals(Object obj)
Parameter
Returns
Overrides
getDefaultInstanceForType()
public StreamingRecognizeResponse getDefaultInstanceForType()
Returns
getEndpointerType()
public StreamingRecognizeResponse.EndpointerType getEndpointerType()
Output-only Indicates the type of endpointer event.
.google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;
Returns
getEndpointerTypeValue()
public int getEndpointerTypeValue()
Output-only Indicates the type of endpointer event.
.google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;
Returns
getError()
Output-only If set, returns a google.rpc.Status message that
specifies the error for the operation.
.google.rpc.Status error = 1;
Returns
Type | Description |
com.google.rpc.Status | |
getErrorOrBuilder()
public StatusOrBuilder getErrorOrBuilder()
Output-only If set, returns a google.rpc.Status message that
specifies the error for the operation.
.google.rpc.Status error = 1;
Returns
Type | Description |
com.google.rpc.StatusOrBuilder | |
getParserForType()
public Parser<StreamingRecognizeResponse> getParserForType()
Returns
Overrides
getResultIndex()
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;
Returns
getResults(int index)
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;
Parameter
Returns
getResultsCount()
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;
Returns
getResultsList()
public 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;
Returns
getResultsOrBuilder(int index)
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;
Parameter
Returns
getResultsOrBuilderList()
public 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;
Returns
Type | Description |
List<? extends com.google.cloud.speech.v1beta1.StreamingRecognitionResultOrBuilder> | |
getSerializedSize()
public int getSerializedSize()
Returns
Overrides
getUnknownFields()
public final UnknownFieldSet getUnknownFields()
Returns
Overrides
hasError()
public boolean hasError()
Output-only If set, returns a google.rpc.Status message that
specifies the error for the operation.
.google.rpc.Status error = 1;
Returns
hashCode()
Returns
Overrides
internalGetFieldAccessorTable()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Overrides
isInitialized()
public final boolean isInitialized()
Returns
Overrides
newBuilderForType()
public StreamingRecognizeResponse.Builder newBuilderForType()
Returns
newBuilderForType(GeneratedMessageV3.BuilderParent parent)
protected StreamingRecognizeResponse.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Returns
Overrides
toBuilder()
public StreamingRecognizeResponse.Builder toBuilder()
Returns
writeTo(CodedOutputStream output)
public void writeTo(CodedOutputStream output)
Parameter
Overrides
Exceptions