Reference documentation and code samples for the Cloud Speech-to-Text V1p1beta1 API class Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse.
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:
results { alternatives { transcript: "tube" } stability: 0.01 }
results { alternatives { transcript: "to be a" } stability: 0.01 }
results { alternatives { transcript: "to be" } stability: 0.9 } results { alternatives { transcript: " or not to be" } stability: 0.01 }
results { alternatives { transcript: "to be or not to be" confidence: 0.92 } alternatives { transcript: "to bee or not to bee" } is_final: true }
results { alternatives { transcript: " that's" } stability: 0.01 }
results { alternatives { transcript: " that is" } stability: 0.9 } results { alternatives { transcript: " the question" } stability: 0.01 }
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 interimresults
: 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 stabilityresults
.The specific
stability
andconfidence
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
.
Inherits
- Object
Extended By
- Google::Protobuf::MessageExts::ClassMethods
Includes
- Google::Protobuf::MessageExts
Methods
#error
def error() -> ::Google::Rpc::Status
- (::Google::Rpc::Status) — If set, returns a google.rpc.Status message that specifies the error for the operation.
#error=
def error=(value) -> ::Google::Rpc::Status
- value (::Google::Rpc::Status) — If set, returns a google.rpc.Status message that specifies the error for the operation.
- (::Google::Rpc::Status) — If set, returns a google.rpc.Status message that specifies the error for the operation.
#request_id
def request_id() -> ::Integer
- (::Integer) — The ID associated with the request. This is a unique ID specific only to the given request.
#request_id=
def request_id=(value) -> ::Integer
- value (::Integer) — The ID associated with the request. This is a unique ID specific only to the given request.
- (::Integer) — The ID associated with the request. This is a unique ID specific only to the given request.
#results
def results() -> ::Array<::Google::Cloud::Speech::V1p1beta1::StreamingRecognitionResult>
-
(::Array<::Google::Cloud::Speech::V1p1beta1::StreamingRecognitionResult>) — 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 moreis_final=false
results (the interim results).
#results=
def results=(value) -> ::Array<::Google::Cloud::Speech::V1p1beta1::StreamingRecognitionResult>
-
value (::Array<::Google::Cloud::Speech::V1p1beta1::StreamingRecognitionResult>) — 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 moreis_final=false
results (the interim results).
-
(::Array<::Google::Cloud::Speech::V1p1beta1::StreamingRecognitionResult>) — 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 moreis_final=false
results (the interim results).
#speech_adaptation_info
def speech_adaptation_info() -> ::Google::Cloud::Speech::V1p1beta1::SpeechAdaptationInfo
- (::Google::Cloud::Speech::V1p1beta1::SpeechAdaptationInfo) — Provides information on adaptation behavior in response
#speech_adaptation_info=
def speech_adaptation_info=(value) -> ::Google::Cloud::Speech::V1p1beta1::SpeechAdaptationInfo
- value (::Google::Cloud::Speech::V1p1beta1::SpeechAdaptationInfo) — Provides information on adaptation behavior in response
- (::Google::Cloud::Speech::V1p1beta1::SpeechAdaptationInfo) — Provides information on adaptation behavior in response
#speech_event_type
def speech_event_type() -> ::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse::SpeechEventType
- (::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse::SpeechEventType) — Indicates the type of speech event.
#speech_event_type=
def speech_event_type=(value) -> ::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse::SpeechEventType
- value (::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse::SpeechEventType) — Indicates the type of speech event.
- (::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse::SpeechEventType) — Indicates the type of speech event.
#total_billed_time
def total_billed_time() -> ::Google::Protobuf::Duration
- (::Google::Protobuf::Duration) — When available, billed audio seconds for the stream. Set only if this is the last response in the stream.
#total_billed_time=
def total_billed_time=(value) -> ::Google::Protobuf::Duration
- value (::Google::Protobuf::Duration) — When available, billed audio seconds for the stream. Set only if this is the last response in the stream.
- (::Google::Protobuf::Duration) — When available, billed audio seconds for the stream. Set only if this is the last response in the stream.