{"id":17963,"date":"2017-01-27T18:08:22","date_gmt":"2017-01-27T18:08:22","guid":{"rendered":"https:\/\/developer.kore.com\/?post_type=docs&#038;p=9724"},"modified":"2024-01-29T10:25:25","modified_gmt":"2024-01-29T10:25:25","slug":"working-with-tone-processing","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/advanced-topics\/working-with-tone-processing\/","title":{"rendered":"Tone Analysis"},"content":{"rendered":"<section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row type_default valign_top\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p>The XO Platform <a href=\"https:\/\/kore.ai\/platform\/design-and-build\/natural-language-processing\/\">Natural Language Processing (NLP)<\/a> interpreter can parse user utterances for specific words and phrases, and then provide an average tone score based on the connotation, word placement, and any added modifiers. You can use the score to help assess the user input and direct the flow of the conversation between the Virtual Assistant and the user.<\/p>\n<p>For example, if the tone score indicates a user is angry or sad, you want to transition the conversation to a live agent. In a dialog task, you can access the tone score from the <code>Context<\/code> object or you can configure events to be triggered, from the <a href=\"\/docs\/bots\/advanced-topics\/sentiment-management\/\">Sentiment Management<\/a> option under <strong>Intelligence<\/strong>.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Tones_Types\">Tones Types<\/span><\/h3>\n<p>The Kore.ai XO Platform evaluates user inputs to find the following six possible emotions:<\/p>\n<ul>\n<li>angry<\/li>\n<li>disgust<\/li>\n<li>fear<\/li>\n<li>sad<\/li>\n<li>joy<\/li>\n<li>positive &#8211; A special tone used to evaluate the general positivity of an utterance.<\/li>\n<\/ul>\n<p>The XO Platform tone algorithm provides a nuanced overview of the user utterance tone by not making the emotions mutually exclusive. For example, an input could yield a high score for fear and a mild score for sadness. Another input could yield a very high score for joy while having a negative score for sadness.<\/p>\n<p>Post v8.1, the platform can identify the emojis in user utterance and set the tone accordingly.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Score_Tone_Emotions\">Score Tone Emotions<\/span><\/h3>\n<p>The XO Platform scores a tone emotion on a scale range of -3 to +3 where positive values represent an <strong>expressed tone emotion<\/strong> and a negative value represents a <strong>suppressed tone emotion<\/strong>.<\/p>\n<p>For positive values, the tone emotion is explicitly communicated, while negative values are explicitly negated.<\/p>\n<p>For example, a user&#8217;s utterance, <em>I am happy about this news,<\/em> returns a positive tone score for joy, while <em>I am <\/em><em>not<\/em><em> happy about this news<\/em>\u00a0returns a negative score for joy.<\/p>\n<p>The following scale shows the relationship of the score to the level of positive expression of the tone emotion or negative suppression of the tone emotion.<\/p>\n<ul>\n<li><strong>+3<\/strong> &#8211; The user definitely expressed the tone emotion.<\/li>\n<li><strong>+2<\/strong> &#8211; The user expressed the tone emotion.<\/li>\n<li><strong>+1<\/strong> &#8211; The user likely expressed the tone emotion.<\/li>\n<li><strong>0<\/strong> &#8211; The user tone emotion is neutral.<\/li>\n<li><strong>-1<\/strong> &#8211; The user likely suppressed the tone emotion.<\/li>\n<li><strong>-2<\/strong> &#8211; The user suppressed the tone emotion.<\/li>\n<li><strong>-3<\/strong> &#8211; The user definitely suppressed the tone emotion.<\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"About_Tone_Scores\">About Tone Scores<\/span><\/h3>\n<p>The overall tone score is calculated as a function of the base tone value and any tone modifiers. Modifiers are generally adverbs or adjectives that supplement a tone emotion word, either to increase or decrease the base tone score.<\/p>\n<p>For example, a user&#8217;s utterance, <em>I am <\/em><em>extremely<\/em><em> disappointed<\/em>, returns a higher tone score for the angry tone emotion than if the user utterance is <em>I am disappointed.<\/em> Conversely, a user utterance of <em>I am <\/em><em>not <\/em><em>disappointed<\/em>\u00a0negates the tone emotion and the tone score.<\/p>\n<p>The value of the base tone and modifiers are used to calculate the final tone score for each tone emotion. The tone analyzer compiles all base tones based on the tone emotion type and then calculates the average score of each tone emotion type in the current dialog task node and the tone total score since the last reset.<\/p>\n<p>Tone results are returned as <code>Context<\/code> object variables as:<\/p>\n<ul>\n<li><code>message_tone<\/code> &#8211; An array of recognized tone emotions and scores for the current node in a dialog task.<\/li>\n<li><code>dialog_tone<\/code> &#8211; An array of average recognized tone emotions and scores for the entire conversation session. This value is reset at the end of each conversation session.<\/li>\n<\/ul>\n<p><span class=\"crayon-s\">Each variable is populated with key\/value pairs for each recognized tone emotion. Key\/value pairs are not returned if a tone is not detected for an emotion. However, the NLP engine returns a tone score of 0 when a tone is recognized as neutral. When you access tone variables in the <code>Context<\/code> object, you must be able to handle positive, negative, zero, as well as undefined results.<\/span><\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h3><span class=\"ez-toc-section\" id=\"Examples\">Examples<\/span><\/h3>\n<pre class=\"lang:default decode:true \">message_tone\r\n   0\r\n      tone_name : positive\r\n      level : 2\r\n   1\r\n      tone_name : disgust\r\n      level : -2\r\n   2\r\n      tone_name : angry\r\n      level : -2\r\ndialog_tone\r\n   0\r\n      tone_name : angry\r\n      level : -3\r\n   1\r\n      tone_name : sad\r\n      level : -3\r\n   2\r\n      tone_name : positive\r\n      level : 3\r\n   3\r\n      tone_name : joy\r\n      level : 3<\/pre>\n<p>Here are some examples of test sentences with their associated tone emotion scores:<br \/>\n<em>I don&#8217;t think that this is a good idea and I am not happy with how it came out, especially because of your attitude.<\/em><\/p>\n<pre class=\"lang:default decode:true \">dialog_tone\r\n   0\r\n      tone_name : joy\r\n      count : 1\r\n      level : 0.67\r\n   1\r\n      tone_name : sad\r\n      count : 1\r\n      level : 0.5\r\n   2\r\n      tone_name : angry\r\n      count : 1\r\n      level : 0.5<\/pre>\n<p><em>This is a great idea! I&#8217;m super excited already.<\/em><\/p>\n<pre class=\"lang:default decode:true\">dialog_tone\r\n   0\r\n      tone_name : joy\r\n      count : 1\r\n      level : 3\r\n   1\r\n      tone_name : sad\r\n      count : 1\r\n      level : 2.8\r\n   2\r\n      tone_name : angry\r\n      count : 1\r\n      level : -3\r\n}<\/pre>\n<p><em>This was a funny and casually well-written book, a good read. But it&#8217;s a little frustrating because it abandons the <strong>narrative<\/strong>, if you will, without finishing it.<\/em><\/p>\n<pre class=\"lang:default decode:true \">dialog_tone\r\n   0\r\n      tone_name : joy\r\n      count : 1\r\n      level : 1.5\r\n   1\r\n      tone_name : sad\r\n      count : 1\r\n      level : -1.5\r\n   2\r\n      tone_name : angry\r\n      count : 1\r\n      level : -1<\/pre>\n<p>You can access and use tone scores to help drive the flow of your dialog task using conditional transition statements. For example,<\/p>\n<pre class=\"lang:default decode:true\">if context.message_tone.angry &gt; 2.0\r\n    then goTo liveAgent<\/pre>\n<p>For more information, refer to <a href=\"\/docs\/bots\/bot-builder-tool\/dialog-task\/context-object\/\">Context Object<\/a>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Adding_Sentiment_Words_to_Concepts\">Adding Sentiment Words to Concepts<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">For identifying the tone and analyzing the sentiment of a user utterance\/phrase, you can add those utterances in the Concepts.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The sentiment words are all stored in concepts and it is possible for a virtual assistant to extend the concepts by entering appropriate new words under the relevant concept name, during the concept training.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The syntax for the concept name is: <\/span><span style=\"font-weight: 400;\">~tone-&lt;tonename&gt;-&lt;level&gt;<\/span><span style=\"font-weight: 400;\">, where<\/span><span style=\"font-weight: 400;\"> &lt;tonename&gt;<\/span><span style=\"font-weight: 400;\"> indicates any of the 6 tone types listed in <\/span><a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/advanced-topics\/working-with-tone-processing\/#Tones_Types\"><span style=\"font-weight: 400;\">Tone Types<\/span><\/a><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">&lt;level&gt;<\/span><span style=\"font-weight: 400;\"> is a number from 1 to 7. 1 is equivalent to a -3, 7 is +3, and 4 is the neutral 0. <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/advanced-topics\/working-with-tone-processing\/#Score_Tone_Emotions\" target=\"_blank\" rel=\"noopener noreferrer\">Learn more<\/a>.<\/span><\/p>\n<div class=\"alert alert-info\"><b>Note<\/b>: Apart from the basic tone words, sentiment analysis also uses words that can increase or decrease intensity, like &#8220;very&#8221; or &#8220;extremely&#8221;. However, you don&#8217;t have to add different phrases covering all the possibilities for various levels. Just add a basic tone word, and these intensifiers will adjust the level automatically.<\/div>\n<p><span style=\"font-weight: 400;\">The following are some examples of words that can be mapped to relevant concepts.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">The word <\/span><em><span style=\"font-weight: 400;\">freaking <\/span><\/em><span style=\"font-weight: 400;\">could be defined as a synonym under <\/span><span style=\"font-weight: 400;\">~tone-angry-7,<\/span><span style=\"font-weight: 400;\"> which indicates real bad anger.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">The word <\/span><em><span style=\"font-weight: 400;\">Yikes!<\/span><\/em><span style=\"font-weight: 400;\"> could be defined as a synonym under <\/span><span style=\"font-weight: 400;\">~tone-angry-5,<\/span><span style=\"font-weight: 400;\"> which indicates a bit angry.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">The word <\/span><em><span style=\"font-weight: 400;\">please <\/span><\/em><span style=\"font-weight: 400;\">would come under<\/span><span style=\"font-weight: 400;\"> ~tone-angry-4<\/span><span style=\"font-weight: 400;\"> which indicates a neutral tone.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">The word<\/span><em><span style=\"font-weight: 400;\"> Thanks! <\/span><\/em><span style=\"font-weight: 400;\">indicates a happy tone and could be defined as a synonym under <\/span><span style=\"font-weight: 400;\">~tone-angry-1<\/span><span style=\"font-weight: 400;\">, which is mapped to not angry at all tone.<\/span><\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_medium\"><\/div><\/div><\/div><\/div><\/div><\/div><\/section><section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row type_default valign_top\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"The XO Platform Natural Language Processing (NLP) interpreter can parse user utterances for specific words and phrases, and then provide an average tone score based on the connotation, word placement, and any added modifiers. You can use the score to help assess the user input and direct the flow of the conversation between the Virtual...","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-17963","post","type-post","status-publish","format-standard","hentry","category-advanced-topics"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/17963","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=17963"}],"version-history":[{"count":29,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/17963\/revisions"}],"predecessor-version":[{"id":61095,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/17963\/revisions\/61095"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=17963"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=17963"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=17963"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}