{"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-03-26T07:38:27","modified_gmt":"2021-03-26T07:38:27","slug":"working-with-tone-processing","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v8-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 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 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 might 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 Intelligence.<\/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>Kore.ai Bots Platform evaluates user inputs to find the following six possible emotions:<\/p>\n<ul>\n<li><b>angry<\/b><\/li>\n<li><b>disgust<\/b><\/li>\n<li><b>fear<\/b><\/li>\n<li><b>sad<\/b><\/li>\n<li><b>joy<\/b><\/li>\n<li><b>positive<\/b> &#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\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=\"Scoring_Tone_Emotions\">Scoring Tone Emotions<\/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, \u201c<em>I am happy about this news<\/em>\u201d returns a positive tone score for joy, while \u201c<em>I am <\/em><em>not<\/em><em> happy about this news\u201d<\/em> returns 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 utterance as \u201c<em>I am <\/em><em>extremely<\/em><em> disappointed\u201d<\/em> returns a higher tone score for the angry tone emotion than if the user utterance is \u201c<em>I am disappointed.<\/em>\u201d Conversely, a user utterance of \u201c<em>I am <\/em><em>not <\/em><em>disappointed<\/em>\u201d negates 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\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\"><em>Examples<\/em><\/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>\u201cI 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.\u201d<\/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>\u201cThis is a great idea! I&#8217;m super excited already.\u201d<\/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>\u201cThis was a funny and casually well-written book, a good read. But it&#8217;s a little frustrating because it abandons the &#8220;narrative&#8221;, if you will, without finishing it.\u201d<\/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, see <a href=\"\/docs\/bots\/bot-builder-tool\/dialog-task\/context-object\/\">Context Object<\/a>.<\/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<div class=\"w-post-elm post_navigation layout_simple inv_false\">\n\t<a class=\"post_navigation-item order_first to_prev\" href=\"https:\/\/developer.kore.ai\/v8-0\/docs\/bots\/advanced-topics\/sentiment-management\/\"><\/p>\n<div class=\"post_navigation-item-arrow\"><\/div>\n<div class=\"post_navigation-item-meta\">Previous<\/div>\n<div class=\"post_navigation-item-title\"><span>Sentiment Management<\/span><\/div>\n<p>\t<\/a><br \/>\n<a class=\"post_navigation-item order_second to_next\" href=\"#\"><\/p>\n<div class=\"post_navigation-item-meta\"><\/div>\n<div class=\"post_navigation-item-title\"><\/div>\n<p>\t<\/a><\/div>\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><\/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":[],"class_list":["post-17963","post","type-post","status-publish","format-standard","hentry","category-advanced-topics"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/posts\/17963","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/comments?post=17963"}],"version-history":[{"count":7,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/posts\/17963\/revisions"}],"predecessor-version":[{"id":26291,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/posts\/17963\/revisions\/26291"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/media?parent=17963"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/categories?post=17963"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-0\/wp-json\/wp\/v2\/tags?post=17963"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}