Class: Google::Cloud::Dialogflow::V2::StreamingRecognitionResult
- Inherits:
-
Object
- Object
- Google::Cloud::Dialogflow::V2::StreamingRecognitionResult
- Defined in:
- lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb
Overview
Contains a speech recognition result corresponding to a portion of the audio that is currently being processed or an indication that this is the end of the single requested utterance.
Example:
transcript: "tube"
transcript: "to be a"
transcript: "to be"
transcript: "to be or not to be" is_final: true
transcript: " that's"
transcript: " that is"
message_type:
MESSAGE_TYPE_END_OF_SINGLE_UTTERANCEtranscript: " that is the question" is_final: true
Only two of the responses contain final results (#4 and #8 indicated by
is_final: true). Concatenating these generates the full transcript: "to be
or not to be that is the question".
In each response we populate:
for
MESSAGE_TYPE_TRANSCRIPT:transcriptand possiblyis_final.for
MESSAGE_TYPE_END_OF_SINGLE_UTTERANCE: onlymessage_type.
Defined Under Namespace
Modules: MessageType
Instance Attribute Summary collapse
-
#confidence ⇒ Float
The Speech confidence between 0.0 and 1.0 for the current portion of audio.
-
#is_final ⇒ true, false
If
false, theStreamingRecognitionResultrepresents an interim result that may change. -
#message_type ⇒ Google::Cloud::Dialogflow::V2::StreamingRecognitionResult::MessageType
Type of the result message.
-
#transcript ⇒ String
Transcript text representing the words that the user spoke.
Instance Attribute Details
#confidence ⇒ Float
Returns The Speech confidence between 0.0 and 1.0 for the current portion of audio. A higher number indicates an estimated greater likelihood that the recognized words are correct. The default of 0.0 is a sentinel value indicating that confidence was not set.
This field is typically only provided if is_final is true and you should
not rely on it being accurate or even set.
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb', line 360 class StreamingRecognitionResult # Type of the response message. module MessageType # Not specified. Should never be used. MESSAGE_TYPE_UNSPECIFIED = 0 # Message contains a (possibly partial) transcript. TRANSCRIPT = 1 # Event indicates that the server has detected the end of the user's speech # utterance and expects no additional speech. Therefore, the server will # not process additional audio (although it may subsequently return # additional results). The client should stop sending additional audio # data, half-close the gRPC connection, and wait for any additional results # until the server closes the gRPC connection. This message is only sent if # `single_utterance` was set to `true`, and is not used otherwise. END_OF_SINGLE_UTTERANCE = 2 end end |
#is_final ⇒ true, false
Returns If false, the StreamingRecognitionResult represents an
interim result that may change. If true, the recognizer will not return
any further hypotheses about this piece of the audio. May only be populated
for message_type = MESSAGE_TYPE_TRANSCRIPT.
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb', line 360 class StreamingRecognitionResult # Type of the response message. module MessageType # Not specified. Should never be used. MESSAGE_TYPE_UNSPECIFIED = 0 # Message contains a (possibly partial) transcript. TRANSCRIPT = 1 # Event indicates that the server has detected the end of the user's speech # utterance and expects no additional speech. Therefore, the server will # not process additional audio (although it may subsequently return # additional results). The client should stop sending additional audio # data, half-close the gRPC connection, and wait for any additional results # until the server closes the gRPC connection. This message is only sent if # `single_utterance` was set to `true`, and is not used otherwise. END_OF_SINGLE_UTTERANCE = 2 end end |
#message_type ⇒ Google::Cloud::Dialogflow::V2::StreamingRecognitionResult::MessageType
Returns Type of the result message.
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb', line 360 class StreamingRecognitionResult # Type of the response message. module MessageType # Not specified. Should never be used. MESSAGE_TYPE_UNSPECIFIED = 0 # Message contains a (possibly partial) transcript. TRANSCRIPT = 1 # Event indicates that the server has detected the end of the user's speech # utterance and expects no additional speech. Therefore, the server will # not process additional audio (although it may subsequently return # additional results). The client should stop sending additional audio # data, half-close the gRPC connection, and wait for any additional results # until the server closes the gRPC connection. This message is only sent if # `single_utterance` was set to `true`, and is not used otherwise. END_OF_SINGLE_UTTERANCE = 2 end end |
#transcript ⇒ String
Returns Transcript text representing the words that the user spoke.
Populated if and only if message_type = MESSAGE_TYPE_TRANSCRIPT.
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb', line 360 class StreamingRecognitionResult # Type of the response message. module MessageType # Not specified. Should never be used. MESSAGE_TYPE_UNSPECIFIED = 0 # Message contains a (possibly partial) transcript. TRANSCRIPT = 1 # Event indicates that the server has detected the end of the user's speech # utterance and expects no additional speech. Therefore, the server will # not process additional audio (although it may subsequently return # additional results). The client should stop sending additional audio # data, half-close the gRPC connection, and wait for any additional results # until the server closes the gRPC connection. This message is only sent if # `single_utterance` was set to `true`, and is not used otherwise. END_OF_SINGLE_UTTERANCE = 2 end end |