# Cloud Speech-to-Text V2 API - Class Google::Cloud::Speech::V2::StreamingRecognizeResponse (v1.8.0)

1.8.0 (latest) 1.7.1 1.6.0 1.5.0 1.4.1 1.3.0 1.2.1 1.1.0 1.0.1 0.16.0 0.15.0 0.14.0 0.13.1 0.12.0 0.11.0 0.10.0 0.9.2 0.8.0 0.7.0 0.6.0 0.5.1 0.4.0 0.3.0 0.2.0 0.1.0 Reference documentation and code samples for the Cloud Speech-to-Text V2 API class Google::Cloud::Speech::V2::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 then no messages are streamed back to the client.

Here are some examples of `StreamingRecognizeResponse`s that might
be returned while processing audio:

1. results { alternatives { transcript: "tube" } stability: 0.01 }

2. results { alternatives { transcript: "to be a" } stability: 0.01 }

3. results { alternatives { transcript: "to be" } stability: 0.9 }
   results { alternatives { transcript: " or not to be" } stability: 0.01 }

4. results { alternatives { transcript: "to be or not to be"
   confidence: 0.92 }
   alternatives { transcript: "to bee or not to bee" }
   is_final: true }

5. results { alternatives { transcript: " that's" } stability: 0.01 }

6. results { alternatives { transcript: " that is" } stability: 0.9 }
   results { alternatives { transcript: " the question" } stability: 0.01 }

7. 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`.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #metadata

    def metadata() -> ::Google::Cloud::Speech::V2::RecognitionResponseMetadata

**Returns**

- ([::Google::Cloud::Speech::V2::RecognitionResponseMetadata](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-RecognitionResponseMetadata)) --- Metadata about the recognition.

### #metadata=

    def metadata=(value) -> ::Google::Cloud::Speech::V2::RecognitionResponseMetadata

**Parameter**

- **value** ([::Google::Cloud::Speech::V2::RecognitionResponseMetadata](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-RecognitionResponseMetadata)) --- Metadata about the recognition.
**Returns**

- ([::Google::Cloud::Speech::V2::RecognitionResponseMetadata](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-RecognitionResponseMetadata)) --- Metadata about the recognition.

### #results

    def results() -> ::Array<::Google::Cloud::Speech::V2::StreamingRecognitionResult>

**Returns**

- (::Array\<[::Google::Cloud::Speech::V2::StreamingRecognitionResult](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-StreamingRecognitionResult#Google__Cloud__Speech__V2__StreamingRecognitionResult_is_final_instance_ "Google::Cloud::Speech::V2::StreamingRecognitionResult#is_final (method)")=`true` result (the newly settled portion), followed by zero or more [is_final](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-StreamingRecognitionResult#Google__Cloud__Speech__V2__StreamingRecognitionResult_is_final_instance_ "Google::Cloud::Speech::V2::StreamingRecognitionResult#is_final (method)")=`false` results (the interim results).

### #results=

    def results=(value) -> ::Array<::Google::Cloud::Speech::V2::StreamingRecognitionResult>

**Parameter**

- **value** (::Array\<[::Google::Cloud::Speech::V2::StreamingRecognitionResult](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-StreamingRecognitionResult#Google__Cloud__Speech__V2__StreamingRecognitionResult_is_final_instance_ "Google::Cloud::Speech::V2::StreamingRecognitionResult#is_final (method)")=`true` result (the newly settled portion), followed by zero or more [is_final](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-StreamingRecognitionResult#Google__Cloud__Speech__V2__StreamingRecognitionResult_is_final_instance_ "Google::Cloud::Speech::V2::StreamingRecognitionResult#is_final (method)")=`false` results (the interim results).
**Returns**

- (::Array\<[::Google::Cloud::Speech::V2::StreamingRecognitionResult](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-StreamingRecognitionResult#Google__Cloud__Speech__V2__StreamingRecognitionResult_is_final_instance_ "Google::Cloud::Speech::V2::StreamingRecognitionResult#is_final (method)")=`true` result (the newly settled portion), followed by zero or more [is_final](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-StreamingRecognitionResult#Google__Cloud__Speech__V2__StreamingRecognitionResult_is_final_instance_ "Google::Cloud::Speech::V2::StreamingRecognitionResult#is_final (method)")=`false` results (the interim results).

### #speech_event_offset

    def speech_event_offset() -> ::Google::Protobuf::Duration

**Returns**

- ([::Google::Protobuf::Duration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Protobuf-Duration)) --- Time offset between the beginning of the audio and event emission.

### #speech_event_offset=

    def speech_event_offset=(value) -> ::Google::Protobuf::Duration

**Parameter**

- **value** ([::Google::Protobuf::Duration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Protobuf-Duration)) --- Time offset between the beginning of the audio and event emission.
**Returns**

- ([::Google::Protobuf::Duration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Protobuf-Duration)) --- Time offset between the beginning of the audio and event emission.

### #speech_event_type

    def speech_event_type() -> ::Google::Cloud::Speech::V2::StreamingRecognizeResponse::SpeechEventType

**Returns**

- ([::Google::Cloud::Speech::V2::StreamingRecognizeResponse::SpeechEventType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-StreamingRecognizeResponse-SpeechEventType)) --- Indicates the type of speech event.

### #speech_event_type=

    def speech_event_type=(value) -> ::Google::Cloud::Speech::V2::StreamingRecognizeResponse::SpeechEventType

**Parameter**

- **value** ([::Google::Cloud::Speech::V2::StreamingRecognizeResponse::SpeechEventType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-StreamingRecognizeResponse-SpeechEventType)) --- Indicates the type of speech event.
**Returns**

- ([::Google::Cloud::Speech::V2::StreamingRecognizeResponse::SpeechEventType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-speech-v2/latest/Google-Cloud-Speech-V2-StreamingRecognizeResponse-SpeechEventType)) --- Indicates the type of speech event.