[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-19。"],[[["\u003cp\u003eSentiment analysis assesses the emotional intent of messages exchanged between human agents and end-users during a conversation.\u003c/p\u003e\n"],["\u003cp\u003eThis feature can be activated when creating or modifying a conversation profile, with updates only affecting subsequent conversations.\u003c/p\u003e\n"],["\u003cp\u003eSentiment is quantified by a \u003ccode\u003escore\u003c/code\u003e ranging from -1.0 (negative) to 1.0 (positive) and a \u003ccode\u003emagnitude\u003c/code\u003e value representing the emotional strength from 0.0 to infinity.\u003c/p\u003e\n"],["\u003cp\u003eFor multi-sentence text, sentiment analysis provides both overall document metrics and individual sentence metrics, with a neutral document score possibly indicating mixed sentiments.\u003c/p\u003e\n"],["\u003cp\u003eSentiment results are accessible in the \u003ccode\u003eAnalyzeContentResponse.message.sentimentAnalysis\u003c/code\u003e and, if Cloud Pub/Sub integration is enabled, within the \u003ccode\u003eNewMessagePayload\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Sentiment analysis for chat data\n\nSentiment analysis is a feature that analyzes messages during a conversation\nbetween a human agent and an end-user to determine emotional intent. You can\nenable it during conversation profile creation or editing. If you are editing an\nexisting conversation profile, you will only see the effects in conversations\nafter the conversation profile updates. You also have the option to enable\nsentiment analysis when you [create a conversation profile using the\nAgent Assist console](/agent-assist/docs/conversation-profile).\n\n1. Set `enableSentimentAnalysis` to `true` in [`MessageAnalysisConfig`](/dialogflow/es/docs/reference/rest/v2/projects.conversationProfiles#messageanalysisconfig).\n2. Send a [`createConversation`](/dialogflow/es/docs/reference/rest/v2/projects.conversations/create) request using a [`ConversationProfile`](/dialogflow/es/docs/reference/rest/v2/projects.conversationProfiles) with this feature enabled.\n3. Sentiment results are returned in [`AnalyzeContentResponse.message.sentimentAnalysis`](/dialogflow/es/docs/reference/rest/v2/Message).\n4. If you have [enabled Cloud Pub/Sub](/agent-assist/docs/pub-sub) integration in Agent Assist, sentiment result will also appear in the `NewMessagePayload`.\n\nInterpret sentiment analysis results\n------------------------------------\n\nSentiment is represented by `score` and `magnitude` values, metrics that are\nreturned in the response. The `score` of the sentiment ranges between -1.0\n(negative) and 1.0 (positive) and corresponds to the overall emotional leaning\nof the text. The `magnitude` value indicates the overall strength of emotion\n(both positive and negative) within the given text, between `0.0` and `+inf`.\nFor more information about interpreting these metrics, see the\n[Natural Language sentiment analysis documentation](/natural-language/docs/basics#interpreting_sentiment_analysis_values).\n\nThe following are two examples of sentiment analysis output from the\n[Natural Language API demo feature](https://cloud.google.com/natural-language).\nTo use the demo to test sentiment analysis on sample text: Paste the text into\nthe text box, click **ANALYZE** , and then select the **Sentiment** tab.\n\n### Example 1\n\n**Text: \"I'm not happy.\"**\n\nThe returned `score` is -0.9, and the `magnitude` is 0.9. This indicates a\nvery strong negative emotional leaning, with low-to-moderate strength of\nemotion.\n\n### Example 2\n\n**Text: \"Google cloud is the cloud service from Google.\"**\n\nThe returned values of both `score` and `magnitude` is 0, which means that the\ntext does not show any emotion or strength of feelings.\n\n### Example 3\n\n**Text: \"I'm extremely angry and disappointed for the result. On the other hand,\nI'm happy to see our team was working very hard and show professional\nattitude.\"**\n\nUnlike Example 1, this text contains two sentences. The output includes\n**Entire document** metrics as well as metrics for each individual sentence.\nEntire document values represent the metrics of both sentences combined, not one\nor the other. Each individual sentence is also listed with its corresponding\n`magnitude` and `score` value.\n\nThe returned sentiment `score` for the entire document is 0, while the\n`magnitude` is 1.6. A `score` of 0 in a multi-sentence document can mean that\nit's truly emotionally neutral, or that positive and negative emotional leanings\nat various points in the text canceled each other out. Text with a truly neutral\nsentiment will also have a `magnitude` equal to or close to 0. In this case, the\nrelatively high `magnitude` of 1.6 means that the sentiment of the two sentences\nis not truly neutral, but mixed (for example angry, disappointed and happy at\nvarious points in the text). Looking at the `score` values for each sentence,\none is strongly positive (0.8) and the other is strongly negative (-0.8), which\ncaused the entire document `score` to average to 0."]]