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:
END_OF_SINGLE_UTTERANCE
transcript: " 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
TRANSCRIPT
:transcript
and possiblyis_final
.for
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
, theStreamingRecognitionResult
represents 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.
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb', line 383 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 inputs. # 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
= TRANSCRIPT
.
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb', line 383 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 inputs. # 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.
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb', line 383 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 inputs. # 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
= TRANSCRIPT
.
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb', line 383 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 inputs. # 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 |