{"id":1460,"date":"2019-02-17T09:00:42","date_gmt":"2019-02-17T03:30:42","guid":{"rendered":"https:\/\/www.rangakrish.com\/?p=1460"},"modified":"2019-02-17T16:11:24","modified_gmt":"2019-02-17T10:41:24","slug":"identifying-emotions-from-text","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2019\/02\/17\/identifying-emotions-from-text\/","title":{"rendered":"Identifying Emotions from Text"},"content":{"rendered":"<p>Identifying the predominant <em><strong>sentiment<\/strong><\/em> in unstructured text is used widely these days. There are several REST API services that allow you to submit a piece of text and get back the corresponding sentiment analysis. <a href=\"https:\/\/www.meaningcloud.com\" target=\"_blank\" rel=\"noopener\"><em><strong>Meaningcloud<\/strong><\/em><\/a>, <a href=\"https:\/\/aylien.com\" target=\"_blank\" rel=\"noopener\"><em><strong>Aylien<\/strong><\/em><\/a>, <a href=\"https:\/\/cloud.google.com\/natural-language\/\" target=\"_blank\" rel=\"noopener\"><em><strong>Google&#8217;s Cloud Natural Language API<\/strong><\/em><\/a>, and<span class=\"Apple-converted-space\">\u00a0 <\/span><a href=\"https:\/\/natural-language-understanding-demo.ng.bluemix.net\/\" target=\"_blank\" rel=\"noopener\"><em><strong>IBM Natural Language Understanding<\/strong><\/em>\u00a0<em><strong>Service<\/strong><\/em><\/a> are just a few.<\/p>\n<p><em><strong>Emotion<\/strong><\/em> detection, especially from facial expressions and speech, is also catching up. <a href=\"https:\/\/cloud.google.com\/vision\/\" target=\"_blank\" rel=\"noopener\"><em><strong>Google<\/strong><\/em><\/a> and <a href=\"https:\/\/azure.microsoft.com\/en-in\/services\/cognitive-services\/emotion\/\" target=\"_blank\" rel=\"noopener\"><em><strong>Microsoft<\/strong><\/em><\/a> have APIs to do this. However, for my article today, the focus is on detecting emotions from &#8220;<em><strong>unstructured text<\/strong><\/em>&#8220;, and I am going to look at IBM&#8217;s API as part of its <a href=\"https:\/\/natural-language-understanding-demo.ng.bluemix.net\/\" target=\"_blank\" rel=\"noopener\"><em><strong>Natural Language Understanding Service.<\/strong><\/em><\/a><\/p>\n<p>By the way, if you are interested in learning about the differences between &#8220;<em><strong>sentiment<\/strong><\/em>&#8221; and &#8220;<em><strong>emotion<\/strong><\/em>&#8220;, I encourage you to go through <a href=\"https:\/\/centiment.io\/beta\/blog\/emotion-vs-sentiment-the-difference\/\" target=\"_blank\" rel=\"noopener\"><em><strong>this<\/strong><\/em><\/a>\u00a0article and <a href=\"https:\/\/www.linkedin.com\/pulse\/sentiment-analysis-versus-emotional-same-different-shahbaz-anwar\" target=\"_blank\" rel=\"noopener\"><em><strong>this<\/strong><\/em><\/a>\u00a0one.<\/p>\n<p>The set of emotions detected by different APIs varies somewhat. <em><strong>IBM<\/strong><\/em>, for instance, detects:<\/p>\n<blockquote>\n<ul>\n<li><span style=\"color: #0000ff;\">Anger<\/span><\/li>\n<li><span style=\"color: #0000ff;\">Disgust<\/span><\/li>\n<li><span style=\"color: #0000ff;\">Fear<\/span><\/li>\n<li><span style=\"color: #0000ff;\">Joy<\/span><\/li>\n<li><span style=\"color: #0000ff;\">Sadness<\/span><\/li>\n<\/ul>\n<\/blockquote>\n<p>Another company, <a href=\"https:\/\/www.paralleldots.com\/emotion-detection\" target=\"_blank\" rel=\"noopener\"><em><strong>ParallelDots<\/strong><\/em><\/a>\u00a0detects the following emotions:<\/p>\n<blockquote>\n<ul>\n<li><span style=\"color: #0000ff;\">Angry<\/span><\/li>\n<li><span style=\"color: #0000ff;\">Bored<\/span><\/li>\n<li><span style=\"color: #0000ff;\">Excited<\/span><\/li>\n<li><span style=\"color: #0000ff;\">Fear<\/span><\/li>\n<li><span style=\"color: #0000ff;\">Happy<\/span><\/li>\n<li><span style=\"color: #0000ff;\">Sad<\/span><\/li>\n<li><span style=\"color: #0000ff;\">Sarcastic<\/span><\/li>\n<\/ul>\n<\/blockquote>\n<p>The standard reference for the set of emotions is the work by <a href=\"https:\/\/managementmania.com\/en\/six-basic-emotions\" target=\"_blank\" rel=\"noopener\"><em><strong>Paul Ekman<\/strong><\/em><\/a>. This <a href=\"https:\/\/en.wikipedia.org\/wiki\/Contrasting_and_categorization_of_emotions\" target=\"_blank\" rel=\"noopener\"><em><strong>Wikipedia<\/strong><\/em><\/a> article\u00a0gives interesting details on various emotion categories.<\/p>\n<p>Getting back to today&#8217;s experiment, I decided to use <a href=\"https:\/\/github.com\/watson-developer-cloud\/python-sdk\" target=\"_blank\" rel=\"noopener\"><em><strong>IBM&#8217;s Python SDK<\/strong><\/em><\/a>\u00a0instead of directly accessing their <em><strong>HTTPS<\/strong><\/em> end point.<\/p>\n<p>The program itself is trivial:<\/p>\n<figure id=\"attachment_1462\" aria-describedby=\"caption-attachment-1462\" style=\"width: 649px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Code.jpg?ssl=1\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"1462\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/02\/17\/identifying-emotions-from-text\/code-4\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Code.jpg\" data-orig-size=\"649,243\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1550327000&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Program to Dump Emotions\" data-image-description=\"&lt;p&gt;Program to Dump Emotions&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Program to Dump Emotions&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Code.jpg\" class=\"size-full wp-image-1462\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Code.jpg?resize=649%2C243&#038;ssl=1\" alt=\"Program to Dump Emotions\" width=\"649\" height=\"243\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Code.jpg?w=649&amp;ssl=1 649w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Code.jpg?resize=300%2C112&amp;ssl=1 300w\" sizes=\"(max-width: 649px) 100vw, 649px\" \/><\/a><figcaption id=\"caption-attachment-1462\" class=\"wp-caption-text\"><strong>Program to Dump Emotions<\/strong><\/figcaption><\/figure>\n<p>The first sentence to try is:<\/p>\n<blockquote><p><span style=\"color: #0000ff;\">&#8220;It was scary to drive alone on the highway.&#8221;<\/span><\/p><\/blockquote>\n<p>Here is the output from the program:<\/p>\n<figure id=\"attachment_1463\" aria-describedby=\"caption-attachment-1463\" style=\"width: 290px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example1-1.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"1463\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/02\/17\/identifying-emotions-from-text\/example1-14\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example1-1.jpg\" data-orig-size=\"290,313\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1550326950&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Identified Emotions\" data-image-description=\"&lt;p&gt;Identified Emotions&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Identified Emotions&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example1-1.jpg\" class=\"size-full wp-image-1463\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example1-1.jpg?resize=290%2C313&#038;ssl=1\" alt=\"Identified Emotions\" width=\"290\" height=\"313\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example1-1.jpg?w=290&amp;ssl=1 290w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example1-1.jpg?resize=278%2C300&amp;ssl=1 278w\" sizes=\"(max-width: 290px) 100vw, 290px\" \/><\/a><figcaption id=\"caption-attachment-1463\" class=\"wp-caption-text\"><strong>Identified Emotions<\/strong><\/figcaption><\/figure>\n<p>This shows that &#8220;<em><strong>fear<\/strong><\/em>&#8221; is the primary emotion. I am sure everyone will agree.<\/p>\n<p>Here is the second sentence:<\/p>\n<blockquote><p><span style=\"color: #0000ff;\">&#8220;I can&#8217;t wait to see the President in person!&#8221;<\/span><\/p><\/blockquote>\n<p>The program identifies the following emotion weightage:<\/p>\n<figure id=\"attachment_1464\" aria-describedby=\"caption-attachment-1464\" style=\"width: 278px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example2-1.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"1464\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/02\/17\/identifying-emotions-from-text\/example2-10\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example2-1.jpg\" data-orig-size=\"278,312\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1550349220&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Identified Emotions\" data-image-description=\"&lt;p&gt;Identified Emotions&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Identified Emotions&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example2-1.jpg\" class=\"size-full wp-image-1464\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example2-1.jpg?resize=278%2C312&#038;ssl=1\" alt=\"Identified Emotions\" width=\"278\" height=\"312\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example2-1.jpg?w=278&amp;ssl=1 278w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example2-1.jpg?resize=267%2C300&amp;ssl=1 267w\" sizes=\"(max-width: 278px) 100vw, 278px\" \/><\/a><figcaption id=\"caption-attachment-1464\" class=\"wp-caption-text\"><strong>Identified Emotions<\/strong><\/figcaption><\/figure>\n<p>In this case, the main emotion is &#8220;<em><strong>J<\/strong><strong>oy<\/strong><\/em>&#8220;. Although this is as expected, I was hoping for a greater weightage for &#8220;<em><strong>J<\/strong><strong>oy<\/strong><\/em>&#8220;, say, more than <span style=\"color: #0000ff;\"><em><strong>0.7<\/strong><\/em><\/span>. It is not clear why it is just <span style=\"color: #0000ff;\"><em><strong>0.32.<\/strong><\/em><\/span><\/p>\n<p>The next sentence is:<\/p>\n<blockquote><p><span style=\"color: #0000ff;\">&#8220;The talk was dull and uninteresting. The audience was literally yawning throughout the program.&#8221;<\/span><\/p><\/blockquote>\n<p>Let us see how the program determines the emotions:<\/p>\n<figure id=\"attachment_1466\" aria-describedby=\"caption-attachment-1466\" style=\"width: 289px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example3-1.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1466\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/02\/17\/identifying-emotions-from-text\/example3-9\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example3-1.jpg\" data-orig-size=\"289,312\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1550349657&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Identified Emotions\" data-image-description=\"&lt;p&gt;Identified Emotions&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Identified Emotions&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example3-1.jpg\" class=\"size-full wp-image-1466\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example3-1.jpg?resize=289%2C312&#038;ssl=1\" alt=\"Identified Emotions\" width=\"289\" height=\"312\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example3-1.jpg?w=289&amp;ssl=1 289w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example3-1.jpg?resize=278%2C300&amp;ssl=1 278w\" sizes=\"(max-width: 289px) 100vw, 289px\" \/><\/a><figcaption id=\"caption-attachment-1466\" class=\"wp-caption-text\"><strong>Identified Emotions<\/strong><\/figcaption><\/figure>\n<p>Interesting. &#8220;<em><strong>sadness<\/strong><\/em>&#8221; and &#8220;<em><strong>disgust<\/strong><\/em>&#8221; predominate, with almost equal weightage. This seems OK to me.<\/p>\n<p>Let us try this one:<\/p>\n<blockquote><p><span style=\"color: #0000ff;\">&#8220;Our whole family rejoiced when my son got the first prize.&#8221;<\/span><\/p><\/blockquote>\n<p>Obviously, this is a good example of &#8220;<em><strong>Joy<\/strong><\/em>&#8221; being the primary emotion. What does the program have to say?<\/p>\n<figure id=\"attachment_1467\" aria-describedby=\"caption-attachment-1467\" style=\"width: 255px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example4-1.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1467\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/02\/17\/identifying-emotions-from-text\/example4-7\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example4-1.jpg\" data-orig-size=\"255,313\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1550350067&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Identified Emotions\" data-image-description=\"&lt;p&gt;Identified Emotions&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Identified Emotions&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example4-1.jpg\" class=\"size-full wp-image-1467\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example4-1.jpg?resize=255%2C313&#038;ssl=1\" alt=\"Identified Emotions\" width=\"255\" height=\"313\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example4-1.jpg?w=255&amp;ssl=1 255w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example4-1.jpg?resize=244%2C300&amp;ssl=1 244w\" sizes=\"(max-width: 255px) 100vw, 255px\" \/><\/a><figcaption id=\"caption-attachment-1467\" class=\"wp-caption-text\"><strong>Identified Emotions<\/strong><\/figcaption><\/figure>\n<p>Great. The program&#8217;s output agrees with our intuition.<\/p>\n<p>Here is our last example:<\/p>\n<blockquote><p><span style=\"color: #0000ff;\">&#8220;I don&#8217;t understand why our politicians are so arrogant.&#8221;<\/span><\/p><\/blockquote>\n<p>The output for this is:<\/p>\n<figure id=\"attachment_1468\" aria-describedby=\"caption-attachment-1468\" style=\"width: 292px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example5-1.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1468\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/02\/17\/identifying-emotions-from-text\/example5-7\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example5-1.jpg\" data-orig-size=\"292,315\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1550350169&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Identified Emotions\" data-image-description=\"&lt;p&gt;Identified Emotions&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Identified Emotions&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example5-1.jpg\" class=\"size-full wp-image-1468\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example5-1.jpg?resize=292%2C315&#038;ssl=1\" alt=\"Identified Emotions\" width=\"292\" height=\"315\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example5-1.jpg?w=292&amp;ssl=1 292w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Example5-1.jpg?resize=278%2C300&amp;ssl=1 278w\" sizes=\"(max-width: 292px) 100vw, 292px\" \/><\/a><figcaption id=\"caption-attachment-1468\" class=\"wp-caption-text\"><strong>Identified Emotions<\/strong><\/figcaption><\/figure>\n<p>So, &#8220;<em><strong>disgust<\/strong><\/em>&#8221; and &#8220;<em><strong>anger<\/strong><\/em>&#8221; predominate. Couldn&#8217;t agree more!<\/p>\n<p><span class=\"Apple-converted-space\">Using the SDK itself is quite straightforward, and with 30000 free NLU items per\u00a0<\/span>month, this service is definitely worth checking out. Next week, I plan to look at <a href=\"https:\/\/www.paralleldots.com\/emotion-detection\" target=\"_blank\" rel=\"noopener\"><em><strong>ParallelDots<\/strong><\/em><\/a> API for detecting emotions.<\/p>\n<p>Bye, until then! Have a fantastic weekend!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Identifying the predominant sentiment in unstructured text is used widely these days. There are several REST API services that allow you to submit a piece of text and get back the corresponding sentiment analysis. Meaningcloud, Aylien, Google&#8217;s Cloud Natural Language API, and\u00a0 IBM Natural Language Understanding\u00a0Service are just a few. Emotion detection, especially from facial [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[107,17,103],"tags":[136,191],"class_list":["post-1460","post","type-post","status-publish","format-standard","hentry","category-natural-language-processing","category-programming","category-python","tag-emotions","tag-ibm-natural-language-understanding"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-ny","jetpack-related-posts":[{"id":1475,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/02\/24\/emotion-detection-using-paralleldots-api\/","url_meta":{"origin":1460,"position":0},"title":"Emotion Detection using ParallelDots API","author":"admin","date":"February 24, 2019","format":false,"excerpt":"Last week, I showed how we can use IBM Natural Language Understanding API to identify emotions from given text. Today, I would like to run through the same examples, but using ParallelDots API service. There are wrappers\u00a0in Java, Python, Ruby, C#, and PHP for accessing the REST service. However, I\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"The Code","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Code-1.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Code-1.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/02\/Code-1.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":856,"url":"https:\/\/www.rangakrish.com\/index.php\/2018\/02\/25\/sentiments-and-emotions-in-ilexicon\/","url_meta":{"origin":1460,"position":1},"title":"Sentiments and Emotions in iLexicon","author":"admin","date":"February 25, 2018","format":false,"excerpt":"Detecting sentiments and emotions in a piece of text are frequently performed activities in Text analysis. There are some API services available for this. For example, meaningcloud.com \u00a0has an API for detecting sentiments in the text submitted to it. Another API service provider is aylien.com . Emotion detection for text\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2131,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/09\/13\/mathematica-using-textcases-to-extract-information-from-natural-language-text\/","url_meta":{"origin":1460,"position":2},"title":"Mathematica: Using TextCases to Extract Information from Natural Language Text\u00a0","author":"admin","date":"September 13, 2020","format":false,"excerpt":"Extracting meaningful information from unstructured, human readable text is a hot topic of research today and has important applications in many domains. I have written a few blogs related to this topic, for example, see this\u00a0and this. In today\u2019s article, I would like to show how Mathematica can be a\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Extracting Sentences","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/09\/ex1-2-300x106.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1285,"url":"https:\/\/www.rangakrish.com\/index.php\/2018\/12\/09\/parsing-text-with-meaningclouds-text-analytics-api\/","url_meta":{"origin":1460,"position":3},"title":"Parsing Text with MeaningCloud&#8217;s Text Analytics API","author":"admin","date":"December 9, 2018","format":false,"excerpt":"There is wide-spread interest in Natural Language Processing (NLP) today, and there are several API services available to cater to this demand. See this article for a fairly detailed list of services. All of them support multiple languages, including English. Today, I am going to share my experience in working\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Get Words Function","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Get-words.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Get-words.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Get-words.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1541,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/04\/21\/textcontents-function-in-mathematica-12\/","url_meta":{"origin":1460,"position":4},"title":"TextContents[ ] Function in Mathematica 12","author":"admin","date":"April 21, 2019","format":false,"excerpt":"Mathematica 12 was released a few days ago.\u00a0 It has been over a year since version 11.3 came out in March 2018. The long wait appears justified since the new release boasts of numerous improvements and new features across several areas. You may want to read this blog post\u00a0by Stephen\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Importing Text File","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/04\/FileImport.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/04\/FileImport.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/04\/FileImport.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":884,"url":"https:\/\/www.rangakrish.com\/index.php\/2018\/04\/08\/natural-language-generation\/","url_meta":{"origin":1460,"position":5},"title":"Natural Language Generation","author":"admin","date":"April 8, 2018","format":false,"excerpt":"I had written a series of posts on my iLangGen framework last year. It aims to provide a flexible and expressive approach for building natural language generation systems. In today's post, I would like to describe a concrete example of how iLangGen can be used for generating natural language text\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Overall Approach","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/04\/overall-1.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/1460","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/comments?post=1460"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/1460\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=1460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=1460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=1460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}