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 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 `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.
|
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, com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter| Modifier and Type | Field and Description |
|---|---|
static int |
ERROR_FIELD_NUMBER |
static int |
RESULTS_FIELD_NUMBER |
static int |
SPEECH_EVENT_TYPE_FIELD_NUMBER |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
static StreamingRecognizeResponse |
getDefaultInstance() |
StreamingRecognizeResponse |
getDefaultInstanceForType() |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
com.google.rpc.Status |
getError()
If set, returns a [google.rpc.Status][google.rpc.Status] message that
specifies the error for the operation.
|
com.google.rpc.StatusOrBuilder |
getErrorOrBuilder()
If set, returns a [google.rpc.Status][google.rpc.Status] message that
specifies the error for the operation.
|
com.google.protobuf.Parser<StreamingRecognizeResponse> |
getParserForType() |
StreamingRecognitionResult |
getResults(int index)
This repeated list contains zero or more results that
correspond to consecutive portions of the audio currently being processed.
|
int |
getResultsCount()
This repeated list contains zero or more results that
correspond to consecutive portions of the audio currently being processed.
|
List<StreamingRecognitionResult> |
getResultsList()
This repeated list contains zero or more results that
correspond to consecutive portions of the audio currently being processed.
|
StreamingRecognitionResultOrBuilder |
getResultsOrBuilder(int index)
This repeated list contains zero or more results that
correspond to consecutive portions of the audio currently being processed.
|
List<? extends StreamingRecognitionResultOrBuilder> |
getResultsOrBuilderList()
This repeated list contains zero or more results that
correspond to consecutive portions of the audio currently being processed.
|
int |
getSerializedSize() |
StreamingRecognizeResponse.SpeechEventType |
getSpeechEventType()
Indicates the type of speech event.
|
int |
getSpeechEventTypeValue()
Indicates the type of speech event.
|
com.google.protobuf.UnknownFieldSet |
getUnknownFields() |
boolean |
hasError()
If set, returns a [google.rpc.Status][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) |
protected Object |
newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused) |
static StreamingRecognizeResponse |
parseDelimitedFrom(InputStream input) |
static StreamingRecognizeResponse |
parseDelimitedFrom(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(ByteBuffer data) |
static StreamingRecognizeResponse |
parseFrom(ByteBuffer 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(InputStream input) |
static StreamingRecognizeResponse |
parseFrom(InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static com.google.protobuf.Parser<StreamingRecognizeResponse> |
parser() |
StreamingRecognizeResponse.Builder |
toBuilder() |
void |
writeTo(com.google.protobuf.CodedOutputStream output) |
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, makeExtensionsImmutable, mergeFromAndMakeImmutableInternal, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBooleanList, newBuilderForType, newDoubleList, newFloatList, newIntList, newLongList, 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, waitpublic static final int ERROR_FIELD_NUMBER
public static final int RESULTS_FIELD_NUMBER
public static final int SPEECH_EVENT_TYPE_FIELD_NUMBER
protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
newInstance in class com.google.protobuf.GeneratedMessageV3public 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()
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 com.google.rpc.Status getError()
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 com.google.rpc.StatusOrBuilder getErrorOrBuilder()
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 List<StreamingRecognitionResult> getResultsList()
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 StreamingRecognizeResponseOrBuilderpublic List<? extends StreamingRecognitionResultOrBuilder> getResultsOrBuilderList()
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 StreamingRecognizeResponseOrBuilderpublic int getResultsCount()
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 StreamingRecognizeResponseOrBuilderpublic StreamingRecognitionResult getResults(int index)
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 StreamingRecognizeResponseOrBuilderpublic StreamingRecognitionResultOrBuilder getResultsOrBuilder(int index)
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 StreamingRecognizeResponseOrBuilderpublic int getSpeechEventTypeValue()
Indicates the type of speech event.
.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4;
getSpeechEventTypeValue in interface StreamingRecognizeResponseOrBuilderpublic StreamingRecognizeResponse.SpeechEventType getSpeechEventType()
Indicates the type of speech event.
.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4;
getSpeechEventType 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 IOException
writeTo in interface com.google.protobuf.MessageLitewriteTo in class com.google.protobuf.GeneratedMessageV3IOExceptionpublic int getSerializedSize()
getSerializedSize in interface com.google.protobuf.MessageLitegetSerializedSize in class com.google.protobuf.GeneratedMessageV3public boolean equals(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(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static StreamingRecognizeResponse parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic 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(InputStream input) throws IOException
IOExceptionpublic static StreamingRecognizeResponse parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static StreamingRecognizeResponse parseDelimitedFrom(InputStream input) throws IOException
IOExceptionpublic static StreamingRecognizeResponse parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static StreamingRecognizeResponse parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
IOExceptionpublic static StreamingRecognizeResponse parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
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.MessageOrBuilderCopyright © 2021 Google LLC. All rights reserved.