# Cloud Speech V2 Client - Class RecognizeRequest (2.5.1)

2.5.1 (latest) 2.5.0 2.4.0 2.3.0 2.2.1 2.1.1 2.0.1 1.20.1 1.19.2 1.18.3 1.16.0 1.15.0 1.14.3 1.13.1 1.12.0 1.11.2 1.10.0 1.9.1 1.8.0 1.7.0 Reference documentation and code samples for the Cloud Speech V2 Client class RecognizeRequest.

Request message for the
[Recognize](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.Client.SpeechClient#_Google_Cloud_Speech_V2_Client_SpeechClient__recognize__) method. Either
`content` or `uri` must be supplied. Supplying both or neither returns
[INVALID_ARGUMENT](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Code.html#_Google_Rpc_Code__INVALID_ARGUMENT). See [content
limits](https://cloud.google.com/speech-to-text/quotas#content).

Generated from protobuf message `google.cloud.speech.v2.RecognizeRequest`

## Namespace

Google \\ Cloud \\ Speech \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ recognizer` | `string` Required. The name of the Recognizer to use during recognition. The expected format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The {recognizer} segment may be set to `_` to use an empty implicit Recognizer. |
| `↳ config` | `https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig` Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the [config_mask](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfigMask__) field can be used to override parts of the [default_recognition_config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.Recognizer#_Google_Cloud_Speech_V2_Recognizer__getDefaultRecognitionConfig__) of the Recognizer resource. |
| `↳ config_mask` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/FieldMask` The list of fields in [config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) that override the values in the [default_recognition_config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.Recognizer#_Google_Cloud_Speech_V2_Recognizer__getDefaultRecognitionConfig__) of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in [config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) override the values in the recognizer for this recognition request. If a mask is provided, only the fields listed in the mask override the config in the recognizer for this recognition request. If a wildcard (`*`) is provided, [config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) completely overrides and replaces the config in the recognizer for this recognition request. |
| `↳ content` | `string` The audio data bytes encoded as specified in [RecognitionConfig](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig). As with all bytes fields, proto buffers use a pure binary representation, whereas JSON representations use base64. |
| `↳ uri` | `string` URI that points to a file that contains audio data bytes as specified in [RecognitionConfig](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig). The file must not be compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported, which must be specified in the following format: `gs://bucket_name/object_name` (other URI formats return [INVALID_ARGUMENT](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Code.html#_Google_Rpc_Code__INVALID_ARGUMENT)). For more information, see [Request URIs](https://cloud.google.com/storage/docs/reference-uris). |

### getRecognizer

Required. The name of the Recognizer to use during recognition. The
expected format is
`projects/{project}/locations/{location}/recognizers/{recognizer}`. The
{recognizer} segment may be set to `_` to use an empty implicit Recognizer.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setRecognizer

Required. The name of the Recognizer to use during recognition. The
expected format is
`projects/{project}/locations/{location}/recognizers/{recognizer}`. The
{recognizer} segment may be set to `_` to use an empty implicit Recognizer.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getConfig

Features and audio metadata to use for the Automatic Speech Recognition.

This field in combination with the
[config_mask](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfigMask__) field
can be used to override parts of the
[default_recognition_config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.Recognizer#_Google_Cloud_Speech_V2_Recognizer__getDefaultRecognitionConfig__)
of the Recognizer resource.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig|null` |   |

### hasConfig

### clearConfig

### setConfig

Features and audio metadata to use for the Automatic Speech Recognition.

This field in combination with the
[config_mask](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfigMask__) field
can be used to override parts of the
[default_recognition_config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.Recognizer#_Google_Cloud_Speech_V2_Recognizer__getDefaultRecognitionConfig__)
of the Recognizer resource.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getConfigMask

The list of fields in
[config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) that override the
values in the
[default_recognition_config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.Recognizer#_Google_Cloud_Speech_V2_Recognizer__getDefaultRecognitionConfig__)
of the recognizer during this recognition request. If no mask is provided,
all non-default valued fields in
[config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) override the
values in the recognizer for this recognition request. If a mask is
provided, only the fields listed in the mask override the config in the
recognizer for this recognition request. If a wildcard (`*`) is provided,
[config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) completely
overrides and replaces the config in the recognizer for this recognition
request.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/FieldMask|null` |   |

### hasConfigMask

### clearConfigMask

### setConfigMask

The list of fields in
[config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) that override the
values in the
[default_recognition_config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.Recognizer#_Google_Cloud_Speech_V2_Recognizer__getDefaultRecognitionConfig__)
of the recognizer during this recognition request. If no mask is provided,
all non-default valued fields in
[config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) override the
values in the recognizer for this recognition request. If a mask is
provided, only the fields listed in the mask override the config in the
recognizer for this recognition request. If a wildcard (`*`) is provided,
[config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) completely
overrides and replaces the config in the recognizer for this recognition
request.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/FieldMask` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getContent

The audio data bytes encoded as specified in
[RecognitionConfig](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig). As
with all bytes fields, proto buffers use a pure binary representation,
whereas JSON representations use base64.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasContent

### setContent

The audio data bytes encoded as specified in
[RecognitionConfig](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig). As
with all bytes fields, proto buffers use a pure binary representation,
whereas JSON representations use base64.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUri

URI that points to a file that contains audio data bytes as specified in
[RecognitionConfig](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig). The file
must not be compressed (for example, gzip). Currently, only Google Cloud
Storage URIs are supported, which must be specified in the following
format: `gs://bucket_name/object_name` (other URI formats return
[INVALID_ARGUMENT](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Code.html#_Google_Rpc_Code__INVALID_ARGUMENT)). For more
information, see [Request
URIs](https://cloud.google.com/storage/docs/reference-uris).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasUri

### setUri

URI that points to a file that contains audio data bytes as specified in
[RecognitionConfig](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig). The file
must not be compressed (for example, gzip). Currently, only Google Cloud
Storage URIs are supported, which must be specified in the following
format: `gs://bucket_name/object_name` (other URI formats return
[INVALID_ARGUMENT](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Code.html#_Google_Rpc_Code__INVALID_ARGUMENT)). For more
information, see [Request
URIs](https://cloud.google.com/storage/docs/reference-uris).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAudioSource

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### static::build

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `recognizer` | `string` Required. The name of the Recognizer to use during recognition. The expected format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The {recognizer} segment may be set to `_` to use an empty implicit Recognizer. Please see SpeechClient::recognizerName() for help formatting this field. |
| `config` | `https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig` Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the [config_mask](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfigMask__) field can be used to override parts of the [default_recognition_config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.Recognizer#_Google_Cloud_Speech_V2_Recognizer__getDefaultRecognitionConfig__) of the Recognizer resource. |
| `configMask` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/FieldMask` The list of fields in [config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) that override the values in the [default_recognition_config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.Recognizer#_Google_Cloud_Speech_V2_Recognizer__getDefaultRecognitionConfig__) of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in [config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) override the values in the recognizer for this recognition request. If a mask is provided, only the fields listed in the mask override the config in the recognizer for this recognition request. If a wildcard (`*`) is provided, [config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) completely overrides and replaces the config in the recognizer for this recognition request. |
| `content` | `string` The audio data bytes encoded as specified in [RecognitionConfig](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig). As with all bytes fields, proto buffers use a pure binary representation, whereas JSON representations use base64. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest` |   |

### static::buildFromRecognizerConfigConfigMaskUri

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `recognizer` | `string` Required. The name of the Recognizer to use during recognition. The expected format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The {recognizer} segment may be set to `_` to use an empty implicit Recognizer. Please see SpeechClient::recognizerName() for help formatting this field. |
| `config` | `https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig` Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the [config_mask](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfigMask__) field can be used to override parts of the [default_recognition_config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.Recognizer#_Google_Cloud_Speech_V2_Recognizer__getDefaultRecognitionConfig__) of the Recognizer resource. |
| `configMask` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/FieldMask` The list of fields in [config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) that override the values in the [default_recognition_config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.Recognizer#_Google_Cloud_Speech_V2_Recognizer__getDefaultRecognitionConfig__) of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in [config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) override the values in the recognizer for this recognition request. If a mask is provided, only the fields listed in the mask override the config in the recognizer for this recognition request. If a wildcard (`*`) is provided, [config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) completely overrides and replaces the config in the recognizer for this recognition request. |
| `uri` | `string` URI that points to a file that contains audio data bytes as specified in [RecognitionConfig](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig). The file must not be compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported, which must be specified in the following format: `gs://bucket_name/object_name` (other URI formats return [INVALID_ARGUMENT](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Code.html#_Google_Rpc_Code__INVALID_ARGUMENT)). For more information, see [Request URIs](https://cloud.google.com/storage/docs/reference-uris). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest` |   |