{"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":"2021-02-17T11:13:35","modified_gmt":"2021-02-17T11:13:35","slug":"working-with-tone-processing","status":"publish","type":"post","link":"https:\/\/multisite.korebots.com\/v9-0\/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 via_grid cols_1 laptops-cols_inherit tablets-cols_inherit mobiles-cols_1 valign_top type_default stacking_default\"><div class=\"wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><p>The bots 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 bot and the user.<\/p>\n<p>For example, if the tone score indicates a user is angry or sad, you want to transition the bot 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<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Tones_Types\"><\/span>Tones Types<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Kore.ai bots 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 bots 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<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Score_Tone_Emotions\"><\/span>Score Tone Emotions<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The bots 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 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<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"About_Tone_Scores\"><\/span>About Tone Scores<span class=\"ez-toc-section-end\"><\/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 utterance as <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 dialog task session. This value is reset at the end of each dialog 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<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Examples\"><\/span>Examples<span class=\"ez-toc-section-end\"><\/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<i>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.<\/i><\/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><i>This is a great idea! I&#8217;m super excited already.<\/i><\/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><i>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.<\/i><\/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<\/div><\/div><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>[vc_raw_html]JTNDZGl2JTIwY2xhc3MlM0QlMjJ3LXBvc3QtZWxtJTIwcG9zdF9uYXZpZ2F0aW9uJTIwbGF5b3V0X3NpbXBsZSUyMGludl9mYWxzZSUyMiUzRSUwQSUwOSUzQ2ElMjBjbGFzcyUzRCUyMnBvc3RfbmF2aWdhdGlvbi1pdGVtJTIwb3JkZXJfZmlyc3QlMjB0b19wcmV2JTIyJTIwaHJlZiUzRCUyMmh0dHBzJTNBJTJGJTJGZGV2ZWxvcGVyLmtvcmUuYWklMkZkb2NzJTJGYm90cyUyRmFkdmFuY2VkLXRvcGljcyUyRnNlbnRpbWVudC1tYW5hZ2VtZW50JTJGJTIyJTNFJTNDJTJGcCUzRSUwQSUzQ2RpdiUyMGNsYXNzJTNEJTIycG9zdF9uYXZpZ2F0aW9uLWl0ZW0tYXJyb3clMjIlM0UlM0MlMkZkaXYlM0UlMEElM0NkaXYlMjBjbGFzcyUzRCUyMnBvc3RfbmF2aWdhdGlvbi1pdGVtLW1ldGElMjIlM0VQcmV2aW91cyUzQyUyRmRpdiUzRSUwQSUzQ2RpdiUyMGNsYXNzJTNEJTIycG9zdF9uYXZpZ2F0aW9uLWl0ZW0tdGl0bGUlMjIlM0UlM0NzcGFuJTNFU2VudGltZW50JTIwTWFuYWdlbWVudCUzQyUyRnNwYW4lM0UlM0MlMkZkaXYlM0UlMEElM0NwJTNFJTNDJTJGYSUzRSUzQ2JyJTIwJTJGJTNFJTBBJTNDYSUyMGNsYXNzJTNEJTIycG9zdF9uYXZpZ2F0aW9uLWl0ZW0lMjBvcmRlcl9zZWNvbmQlMjB0b19uZXh0JTIyJTIwaHJlZiUzRCUyMiUyMyUyMiUzRSUzQyUyRnAlM0UlMEElM0NkaXYlMjBjbGFzcyUzRCUyMnBvc3RfbmF2aWdhdGlvbi1pdGVtLW1ldGElMjIlM0UlM0MlMkZkaXYlM0UlMEElM0NkaXYlMjBjbGFzcyUzRCUyMnBvc3RfbmF2aWdhdGlvbi1pdGVtLXRpdGxlJTIyJTNFJTNDJTJGZGl2JTNFJTBBJTNDcCUzRSUzQyUyRmElM0UlM0MlMkZkaXYlM0U=[\/vc_raw_html]<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><\/section>\n","protected":false},"excerpt":{"rendered":"The bots 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 bot...","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/17963"}],"collection":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/comments?post=17963"}],"version-history":[{"count":11,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/17963\/revisions"}],"predecessor-version":[{"id":26886,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/17963\/revisions\/26886"}],"wp:attachment":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/media?parent=17963"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/categories?post=17963"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/tags?post=17963"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}