Cloud Speech V2 Client - Class SpeechRecognitionResult (1.18.3)

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

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

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

Namespace

Google \ Cloud \ Speech \ V2

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

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

May contain one or more recognition hypotheses. 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_offset 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. These alternatives are ordered in terms of accuracy, with the top (first) alternative being the most probable, as ranked by the recognizer.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setAlternatives

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

Parameter
Name Description
var array<Google\Cloud\Speech\V2\SpeechRecognitionAlternative>
Returns
Type Description
$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.

Returns
Type Description
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.

Parameter
Name Description
var int
Returns
Type Description
$this

getResultEndOffset

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

Returns
Type Description
Google\Protobuf\Duration|null

hasResultEndOffset

clearResultEndOffset

setResultEndOffset

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

Parameter
Name Description
var Google\Protobuf\Duration
Returns
Type Description
$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.

Returns
Type Description
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.

Parameter
Name Description
var string
Returns
Type Description
$this