本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
您可以使用情緒分析來判斷使用者表達用語中表達的情緒。使用情緒資訊,您可以管理對話流程或執行通話後分析。例如,如果使用者情緒為負面,您可以建立流程,將對話轉交給人類客服人員。
Amazon Lex 與 Amazon Comprehend 整合,以偵測使用者情緒。Amazon Comprehend 的回應指出文字的整體情緒是正面、中性、負面或混合。回應包含使用者表達用語最有可能的情緒,以及每個情緒類別的分數。分數代表正確偵測到的情緒的可能性。
您可以使用主控台或使用 Amazon Lex API 來啟用機器人的情緒分析。您可以在機器人的別名上啟用情緒分析。在 Amazon Lex 主控台上:
-
選擇別名。
-
在詳細資訊中,選擇編輯。
-
選擇啟用情緒分析以開啟或關閉情緒分析。
-
選擇 Confirm (確認) 以儲存變更。
如果您使用 API,請呼叫 CreateBotAlias 操作,並將 detectSentiment
欄位設定為 true
。
啟用情緒分析時,RecognizeText 和 RecognizeUtterance 操作的回應會傳回interpretations
結構sentimentResponse
中呼叫的欄位,其中包含其他中繼資料。sentimentResponse
欄位有兩個欄位,sentiment
和 sentimentScore
,其中包含情緒分析的結果。如果您使用的是 Lambda 函數, sentimentResponse
欄位會包含在傳送至函數的事件資料中。
以下是 sentimentResponse
欄位傳回 RecognizeText
或 RecognizeUtterance
回應一部分的範例。
sentimentResponse {
"sentimentScore": {
"mixed": 0.030585512690246105,
"positive": 0.94992071056365967,
"neutral": 0.0141543131828308,
"negative": 0.00893945890665054
},
"sentiment": "POSITIVE"
}
Amazon Lex 代表您呼叫 Amazon Comprehend,以判斷機器人處理的每個表達式中的情緒。透過啟用情緒分析,即表示您同意 Amazon Comprehend 的服務條款和協議。如需 Amazon Comprehend 定價的詳細資訊,請參閱 Amazon Comprehend 定價
如需 Amazon Comprehend 情緒分析如何運作的詳細資訊,請參閱《Amazon Comprehend 開發人員指南》中的判斷情緒。