# Cloud Speech V2 Client - Class Recognizer (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 Recognizer.

A Recognizer message. Stores recognition configuration and metadata.

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

## Namespace

Google \\ Cloud \\ Speech \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Output only. Identifier. The resource name of the Recognizer. Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`. |
| `↳ uid` | `string` Output only. System-assigned unique identifier for the Recognizer. |
| `↳ display_name` | `string` User-settable, human-readable name for the Recognizer. Must be 63 characters or less. |
| `↳ model` | `string` Optional. This field is now deprecated. Prefer the [`model`](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig#_Google_Cloud_Speech_V2_RecognitionConfig__getModel__) field in the [`RecognitionConfig`](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig) message. Which model to use for recognition requests. Select the model best suited to your domain to get best results. Guidance for choosing which model to use can be found in the [Transcription Models Documentation](https://cloud.google.com/speech-to-text/v2/docs/transcription-model) and the models supported in each region can be found in the [Table Of Supported Models](https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages). |
| `↳ language_codes` | `string[]` Optional. This field is now deprecated. Prefer the [`language_codes`](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig#_Google_Cloud_Speech_V2_RecognitionConfig__getLanguageCodes__) field in the [`RecognitionConfig`](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig) message. The language of the supplied audio as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. Supported languages for each model are listed in the [Table of Supported Models](https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages). If additional languages are provided, recognition result will contain recognition in the most likely language detected. The recognition result will include the language tag of the language detected in the audio. When you create or update a Recognizer, these values are stored in normalized BCP-47 form. For example, "en-us" is stored as "en-US". |
| `↳ default_recognition_config` | `https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig` Default configuration to use for requests with this Recognizer. This can be overwritten by inline configuration in the [RecognizeRequest.config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__) field. |
| `↳ annotations` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Allows users to store small amounts of arbitrary data. Both the key and the value must be 63 characters or less each. At most 100 annotations. |
| `↳ state` | `int` Output only. The Recognizer lifecycle state. |
| `↳ create_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. Creation time. |
| `↳ update_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The most recent time this Recognizer was modified. |
| `↳ delete_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The time at which this Recognizer was requested for deletion. |
| `↳ expire_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The time at which this Recognizer will be purged. |
| `↳ etag` | `string` Output only. This checksum is computed by the server based on the value of other fields. This may be sent on update, undelete, and delete requests to ensure the client has an up-to-date value before proceeding. |
| `↳ reconciling` | `bool` Output only. Whether or not this Recognizer is in the process of being updated. |
| `↳ kms_key_name` | `string` Output only. The [KMS key name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which the Recognizer is encrypted. The expected format is `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. |
| `↳ kms_key_version_name` | `string` Output only. The [KMS key version name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions) with which the Recognizer is encrypted. The expected format is `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`. |

### getName

Output only. Identifier. The resource name of the Recognizer.

Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.

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

### setName

Output only. Identifier. The resource name of the Recognizer.

Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.

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

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

### getUid

Output only. System-assigned unique identifier for the Recognizer.

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

### setUid

Output only. System-assigned unique identifier for the Recognizer.

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

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

### getDisplayName

User-settable, human-readable name for the Recognizer. Must be 63
characters or less.

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

### setDisplayName

User-settable, human-readable name for the Recognizer. Must be 63
characters or less.

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

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

### getModel

Optional. This field is now deprecated. Prefer the
[`model`](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig#_Google_Cloud_Speech_V2_RecognitionConfig__getModel__) field in the
[`RecognitionConfig`](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig) message.

Which model to use for recognition requests. Select the model best suited
to your domain to get best results.
Guidance for choosing which model to use can be found in the [Transcription
Models
Documentation](https://cloud.google.com/speech-to-text/v2/docs/transcription-model)
and the models supported in each region can be found in the [Table Of
Supported
Models](https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages).

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

### setModel

Optional. This field is now deprecated. Prefer the
[`model`](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig#_Google_Cloud_Speech_V2_RecognitionConfig__getModel__) field in the
[`RecognitionConfig`](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig) message.

Which model to use for recognition requests. Select the model best suited
to your domain to get best results.
Guidance for choosing which model to use can be found in the [Transcription
Models
Documentation](https://cloud.google.com/speech-to-text/v2/docs/transcription-model)
and the models supported in each region can be found in the [Table Of
Supported
Models](https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages).

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

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

### getLanguageCodes

Optional. This field is now deprecated. Prefer the
[`language_codes`](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig#_Google_Cloud_Speech_V2_RecognitionConfig__getLanguageCodes__)
field in the
[`RecognitionConfig`](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig) message.

The language of the supplied audio as a
[BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
Supported languages for each model are listed in the [Table of Supported
Models](https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages).
If additional languages are provided, recognition result will contain
recognition in the most likely language detected. The recognition result
will include the language tag of the language detected in the audio.
When you create or update a Recognizer, these values are
stored in normalized BCP-47 form. For example, "en-us" is stored as
"en-US".

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setLanguageCodes

Optional. This field is now deprecated. Prefer the
[`language_codes`](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig#_Google_Cloud_Speech_V2_RecognitionConfig__getLanguageCodes__)
field in the
[`RecognitionConfig`](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognitionConfig) message.

The language of the supplied audio as a
[BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
Supported languages for each model are listed in the [Table of Supported
Models](https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages).
If additional languages are provided, recognition result will contain
recognition in the most likely language detected. The recognition result
will include the language tag of the language detected in the audio.
When you create or update a Recognizer, these values are
stored in normalized BCP-47 form. For example, "en-us" is stored as
"en-US".

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

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

### getDefaultRecognitionConfig

Default configuration to use for requests with this Recognizer.

This can be overwritten by inline configuration in the
[RecognizeRequest.config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__)
field.

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

### hasDefaultRecognitionConfig

### clearDefaultRecognitionConfig

### setDefaultRecognitionConfig

Default configuration to use for requests with this Recognizer.

This can be overwritten by inline configuration in the
[RecognizeRequest.config](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.RecognizeRequest#_Google_Cloud_Speech_V2_RecognizeRequest__getConfig__)
field.

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

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

### getAnnotations

Allows users to store small amounts of arbitrary data.

Both the key and the value must be 63 characters or less each.
At most 100 annotations.

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

### setAnnotations

Allows users to store small amounts of arbitrary data.

Both the key and the value must be 63 characters or less each.
At most 100 annotations.

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

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

### getState

Output only. The Recognizer lifecycle state.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [State](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.Recognizer.State). |

### setState

Output only. The Recognizer lifecycle state.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [State](https://docs.cloud.google.com/php/docs/reference/cloud-speech/latest/V2.Recognizer.State). |

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

### getCreateTime

Output only. Creation time.

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

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. Creation time.

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

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

### getUpdateTime

Output only. The most recent time this Recognizer was modified.

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

### hasUpdateTime

### clearUpdateTime

### setUpdateTime

Output only. The most recent time this Recognizer was modified.

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

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

### getDeleteTime

Output only. The time at which this Recognizer was requested for deletion.

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

### hasDeleteTime

### clearDeleteTime

### setDeleteTime

Output only. The time at which this Recognizer was requested for deletion.

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

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

### getExpireTime

Output only. The time at which this Recognizer will be purged.

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

### hasExpireTime

### clearExpireTime

### setExpireTime

Output only. The time at which this Recognizer will be purged.

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

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

### getEtag

Output only. This checksum is computed by the server based on the value of
other fields. This may be sent on update, undelete, and delete requests to
ensure the client has an up-to-date value before proceeding.

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

### setEtag

Output only. This checksum is computed by the server based on the value of
other fields. This may be sent on update, undelete, and delete requests to
ensure the client has an up-to-date value before proceeding.

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

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

### getReconciling

Output only. Whether or not this Recognizer is in the process of being
updated.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setReconciling

Output only. Whether or not this Recognizer is in the process of being
updated.

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

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

### getKmsKeyName

Output only. The [KMS key
name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
the Recognizer is encrypted. The expected format is
`projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.

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

### setKmsKeyName

Output only. The [KMS key
name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
the Recognizer is encrypted. The expected format is
`projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.

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

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

### getKmsKeyVersionName

Output only. The [KMS key version
name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
with which the Recognizer is encrypted. The expected format is
`projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.

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

### setKmsKeyVersionName

Output only. The [KMS key version
name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
with which the Recognizer is encrypted. The expected format is
`projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.

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

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