# Cloud Natural Language V2 Client - Class AnnotateTextResponse (1.2.1)

1.2.1 (latest) 1.2.0 1.1.4 1.0.1 0.34.3 0.33.0 0.32.7 0.31.3 0.30.2 0.29.0 0.28.5 Reference documentation and code samples for the Cloud Natural Language V2 Client class AnnotateTextResponse.

The text annotations response message.

Generated from protobuf message `google.cloud.language.v2.AnnotateTextResponse`

## Namespace

Google \\ Cloud \\ Language \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ sentences` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.Sentence>` Sentences in the input document. Populated if the user enables [AnnotateTextRequest.Features.extract_document_sentiment](https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.AnnotateTextRequest.Features#_Google_Cloud_Language_V2_AnnotateTextRequest_Features__getExtractDocumentSentiment__). |
| `↳ entities` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.Entity>` Entities, along with their semantic information, in the input document. Populated if the user enables [AnnotateTextRequest.Features.extract_entities](https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.AnnotateTextRequest.Features#_Google_Cloud_Language_V2_AnnotateTextRequest_Features__getExtractEntities__) or AnnotateTextRequest.Features.extract_entity_sentiment. |
| `↳ document_sentiment` | `https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.Sentiment` The overall sentiment for the document. Populated if the user enables [AnnotateTextRequest.Features.extract_document_sentiment](https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.AnnotateTextRequest.Features#_Google_Cloud_Language_V2_AnnotateTextRequest_Features__getExtractDocumentSentiment__). |
| `↳ language_code` | `string` The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language field for more details. |
| `↳ categories` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.ClassificationCategory>` Categories identified in the input document. |
| `↳ moderation_categories` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.ClassificationCategory>` Harmful and sensitive categories identified in the input document. |
| `↳ language_supported` | `bool` Whether the language is officially supported by all requested features. The API may still return a response when the language is not supported, but it is on a best effort basis. |

### getSentences

Sentences in the input document. Populated if the user enables
[AnnotateTextRequest.Features.extract_document_sentiment](https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.AnnotateTextRequest.Features#_Google_Cloud_Language_V2_AnnotateTextRequest_Features__getExtractDocumentSentiment__).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.Sentence>` |   |

### setSentences

Sentences in the input document. Populated if the user enables
[AnnotateTextRequest.Features.extract_document_sentiment](https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.AnnotateTextRequest.Features#_Google_Cloud_Language_V2_AnnotateTextRequest_Features__getExtractDocumentSentiment__).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.Sentence>` |

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

### getEntities

Entities, along with their semantic information, in the input document.

Populated if the user enables
[AnnotateTextRequest.Features.extract_entities](https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.AnnotateTextRequest.Features#_Google_Cloud_Language_V2_AnnotateTextRequest_Features__getExtractEntities__)
or
AnnotateTextRequest.Features.extract_entity_sentiment.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.Entity>` |   |

### setEntities

Entities, along with their semantic information, in the input document.

Populated if the user enables
[AnnotateTextRequest.Features.extract_entities](https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.AnnotateTextRequest.Features#_Google_Cloud_Language_V2_AnnotateTextRequest_Features__getExtractEntities__)
or
AnnotateTextRequest.Features.extract_entity_sentiment.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.Entity>` |

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

### getDocumentSentiment

The overall sentiment for the document. Populated if the user enables
[AnnotateTextRequest.Features.extract_document_sentiment](https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.AnnotateTextRequest.Features#_Google_Cloud_Language_V2_AnnotateTextRequest_Features__getExtractDocumentSentiment__).

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

### hasDocumentSentiment

### clearDocumentSentiment

### setDocumentSentiment

The overall sentiment for the document. Populated if the user enables
[AnnotateTextRequest.Features.extract_document_sentiment](https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.AnnotateTextRequest.Features#_Google_Cloud_Language_V2_AnnotateTextRequest_Features__getExtractDocumentSentiment__).

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

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

### getLanguageCode

The language of the text, which will be the same as the language specified
in the request or, if not specified, the automatically-detected language.

See Document.language field for more details.

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

### setLanguageCode

The language of the text, which will be the same as the language specified
in the request or, if not specified, the automatically-detected language.

See Document.language field for more details.

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

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

### getCategories

Categories identified in the input document.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.ClassificationCategory>` |   |

### setCategories

Categories identified in the input document.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.ClassificationCategory>` |

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

### getModerationCategories

Harmful and sensitive categories identified in the input document.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.ClassificationCategory>` |   |

### setModerationCategories

Harmful and sensitive categories identified in the input document.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V2.ClassificationCategory>` |

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

### getLanguageSupported

Whether the language is officially supported by all requested features.

The API may still return a response when the language is not supported, but
it is on a best effort basis.

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

### setLanguageSupported

Whether the language is officially supported by all requested features.

The API may still return a response when the language is not supported, but
it is on a best effort basis.

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

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