# Cloud AutoML V1 Client - Class TextSentimentAnnotation (2.1.3)

2.1.3 (latest) 2.1.2 2.0.5 1.6.5 1.5.4 1.4.17 Reference documentation and code samples for the Cloud AutoML V1 Client class TextSentimentAnnotation.

Contains annotation details specific to text sentiment.

Generated from protobuf message `google.cloud.automl.v1.TextSentimentAnnotation`

## Namespace

Google \\ Cloud \\ AutoMl \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ sentiment` | `int` Output only. The sentiment with the semantic, as given to the [AutoMl.ImportData](https://docs.cloud.google.com/php/docs/reference/cloud-automl/latest/V1.Client.AutoMlClient#_Google_Cloud_AutoMl_V1_Client_AutoMlClient__importData__) when populating the dataset from which the model used for the prediction had been trained. The sentiment values are between 0 and Dataset.text_sentiment_dataset_metadata.sentiment_max (inclusive), with higher value meaning more positive sentiment. They are completely relative, i.e. 0 means least positive sentiment and sentiment_max means the most positive from the sentiments present in the train data. Therefore e.g. if train data had only negative sentiment, then sentiment_max, would be still negative (although least negative). The sentiment shouldn't be confused with "score" or "magnitude" from the previous Natural Language Sentiment Analysis API. |

### getSentiment

Output only. The sentiment with the semantic, as given to the
[AutoMl.ImportData](https://docs.cloud.google.com/php/docs/reference/cloud-automl/latest/V1.Client.AutoMlClient#_Google_Cloud_AutoMl_V1_Client_AutoMlClient__importData__) when populating the dataset from which the model used
for the prediction had been trained.

The sentiment values are between 0 and
Dataset.text_sentiment_dataset_metadata.sentiment_max (inclusive),
with higher value meaning more positive sentiment. They are completely
relative, i.e. 0 means least positive sentiment and sentiment_max means
the most positive from the sentiments present in the train data. Therefore
e.g. if train data had only negative sentiment, then sentiment_max, would
be still negative (although least negative).
The sentiment shouldn't be confused with "score" or "magnitude"
from the previous Natural Language Sentiment Analysis API.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setSentiment

Output only. The sentiment with the semantic, as given to the
[AutoMl.ImportData](https://docs.cloud.google.com/php/docs/reference/cloud-automl/latest/V1.Client.AutoMlClient#_Google_Cloud_AutoMl_V1_Client_AutoMlClient__importData__) when populating the dataset from which the model used
for the prediction had been trained.

The sentiment values are between 0 and
Dataset.text_sentiment_dataset_metadata.sentiment_max (inclusive),
with higher value meaning more positive sentiment. They are completely
relative, i.e. 0 means least positive sentiment and sentiment_max means
the most positive from the sentiments present in the train data. Therefore
e.g. if train data had only negative sentiment, then sentiment_max, would
be still negative (although least negative).
The sentiment shouldn't be confused with "score" or "magnitude"
from the previous Natural Language Sentiment Analysis API.

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

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