Cloud Speech V1 Client - Class SpeechRecognitionResult (1.7.0)

Reference documentation and code samples for the Cloud Speech V1 Client class SpeechRecognitionResult.

A speech recognition result corresponding to a portion of the audio.

Generated from protobuf message google.cloud.speech.v1.SpeechRecognitionResult

Methods

__construct

Constructor.

Parameters
NameDescription
data array

Optional. Data for populating the Message object.

↳ alternatives array<Google\Cloud\Speech\V1\SpeechRecognitionAlternative>

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives). These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

↳ channel_tag int

For multi-channel audio, this is the channel number corresponding to the recognized result for the audio from that channel. For audio_channel_count = N, its output values can range from '1' to 'N'.

↳ result_end_time Google\Protobuf\Duration

Time offset of the end of this result relative to the beginning of the audio.

↳ language_code string

Output only. The BCP-47 language tag of the language in this result. This language code was detected to have the most likelihood of being spoken in the audio.

getAlternatives

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives).

These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

Generated from protobuf field repeated .google.cloud.speech.v1.SpeechRecognitionAlternative alternatives = 1;

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setAlternatives

May contain one or more recognition hypotheses (up to the maximum specified in max_alternatives).

These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

Generated from protobuf field repeated .google.cloud.speech.v1.SpeechRecognitionAlternative alternatives = 1;

Parameter
NameDescription
var array<Google\Cloud\Speech\V1\SpeechRecognitionAlternative>
Returns
TypeDescription
$this

getChannelTag

For multi-channel audio, this is the channel number corresponding to the recognized result for the audio from that channel.

For audio_channel_count = N, its output values can range from '1' to 'N'.

Generated from protobuf field int32 channel_tag = 2;

Returns
TypeDescription
int

setChannelTag

For multi-channel audio, this is the channel number corresponding to the recognized result for the audio from that channel.

For audio_channel_count = N, its output values can range from '1' to 'N'.

Generated from protobuf field int32 channel_tag = 2;

Parameter
NameDescription
var int
Returns
TypeDescription
$this

getResultEndTime

Time offset of the end of this result relative to the beginning of the audio.

Generated from protobuf field .google.protobuf.Duration result_end_time = 4;

Returns
TypeDescription
Google\Protobuf\Duration|null

hasResultEndTime

clearResultEndTime

setResultEndTime

Time offset of the end of this result relative to the beginning of the audio.

Generated from protobuf field .google.protobuf.Duration result_end_time = 4;

Parameter
NameDescription
var Google\Protobuf\Duration
Returns
TypeDescription
$this

getLanguageCode

Output only. The BCP-47 language tag of the language in this result. This language code was detected to have the most likelihood of being spoken in the audio.

Generated from protobuf field string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
string

setLanguageCode

Output only. The BCP-47 language tag of the language in this result. This language code was detected to have the most likelihood of being spoken in the audio.

Generated from protobuf field string language_code = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
var string
Returns
TypeDescription
$this