class StreamingRecognizeResponse extends Message

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 StreamingRecognizeResponses 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. speech_event_type: END_OF_SINGLE_UTTERANCE 8. 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 #8 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.

Protobuf type Google\Cloud\Speech\V1\StreamingRecognizeResponse

Methods

__construct()

No description

getError()

Output-only If set, returns a [google.rpc.Status][] message that specifies the error for the operation.

setError(Status $var)

Output-only If set, returns a [google.rpc.Status][] message that specifies the error for the operation.

RepeatedField
getResults()

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed.

setResults(array|RepeatedField $var)

Output-only This repeated list contains zero or more results that correspond to consecutive portions of the audio currently being processed.

int
getSpeechEventType()

Output-only Indicates the type of speech event.

setSpeechEventType(int $var)

Output-only Indicates the type of speech event.

Details

at line 75
__construct()

at line 87
Status getError()

Output-only If set, returns a [google.rpc.Status][] message that specifies the error for the operation.

Generated from protobuf field .google.rpc.Status error = 1;

Return Value

Status

at line 99
setError(Status $var)

Output-only If set, returns a [google.rpc.Status][] message that specifies the error for the operation.

Generated from protobuf field .google.rpc.Status error = 1;

Parameters

Status $var

at line 114
RepeatedField getResults()

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.

Generated from protobuf field repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2;

Return Value

RepeatedField

at line 128
setResults(array|RepeatedField $var)

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.

Generated from protobuf field repeated .google.cloud.speech.v1.StreamingRecognitionResult results = 2;

Parameters

array|RepeatedField $var

at line 140
int getSpeechEventType()

Output-only Indicates the type of speech event.

Generated from protobuf field .google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4;

Return Value

int

at line 151
setSpeechEventType(int $var)

Output-only Indicates the type of speech event.

Generated from protobuf field .google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType speech_event_type = 4;

Parameters

int $var