Class: Google::Cloud::Speech::V1::StreamingRecognizeResponse
- Inherits:
-
Object
- Object
- Google::Cloud::Speech::V1::StreamingRecognizeResponse
- Extended by:
- Protobuf::MessageExts::ClassMethods
- Includes:
- Protobuf::MessageExts
- Defined in:
- proto_docs/google/cloud/speech/v1/cloud_speech.rb
Overview
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
.
Defined Under Namespace
Modules: SpeechEventType
Instance Attribute Summary collapse
-
#error ⇒ ::Google::Rpc::Status
If set, returns a google.rpc.Status message that specifies the error for the operation.
-
#request_id ⇒ ::Integer
The ID associated with the request.
-
#results ⇒ ::Array<::Google::Cloud::Speech::V1::StreamingRecognitionResult>
This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed.
-
#speech_adaptation_info ⇒ ::Google::Cloud::Speech::V1::SpeechAdaptationInfo
Provides information on adaptation behavior in response.
-
#speech_event_time ⇒ ::Google::Protobuf::Duration
Time offset between the beginning of the audio and event emission.
-
#speech_event_type ⇒ ::Google::Cloud::Speech::V1::StreamingRecognizeResponse::SpeechEventType
Indicates the type of speech event.
-
#total_billed_time ⇒ ::Google::Protobuf::Duration
When available, billed audio seconds for the stream.
Instance Attribute Details
#error ⇒ ::Google::Rpc::Status
Returns If set, returns a google.rpc.Status message that specifies the error for the operation.
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 |
# File 'proto_docs/google/cloud/speech/v1/cloud_speech.rb', line 798 class StreamingRecognizeResponse include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # Indicates the type of speech event. module SpeechEventType # No speech event specified. SPEECH_EVENT_UNSPECIFIED = 0 # This 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 event is only sent if # `single_utterance` was set to `true`, and is not used otherwise. END_OF_SINGLE_UTTERANCE = 1 # This event indicates that the server has detected the beginning of human # voice activity in the stream. This event can be returned multiple times # if speech starts and stops repeatedly throughout the stream. This event # is only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_BEGIN = 2 # This event indicates that the server has detected the end of human voice # activity in the stream. This event can be returned multiple times if # speech starts and stops repeatedly throughout the stream. This event is # only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_END = 3 # This event indicates that the user-set timeout for speech activity begin # or end has exceeded. Upon receiving this event, the client is expected to # send a half close. Further audio will not be processed. SPEECH_ACTIVITY_TIMEOUT = 4 end end |
#request_id ⇒ ::Integer
Returns The ID associated with the request. This is a unique ID specific only to the given request.
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 |
# File 'proto_docs/google/cloud/speech/v1/cloud_speech.rb', line 798 class StreamingRecognizeResponse include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # Indicates the type of speech event. module SpeechEventType # No speech event specified. SPEECH_EVENT_UNSPECIFIED = 0 # This 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 event is only sent if # `single_utterance` was set to `true`, and is not used otherwise. END_OF_SINGLE_UTTERANCE = 1 # This event indicates that the server has detected the beginning of human # voice activity in the stream. This event can be returned multiple times # if speech starts and stops repeatedly throughout the stream. This event # is only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_BEGIN = 2 # This event indicates that the server has detected the end of human voice # activity in the stream. This event can be returned multiple times if # speech starts and stops repeatedly throughout the stream. This event is # only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_END = 3 # This event indicates that the user-set timeout for speech activity begin # or end has exceeded. Upon receiving this event, the client is expected to # send a half close. Further audio will not be processed. SPEECH_ACTIVITY_TIMEOUT = 4 end end |
#results ⇒ ::Array<::Google::Cloud::Speech::V1::StreamingRecognitionResult>
Returns 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).
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 |
# File 'proto_docs/google/cloud/speech/v1/cloud_speech.rb', line 798 class StreamingRecognizeResponse include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # Indicates the type of speech event. module SpeechEventType # No speech event specified. SPEECH_EVENT_UNSPECIFIED = 0 # This 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 event is only sent if # `single_utterance` was set to `true`, and is not used otherwise. END_OF_SINGLE_UTTERANCE = 1 # This event indicates that the server has detected the beginning of human # voice activity in the stream. This event can be returned multiple times # if speech starts and stops repeatedly throughout the stream. This event # is only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_BEGIN = 2 # This event indicates that the server has detected the end of human voice # activity in the stream. This event can be returned multiple times if # speech starts and stops repeatedly throughout the stream. This event is # only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_END = 3 # This event indicates that the user-set timeout for speech activity begin # or end has exceeded. Upon receiving this event, the client is expected to # send a half close. Further audio will not be processed. SPEECH_ACTIVITY_TIMEOUT = 4 end end |
#speech_adaptation_info ⇒ ::Google::Cloud::Speech::V1::SpeechAdaptationInfo
Returns Provides information on adaptation behavior in response.
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 |
# File 'proto_docs/google/cloud/speech/v1/cloud_speech.rb', line 798 class StreamingRecognizeResponse include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # Indicates the type of speech event. module SpeechEventType # No speech event specified. SPEECH_EVENT_UNSPECIFIED = 0 # This 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 event is only sent if # `single_utterance` was set to `true`, and is not used otherwise. END_OF_SINGLE_UTTERANCE = 1 # This event indicates that the server has detected the beginning of human # voice activity in the stream. This event can be returned multiple times # if speech starts and stops repeatedly throughout the stream. This event # is only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_BEGIN = 2 # This event indicates that the server has detected the end of human voice # activity in the stream. This event can be returned multiple times if # speech starts and stops repeatedly throughout the stream. This event is # only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_END = 3 # This event indicates that the user-set timeout for speech activity begin # or end has exceeded. Upon receiving this event, the client is expected to # send a half close. Further audio will not be processed. SPEECH_ACTIVITY_TIMEOUT = 4 end end |
#speech_event_time ⇒ ::Google::Protobuf::Duration
Returns Time offset between the beginning of the audio and event emission.
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 |
# File 'proto_docs/google/cloud/speech/v1/cloud_speech.rb', line 798 class StreamingRecognizeResponse include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # Indicates the type of speech event. module SpeechEventType # No speech event specified. SPEECH_EVENT_UNSPECIFIED = 0 # This 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 event is only sent if # `single_utterance` was set to `true`, and is not used otherwise. END_OF_SINGLE_UTTERANCE = 1 # This event indicates that the server has detected the beginning of human # voice activity in the stream. This event can be returned multiple times # if speech starts and stops repeatedly throughout the stream. This event # is only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_BEGIN = 2 # This event indicates that the server has detected the end of human voice # activity in the stream. This event can be returned multiple times if # speech starts and stops repeatedly throughout the stream. This event is # only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_END = 3 # This event indicates that the user-set timeout for speech activity begin # or end has exceeded. Upon receiving this event, the client is expected to # send a half close. Further audio will not be processed. SPEECH_ACTIVITY_TIMEOUT = 4 end end |
#speech_event_type ⇒ ::Google::Cloud::Speech::V1::StreamingRecognizeResponse::SpeechEventType
Returns Indicates the type of speech event.
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 |
# File 'proto_docs/google/cloud/speech/v1/cloud_speech.rb', line 798 class StreamingRecognizeResponse include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # Indicates the type of speech event. module SpeechEventType # No speech event specified. SPEECH_EVENT_UNSPECIFIED = 0 # This 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 event is only sent if # `single_utterance` was set to `true`, and is not used otherwise. END_OF_SINGLE_UTTERANCE = 1 # This event indicates that the server has detected the beginning of human # voice activity in the stream. This event can be returned multiple times # if speech starts and stops repeatedly throughout the stream. This event # is only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_BEGIN = 2 # This event indicates that the server has detected the end of human voice # activity in the stream. This event can be returned multiple times if # speech starts and stops repeatedly throughout the stream. This event is # only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_END = 3 # This event indicates that the user-set timeout for speech activity begin # or end has exceeded. Upon receiving this event, the client is expected to # send a half close. Further audio will not be processed. SPEECH_ACTIVITY_TIMEOUT = 4 end end |
#total_billed_time ⇒ ::Google::Protobuf::Duration
Returns When available, billed audio seconds for the stream. Set only if this is the last response in the stream.
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 |
# File 'proto_docs/google/cloud/speech/v1/cloud_speech.rb', line 798 class StreamingRecognizeResponse include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # Indicates the type of speech event. module SpeechEventType # No speech event specified. SPEECH_EVENT_UNSPECIFIED = 0 # This 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 event is only sent if # `single_utterance` was set to `true`, and is not used otherwise. END_OF_SINGLE_UTTERANCE = 1 # This event indicates that the server has detected the beginning of human # voice activity in the stream. This event can be returned multiple times # if speech starts and stops repeatedly throughout the stream. This event # is only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_BEGIN = 2 # This event indicates that the server has detected the end of human voice # activity in the stream. This event can be returned multiple times if # speech starts and stops repeatedly throughout the stream. This event is # only sent if `voice_activity_events` is set to true. SPEECH_ACTIVITY_END = 3 # This event indicates that the user-set timeout for speech activity begin # or end has exceeded. Upon receiving this event, the client is expected to # send a half close. Further audio will not be processed. SPEECH_ACTIVITY_TIMEOUT = 4 end end |