class RecognitionConfig extends Message

Provides information to the recognizer that specifies how to process the request.

Protobuf type Google\Cloud\Speech\V1\RecognitionConfig

Methods

__construct()

No description

int
getEncoding()

Required Encoding of audio data sent in all RecognitionAudio messages.

setEncoding(int $var)

Required Encoding of audio data sent in all RecognitionAudio messages.

int
getSampleRateHertz()

Required Sample rate in Hertz of the audio data sent in all RecognitionAudio messages. Valid values are: 8000-48000.

setSampleRateHertz(int $var)

Required Sample rate in Hertz of the audio data sent in all RecognitionAudio messages. Valid values are: 8000-48000.

string
getLanguageCode()

Required The language of the supplied audio as a BCP-47 language tag.

setLanguageCode(string $var)

Required The language of the supplied audio as a BCP-47 language tag.

int
getMaxAlternatives()

Optional Maximum number of recognition hypotheses to be returned.

setMaxAlternatives(int $var)

Optional Maximum number of recognition hypotheses to be returned.

bool
getProfanityFilter()

Optional If set to true, the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks, e.g. "f***". If set to false or omitted, profanities won't be filtered out.

setProfanityFilter(bool $var)

Optional If set to true, the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks, e.g. "f***". If set to false or omitted, profanities won't be filtered out.

RepeatedField
getSpeechContexts()

Optional A means to provide context to assist the speech recognition.

setSpeechContexts(array|RepeatedField $var)

Optional A means to provide context to assist the speech recognition.

Details

at line 72
__construct()

at line 83
int getEncoding()

Required Encoding of audio data sent in all RecognitionAudio messages.

Generated from protobuf field .google.cloud.speech.v1.RecognitionConfig.AudioEncoding encoding = 1;

Return Value

int

at line 94
setEncoding(int $var)

Required Encoding of audio data sent in all RecognitionAudio messages.

Generated from protobuf field .google.cloud.speech.v1.RecognitionConfig.AudioEncoding encoding = 1;

Parameters

int $var

at line 110
int getSampleRateHertz()

Required Sample rate in Hertz of the audio data sent in all RecognitionAudio messages. Valid values are: 8000-48000.

16000 is optimal. For best results, set the sampling rate of the audio source to 16000 Hz. If that's not possible, use the native sample rate of the audio source (instead of re-sampling).

Generated from protobuf field int32 sample_rate_hertz = 2;

Return Value

int

at line 125
setSampleRateHertz(int $var)

Required Sample rate in Hertz of the audio data sent in all RecognitionAudio messages. Valid values are: 8000-48000.

16000 is optimal. For best results, set the sampling rate of the audio source to 16000 Hz. If that's not possible, use the native sample rate of the audio source (instead of re-sampling).

Generated from protobuf field int32 sample_rate_hertz = 2;

Parameters

int $var

at line 141
string getLanguageCode()

Required The language of the supplied audio as a BCP-47 language tag.

Example: "en-US". See Language Support for a list of the currently supported language codes.

Generated from protobuf field string language_code = 3;

Return Value

string

at line 156
setLanguageCode(string $var)

Required The language of the supplied audio as a BCP-47 language tag.

Example: "en-US". See Language Support for a list of the currently supported language codes.

Generated from protobuf field string language_code = 3;

Parameters

string $var

at line 173
int getMaxAlternatives()

Optional Maximum number of recognition hypotheses to be returned.

Specifically, the maximum number of SpeechRecognitionAlternative messages within each SpeechRecognitionResult. The server may return fewer than max_alternatives. Valid values are 0-30. A value of 0 or 1 will return a maximum of one. If omitted, will return a maximum of one.

Generated from protobuf field int32 max_alternatives = 4;

Return Value

int

at line 189
setMaxAlternatives(int $var)

Optional Maximum number of recognition hypotheses to be returned.

Specifically, the maximum number of SpeechRecognitionAlternative messages within each SpeechRecognitionResult. The server may return fewer than max_alternatives. Valid values are 0-30. A value of 0 or 1 will return a maximum of one. If omitted, will return a maximum of one.

Generated from protobuf field int32 max_alternatives = 4;

Parameters

int $var

at line 204
bool getProfanityFilter()

Optional If set to true, the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks, e.g. "f***". If set to false or omitted, profanities won't be filtered out.

Generated from protobuf field bool profanity_filter = 5;

Return Value

bool

at line 218
setProfanityFilter(bool $var)

Optional If set to true, the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks, e.g. "f***". If set to false or omitted, profanities won't be filtered out.

Generated from protobuf field bool profanity_filter = 5;

Parameters

bool $var

at line 230
RepeatedField getSpeechContexts()

Optional A means to provide context to assist the speech recognition.

Generated from protobuf field repeated .google.cloud.speech.v1.SpeechContext speech_contexts = 6;

Return Value

RepeatedField

at line 241
setSpeechContexts(array|RepeatedField $var)

Optional A means to provide context to assist the speech recognition.

Generated from protobuf field repeated .google.cloud.speech.v1.SpeechContext speech_contexts = 6;

Parameters

array|RepeatedField $var