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. endpointer_type: START_OF_SPEECH 2. results { alternatives { transcript: "tube" } stability: 0.01 } result_index: 0 3. results { alternatives { transcript: "to be a" } stability: 0.01 } result_index: 0 4. results { alternatives { transcript: "to be" } stability: 0.9 } results { alternatives { transcript: " or not to be" } stability: 0.01 } result_index: 0 5. results { alternatives { transcript: "to be or not to be" confidence: 0.92 } alternatives { transcript: "to bee or not to bee" } is_final: true } result_index: 0 6. results { alternatives { transcript: " that's" } stability: 0.01 } result_index: 1 7. results { alternatives { transcript: " that is" } stability: 0.9 } results { alternatives { transcript: " the question" } stability: 0.01 } result_index: 1 8. endpointer_type: END_OF_SPEECH 9. results { alternatives { transcript: " that is the question" confidence: 0.98 } alternatives { transcript: " that was the question" } is_final: true } result_index: 1 10. endpointer_type: END_OF_AUDIO Notes: - Only two of the above responses #5 and #9 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. #4 and #7 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. - The result_index indicates the portion of audio that has had final results returned, and is no longer being processed. For example, the results in #6 and later correspond to the portion of audio after "to be or not to be".

Protobuf type Google\Cloud\Speech\V1beta1\StreamingRecognizeResponse

Methods

__construct()

No description

getError()

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

setError(Status $var)

Output-only If set, returns a [google.rpc.Status][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
getResultIndex()

Output-only Indicates the lowest index in the results array that has changed. The repeated StreamingRecognitionResult results overwrite past results at this index and higher.

setResultIndex(int $var)

Output-only Indicates the lowest index in the results array that has changed. The repeated StreamingRecognitionResult results overwrite past results at this index and higher.

int
getEndpointerType()

Output-only Indicates the type of endpointer event.

setEndpointerType(int $var)

Output-only Indicates the type of endpointer event.

Details

at line 92
__construct()

at line 104
Status getError()

Output-only If set, returns a [google.rpc.Status][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 116
setError(Status $var)

Output-only If set, returns a [google.rpc.Status][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 131
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.v1beta1.StreamingRecognitionResult results = 2;

Return Value

RepeatedField

at line 145
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.v1beta1.StreamingRecognitionResult results = 2;

Parameters

array|RepeatedField $var

at line 159
int getResultIndex()

Output-only Indicates the lowest index in the results array that has changed. The repeated StreamingRecognitionResult results overwrite past results at this index and higher.

Generated from protobuf field int32 result_index = 3;

Return Value

int

at line 172
setResultIndex(int $var)

Output-only Indicates the lowest index in the results array that has changed. The repeated StreamingRecognitionResult results overwrite past results at this index and higher.

Generated from protobuf field int32 result_index = 3;

Parameters

int $var

at line 184
int getEndpointerType()

Output-only Indicates the type of endpointer event.

Generated from protobuf field .google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;

Return Value

int

at line 195
setEndpointerType(int $var)

Output-only Indicates the type of endpointer event.

Generated from protobuf field .google.cloud.speech.v1beta1.StreamingRecognizeResponse.EndpointerType endpointer_type = 4;

Parameters

int $var