Reference documentation and code samples for the Cloud AutoML V1 Client class TextSentimentAnnotation.
Contains annotation details specific to text sentiment.
Generated from protobuf messagegoogle.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 theAutoMl.ImportDatawhen 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 theAutoMl.ImportDatawhen 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 theAutoMl.ImportDatawhen 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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud AutoML V1 Client - Class TextSentimentAnnotation (2.0.5)\n\nVersion latestkeyboard_arrow_down\n\n- [2.0.5 (latest)](/php/docs/reference/cloud-automl/latest/V1.TextSentimentAnnotation)\n- [2.0.4](/php/docs/reference/cloud-automl/2.0.4/V1.TextSentimentAnnotation)\n- [1.6.5](/php/docs/reference/cloud-automl/1.6.5/V1.TextSentimentAnnotation)\n- [1.5.4](/php/docs/reference/cloud-automl/1.5.4/V1.TextSentimentAnnotation)\n- [1.4.17](/php/docs/reference/cloud-automl/1.4.17/V1.TextSentimentAnnotation) \nReference documentation and code samples for the Cloud AutoML V1 Client class TextSentimentAnnotation.\n\nContains annotation details specific to text sentiment.\n\nGenerated from protobuf message `google.cloud.automl.v1.TextSentimentAnnotation`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ AutoMl \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getSentiment\n\nOutput only. The sentiment with the semantic, as given to the\n[AutoMl.ImportData](/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\nfor the prediction had been trained.\n\nThe sentiment values are between 0 and\nDataset.text_sentiment_dataset_metadata.sentiment_max (inclusive),\nwith higher value meaning more positive sentiment. They are completely\nrelative, i.e. 0 means least positive sentiment and sentiment_max means\nthe most positive from the sentiments present in the train data. Therefore\ne.g. if train data had only negative sentiment, then sentiment_max, would\nbe still negative (although least negative).\nThe sentiment shouldn't be confused with \"score\" or \"magnitude\"\nfrom the previous Natural Language Sentiment Analysis API.\n\n### setSentiment\n\nOutput only. The sentiment with the semantic, as given to the\n[AutoMl.ImportData](/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\nfor the prediction had been trained.\n\nThe sentiment values are between 0 and\nDataset.text_sentiment_dataset_metadata.sentiment_max (inclusive),\nwith higher value meaning more positive sentiment. They are completely\nrelative, i.e. 0 means least positive sentiment and sentiment_max means\nthe most positive from the sentiments present in the train data. Therefore\ne.g. if train data had only negative sentiment, then sentiment_max, would\nbe still negative (although least negative).\nThe sentiment shouldn't be confused with \"score\" or \"magnitude\"\nfrom the previous Natural Language Sentiment Analysis API."]]