Class: Google::Cloud::Speech::V1::StreamingRecognizeResponse
- Inherits:
- 
      Object
      
        - Object
- Google::Cloud::Speech::V1::StreamingRecognizeResponse
 
- Defined in:
- lib/google/cloud/speech/v1/doc/google/cloud/speech/v1/cloud_speech.rb
Overview
+StreamingRecognizeResponse+ is the only message returned to the client by +StreamingRecognize+. A series of one or more +StreamingRecognizeResponse+ messages are streamed back to the client.
Here's an example of a series of ten +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 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+. 
Defined Under Namespace
Modules: SpeechEventType
Instance Attribute Summary collapse
- 
  
    
      #error  ⇒ Google::Rpc::Status 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Output-only If set, returns a Rpc::Status message that specifies the error for the operation. 
- 
  
    
      #results  ⇒ Array<Google::Cloud::Speech::V1::StreamingRecognitionResult> 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed. 
- 
  
    
      #speech_event_type  ⇒ Google::Cloud::Speech::V1::StreamingRecognizeResponse::SpeechEventType 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Output-only Indicates the type of speech event. 
Instance Attribute Details
#error ⇒ Google::Rpc::Status
Returns Output-only If set, returns a Rpc::Status message that specifies the error for the operation.
| 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | # File 'lib/google/cloud/speech/v1/doc/google/cloud/speech/v1/cloud_speech.rb', line 314 class StreamingRecognizeResponse # 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 end end | 
#results ⇒ Array<Google::Cloud::Speech::V1::StreamingRecognitionResult>
Returns Output-only 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.
| 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | # File 'lib/google/cloud/speech/v1/doc/google/cloud/speech/v1/cloud_speech.rb', line 314 class StreamingRecognizeResponse # 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 end end | 
#speech_event_type ⇒ Google::Cloud::Speech::V1::StreamingRecognizeResponse::SpeechEventType
Returns Output-only Indicates the type of speech event.
| 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | # File 'lib/google/cloud/speech/v1/doc/google/cloud/speech/v1/cloud_speech.rb', line 314 class StreamingRecognizeResponse # 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 end end |