Sentiment analysis is a feature that analyzes messages during a conversation between a human agent and an end-user to determine emotional intent. You can enable it during conversation profile creation or editing. If you are editing an existing conversation profile, you will only see the effects in conversations after the conversation profile updates. You also have the option to enable sentiment analysis when you create a conversation profile using the Agent Assist console.
- Send a
createConversationrequest using a
ConversationProfilewith this feature enabled.
- Sentiment results are returned in
- If you have enabled Cloud Pub/Sub integration
in Agent Assist, sentiment result will also appear in the
Interpret sentiment analysis results
Sentiment is represented by
magnitude values, metrics that are
returned in the response. The
score of the sentiment ranges between -1.0
(negative) and 1.0 (positive) and corresponds to the overall emotional leaning
of the text. The
magnitude value indicates the overall strength of emotion
(both positive and negative) within the given text, between
For more information about interpreting these metrics, see the
Natural Language sentiment analysis documentation.
The following are two examples of sentiment analysis output from the Natural Language API demo feature. To use the demo to test sentiment analysis on sample text: Paste the text into the text box, click ANALYZE, and then select the Sentiment tab.
Text: "I'm not happy."
score is -0.9, and the
magnitude is 0.9. This indicates a
very strong negative emotional leaning, with low-to-moderate strength of
Text: "Google cloud is the cloud service from Google."
The returned values of both
magnitude is 0, which means that the
text does not show any emotion or strength of feelings.
Text: "I'm extremely angry and disappointed for the result. On the other hand, I'm happy to see our team was working very hard and show professional attitude."
Unlike Example 1, this text contains two sentences. The output includes
Entire document metrics as well as metrics for each individual sentence.
Entire document values represent the metrics of both sentences combined, not one
or the other. Each individual sentence is also listed with its corresponding
The returned sentiment
score for the entire document is 0, while the
magnitude is 1.6. A
score of 0 in a multi-sentence document can mean that
it's truly emotionally neutral, or that positive and negative emotional leanings
at various points in the text canceled each other out. Text with a truly neutral
sentiment will also have a
magnitude equal to or close to 0. In this case, the
magnitude of 1.6 means that the sentiment of the two sentences
is not truly neutral, but mixed (for example angry, disappointed and happy at
various points in the text). Looking at the
score values for each sentence,
one is strongly positive (0.8) and the other is strongly negative (-0.8), which
caused the entire document
score to average to 0.