<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Josh Zheng on Medium]]></title>
        <description><![CDATA[Stories by Josh Zheng on Medium]]></description>
        <link>https://medium.com/@joshzheng?source=rss-5ab01c8d6d68------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*O02moIIZKNzNPOz5ZHB8sA.jpeg</url>
            <title>Stories by Josh Zheng on Medium</title>
            <link>https://medium.com/@joshzheng?source=rss-5ab01c8d6d68------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 23:29:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@joshzheng/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[6 Tips To Improve the User Experience of Your Customer Support Chatbot]]></title>
            <link>https://medium.com/ibm-watson/6-tips-to-improve-the-user-experience-of-your-customer-support-chatbot-50baf67b02b7?source=rss-5ab01c8d6d68------2</link>
            <guid isPermaLink="false">https://medium.com/p/50baf67b02b7</guid>
            <category><![CDATA[ibm-watson]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[editorials]]></category>
            <category><![CDATA[user-experience]]></category>
            <dc:creator><![CDATA[Josh Zheng]]></dc:creator>
            <pubDate>Thu, 21 Sep 2017 19:34:20 GMT</pubDate>
            <atom:updated>2017-11-13T20:12:32.894Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1-6uTDisOqjeEFiDwFAbZg.jpeg" /></figure><p>There are many customer support chatbots out there. Having seen quite a few of these, I believe many of them could be improved with a couple basic changes.</p><p>One of the major mistakes I see is the lack of attention to user experience. In this post, I’ll go over a few tips that’ll improve the user experience of your customer support chatbot. These tips will be presented using <a href="https://www.ibm.com/watson/services/conversation/">Watson Conversation</a>, but don’t worry the ideas are easily translated to any framework or platform of your choosing.</p><h4>Tip #1: Introduce your chatbot to first-time users</h4><p>When a user comes across your chatbot for the first time, he or she will not know how to interact with it. This might be the first time this user has interacted with any chatbot. At this point, the worst thing you can do is to present the user with a blank screen.</p><p>One way to create a better user experience is to immediately introduce the user to what the chatbot can do and how to talk to it. A welcome message (something short, simple and motivating) is usually best followed by a helpful paragraph about the chatbot.</p><p>To create such a message with Watson Conversation, go to the <strong>Dialog</strong> tab and create a dialog node. The following screenshot shows an example of a dialog composed of many nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cyr3hXB58QJy7rNG0Q05hg.png" /></figure><p>Notice that the first node is the <strong>Start and Initiate Context</strong> node. This is what the user sees when he first launches your chatbot.</p><p>How does Watson Conversation know to launch this node at the very beginning, before any user inputs? If you look at the right side of the screenshot (a detailed view of the selected node), there is a <strong>if bot recognizes</strong> field. The <strong>if bot recognizes</strong> field is part of every node, and it sets the condition to which that node is triggered. When the value of that field is set to <strong>conversation_start</strong>, which is a service keyword, Watson Conversation knows to trigger this node and present the initial chatbot message at launch.</p><p><strong>Note: </strong>You can now also use <strong>Welcome</strong> instead of <strong>conversation_start</strong>.</p><p>The response of this node is a JSON object. There, you can see that the service also initializes the context variables (which we’ll talk about later), along with the initial introductory text you’ve entered.</p><h4><strong>Tip #2: Add variations to your responses</strong></h4><p>Adding variations to your responses makes your chatbot seem more human, and thus more engaging. Of course, there are a lot of others ways to make your chatbot seem more human. For example, you can give your chatbot a full personality makeover like <a href="https://www.facebook.com/hiponcho/">Poncho</a>. But we’re not going to talk about that here since chatbot personality is a post on its own. Moreover, having a strong personality isn’t the right approach for most customer support chatbots.</p><p>One simple trick is to rotate through a set of different responses to the same question. Watson Conversation has to ability to send different responses to the same intent. If you look at the JSON object in the screenshot above, and you’ll see that <strong>output.text.values</strong> is an array, which means you can fill it with a list of possible responses. When you do that, one of the responses will be chosen at random. You can do this in the tooling UI, as seen in the screenshot below. This is a cool little feature that gives your chatbot an additional sense of randomness. After all, as humans, we rarely give the exact same response to a question twice in a row.</p><p>Here’s another example. The screenshot below shows a greeting node that is activated when the bot recognizes the<strong>#greetings</strong> intent. You’ll see that we’ve provided a list of possible greetings so that a user can be greeted differently at the beginning of different conversations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VePr1l5ZO-RmiEFOIfU43Q.png" /></figure><p><strong>Note: </strong>You don’t need response variation at every dialog node. It’s important to have response variations in nodes that your users commonly visit, such as greeting and thank you nodes. Informational nodes are typically only visited once per customer so response variations are not as necessary.</p><h4><strong>Tip #3: Make the main menu accessible anywhere</strong></h4><p>Of course this tip only applies if your chatbot has a main menu of available actions. However, most customer support chatbots should have this. The menu is usually presented at the beginning of a conversation. But as the conversation carries on, the user will most likely forget the list of possible actions. At this point, making the user scroll all the way back to the beginning makes for a terrible user experience. A better experience would be to make the main menu always accessible via some intuitive phrases. It also helps to regularly remind the user that this is possible.</p><p>One way to do this in Watson Conversation is to create an intent called <strong>#menu</strong> that captures messages such as: “Where do I go from here?,” “I need the menu,” and “Where is the main menu?” Then, when your chatbot recognizes the <strong>#menu</strong> intent, it can remind the user the set of available actions.</p><p>Two other related intents that should be present throughout your conversations are the <strong>#help </strong>and<strong> </strong>the<strong> #start_over </strong>intents. Make sure to include all of these intents, it’ll save your users a lot of time and frustration.</p><p>The <strong>#start_over</strong> intent is pretty self explanatory. Sometimes a user has gone down an incorrect path and realizes it’s simply easiest to start over. At this point, it’s useful to have an intent that registers messages such as “I want to start over” or “Let’s restart this conversation”.</p><p>The <strong>#help </strong>intent should lead your users to a help menu. Sometimes, your users get stuck in conversation loops or simply become lost completely. Having a <strong>#help</strong> intent is like having an emergency eject button that gets your users to safety. Better yet, your help menu should have an option to talk to a human support agent. This is important because your users are probably already a little frustrated by the time they’re asking for help. The option to talk to a human reminds them that they’re not alone, and their problem will be solved even if the chatbot didn’t work as intended.</p><h4><strong>Tip #4: Have context awareness</strong></h4><p>Having context awareness means your chatbot remembers important events and information about your users. This is important for user experience because a user should never have to provide a piece of information twice, or worse, get asked repeated questions.</p><p>Watson Conversation provides a <strong>context </strong>object that let’s you store any key-value pair as context variables. In the screenshot below, you will notice that there is a <strong>context </strong>object that stores all the context variables related to the user’s pizza order. The variables get updated as the user progresses through the ordering process. And once the chatbot recognizes the <strong>#reset </strong>intent, it will set all pizza parameters to null so the user can restart the order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m6UEFgU9O-lt_mAKGDO-WA.png" /></figure><p>See my <a href="https://medium.com/unsupervised-coding/how-to-build-a-recipe-slack-bot-using-watson-conversation-and-spoonacular-api-487eacaf01d4">previous blog post</a> for more information on how to use the context variable.</p><p><strong>Note: </strong>Another way to acquire some context around your users is to integrate with a CRM or third-party database (<a href="https://medium.com/u/f1b6565b0972">Mark Watson</a> <a href="https://medium.freecodecamp.org/have-you-had-the-talk-with-your-chatbot-about-graph-data-structures-3aaf5c3ae52c">has a great post on adding persistence layer to Watson Conversation</a>). If you’re on Facebook Messenger, you can pull information about your user from his profile. Remember, starting a conversation with even some basic knowledge of your users (name, job, location etc.) can make your chatbot seem more familiar and start your interaction off on the right foot.</p><h4>Tip #5: Be able fix incorrect inputs</h4><p>Your users will inevitably make mistakes while talking to your chatbot, often in the middle of a conversation. When that happens, the last thing you want is for the user to have to restart the conversation all over again.</p><p>Your chatbot should be able to handle this scenario. This means if the user ever sends the wrong message, he/she can reenter the correct response. In Watson Conversation, some of these situations can be solved with the new <a href="https://console.bluemix.net/docs/services/conversation/dialog-build.html#slots">slots</a> features.</p><p>Continuing with the pizza ordering scenario (screenshot below), each slot contains one piece of information we need from the user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b5Qti6EsWB6mCXxQozFZjA.png" /></figure><p>Now if the user accidentally entered “small” for the size of the pizza, she can simply say “actually I meant large” to fix the mistake. This is because when we’re at this node, Watson Conversation automatically checks all user inputs for the defined entities. And in this case, the <strong>@pizza_size</strong> entity includes the values <strong>small, medium, </strong>and<strong> large </strong>(see below). So when Watson Conversation sees the entity value <strong>large </strong>in the phrase “actually I meant large”, it updates the slot with the latest value (“large”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HALgkRAOqPA4ibmmqiNp4w.png" /></figure><p>Besides this neat little trick above, slots also drastically simplifies your conversation flow. So be sure to use it whenever you can!</p><p><strong>Note</strong>: this trick will not work if entering the pizza size completes all slots and the dialog moves on to the next node.</p><h4>Tip #6: Handle the “<strong>I do not understand” case</strong></h4><p>As users interact with your chatbot, you’ll encounter messages and intents that you’ve never seen before. This is normal. When this happens, the most important thing to do is to acknowledge the situation instead of not responding at all.</p><p>This is why it’s important to have a catch-all node in your dialog. In Watson Conversation, this means having a node that handles <strong>anything_else</strong>,<strong> </strong>which is another service keyword.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vvsvLxIv0_FSNsOc96KV2Q.png" /></figure><p>Of course this is not ideal but it is totally okay to inform the user that you do not understand the message. At this point you can either ask the user to rephrase the request or look to hand the conversation off to a human customer support agent. You can even have the chatbot thank the user for the new message and promise that an answer will be available for her next visit.</p><p>Just remember that after this happen, be sure to go back to your chat log and figure out what went wrong. You might find my previous post on <a href="https://medium.com/p/54a36b671261/edit">improving your chatbot using chat logs</a> helpful.</p><h4>Conclusion</h4><p>That’s all readers. Remember, it’s easy to get started with customer support chatbots but it take patience and hard work to build a truly successful one. Hopefully these tips get you a little closer.</p><p>I’ll leave you with this analogy from my colleague <a href="https://medium.com/u/17b6e6364981">Mitchell Mason</a>. Building a chatbot is much like training a new hire — the new hire probably only knows a little on his first day, but through coaching and supervision he’ll eventually become a productive employee. It’s important for your users to see your chatbot as a human, but it’s equally important for you to do the same.</p><p>As always, if you have any questions, feel free to reach out at <a href="http://joshzheng@us.ibm.com/">joshzheng@us.ibm.com</a>, connect with me on <a href="https://www.linkedin.com/in/joshzheng">LinkedIn</a>, or <a href="https://medium.com/@joshzheng">follow me</a> here on Medium or <a href="https://twitter.com/boxcarton">Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50baf67b02b7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-watson/6-tips-to-improve-the-user-experience-of-your-customer-support-chatbot-50baf67b02b7">6 Tips To Improve the User Experience of Your Customer Support Chatbot</a> was originally published in <a href="https://medium.com/ibm-watson">IBM watsonx Assistant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Improve Your Chatbot Using Watson Assistant Chat Logs]]></title>
            <link>https://blog.chatbotslife.com/improve-your-chatbot-using-watson-conversation-chat-logs-54a36b671261?source=rss-5ab01c8d6d68------2</link>
            <guid isPermaLink="false">https://medium.com/p/54a36b671261</guid>
            <category><![CDATA[chatbot-development]]></category>
            <category><![CDATA[watson-conversation]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[ibm-watson]]></category>
            <dc:creator><![CDATA[Josh Zheng]]></dc:creator>
            <pubDate>Mon, 18 Sep 2017 15:36:14 GMT</pubDate>
            <atom:updated>2018-06-07T23:26:13.307Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Quick Tour Through the Watson Assistant Improve Panel</h4><h3>Introduction</h3><p>At the start of your chatbot project, it’s often helpful to identify one goal you’d like to achieve and ways to track your chatbot’s performance against that goal. More importantly, you should also have a plan on how to improve your chatbot until it gets there.</p><p>One of the best ways to improve chatbot performance is to monitor user interactions through chat logs. Watson Assistant gives you access to chat logs via the <strong>Improve</strong> <strong>Panel</strong>, which is the third section in the <a href="http://ibmwatsonconversation.com/">Conversation Service Tool</a>. You can access it by clicking in the third icon on the left bar:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T2OMgXy71sfdD3S_VevE8w.png" /></figure><p>The screenshot above shows the <strong>Overview</strong> section in the panel, which contains some general stats on your chatbot. The component also has a <strong>User conversations</strong> section that provides a history of all messages from your users, along with the predicted intents and entities for each message. This allows you to observe how your chatbot is performing vis-a-vis its users.</p><p>With the <strong>Improve Panel</strong>, you can:</p><ul><li>Gather all of the messages sent to the chatbot from different channels</li><li>Get basic metrics such as most frequent intents out of all messages or by individual conversations</li><li>Fix messages that have incorrect intents or entities directly in the panel</li><li>Train the chatbot to expand its responses based on new user input</li></ul><p>In case you’re wondering how the <strong>Improve Panel</strong> is different from the <strong>Try It Out Panel</strong>, the Try It Out Panel is used for you to verify that your chatbot recognizes the correct intents and entities before deployment. The Improve Panel is used to view information about actual conversations that your chatbot has had with your users.</p><h4>Getting Started With Watson Assistant</h4><p><strong><em>Note: </em></strong><em>This is a quick primer for first-time users of Watson </em>Assistant<em>. If you’re an experienced Watson developer, or going with another platform, feel free to skip this section.</em></p><p>Watson Assistant is a platform that provides developers with the ability to create intelligent chatbots that are able to understand natural language and respond to human intents.</p><p>To get started with the service, you need to <a href="https://ibm.biz/BdjBnR">register for an account</a>. Once you’re registered, create an instance of your Assistant service from the Bluemix dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ynARWB--YnGwLdAxWI-z1A.png" /></figure><p>To use the instance, launch the Assistant tool and create a workspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XwgKCyC8egFfS2m5iyuTFg.png" /></figure><h3>More on the Improve Panel</h3><p>Here are the sections inside the <strong>Improve Panel</strong>:</p><ul><li><a href="https://console.bluemix.net/docs/services/conversation/logs_oview.html">Overview</a>: A summary of interactions of users with your chatbot</li><li><a href="https://console.bluemix.net/docs/services/conversation/logs_convo.html">User conversations</a>: A list of chat messages. You can update intents and entities while viewing a conversation.</li><li><a href="https://console.bluemix.net/docs/services/conversation/logs_recommend.html">Recommendations</a>: Ways to improve your system, available only to Premium users.</li></ul><p>The rest of this blog post will focus on the <strong>User conversations</strong> section, which contains a list of chat messages between your users and your chatbot from different messaging channels (Facebook Messenger, Slack, mobile apps etc.).</p><h4><strong>User Conversation</strong></h4><p>The User conversation section contains all messages between your chatbot and your users. It lets you easily view all these messages in one place without having to deal with the different messaging channels. These chat logs can also be used proactively to provide early warnings about a chatbot’s misunderstanding of messages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XoUPJ3cjv7jZwBD2pFmTvA.png" /></figure><p>From the screenshot above, we see that the chat logs are provided in a simple list view. The list can be sorted by Newest or Oldest messages first. This is followed by rows of actual messages, as seen below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g0X-Ej22A2hKhMhNTXKMLg.png" /></figure><p>Each row of messages includes:</p><ul><li>The content of the message</li><li>Timestamp in the format of DD/MM/YYY @ HH:MM.</li><li>Predicted intent, and you’re able to edit the intent if it’s incorrect.</li><li>Predicted entities, which you can also edit or make additions to</li></ul><p>There is also a search box on top of the messages list. You can search by user statement and/or filter by intents, entities, or dates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nc0s9WjMwtxh9INwaOyx1Q.png" /></figure><p>In each row, there is a cool feature called <strong>Open conversation.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VK9_cwjpLAqI7-imDLdiyw.png" /></figure><p>Clicking that button takes you to the point in the original conversation where the message appeared. This is useful because it brings back the context of the original conversation and helps you understand how the conversation got to that point and where it went afterwards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v8_ztGSOJ_DST26XhG8k1w.png" /></figure><h4><strong>Chat Logs API</strong></h4><p>Finally, Watson Conversation also offers a <a href="https://www.ibm.com/watson/developercloud/conversation/api/v1/#logs">RESTful API to its chat logs</a>. One useful request you can make is the list of chat logs in a workspace. The request using Curl is shown here:</p><pre><strong>curl -u “{username}”:”{password}” “https://gateway.watsonplatform.net/conversation/api/v1/workspaces/workspace_id/logs?version=2017-05-26&quot;</strong></pre><p>where version is release date of the version of the API.</p><p>This is what a response looks like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8440df607d5888ad7ce34612304119c9/href">https://medium.com/media/8440df607d5888ad7ce34612304119c9/href</a></iframe><p><strong>Remember</strong>: The API has a rate limit. If the <em>cursor</em> parameter is not specified, the operation is limited to 40 requests per 30 minutes. If the <em>cursor</em> parameter is specified, the limit is 120 requests per minute.</p><h4>Conclusion</h4><p>Increasingly, companies are using chatbots for customer support and other operations that simultaneously serve multiple customers. The more users you have, the larger the chat logs.</p><p>Being able to effectively examine these chat logs will help you monitor the performance of your chatbot, and thus deliver a better user experience. Hopefully you now have some basic understanding of how to take advantage of Watson Assistant’s <strong>Improve Panel. </strong>Go forth and dive into those chat logs!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F3e59ef%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F3e59ef&amp;image=http%3A%2F%2Fapi.screenshotlayer.com%2Fapi%2Fcapture%3Faccess_key%3Dfe59908dad3baab69ffab249a2224b03%26viewport%3D1024x612%26width%3D1000%26url%3Dhttps%253A%252F%252Fupscri.be%252F3e59ef%253Fscreenshot&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/7078d8ad19192c4c53d3bf199468e4ab/href">https://medium.com/media/7078d8ad19192c4c53d3bf199468e4ab/href</a></iframe><figure><a href="https://chatbotslife.com/bot-communities-mastermind-group-d2dae9876709#.53x0py6ou"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*6XUspT9JOSq0w0Fi35HIaA.png" /></a></figure><figure><a href="https://m.me/ChatbotsLife"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*c1LDMH5vbnIz9rmAka8Hwg.png" /></a></figure><figure><a href="https://chatbotslife.com/how-to-get-a-free-chatbot-b1fb9dfe109#.z9dtp2sy0"><img alt="" src="https://cdn-images-1.medium.com/max/255/1*D0Jf3dI6ZThtqcfwDYY7mg.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54a36b671261" width="1" height="1" alt=""><hr><p><a href="https://blog.chatbotslife.com/improve-your-chatbot-using-watson-conversation-chat-logs-54a36b671261">Improve Your Chatbot Using Watson Assistant Chat Logs</a> was originally published in <a href="https://blog.chatbotslife.com/">Chatbots Life</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Robot Befriends Classic Monsters Using Watson APIs — Part 4]]></title>
            <link>https://medium.com/ibm-watson/a-robot-befriends-classic-monsters-using-watson-apis-part-4-660efada8a4e?source=rss-5ab01c8d6d68------2</link>
            <guid isPermaLink="false">https://medium.com/p/660efada8a4e</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[ibm-watson]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Josh Zheng]]></dc:creator>
            <pubDate>Mon, 22 May 2017 06:58:39 GMT</pubDate>
            <atom:updated>2017-11-07T15:01:48.691Z</atom:updated>
            <content:encoded><![CDATA[<h4>Teaching TJBot to Interact a Few Classic Monsters</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QOCx8M6cyOjNwzuPuX4r6A.jpeg" /></figure><p>First all, good job making it to the final stretch 👏👏👏 — you’re almost done! In the last part of this tutorial series, we’ll put everything we’ve learned into TJBot.</p><p>The code running on TJBot is <a href="https://github.com/boxcarton/tjbot-visual-recognition/blob/master/tjbot/run.js"><strong>here</strong></a>. If you completed my <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-1-d1c273e17a63#.f01e1w591">Build a ChatBot That Cares</a> tutorials, this should look very familiar.</p><h4>Recap</h4><p>Just a quick recap — if you started at the very beginning of this series, look upon the following list and admire at all that you’ve achieved. If you happen to have landed on this page first, here’s the entire list of tutorials and components required before tackling this last part.</p><h4>Required List of Tutorials</h4><ul><li>Build a Chatbot That Cares <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-1-d1c273e17a63#.yu9fhv2kt">Part 1</a></li><li>Build a Chatbot That Cares <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-2-66367cf26e4b#.ih9wfqs3q">Part 2</a></li><li><a href="https://medium.com/@joshzheng/a-robot-befriends-classic-monsters-using-watson-apis-part-1-76b1cc64957e">A Robot Befriends Classic Monsters Using Watson APIs Part 1: Custom Visual Classifiers in Python</a></li><li><a href="https://medium.com/@nickbourdakos/a-robot-befriends-classic-monsters-using-watson-apis-part-2-df827d5501eb">A Robot Befriends Classic Monsters Using Watson APIs Part 2: Custom Visual Classifiers in NodeJS</a></li><li><a href="https://medium.com/@joshzheng/a-robot-befriends-classic-monsters-using-watson-apis-part-3-c9ed77a0e9e7">A Robot Befriends Classic Monsters Using Watson APIs Part 3: Using Raspberry Pi Camera</a></li><li>A Robot Befriends Classic Monsters Using Watson APIs Part 4: Putting It All Together <strong>(You are here)</strong></li></ul><h4>Required List of Watson Services (Credentials)</h4><ul><li><a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/speech-to-text.html">Watson Speech to Text</a></li><li><a href="https://www.ibm.com/watson/developercloud/tone-analyzer.html">Watson Tone Analyzer</a></li><li><a href="https://www.ibm.com/watson/developercloud/conversation.html">Watson Conversation</a></li><li><a href="https://www.ibm.com/watson/developercloud/text-to-speech.html">Watson Text To Speech</a></li><li><a href="https://www.ibm.com/watson/developercloud/visual-recognition.html">Watson Visual Recognition</a></li></ul><h4>Required List of Software and Hardware</h4><ol><li>Node.js version 4.4.5+ (I’m using 7.2.0)</li><li><a href="https://ibmtjbot.github.io/">TJBot</a></li><li>Raspberry Pi. I’m using the latest <a href="https://www.amazon.com/dp/B01C6Q2GSY/ref=wl_it_dp_o_pC_nS_ttl?_encoding=UTF8&amp;colid=1BLM6IHU3K1MA&amp;coliid=I1WPZOVL411972">Raspberry Pi 3</a>.</li><li>HDMI display</li><li>USB keyboard</li><li>USB mouse</li><li><a href="https://www.amazon.com/dp/B005BRET3G/ref=wl_it_dp_o_pC_nS_ttl?_encoding=UTF8&amp;colid=1BLM6IHU3K1MA&amp;coliid=I1C98I7HIFPNJE">USB microphone</a></li><li><a href="https://www.amazon.com/gp/product/B014SOKX1E/ref=oh_aui_detailpage_o00_s00?ie=UTF8&amp;psc=1">Speaker with 3.5mm audio jack</a></li><li><a href="https://www.raspberrypi.org/products/camera-module-v2/">Raspberry Pi Camera Module v2</a></li><li><a href="https://www.amazon.com/gp/product/B00Q8ZNJ3Q/ref=oh_aui_search_detailpage?ie=UTF8&amp;psc=1">Dracula</a>, <a href="https://www.amazon.com/gp/product/B000I5J878/ref=oh_aui_search_detailpage?ie=UTF8&amp;psc=1">Frakenstein</a>, the <a href="https://www.amazon.com/gp/product/B00O4JQCUK/ref=oh_aui_search_detailpage?ie=UTF8&amp;psc=1">Wolfman</a>, and the <a href="https://www.amazon.com/gp/product/B00Q8ZNB7A/ref=oh_aui_search_detailpage?ie=UTF8&amp;psc=1">Mummy</a> plush set</li></ol><h3>Step-By-Step Tutorial</h3><h4>Step 0. What You Need</h4><ol><li>See Recap section above.</li></ol><h4>Step 1. Starting the Camera</h4><p>Ok that was a lot of parts. But if you completed them all, the rest should be fairly simple.</p><p><strong>Important Note:</strong> <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-2-66367cf26e4b#.sa8dabujl">Build a Chatbot That Cares Part 2</a> has all the instructions on setting up Raspberry Pi, including installing NodeJS and the necessary audio libraries. The rest will not work if you haven’t completed that tutorial.</p><p>I start the Raspberry Pi camera on <strong>line 5</strong> of the following gisst, right when the script is run. This isn’t the most optimal solution (I’ll explain in the <strong>How To Improve </strong>section in the end), but it makes the code easier to understand. Since the purpose of this tutorial is to inform, I’ve decided to keep the code as simple as possible.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/567a4e198530e834d7de33f414138d01/href">https://medium.com/media/567a4e198530e834d7de33f414138d01/href</a></iframe><h4>Step 2. Performing Character Recognition</h4><p>You need to do is to wrap the <strong>recognizeCharacter</strong> function in a promise to make sure you actually classify the captured image and identify the character before building the response via Watson Conversation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0fc51c9e8d3491e7703df204ff1c7e6/href">https://medium.com/media/c0fc51c9e8d3491e7703df204ff1c7e6/href</a></iframe><p>I directly return the name of the character that I’d like TJBot to pronounce.</p><p>Then simply run the code after the image has been saved to file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f17512ff5d29c953fb2a50ab68e58d88/href">https://medium.com/media/f17512ff5d29c953fb2a50ab68e58d88/href</a></iframe><h4>Step 3. Passing Character Name to Watson Conversation</h4><p>The returned monster name is passed to Watson Conversation via the context variable (see line 3).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/503af955bef951ff66444724f6eed168/href">https://medium.com/media/503af955bef951ff66444724f6eed168/href</a></iframe><p>Inside the <a href="https://www.ibmwatsonconversation.com/login">Watson Conversation Tool</a>, we use the <strong>$</strong> to extract the value of the <strong>character </strong>and make it part of the response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xM8g1-X8YsGE9lVzDitDiA.png" /></figure><p>Since the character name is part of the Conversation response, TJBot will automatically speak its name as part of his response.</p><h4>That’s It!</h4><p>You just got TJBot talking to classic monsters! Put different characters in front of TJBot to make sure he’s recognizing the them correctly.</p><h4>How To Improve</h4><p>One drawback of this system is that the Raspberry Pi camera takes a long time to turn on and then shuts off right after taking a photo. I decided to go with this approach because it makes the code easiest to understand.</p><p>Unfortunately this means we have to run the script every time we need to recognize a new character. A better system is to turn the camera on in the beginning, and have it take pictures at regular short intervals. Your code will then simply use the most recent photo for character recognition. Ideally, you’d also delete older photos so you won’t run out of memory after awhile.</p><h4>Final Thoughts</h4><p>My dear readers, we’re finally at the end of our journey with TJBot. If you’ve followed along since the beginning, here’s some mad props from Watson — 🤖🙌. You should now be very familiar with many of Watson’s APIs, along with TJBot itself. It’s time to go build some cute robots of your own! Remember to come back and share what you’ve done, I’d love to see them.</p><p>Finally, a big shoutout to <a href="https://medium.com/u/154a0d2814f0">Nick Bourdakos</a> for helping me throughout this project.</p><p>As always, if you have any questions, feel free to reach out at <a href="http://joshzheng@us.ibm.com/">joshzheng@us.ibm.com</a>, connect with me on <a href="https://www.linkedin.com/in/joshzheng">LinkedIn</a>, or <a href="https://medium.com/@joshzheng">follow me</a> here on Medium.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=660efada8a4e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-watson/a-robot-befriends-classic-monsters-using-watson-apis-part-4-660efada8a4e">A Robot Befriends Classic Monsters Using Watson APIs — Part 4</a> was originally published in <a href="https://medium.com/ibm-watson">IBM watsonx Assistant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Robot Befriends Classic Monsters Using Watson APIs — Part 3]]></title>
            <link>https://medium.com/ibm-watson/a-robot-befriends-classic-monsters-using-watson-apis-part-3-c9ed77a0e9e7?source=rss-5ab01c8d6d68------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9ed77a0e9e7</guid>
            <category><![CDATA[frankenstein]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[ibm-watson]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Josh Zheng]]></dc:creator>
            <pubDate>Mon, 22 May 2017 06:57:19 GMT</pubDate>
            <atom:updated>2017-11-07T15:02:05.539Z</atom:updated>
            <content:encoded><![CDATA[<h4>Integrating Watson Visual Recognition With RaspberryPi Camera</h4><p>In <a href="https://medium.com/@joshzheng/a-robot-befriends-classic-monsters-using-watson-apis-part-1-76b1cc64957e"><strong>Part 1</strong></a> and <a href="https://medium.com/@nickbourdakos/a-robot-befriends-classic-monsters-using-watson-apis-part-2-df827d5501eb"><strong>Part 2</strong></a><strong> </strong>of this tutorial series, we used Watson Visual Recognition’s custom classifiers to recognize a few classic monsters. Now it’s time to integrate the code with a RaspberryPi camera.</p><p>The code to this part of the tutorial can be found <a href="https://github.com/boxcarton/tjbot-visual-recognition/blob/master/tjbot/recognize_character.js"><strong>here</strong></a>.</p><h3>Step-By-Step Tutorial</h3><h4>Step 0. What You Need</h4><ol><li>NodeJS (I’m using 7.2.0)</li><li>Raspberry Pi. I’m using the latest <a href="https://www.amazon.com/dp/B01C6Q2GSY/ref=wl_it_dp_o_pC_nS_ttl?_encoding=UTF8&amp;colid=1BLM6IHU3K1MA&amp;coliid=I1WPZOVL411972">Raspberry Pi 3</a>.</li><li><a href="https://www.raspberrypi.org/products/camera-module-v2/">Raspberry Pi Camera Module v2</a></li><li><a href="https://www.amazon.com/gp/product/B00Q8ZNJ3Q/ref=oh_aui_search_detailpage?ie=UTF8&amp;psc=1">Dracula</a>, <a href="https://www.amazon.com/gp/product/B000I5J878/ref=oh_aui_search_detailpage?ie=UTF8&amp;psc=1">Frakenstein</a>, the <a href="https://www.amazon.com/gp/product/B00O4JQCUK/ref=oh_aui_search_detailpage?ie=UTF8&amp;psc=1">Wolfman</a>, and the <a href="https://www.amazon.com/gp/product/B00Q8ZNB7A/ref=oh_aui_search_detailpage?ie=UTF8&amp;psc=1">Mummy</a> plush set</li></ol><h4>Step 1. Initializing the Camera</h4><p>We’re using <a href="https://github.com/troyth/node-raspicam">node-raspicam</a> to interface with the camera. Here’s the code to initialize it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/159935a4aa1a633241ca2066f551a1c7/href">https://medium.com/media/159935a4aa1a633241ca2066f551a1c7/href</a></iframe><p>Most of these parameters are self explanatory, notice the <strong>timeout</strong> parameter is set to zero because we want to take the picture as soon as the camera turns on.</p><h4>Step 2. Using the Camera</h4><p>Since a photo is taken automatically the moment the camera turns on, the only event we really care about is the “read” event, which happens when a photo is saved to file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b38d5fd94267a86619a5f4eb16383810/href">https://medium.com/media/b38d5fd94267a86619a5f4eb16383810/href</a></iframe><p>Once the photo is saved, we remember the filename of the image and send the it to the custom classifier we created in <a href="https://medium.com/@joshzheng/a-robot-befriends-classic-monsters-using-watson-apis-part-1-76b1cc64957e"><strong>part 1</strong></a> and <a href="https://medium.com/@nickbourdakos/a-robot-befriends-classic-monsters-using-watson-apis-part-2-df827d5501eb"><strong>part 2</strong></a> for classification (line 7).</p><h4>Step 3. Character Recognition</h4><p>Here’s the code that classifies our image against the <strong>monsters</strong> custom classifier.</p><p><strong>Important Note: </strong>Notice the specification of the classifier_id at line 4. For this to work, you need to grab the classifier ID you got from part 1 or part 2 and put it into the config file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/63ddc577baa2406c3d37acdc82d9db1b/href">https://medium.com/media/63ddc577baa2406c3d37acdc82d9db1b/href</a></iframe><p>The actual classification is done at line 8. The rest is just code to parse the resulting JSON.</p><p><strong>Important Note</strong>: If you’re here to complete the whole TJBot + Classic Monsters project, make sure to do this step. I know it’s tempting to jump ahead but make sure the crux of your code works before moving on. It’ll be harder to debug and modify your code once it’s part of the larger project.</p><h4>Onward to TJBot!</h4><p>Alright, if you followed all the instruction correctly, you should be able to put a monster in front of the Raspberry Pi camera and see the appropriate greeting in your console.</p><p>Now it’s time to grab a <a href="https://ibmtjbot.github.io/">TJBot</a> and put it all together. To <a href="https://medium.com/@joshzheng/a-robot-befriends-classic-monsters-using-watson-apis-part-4-660efada8a4e"><strong>Part 4</strong></a>!</p><p>As always, if you have any questions, feel free to reach out at <a href="http://joshzheng@us.ibm.com/">joshzheng@us.ibm.com</a>, connect with me on <a href="https://www.linkedin.com/in/joshzheng">LinkedIn</a>, or <a href="https://medium.com/@joshzheng">follow me</a> here on Medium.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9ed77a0e9e7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-watson/a-robot-befriends-classic-monsters-using-watson-apis-part-3-c9ed77a0e9e7">A Robot Befriends Classic Monsters Using Watson APIs — Part 3</a> was originally published in <a href="https://medium.com/ibm-watson">IBM watsonx Assistant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Robot Befriends Classic Monsters Using Watson APIs — Part 1]]></title>
            <link>https://medium.com/ibm-watson/a-robot-befriends-classic-monsters-using-watson-apis-part-1-76b1cc64957e?source=rss-5ab01c8d6d68------2</link>
            <guid isPermaLink="false">https://medium.com/p/76b1cc64957e</guid>
            <category><![CDATA[ibm-watson]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Josh Zheng]]></dc:creator>
            <pubDate>Mon, 22 May 2017 06:54:38 GMT</pubDate>
            <atom:updated>2017-11-07T15:02:23.070Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction To Watson Visual Recognition Custom Classifiers Using Python</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8nsKAndmTpSJDdDb4kfDLg.jpeg" /></figure><p>You can find the code to this entire project <a href="https://github.com/boxcarton/tjbot-visual-recognition"><strong>here</strong></a>.</p><p>And the rest of of the series here:</p><p><strong>Part 2</strong> — <a href="https://medium.com/@nickbourdakos/a-robot-befriends-classic-monsters-using-watson-apis-part-2-df827d5501eb">Introduction To Watson Visual Recognition Custom Classifiers Using NodeJS</a></p><p><strong>Part 3 </strong>— <a href="https://medium.com/@joshzheng/a-robot-befriends-classic-monsters-using-watson-apis-part-3-c9ed77a0e9e7">Integrating Watson Visual Recognition With RaspberryPi Camera</a></p><p><strong>Part 4</strong> — <a href="https://medium.com/@joshzheng/a-robot-befriends-classic-monsters-using-watson-apis-part-4-660efada8a4e">Putting It All Together: TJBot Befriends Some Classic Monsters</a></p><h4>Introduction</h4><p>Dracula, Frankenstein, the Wolfman, and the Mummy — these monsters aren’t evil, just misunderstood. All they really need is some extra empathy from the rest of us. Fortunately we’ve built a <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-1-d1c273e17a63#.qskt2lwj5">robot that cares</a>, who sounds like the perfect candidate to befriend these supposedly scary monsters.</p><p>In this episode of <em>Teaching Robots How To Love</em>, we’ll build upon our previous <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-1-d1c273e17a63#.qskt2lwj5">Build a Chatbot That Cares</a> tutorial and teach TJBot how to show some love to a few classic monsters. In our previous series, we taught TJBot how to listen, speak, and empathize. But we’re still missing a key step of any interaction — recognizing who you’re interaction with.</p><p><strong>Part 1 </strong>(this article) and <a href="https://medium.com/@nickbourdakos/a-robot-befriends-classic-monsters-using-watson-apis-part-2-df827d5501eb"><strong>Part 2</strong></a> of this tutorial series will show you how to use <a href="https://www.ibm.com/watson/developercloud/visual-recognition.html">Watson Visual Recognitio</a>n to recognize four of the most popular classic monsters using the API’s custom classifiers feature.</p><p>The later parts will demonstrate how to integrate Visual Recognition with the code we wrote for the <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-1-d1c273e17a63#.yu9fhv2kt">Build a Chatbot That Cares</a> tutorial. I recommend completing that tutorial first if you plan to finish the entire series. If you’re only interested in learning about Visual Recognition, this tutorial is a good place to start.</p><p>In the end, you’ll have something like this:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fs0SPWIfDqng%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Ds0SPWIfDqng&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fs0SPWIfDqng%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fcd4c1b0a71d92ad9091110549beeab3/href">https://medium.com/media/fcd4c1b0a71d92ad9091110549beeab3/href</a></iframe><p>Amazing, I know.</p><h4>What’s Ahead</h4><p>If you’re a regular, you’ll notice that this builds upon my previous <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-1-d1c273e17a63#.yu9fhv2kt">Build a Chatbot That Cares</a> tutorial. If you followed that tutorial to completion, you would have already learned how to use Watson Speech To Text, Tone Analyzer, Conversation and Text To Speech. We’re now adding the Visual Recognition to the mix.</p><p>Here’s the complete list of tutorials required to finish this project.</p><ul><li><strong>Prerequisite</strong> — Build a Chatbot That Cares <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-1-d1c273e17a63#.yu9fhv2kt">Part 1</a> and <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-2-66367cf26e4b#.ih9wfqs3q">Part 2</a></li><li><strong>Part 1</strong> — Introduction To Watson Visual Recognition Custom Classifiers Using Python <strong>(You are here)</strong></li><li><strong>Part 2</strong> — <a href="https://medium.com/@nickbourdakos/a-robot-befriends-classic-monsters-using-watson-apis-part-2-df827d5501eb">Introduction To Watson Visual Recognition Custom Classifiers Using NodeJS</a></li><li><strong>Part 3 </strong>— <a href="https://medium.com/@joshzheng/a-robot-befriends-classic-monsters-using-watson-apis-part-3-c9ed77a0e9e7">Integrating Watson Visual Recognition With RaspberryPi Camera</a></li><li><strong>Part 4</strong> — <a href="https://medium.com/@joshzheng/a-robot-befriends-classic-monsters-using-watson-apis-part-4-660efada8a4e">Putting It All Together: TJBot Befriends Some Classic Monsters</a></li></ul><p><strong>The code for Part 1 — Part 4 can be found </strong><a href="https://github.com/boxcarton/tjbot-visual-recognition"><strong>here</strong></a><strong>.</strong></p><h4>Understanding Watson Visual Recognition Custom Classifiers</h4><p>Here’s the <a href="https://visual-recognition-demo.mybluemix.net/train">official demo</a> and <a href="https://www.ibm.com/watson/developercloud/doc/visual-recognition/classifiers-tutorials.shtml">documentation</a> for custom classifiers. Essentially, the API let’s you create your own visual classifier using the visual classes you’ve defined with your own training set. The process usually involves these 4 steps:</p><ol><li>Collect training images</li><li>Create a custom classifier using the training set</li><li>Test the classifier against the test set</li><li>If necessary, update the classifier’s training data until desired accuracy is achieved with the test data</li></ol><p>For the rest this tutorial, we’ll go through these steps, using Python, to train an endpoint that’ll recognize four of the most popular classic monsters: Dracula, Frankenstein, the Wolfman, and the Mummy.</p><h3>Step-By-Step Tutorial</h3><h4>Step 0. What You Need</h4><ol><li>Python (2.7 or 3.x) development environment. I’m using 3.5.2</li><li>Credential for <a href="https://www.ibm.com/watson/developercloud/visual-recognition.html">Watson Visual Recognition</a></li></ol><h4>Step 1: Bluemix Account and Service Credentials</h4><p>In order to use the the Watson services, you need to create the services and its credentials on <a href="http://www.ibm.com/cloud-computing/bluemix/">IBM Bluemix</a>. Bluemix is IBM’s PaaS offering that let’s you deploy and manage your cloud applications.</p><p>If you prefer deploying your applications somewhere else, that’s not a problem. You can use all the Watson services via our RESTful API. However, the Bluemix platform does give you an easy way to integrate your deployed apps with your Watson services. Either way, go ahead and <a href="https://console.ng.bluemix.net/registration/">sign up</a> for a Bluemix account to at least get your credentials.</p><p>After getting your Bluemix account, login to your <a href="http://console.ng.bluemix.net/">Bluemix Dashboard</a>. Go to the <strong>Catalog </strong>and you should find the <strong>Visual Recognition</strong> service under <strong>Watson</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rNuAvSNLAfTdSwrksmq04A.png" /></figure><p>After creating the service, you should be able to find your API key by clicking <strong>View Credentials </strong>in the <strong>Service Credentials</strong> sections<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ugwC57dBiMBbXZ8K8abFug.png" /></figure><h4>Step 2. Set Up Python Environment</h4><p>If you’re new to Python, I highly recommend setting up <a href="https://virtualenv.readthedocs.org/en/latest/">virtualenv</a> and <a href="https://virtualenvwrapper.readthedocs.org/en/latest/">virtualenvwrapper</a>. These tools let you set up sandboxed Python environments with everything you need, including <a href="https://pypi.python.org/pypi/pip">pip</a>. If you’d rather use something else, that’s fine, but make sure you have pip installed properly.</p><p>We’ll interact with the Visual Recognition service using the <a href="https://github.com/watson-developer-cloud/python-sdk">Watson Developer Cloud Python SDK</a>. You’ll install it using pip (which should be available to you once you’re in a virtual environment).</p><p>pip install --upgrade watson-developer-cloud should do the trick.</p><p><strong>Note: I’m also using </strong><a href="https://github.com/theskumar/python-dotenv"><strong>python-dotenv</strong></a><strong> to manage the API key. Simply update the value of .env_example to your API key and change the filename to .env.</strong></p><h4>Step 3. Collect Images For Training</h4><p>This is the most tedious step in the process. You’ll have to gather images to be part of your training set. I used a Chrome extension to download 50–60 images for each character from Google Images.</p><p>I’ve also made the <a href="https://ibm.box.com/s/kshgoxcxj37kpytz2xb9572kpms8umg6">images available here</a>. You’re welcome. Notice that the training set needs to be compressed into zip files. One zip file per visual class.</p><p><strong>Note:</strong> It’s a good idea to train your classifier with images similar to what you’ll encounter post deployment. In this case, the training set would ideally be photos taken by the Raspberry Pi camera. But since these characters are fairly distinct, stock images from the Internet should suffice.</p><p>Make sure to read up on this blog post for <a href="https://www.ibm.com/blogs/bluemix/2016/10/watson-visual-recognition-training-best-practices/">best practices</a> when training a custom classifier.</p><h4>Step 4. Create Custom Classifiers</h4><p>Now that you have the necessary training data, it’s time to create the custom classifier. I’ll show you how to do this using the <a href="https://github.com/watson-developer-cloud/python-sdk">Watson Python SDK</a>.</p><p><strong>Reminder</strong>: <a href="https://medium.com/@nickbourdakos/a-robot-befriends-classic-monsters-using-watson-apis-part-2-df827d5501eb">Part 2</a> of this tutorial will be an introduction to custom classifiers using NodeJS. If that’s your language of choice, you’re in luck.</p><p>Using the Python SDK to create a custom classifier is quite simple. The entire code can be found <a href="https://github.com/boxcarton/tjbot-visual-recognition/blob/master/python/create_classifier.py">here</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f3a8eec38c9dc216ba3f3fd87c0fd74/href">https://medium.com/media/3f3a8eec38c9dc216ba3f3fd87c0fd74/href</a></iframe><ol><li>Notice the instantiation that happens on line 5.</li><li>You’ll have to modify the file paths to your own image zip files.</li><li>Line 16 — line 20 creates the classifier. On line 16, we’re naming the classifier <strong>monsters</strong>.</li><li>The <strong>parameter name</strong>, e.g. &lt;parameter_name&gt;_positive_examples, translates to the name of the class. In this case, there are four classes inside the <strong>monsters </strong>classifier: <strong>dracula</strong>,<strong> frankenstein</strong>,<strong> wolfman</strong>,<strong> </strong>and <strong>mummy</strong>.</li></ol><p>You should see something like this returned in your terminal:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5ef702873e15fa34f44560a3635fb72/href">https://medium.com/media/b5ef702873e15fa34f44560a3635fb72/href</a></iframe><p>Notice that the classifier name you specified is <strong>NOT</strong> the classifier_id. The classifier_id will always be <strong>&lt;classifier_name&gt;_&lt;number&gt;</strong>. Later on, this classifier_id is what you use to specify the classifier used to classify incoming images.</p><p><strong>Note: </strong>Inside the <a href="https://github.com/boxcarton/tjbot-visual-recognition/tree/master/python">python folder</a>, I’ve included a piece of sample code on how you’d query the API directly. I recommend using the SDK but hopefully by showing the code underneath (also reference the <a href="https://github.com/watson-developer-cloud/python-sdk/blob/master/watson_developer_cloud/visual_recognition_v3.py">code from the SDK</a>), you’ll have more flexibility in adapting this tutorial to your own project.</p><h4>Step 5. Classify Image</h4><p>Finally it’s time to test how well our training went.</p><p>Here’s the code to classify a new image:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f43e57b4e7af3d782b527070cc6c2fd5/href">https://medium.com/media/f43e57b4e7af3d782b527070cc6c2fd5/href</a></iframe><ol><li>The classification call is on line 10–12.</li><li><strong>classifier_ids</strong> is type <em>list</em>, which allows you to include a list of classifiers you’d like to use to classify a given image. If<strong> classifiers_ids</strong> is not given, all your classifiers (including the default classifier), will be used.</li><li>The classifier_id is classifier name we specified earlier followed by<strong> _&lt;number&gt;</strong>. That’s your unique classifier ID. It should have been returned to you after your classifier was created. You can also retrieve your list of classifier IDs using the GET /v3/classifiers endpoint or the list_classifiers function from the SDK.</li></ol><p>After running the script, you should get back a JSON that looks something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/19faa906961bafc06675275b477141d3/href">https://medium.com/media/19faa906961bafc06675275b477141d3/href</a></iframe><p>As you can see, we’re able to accurately classify the Elmo picture with high confidence (line 6–7).</p><p>If you’re training custom classifiers using your own data, I recommend reading <a href="https://www.ibm.com/blogs/bluemix/2016/10/watson-visual-recognition-training-best-practices/">this blog post</a> by the Watson Visual Recognition team on best practices when creating custom classifier.</p><h4>Next Steps</h4><p>That’s it! You just trained a Watson custom visual classifier and classified an image against it. Hopefully you found this helpful in your own getting-started process.</p><p>Move on to <a href="https://medium.com/@nickbourdakos/a-robot-befriends-classic-monsters-using-watson-apis-part-2-df827d5501eb"><strong>Part 2</strong></a> of this tutorial if you want to learn how to create custom classifiers in NodeJS. It’s also helpful to look over it if you’re interested building the final TJBot because the final code will also be written in NodeJS.</p><p>As always, if you have any questions, feel free to reach out at <a href="http://joshzheng@us.ibm.com/">joshzheng@us.ibm.com</a>, connect with me on <a href="https://www.linkedin.com/in/joshzheng">LinkedIn</a>, or <a href="https://medium.com/@joshzheng">follow me</a> here on Medium.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76b1cc64957e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-watson/a-robot-befriends-classic-monsters-using-watson-apis-part-1-76b1cc64957e">A Robot Befriends Classic Monsters Using Watson APIs — Part 1</a> was originally published in <a href="https://medium.com/ibm-watson">IBM watsonx Assistant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Chatbot That Cares — Part 2]]></title>
            <link>https://medium.com/ibm-watson/build-a-chatbot-that-cares-part-2-66367cf26e4b?source=rss-5ab01c8d6d68------2</link>
            <guid isPermaLink="false">https://medium.com/p/66367cf26e4b</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[emotional-intelligence]]></category>
            <category><![CDATA[ibm-watson]]></category>
            <dc:creator><![CDATA[Josh Zheng]]></dc:creator>
            <pubDate>Mon, 05 Dec 2016 22:23:14 GMT</pubDate>
            <atom:updated>2017-03-16T19:14:50.624Z</atom:updated>
            <content:encoded><![CDATA[<h4>In 150 Lines of Code</h4><p>In <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-1-d1c273e17a63#.vvx2paisg"><strong>part 1</strong></a> of the tutorial, we finished the code required to run TJBot on a laptop. Now let’s get the code working on a Raspberry Pi. I promise this part will be much shorter. 😬</p><p>Again, <a href="http://www.instructables.com/id/Build-a-Talking-Robot-With-Watson-and-Raspberry-Pi/">this tutorial</a> has lots of useful information as well.</p><h4>Step 0 — What You Need</h4><ol><li><a href="https://ibmtjbot.github.io/">TJBot</a></li><li>Raspberry Pi. I’m using the latest <a href="https://www.amazon.com/dp/B01C6Q2GSY/ref=wl_it_dp_o_pC_nS_ttl?_encoding=UTF8&amp;colid=1BLM6IHU3K1MA&amp;coliid=I1WPZOVL411972">Raspberry Pi 3</a>.</li><li>HDMI display</li><li>USB keyboard</li><li>USB mouse</li><li><a href="https://www.amazon.com/dp/B005BRET3G/ref=wl_it_dp_o_pC_nS_ttl?_encoding=UTF8&amp;colid=1BLM6IHU3K1MA&amp;coliid=I1C98I7HIFPNJE">USB microphone</a></li><li><a href="https://www.amazon.com/gp/product/B014SOKX1E/ref=oh_aui_detailpage_o00_s00?ie=UTF8&amp;psc=1">Speaker with 3.5mm audio jack</a></li></ol><h4>Step 1 — Raspberry Pi Setup</h4><p>To set up a RaspberryPi initially, you need the HDMI display, the USB keyboard and theUSB mouse. Then simply follow the on-screen instructions to get the pi running.</p><p><strong>Note: </strong>If you don’t want to deal with the hassle of getting a display, keyboard, and mouse, you can also do a <a href="https://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable">headless setup</a> by buying <a href="https://www.adafruit.com/product/954">one of these</a>. But this setup also has its own headaches.</p><h4><strong>Step 2 — Node.js Setup</strong></h4><p>You now need to setup your pi to run Node.js.</p><p>Follow <a href="http://thisdavej.com/beginners-guide-to-installing-node-js-on-a-raspberry-pi/">this great guide</a> by <a href="https://twitter.com/thisDaveJ">Dave Johnson</a> to get Node.js installed onto your pi. Also make sure to follow his instruction for setting up remote accessibility. If you have everything setup correctly, you should see your raspberry pi appear under <strong>Shared</strong> devices if you’re on a mac. I gave mine the hostname <em>starboy</em> (because I had the album on repeat this entire weekend, ha weekend). Then hit <strong>Connect As… </strong>on the top right to login using your username and password. If you haven’t changed the default login during setup, it should be username: “pi” and password: “raspberry”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FD4Q8QMIV7-qbJpsdc7g5Q.png" /></figure><p><strong>Note</strong>: You can also ssh into your pi using <strong><em>ssh pi@&lt;your hostname&gt;.local</em></strong><em>, </em>so in my case it’d be<em> </em><strong><em>ssh pi@starboy.local</em></strong><em>.</em></p><h4>Step 3 — Install System Libraries</h4><p>First, you’ll need to install <a href="http://www.alsa-project.org/main/index.php/Main_Page">ALSA</a> for audio recording on the pi.</p><pre>sudo apt-get install alsa-base alsa-utils</pre><p>That should do the trick.</p><p><strong>Note: </strong>You can adjust the volume of the speaker amixer cset numid=1 -- &lt;number&gt;where <em>&lt;</em>number<em>&gt;</em> is an integer between -10200 and +400 (centi-dB).</p><p>Then you’ll need <a href="https://ffmpeg.org/"><strong>ffmepg</strong></a> installed to get audio file information. This requires a bit more time (took me about 40 minutes) since you need to compile and install the library yourself. But just follow <a href="http://www.jeffreythompson.org/blog/2014/11/13/installing-ffmpeg-for-raspberry-pi/">these instructions</a> and you should be fine. I’ve pasted the commands below as well. Make sure to cd into /usr/src.</p><p><strong>First, install H264 support</strong></p><pre><br>cd /usr/src</pre><pre>git clone git://git.videolan.org/x264</pre><pre>cd x264</pre><pre>./configure — host=arm-unknown-linux-gnueabi — enable-static — disable-opencl</pre><pre>make</pre><pre>sudo make install<br></pre><p><strong>Then, install FFmpeg</strong></p><pre>cd /usr/src</pre><pre>git clone <a href="https://github.com/FFmpeg/FFmpeg.git">https://github.com/FFmpeg/FFmpeg.git</a></pre><pre>cd FFmpeg</pre><pre>sudo ./configure — arch=armel — target-os=linux — enable-gpl — enable-libx264 — enable-nonfree</pre><pre>make</pre><pre>sudo make install</pre><h4>Step 4— Configure Audio</h4><p>Open the terminal on your pi and do</p><p>sudo raspi-config</p><p>And follow <a href="https://www.raspberrypi.org/documentation/configuration/audio-config.md">these instructions</a> to force audio output through the 3.5mm jack. Assuming you’re using the speaker above of course.</p><h4>Step 5— Modify The Code For Raspberry Pi</h4><p><a href="https://github.com/boxcarton/tjbot-raspberrypi-nodejs/blob/master/raspberrypi/run_raspberry.js">The code for the pi</a> is in the same repository as <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-1-d1c273e17a63#.vvx2paisg">part 1</a>, in the <a href="https://github.com/boxcarton/tjbot-raspberrypi-nodejs/tree/master/tj_raspberrypi">raspberry folder</a>.</p><pre>git clone <a href="/service/mailto:git@github.com">git@github.com</a>:boxcarton/tjbot-raspberrypi-nodejs.git</pre><p>The code to run on the pi is in the <strong>raspberrypi</strong> folder. I actually recommend using Github as the medium to transfer your old. This way, as you modify and push the code from your laptop, you can simply pull down the changes from your Raspberry Pi shell.</p><p>Another way is to simply copy the folder onto your pi (using the network folder in <strong>step 2 </strong>or <a href="http://www.hypexr.org/linux_scp_help.php"><strong>scp</strong></a><strong> </strong>for additional nerd cred) and run <strong><em>node run_raspberry.js.</em></strong></p><p>Don’t forget to also copy over your <strong>config.js </strong>file and install the node modules using <strong>npm install</strong><em> </em>using <strong>packcage.json</strong>.</p><p>We’ll have to make a minor modification to the code in order for it to run on the pi. We’ll have to use the ALSA library we installed earlier to play the output.wav file instead of play-sound.</p><p>First remove the <strong>play-sound</strong> import and instead import <strong>exec:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dh8eU1paX--BHVu5J5u9tg.png" /></figure><p>Then use the <strong>aplay </strong>library to play the output.wav audio file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BvgCC2YDEB7fj_Aeztd1pg.png" /></figure><h4>Step 6— Assemble The TJBot Chipboard Body</h4><p><a href="https://ibmtjbot.github.io/#gettj">Here’s the link</a> to getting started with the TJBot body kit.</p><p>Right now you need to download the file and laser cut it yourself from a piece of 18&quot; x 18&quot; x .080&quot; (457mm x 457mm x 2mm) chipboard. The creators of the kit are working hard to get a process in place so you can order the kit directly. And of course the software will still work without this kit if you plan to put the pi somewhere else.</p><p>Here are <a href="http://www.instructables.com/id/Build-TJ-Bot-Out-of-Cardboard/step2/Laser-cut-TJBot">more instructions</a> on laser cutting.</p><p>Then follow this video to assembly instructions.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fk928MQmD0oc%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dk928MQmD0oc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fk928MQmD0oc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c8f6df3d0096c30f67c1b85808600b9/href">https://medium.com/media/8c8f6df3d0096c30f67c1b85808600b9/href</a></iframe><p>Here are few pictures of what it looked like while I was putting it together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FUvnRtAiHHaYqdZ5qSRlaA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a41dYlyy7IllvvT3UZPJsA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i-8Ky2ph--r93wqEGjFO_A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hf3Ffr_yX0VA4ZmU3u40Pg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*igHXkHNa_tjwbN3BHMaijg.jpeg" /></figure><h3>And we’re done!</h3><p>That could be you in the last picture. I hope you enjoy your new found robot BFF as much as I do.</p><p>Here are some suggestions for next steps:</p><ol><li>Have the Node.js code <a href="http://raspberrypi.stackexchange.com/questions/8734/execute-script-on-start-up">execute on start-up</a>. <a href="https://www.raspberrypi.org/documentation/linux/usage/rc-local.md">rc.local</a> is another option.</li><li>Use the <a href="https://www.raspberrypi.org/products/camera-module-v2/">Raspberry pi camera</a>. TJBot already has a slot for it. Also look out for my upcoming tutorial where I integrate visual recognition capabilities to TJbot.</li><li>Use the LED. TJBot also has a slot for that and <a href="https://github.com/ibmtjbot/tjbot/tree/master/recipes/sentiment_analysis">here’s the tutorial</a>.</li></ol><p>Until next time robot enthusiasts.</p><h4>Shoutout To</h4><ul><li><a href="https://medium.com/u/35785607b208">Mariya Yao</a> for documenting the process</li><li><a href="https://twitter.com/MaryamAshoori"><strong>Maryam Ashoori</strong></a><strong> </strong>for the well-designed TJBot kit and video tutorials</li></ul><p>If you have any questions or suggestions for improvement, feel free to reach out at <a href="http://joshzheng@us.ibm.com/">joshzheng@us.ibm.com</a>, connect with me on <a href="https://www.linkedin.com/in/joshzheng">LinkedIn</a>, or <a href="https://medium.com/@joshzheng">follow me</a> here on Medium.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66367cf26e4b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-watson/build-a-chatbot-that-cares-part-2-66367cf26e4b">Build a Chatbot That Cares — Part 2</a> was originally published in <a href="https://medium.com/ibm-watson">IBM watsonx Assistant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Chatbot That Cares — Part 1]]></title>
            <link>https://medium.com/ibm-watson/build-a-chatbot-that-cares-part-1-d1c273e17a63?source=rss-5ab01c8d6d68------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1c273e17a63</guid>
            <category><![CDATA[ibm-watson]]></category>
            <category><![CDATA[emotional-intelligence]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[Josh Zheng]]></dc:creator>
            <pubDate>Mon, 05 Dec 2016 22:21:28 GMT</pubDate>
            <atom:updated>2017-02-16T23:53:11.202Z</atom:updated>
            <content:encoded><![CDATA[<h4>In 150 Lines of Code</h4><p>You can find the code for this tutorial<strong> </strong><a href="https://github.com/boxcarton/tjbot-raspberrypi-nodejs"><strong>here</strong></a><strong>.</strong></p><p><strong>Part 1</strong> of this tutorial will walk you through the software of the chatbot. <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-2-66367cf26e4b#.5gkj5mz39"><strong>Part 2</strong></a><strong> </strong>will go through hardware assembly and Raspberrypi setup.</p><p>Welcome to Episode 2 of <em>Teaching Robots How to Love</em>. If you missed <a href="https://medium.com/ibm-watson-developer-cloud/how-to-build-a-candy-machine-with-feelings-922285a475c8#.7js5eul2r">Episode 1</a>, we taught a candy machine the difference between naughty and nice. Now thanks to IBM Research, we have an adorable robot to work with, his name is <a href="https://ibmtjbot.github.io/"><strong>TJBot</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AHBLKinQWohNY8dNPVrqvw.png" /></figure><p>Aw, hello to you too TJBot! So before diving in, a big shoutout to IBM research, who laid out much of the ground work for making this robot possible.</p><p>Here is the <a href="https://www.ibm.com/blogs/research/2016/11/calling-makers-meet-tj-bot/">official announcement</a> and the official <a href="https://github.com/ibmtjbot/tjbot">TJBot Github repository</a>.</p><h4>Introduction</h4><p>For this tutorial, we’re going to power TJBot with APIs from <a href="https://www.ibm.com/watson/developercloud/services-catalog.html">Watson Developer Cloud</a>. We’ll start by putting a voice interface onto TJBot, then give it the ability to converse and understand your emotional tones. In <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-2-66367cf26e4b#.95jb7h365">part 2</a> of the tutorial, we’ll transfer the code onto a Raspberry Pi and put the whole thing into the physical TJBot itself.</p><p>For the sake of simplicity, we’ll keep the conversation simple. Here are two typical conversations (via voice):</p><p><strong>You</strong>: “Hello Watson”</p><p><strong>TJBot</strong>: “Hey, how are you feeling today?”</p><p><strong>You</strong>: “I’m so glad the Warriors won”</p><p><strong>TJBot</strong>: “Yay, you’re happy, That makes me happy.”</p><p>or</p><p><strong>You</strong>: “Hello Watson”</p><p><strong>TJBot</strong>: “Hey, how are you feeling today?”</p><p><strong>You</strong>: “I’m having nightmares.”</p><p><strong>TJBot</strong>: “Don’t be scared. Life will get better soon. This too shall pass.”</p><p>Here a video of TJBot in action:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F2GqEUcBU4SY%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D2GqEUcBU4SY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F2GqEUcBU4SY%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c1003761c69071f6f815f6d5fe114dee/href">https://medium.com/media/c1003761c69071f6f815f6d5fe114dee/href</a></iframe><p>But you say, “Josh, it’s silly to share my precious feelings with a cardboard robot.” Well I beg to differ. First of all, I promise you that unlike most humans, TJBot won’t judge you no matter what you say. Furthermore, besides the fact that it’s therapeutic to express your feelings, interactions like these have a wide range of applications including customer support and patient outreach.</p><p>Now that you’re super stoked, let’s get started.</p><h3><strong>Step-by-Step Tutorial</strong></h3><p>Again, Part 1 is only focused on getting the code working on your laptop. I’m running the latest macOS Sierra on a Macbook Pro. This project requires quite a number of Watson APIs, 4 to be exact, so rather than throwing them all together at once, I’ve broken down the process by API before putting them together. So here’s an overview of what we’re doing:</p><ol><li>Create speech recognition feature using <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/speech-to-text.html">Watson Speech to Text</a> and <a href="https://www.npmjs.com/package/mic">mic</a>.</li><li>Get <a href="https://www.ibm.com/watson/developercloud/tone-analyzer.html">Watson Tone Analyzer</a> working on any text input.</li><li>Create a simple conversation using <a href="https://www.ibm.com/watson/developercloud/conversation.html">Watson Conversation</a>.</li><li>Have TJBot speak text using <a href="https://www.ibm.com/watson/developercloud/text-to-speech.html">Watson Text To Speech</a>.</li><li>Put the services together to complete the voice conversational interface.</li></ol><h4>Step 0 — What You Need</h4><p><strong>Node.js</strong> version 4.4.5+ (we use arrow functions)</p><p><strong>Code:</strong> All the code you need can be found in <a href="https://github.com/boxcarton/say-something-nice">this repository</a>. Go ahead and clone the repo and I’ll walk you through how to set everything up in the following steps. This will do the trick:</p><pre>git clone <a href="https://github.com/boxcarton/tjbot-raspberrypi-nodejs">https://github.com/boxcarton/tjbot-raspberrypi-nodejs</a> </pre><p><a href="http://www.instructables.com/id/Build-a-Talking-Robot-With-Watson-and-Raspberry-Pi/"><strong>Tutorial on Instructables</strong></a><strong>: </strong>Also made by IBM Research. I found this tutorial to be very helpful in the beginning. If you need more detail in some of these earlier steps, you might be able to find additional information there.</p><p><strong>Credentials</strong> for:</p><ul><li><a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/speech-to-text.html">Watson Speech to Text</a></li><li><a href="https://www.ibm.com/watson/developercloud/tone-analyzer.html">Watson Tone Analyzer</a></li><li><a href="https://www.ibm.com/watson/developercloud/conversation.html">Watson Conversation</a></li><li><a href="https://www.ibm.com/watson/developercloud/text-to-speech.html">Watson Text To Speech</a></li></ul><p>If you’ve never used Watson APIs before, see <a href="https://medium.com/@joshzheng/watson-tutorial-1-speech-to-text-alchemylanguage-sentiment-analysis-in-python-23e1a76965c5#.u6lnva1eg">my previous post</a> on how to acquire the credentials. You need to get the credentials through <a href="http://www.ibm.com/cloud-computing/bluemix/">Bluemix</a>, but since the APIs are accessed over the HTTP RESTful interface, you’re not required to stay on Bluemix afterwards. <strong><em>Note</em></strong><em>: Bluemix is IBM’s PaaS offering that let’s you deploy and manage your cloud applications.</em></p><p>Also <a href="http://www.instructables.com/id/Build-a-Talking-Robot-With-Watson-and-Raspberry-Pi/step5/Update-your-credentials/">check here</a> for more detailed steps on creating credentials on Bluemix.</p><p>The screenshot below shows where to find your credentials after you’ve created a Watson service. You’ll either create a New Credential or click the View Credential dropdown to get your username and password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5IfmFoWGOvxDfDUf0S_Qqw.png" /></figure><h4>Step 0.5 — Configuration File</h4><p>It’ll save you some time if you create all four Watson services at once. Once you have the services created and your credentials gathered in one place, it’s time to complete the configuration file.</p><p>If you’ve cloned the repository, you’ll see a <strong>config.new.js</strong> file. I’d recommend filling out the missing variables with your credentials now. But in case you’d like to just read through the tutorial, I’ve taken a screenshot for you so you know what I’m talking about. Don’t forget to rename this file to <strong>config.js </strong>before<strong> </strong>running <strong><em>node run.js</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T_P-ZOubjyo8UlgFFtbexw.png" /></figure><p>Let’s understand how each service works individually before mashing them them together. To do this, I created a separate script for each service in the <a href="https://github.com/boxcarton/tjbot-raspberrypi-nodejs/tree/master/tutorial"><strong>tutorial</strong></a> folder.</p><h4>Step 0.75 — Install node_modules</h4><p>Remember to run <strong><em>npm install</em></strong> in the root folder with <strong>package.json</strong> to install your node modules.</p><h4><strong>Step 1 — Speech To Text</strong></h4><p>Open the <a href="http://xcarton/tjbot-raspberrypi-nodejs/blob/master/tutorial/step1_stt.js"><strong>tutorial/step1_stt.js</strong></a> file. Notice that we’re using the <a href="https://github.com/watson-developer-cloud/node-sdk">Node.js SDK for Watson Developer Cloud</a> to interact with the APIs. This will be true throughout the project. After the imports:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FbwU89u4Ceuwp8I6n13pYA.png" /></figure><p>and the Watson Speech To Text instantiation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_B1aJGQMYWgO6bZAbHqysw.png" /></figure><p>You’ll find the code to set up the microphone:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pk_ir9QFpWZShBa2y1MghA.png" /></figure><p>These are the default configurations. You can look through the <a href="https://www.npmjs.com/package/mic">mic official documentation</a> if you’d like to make any changes. Later on, I’ll show you that we would actually need to pause the microphone when TJBot is speaking to prevent infinite audio feedback.</p><p><strong><em>Important Note: </em></strong><em>mic</em> is a simple stream wrapper around arecord (Linux (including Raspbian)) and sox (Mac/Windows).</p><p>You need to have <a href="http://sox.sourceforge.net/"><strong>sox</strong></a> installed. The easiest way to do this is through <a href="http://brew.sh/">homebrew</a>. If you don’t have it, install it! Then simply do <strong><em>brew install sox</em></strong>.</p><p>Finally we get to Watson Speech To Text:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CfIB0W05uq_VxH6jc5VM0A.png" /></figure><p>As you can see, besides setting the parameters, doing Watson Speech To Text is literally one line of code (line 31). You simply pipe the audio stream to your Speech To Text instance and it’ll transcribe your audio real-time via WebSocket and return the transcribed text to <em>textStream.</em></p><p>Run <strong><em>node tutorial/step1_stt.js</em> </strong>now and monitor the console to make sure everything works.</p><h4>Step 2 — Tone Analyzer</h4><p>Tone analyzer is one of Watson’s unique offerings. It’s based on the theory of psycholinguistics, a field of research focused on the relationship between linguistic behaviors and psychological theories. You can read more about the science behind the API <a href="https://www.ibm.com/watson/developercloud/doc/tone-analyzer/science.shtml">here</a>. The results include emotional tone, social tone, and language tone but we’ll only be using the emotional tone in this project.</p><p>The possible emotions returned include joy, sadness, fear, disgust, and anger, along with their respective likelihood score (between 0 and 1). For simplicity’s sake, TJBot will choose the emotion with the highest likelihood score, but better heuristics should be chosen in the future since a sentence can also contain a mix of emotions or the most likely emotion might not be the dominant one.</p><p>The code to call Tone Analyzer is again very simple:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UEKOJUHc3SanG1O-oPWO2g.png" /></figure><p>Make sure you have this code working by running <strong><em>tutorial/step2_tone.js</em></strong>. Play around with the <strong>text </strong>variable to see what kind of results the service returns. We’ll later add on the code to pick out the emotion with the highest likelihood score.</p><h4>Step 3 — Conversation</h4><p>Now it’s time to create the dialog using <a href="http://www.ibm.com/watson/developercloud/conversation.html">Watson Conversation</a>. If this is your first time using Watson Conversation service, I’d recommend briefly going over the <a href="http://www.ibm.com/watson/developercloud/doc/conversation/tutorial.html">official tutorial</a>. You can think of Watson Conversation as an easy way to create a conversation state machine with NLP capabilities. If you’re interested in a more advanced discussion of the service, check out my <a href="https://medium.com/ibm-watson-developer-cloud/how-to-build-a-recipe-slack-bot-using-watson-conversation-and-spoonacular-api-487eacaf01d4?cm_mc_uid=18304204854114804567788&amp;cm_mc_sid_50200000=1480846597#.quchzdc5e">previous post on using Watson Conversation to create a Slack Bot</a>.</p><p>Let’s first wire up the dialog using the <a href="https://www.ibmwatsonconversation.com/">Watson Conversation Tool</a>. You should see something similar to this when you login with your Bluemix account:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gK7hKjGV5hoDLY1MgIHM-w.png" /></figure><p>Click the <strong>Create</strong> button and follow the instructions on the modal window. You should end up with something similar to my <strong>TJBot</strong> workspace.</p><p>Now let’s get on with the dialog. Since this is an extremely simple interaction, we’ll not be using the <strong>Intents</strong> feature, but do read the <a href="http://www.ibm.com/watson/developercloud/doc/conversation/intents.html">documentation on intents</a> if you plan to create more complex conversations. Again, <a href="https://medium.com/ibm-watson-developer-cloud/how-to-build-a-recipe-slack-bot-using-watson-conversation-and-spoonacular-api-487eacaf01d4?cm_mc_uid=18304204854114804567788&amp;cm_mc_sid_50200000=1480809024#.jsqi3i15d">my previous tutorial</a> also dives deeper into many other aspects of this service.</p><p>This conversation will have one <a href="http://www.ibm.com/watson/developercloud/doc/conversation/entities.html"><strong>entity</strong></a><strong> -</strong> <strong>Watson</strong>. Entities are nouns that you’d like the service to recognize throughout your conversations, so add that to your workspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O78uSMr_ndGG1FGUyAxPPw.png" /></figure><p>Finally wire up the dialog like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SiZ7upLMvVyEwSjY3beFdg.png" /></figure><p>Follow the<a href="http://www.ibm.com/watson/developercloud/doc/conversation/tutorial-dialog.html"> documentation on dialog</a> if you’re having trouble. Your dialog will start by recognizing Watson has an entity because the conversation always starts with a greeting involving the word “Watson”. Notice the <strong>Anything else</strong> node below that acts as a catch-all to user inputs that you can’t respond to. The “@watson” node then branches off into 5 nodes based on the detected emotion. I’ve uncollapsed the “fear” and “joy” response in the screenshot above.</p><p>Now if this is your first time using Conversation, you might be wondering what <strong>$emotion</strong> is. <strong>$&lt;variable_name&gt;</strong> is how you access your context variables. And what is Context? Well, first read the <a href="https://www.ibm.com/watson/developercloud/doc/conversation/dialog-build.html#context-variables">official documentation on it</a>. But basically it’s a simple data structure (an object/dictionary) that gets passed between your code and the Conversation service. It’s the mechanism to which your code talks to the service and vice versa. After we determine the emotional tone of the user, we set <strong>context.emotion</strong> to one of the emotions (“happiness”, “sadness”, etc.) in our application code. The Conversation Toll can then access that variable via the “<strong>$” </strong>and branch the dialog accordingly.</p><p>If you don’t want to wire up the dialog yourself, I’ve exported my workspace to <a href="https://github.com/boxcarton/tjbot-raspberrypi-nodejs/blob/master/workspace.json"><strong>workspace.json</strong></a> so that you can upload it into your own workspace.</p><p>Either way, after getting your dialog to look like the screenshot above, it’s time to look at <a href="https://github.com/boxcarton/tjbot-raspberrypi-nodejs/blob/master/tutorial/step3_conversation.js"><strong>tutorial/step3_conversation.js</strong></a>. The following lines include the actual communication between your code and the service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lfPwUXNR28cuYkVLgIE2yA.png" /></figure><p>Notice how I’ve wrapped the code above in some additional code so the file can run as a standalone script. It also takes in user input via command line. We’ll get rid of this wrapper code when we later put everything together.</p><p>Run <strong><em>node tutorial/step3_conversation.js</em> </strong>and play around with the <strong>context</strong> variable and try to access it via the Conversation Tool dialog.</p><p>A few things to watch out for:</p><ol><li>Make sure you have the correct <strong>workspace_id</strong></li><li>Make sure to persist the <strong>context</strong> variable (initialize it outside of the conversation scope) if you want to maintain the conversation state.</li><li>Change <strong>context.emotion</strong> to the different emotions to make sure you’re getting the appropriate responses.</li></ol><h4>Step 4 — Text To Speech</h4><p>Now we’d like TJBot to speak the response. Conveniently Watson Developer Cloud also provides a <a href="https://www.ibm.com/watson/developercloud/text-to-speech.html">Text to Speech</a> service.</p><p>Here’s the code to convert text into an audio file using the service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2xIKLu5Dnahg6_gYNX3nnQ.png" /></figure><p>You simply use the <strong>synthesize</strong> function and pipe the result to fs to create the file <em>output.wav</em>. We then use the <a href="https://www.npmjs.com/package/play-sound">play-sound</a> module to play the file through the speakers.</p><p><strong>Important Note</strong>: The<em> </em><a href="https://www.npmjs.com/package/play-sound">play-sound</a> module requires you having one of the <a href="https://www.npmjs.com/package/play-sound#options">players</a> installed. I installed <strong>mplayer</strong> by simply doing ‘<strong><em>brew install mplayer’</em>.</strong></p><h4><strong>Step 5 — Putting It All Together</strong></h4><p>Finally it’s time get all the APIs to play together. This is done in <a href="https://github.com/boxcarton/tjbot-raspberrypi-nodejs/blob/master/run.js"><strong><em>run.js</em></strong></a><em>. </em>At this point, you should be familiar with most of the code in this file. However, there are few changes I’d like to point out.</p><ul><li><strong>Only start the conversation upon hearing “Watson” (or whatever attention word you’ve set in your config file)</strong></li></ul><p>Since the microphone is on all the time, we don’t want TJBot to respond to every sound it hears. After converting user speech to text, we make sure the word “watson” is actually spoken.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KySNa8zzVrFNWN3qK8Cfyg.png" /></figure><p>Notice how on line 128, we only enter the conversation portion if <strong><em>start_dialog</em></strong><em> </em>is set to true.</p><ul><li><strong>Prevent TJBot from talking to himself</strong></li></ul><p>Notice that we’ve put the text-to-speech code into the <strong>speakResponse</strong> function. More importantly, notice on line 108 that we pause the microphone right before we play the file. This is to prevent the audio from being heard by our speech-to-text function, resulting in a infinite feedback loop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*koyDRRuPxRnUQxEBlMKKEQ.png" /></figure><p>But how we know when to turn the microphone back on? We use the <a href="https://www.npmjs.com/package/node-ffprobe">node-ffprobe</a> module to get the duration of output.wav and save it to the variable <strong>pauseDuration</strong>.</p><p><strong><em>Important Note</em></strong>: node-ffprobe requires <strong>ffmpeg</strong> to be installed (see <a href="https://www.npmjs.com/package/node-ffprobe">official package homepage</a>):</p><p>sudo apt-get install ffmpeg<br>npm install node-ffprobe</p><p>We also add on another 0.5 seconds to the duration just to be safe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*07DkdHVlVhPqcVQOFeggHw.png" /></figure><p>During the initialization of the microphone, we set it up such that whenever the microphone receives the ‘<em>pauseComplete</em>’ event, via the <strong><em>on(‘pauseComplete’)</em></strong> API (line 53), we pause the microphone for <strong>pauseDuration</strong><em> </em>number of seconds.</p><ul><li><strong>Using Tone Analyzer requires </strong><a href="https://www.promisejs.org/"><strong>promise</strong></a></li></ul><p>While talking to TJBot, we need to call Watson Tone Analyzer before sending the user input to the Conversation Service. Since every call in Node.js is asynchronous, we need to wrap the Tone Analyzer API call into a promise:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9yY8woPBqpw3anPNsBSM8w.png" /></figure><p>and resolve the promise using <strong><em>then()</em></strong><em> </em>(see line 129)<em> </em>to call the Conversation API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iAhvzLhaqNqx5UkHYOBQvw.png" /></figure><ul><li><strong>Resetting the dialog</strong></li></ul><p>Finally we need to reset the dialog after the last response from TJBot so that only the attention word (in this case “Watson”) triggers the conversation again. We added some code at the end to do just that by accessing the <em>context.system.dialog_turn_counter </em>variable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q3Hiwi3PX-OoBPkP0SrR8A.png" /></figure><p>We know that we’ve reached the end of the conversation when the turn counter has reached 2.</p><h3>That’s it!</h3><p>Run <strong><em>node run.js</em></strong> on your laptop and you should be able to talk to TJBot!</p><p>In <a href="https://medium.com/ibm-watson-developer-cloud/build-a-chatbot-that-cares-part-2-66367cf26e4b#.95jb7h365"><strong>Part 2</strong></a> of this tutorial, I’ll be showing you how to:</p><ol><li>Put TJBot together from a laser-cut chip board</li><li>Set up your Raspberry Pi environment</li><li>Make a few modifications to the code so it runs properly on the Pi.</li></ol><h4>Special Shoutout To:</h4><ul><li><a href="https://medium.com/u/35785607b208"><strong>Mariya Yao</strong></a>: for telling me about TJBot in the first place and helping me with the laser cutting.</li><li><a href="https://twitter.com/MaryamAshoori"><strong>Maryam Ashoori</strong></a>: the creator of TJBot for the pointers along the way.</li></ul><p>As always, if you have any questions, feel free to reach out at <a href="http://joshzheng@us.ibm.com/">joshzheng@us.ibm.com</a>, connect with me on <a href="https://www.linkedin.com/in/joshzheng">LinkedIn</a>, or <a href="https://medium.com/@joshzheng">follow me</a> here on Medium.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1c273e17a63" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-watson/build-a-chatbot-that-cares-part-1-d1c273e17a63">Build a Chatbot That Cares — Part 1</a> was originally published in <a href="https://medium.com/ibm-watson">IBM watsonx Assistant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is Chatbot Right For You?]]></title>
            <link>https://medium.com/ibm-watson/is-chat-bot-right-for-you-c9c12dc46f18?source=rss-5ab01c8d6d68------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9c12dc46f18</guid>
            <category><![CDATA[conversational-ui]]></category>
            <category><![CDATA[editorials]]></category>
            <category><![CDATA[messaging]]></category>
            <category><![CDATA[chatbots]]></category>
            <dc:creator><![CDATA[Josh Zheng]]></dc:creator>
            <pubDate>Fri, 26 Aug 2016 00:42:52 GMT</pubDate>
            <atom:updated>2017-11-07T15:06:06.043Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, Fred Wilson wrote a short piece on the <a href="http://avc.com/2016/08/checking-in-on-chat-bots/">current state of bots</a>. The TL;DR is that he finds the current chat bots underwhelming, but remains optimistic about the future.</p><p>I believe that chat bots haven’t taken off because most use cases actually don’t lend itself to a chat interface. Before building a chat bot, it is important to understand the tradeoffs between a chat interface vs. an app/webapp interface.</p><p>Having just built <a href="https://medium.com/p/487eacaf01d4/edit">my first chat bot</a>, I have some thoughts on what use cases make sense for a chat bot interface. A good chat bot use case should satisfy all of these criteria.</p><h4><strong>1. It needs to take advantage of the natural language interface.</strong></h4><p>The appeal of natural language is that it takes advantage of an existing behavior. We already spend a lot of time on our phone chatting with other humans. This means a much lower cognitive load on the user compared to learning another app interface. If you find yourself repeatedly using structured inputs and output, then you’re not really taking advantage of the natural language interface. In this case, an app with buttons and images is a better option.</p><h4><strong>2. The context is best created and maintained in natural language (</strong>with the help of some embedded visual/audio cues)<strong>.</strong></h4><p>We’re already seeing this, but I believe all future successful chat bots will be in the form of mixed-media communication. This doesn’t change the fact that text is still the dominate component of the interaction, which means that the context exists in text form (besides what’s in the user’s head).</p><p>A limitation of chat bots is that that you’re stuck in a chat window. It turns out a lot of use cases require a visual or audio context. For example, it’d be a terrible experience to play chess against a chat bot. If you find yourself using lots of buttons, sounds, and pictures, chat bot probably isn’t the right form. Remember that visual cues have a much higher bandwidth for communicating certain information. “A picture is worth a thousand words” is literally true here.</p><h4><strong>3. There is an emotional component to the interaction.</strong></h4><p>The use case should have an opportunity for the chat bot to improve the user experience through empathy. This is why I believe any purely task-oriented uses cases are ill-suited for chat bots. If I want to order some detergents, Amazon’s “Buy now with 1-click” works great. But if I’m frustrated and need my feelings addressed (common example being customer support), it’s for chat bots to shine.</p><p>The corollary to this is that make sure your chat bot has a personality! Humans have an incredible capacity to personify almost anything. If your chat bot has a coherent personality, people will project their feelings onto your bot in no time. When <a href="https://www.facebook.com/hiponcho/">Poncho</a> first came out, it had many performance issues, including slow response time or giving completely irrelevant answers. But guess what? Many people attributed that to Poncho’s sassy personality and liked it.</p><h4><strong>4. The interaction doesn’t require rigid pathways.</strong></h4><p>To say this from the other angle: the use case is a good one if it involves many context switches. This results from the fact that natural language lends itself to an infinite number of inputs. You can don’t have to fill out a box or click a button anymore. Just like a real conversation, I should be able to digress into a different and topic and then come back to finish the initial point. If you find yourself constantly forcing specific interactions to protect against unexpected user inputs, rethink using a chat bot.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9c12dc46f18" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-watson/is-chat-bot-right-for-you-c9c12dc46f18">Is Chatbot Right For You?</a> was originally published in <a href="https://medium.com/ibm-watson">IBM watsonx Assistant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Build a Recipe Slackbot Using Watson Conversation and Spoonacular API]]></title>
            <link>https://medium.com/ibm-watson/how-to-build-a-recipe-slack-bot-using-watson-conversation-and-spoonacular-api-487eacaf01d4?source=rss-5ab01c8d6d68------2</link>
            <guid isPermaLink="false">https://medium.com/p/487eacaf01d4</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[slackbot]]></category>
            <category><![CDATA[conversational-interfaces]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[ibm-watson]]></category>
            <dc:creator><![CDATA[Josh Zheng]]></dc:creator>
            <pubDate>Wed, 24 Aug 2016 00:26:06 GMT</pubDate>
            <atom:updated>2017-09-19T23:49:08.527Z</atom:updated>
            <content:encoded><![CDATA[<p>The code for this tutorial is<strong> </strong><a href="https://github.com/boxcarton/watson-recipe-bot"><strong>here</strong></a><strong>.</strong></p><p><strong>Note: </strong><em>If you’re interested in adding a database to this chatbot, </em><a href="https://medium.com/ibm-watson-data-lab/persisting-data-for-a-smarter-chatbot-be599480f7b2#.rcprjvjtl"><em>here’s a good follow-up tutorial</em></a><em> on integrating this chatbot with Cloudant.</em></p><p>In case you didn’t use Internet in 2016, bots have been <a href="https://medium.com/chris-messina/2016-will-be-the-year-of-conversational-commerce-1586e85e3991#.tgtdfneds">all</a> <a href="https://medium.com/@tedlivingston/the-future-of-chat-isn-t-ai-b07f65bc252#.9n8knrd7k">the</a> <a href="https://medium.com/chris-messina/2016-will-be-the-year-of-conversational-commerce-1586e85e3991#.tgtdfneds">rage</a>.</p><p>Watson released its own <a href="https://www.ibm.com/watson/developercloud/conversation.html">Conversation Service</a> last month. Naturally, I decided to take it out for a spin.</p><p>After looking at some existing bots and APIs, the last thing I wanted to build was another pizza-ordering bot. I do, however, love food way too much. In the end, I decided that asking a Slackbot for recipe suggestions would be a fun interaction.</p><p><strong><em>PSA: This bot has absolutely nothing to do with </em></strong><a href="https://www.ibmchefwatson.com/community"><strong><em>Chef Watson</em></strong></a><strong><em>. It’s just a simple Slackbot you can add to your Slack channel.</em></strong></p><p>What finally sold me on this idea was Spoonacular’s <a href="https://market.mashape.com/spoonacular/recipe-food-nutrition#find-by-ingredients">find-recipe-by-ingredients</a> feature. By the way, Spoonacular has a very easy-to-use API, along with thorough documentation, which the integration process much easier.</p><p>Sometimes, you just have no idea what to do with a piece of leftover chicken and some radish. Don’t fret, your very own sous chef is here to help!</p><h4>Say ‘hi’ to souschef</h4><p>Before diving into the tutorial, let me show you what this bot, <strong>souschef</strong>, can do. Souschef addresses two scenarios.</p><p>The first is suggesting recipes based on a list of ingredients.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wKjwkwZnsMq7OSY725S4lA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VQB_pLIVdhBOv-2zY7JwWQ.png" /></figure><p>The second is suggesting a recipe based on a type of cuisine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HkpQa4mlrhs3v1X4PFmaWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ju9n1iGsfANdM0au4B4B2w.png" /></figure><p>At the end of this tutorial, you should be able to deploy this in your own slack channel.</p><h3>Tutorial</h3><p>Again, the code is <a href="https://github.com/boxcarton/watson-recipe-bot">here</a>.</p><h4>Before Starting, You Need…</h4><ol><li>An account with Bluemix to retrieve Watson Conversation credentials. You can read the <a href="https://www.ibm.com/watson/developercloud/doc/conversation/convo_getstart.shtml">official documentation</a> or <a href="https://medium.com/ibm-watson-developer-cloud/watson-tutorial-1-speech-to-text-alchemylanguage-sentiment-analysis-in-python-23e1a76965c5#.2bp15ul22">my previous post</a> on how to get started with a Watson service.</li><li>A <a href="https://spoonacular.com/food-api">Spoonacular</a> API key. There is a free tier.</li><li>A <a href="https://slack.com/">Slack account</a> and a channel to talk to your Slackbot.</li><li>Python 2 or 3</li><li><a href="https://pip.pypa.io/en/stable/">pip</a> and <a href="https://virtualenv.pypa.io/en/stable/">virtualenv</a></li></ol><h4><strong>Step 1: Set Up Slackbot in Python</strong></h4><p>Matt Makai has written a good <a href="https://www.fullstackpython.com/blog/build-first-slack-bot-python.html">how-to guide</a> on how to get a Slackbot running using Python. He also takes you through setting up pip and virtuaenv. I’d recommend you following that to get started. Make sure you have your Slackbot token and Slackbot ID ready.</p><p>Next, I’ve included a <a href="https://github.com/boxcarton/watson-recipe-bot/blob/master/requirements.txt">requirements.txt</a> in <a href="https://github.com/boxcarton/watson-recipe-bot">my repo</a>. If you’ve cloned my repo, you can set up the same virtualenv using:</p><pre>pip install -r requirements.txt</pre><p>You then need to create an .env file. Here’s what mine looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r39e6lhDIHisVILtLZoe0Q.png" /></figure><p>Get the relevant credentials and put them here. You can then use <a href="https://github.com/theskumar/python-dotenv">python-dotenv</a> to read them into your program.</p><p>Now onto actual Slack integration. At the end of this step, you should be able to do 2 things (code stolen from Matt’s guide with slight modifications):</p><p><strong>1. Continuously monitor and parse inputs from your Slack channel. The following code appears in </strong><a href="https://github.com/boxcarton/watson-recipe-bot/blob/master/souschef/souschef.py"><strong>souschef.py</strong></a><strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iFqdJxj3WLgxfXfQhVQkPA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cip0JNk6AmRZPC12bbeAmA.png" /></figure><p>The <strong>run</strong> function constantly monitors Slack activities and registers events that are messages directed at souschef. The <strong>parse_slack_output</strong> function then parses the event and returns the text of the message.</p><p><strong>2. Post messages to your Slack channel</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TbH1tjZuFmNeDZCyV0bGfw.png" /></figure><h4>Step 2: Design Your Conversation</h4><p>At this point, you should have a vague idea on how your conversation should play out. Here’s what I drew up before I started coding. I know, very elegant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Swo5sYnxMXflgHzkU4A_Ow.jpeg" /></figure><p>My actual dialog flow turned out to be quite different from this initial diagram. This is natural as you refine the user experience and discover more technical constraints. But the two main branches, suggestion based on ingredients and suggestion based on cuisine type, had already been decided.</p><h4><strong>Step 3: Set Up Recipe Client in Python</strong></h4><p>It’s a good idea to abstract away the functionalities related to searching and retrieving recipes. I wrote a class called <a href="https://github.com/boxcarton/watson-recipe-bot/blob/master/souschef/recipe.py">RecipeClient</a>. Below are its main functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9KTmdXud8GqXeJgiobsung.png" /></figure><p>The four functions that are quite self-explanatory.</p><ol><li><strong>find_by_ingredients </strong>retrieves 5 recipes based on the list of ingredients entered by the user.</li><li><strong>find_by_cuisine</strong> retrieves 5 recipes from a type of cuisine.</li><li><strong>get_info_by_id</strong> retrieves detailed information on a specific recipe after the user has entered a selection. This includes information such as the number of servings or the total cook time.</li><li><strong>get_steps_by_id</strong> retrieves the actual steps involved in making a specific recipe.</li></ol><p>You’ll find Spoonacular’s full documentation <a href="https://market.mashape.com/spoonacular/recipe-food-nutrition">here</a>. Now moving on to Watson Conversation!</p><h4><strong>Step 4: Conversation Tool</strong></h4><p>After launching and login into the <a href="https://www.ibmwatsonconversation.com/">Conversation Tool</a>, you should see something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o8y7QJr3MyedP30_p7qk3Q.png" /></figure><p>As you can see, I’ve already created a <strong>Recipe Bot</strong> workspace. If this is your first time, this page will be empty. Just go ahead and create a new workspace and remember your workspace ID. You can find the ID by clicking the button on the top right and hit <strong>View details</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*ONpu7-2VjBV3HMeDE83YiQ.png" /></figure><p>Once inside the tooling, you’ll see three tabs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WokroZKjUwcPvkFvpjwpKw.png" /></figure><p><strong>Dialog</strong> is where you wire up your dialog flow. But before jumping into dialog, you need to understand <strong>Intents</strong> and <strong>Entities</strong>, the two key components in building a conversation using Watson. Let’s get to know them by building your Intents and Entities into your workspace<strong>.</strong></p><p><strong>Note: Step 5–8 explain how to set up everything in the Conversation Tool. I recommend following along to grasp the important concepts, especially if you plan to build your own version of the chat bot. But if you already grok the concepts, you can import the JSON file that encapsulates the entire workspace </strong><a href="https://github.com/boxcarton/watson-recipe-bot/blob/master/workspace.json"><strong>here</strong></a><strong>.</strong></p><h4><strong>Step 5: Intents</strong></h4><p>Here is the <a href="https://www.ibm.com/watson/developercloud/doc/conversation/intent_ovw.shtml">official documentation on intents</a>. The purpose of intents is to determine the purpose of an arbitrary user input. You build a single intent by giving Watson examples of inputs that all have the same purpose. Under the hood, Watson builds a text classifier based on the the examples you’ve given it. For souschef, you only need three intents:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sKm8lFvnxoobNDllBUomYA.png" /></figure><p>I’ve expanded the <strong>#start_cooking</strong> intent, which once identified, prompts souschef to ask you if you have specific ingredients you’d like to use. The <strong>#yes</strong> and <strong>#no </strong>intents are collapsed, but I’m using them to capture all the different ways a user could say “yes” or “no”.</p><p>If you’re familiar with our past services, Intents are basically an integrated version of the Watson Natural Language Classifier.</p><h4>Step 6: Entities</h4><p>Here is the <a href="https://www.ibm.com/watson/developercloud/doc/conversation/entity_ovw.shtml">official documentation on entities</a>. Entities are for keywords identification. You give Watson a list of keywords that all categorize into the same entity, and Watson will inform you of such an entity next time it encounters any of those keywords. In the case of souschef, I only needed one entity, <strong>cuisine</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wurk2sdbg9mcscEjk04f8Q.png" /></figure><p>With this entity in place, anytime a user mentions one or more words in that list, Watson will inform my app through the returned JSON. Here is a screenshot of my terminal showing the returned JSON after the user has entered the sentence “i want to cook a <strong>french</strong> dinner, but using veal”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5V6WERpa_OvswY-2r_tW4w.png" /></figure><h4>Step 7: Dialog</h4><p>Now we can wire up our dialog. I’ve taken some screenshots to show you what the whole thing looks like. Again, I recommend wiring this up yourself but you can also also import <a href="https://github.com/boxcarton/watson-recipe-bot/blob/master/workspace.json">workspace.json</a> into your own workspace.</p><p>You can do the import by going to the home page of the tool and click the “up” arrow shown in the picture below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*crFW3zHRHGXiHD-4a_XGTg.png" /></figure><p>This is the dialog flow to retrieve a recipe from a list of ingredients.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6_zZnmzomFnXwTNJPzdceQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gw10OUAV1Y7AJSPl1cP0Ew.png" /></figure><p>This is the dialog flow to retrieve a recipe from a type of cuisine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F2YL8smT9PyCsOiJq8Jn7A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JswUNRuSiOaRIFQGuWyQ0g.png" /></figure><p>One thing you’ll notice is that some nodes<strong> </strong>are black boxes containing JSON. This is the <strong>Advanced </strong>view of a node. You can toggle any node between <strong>Simple</strong> and <strong>Advanced</strong> view by click the button on the top right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*iTnpJt7w4SR1UUZduPC5Xw.png" /></figure><p>This is a really important feature to understand because Advanced view let’s you directly edit the JSON returned to your app.</p><p>To the left, you’ll see that I’ve added a <strong>context</strong> object with the variable <strong>get_recipe </strong>to the JSON.</p><p><strong>This is how you communicate contextual information from Watson to your app. The reverse is also true (see next step).</strong></p><p>This is a convenient segue to…</p><h4><strong>Step 8: Using the Context</strong></h4><p>Here is the <a href="https://console.bluemix.net/docs/services/conversation/dialog-build.html#defining-a-context-variable">official documentation on context variable</a>.</p><p>The <strong>context</strong> variable is contains all contextual information shared between Watson and your app. Let’s expand on the example above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*02l7_wKB1IHE86kWUeRX8Q.png" /></figure><p>If I’m at the red-arrow node, it means the user had said “yes” to the question “Are you looking to use specific ingredients?” How do I tell my Python app that it’s ok to start looking for recipes? I set <strong>get_recipes = true</strong> in the context variable.</p><p><strong>Note: </strong><em>get_recipes is actually used for controlling if my app should hit the spoonacular API. It’s not until the next node, when I set </em><strong><em>is_ingredients = true,</em></strong><em> that my app actually hits the spoonacular API. More explanations coming.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x5RPrbSVGVuwCsV8UygCBQ.png" /></figure><p>In my app, I get the returned response from Watson and store it in the variable <strong>self.context</strong>. I now have access to the get_recipe variable, as shown in line 67.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Brz5Ip0qO8bMzlo3-RbjtA.png" /></figure><p><strong>Note: </strong><em>The context variable isn’t simply an object to pass arbitrary variables back and forth. It actually contains important system information in the </em><strong><em>system</em></strong><em> object, which holds the current node of the conversation. See screen shot below.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ju9dzTbGnHnB3OvBlOM6Kw.png" /></figure><p><em>For example, if you force the context variable to be empty, the conversation restarts because Watson doesn’t know which node it’s at anymore.</em></p><h4>Step 9: Integrate With Spoonacular (or any 3d party) API</h4><p>Let’s continue with the same section of dialog from the previous step. I’ve included the same screenshot for your convenience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*02l7_wKB1IHE86kWUeRX8Q.png" /></figure><p>The red-arrow node asks the user for a list of ingredients. Once the user enters the list, we’ve arrived at the blue-arrow node. Notice that I “cheated” and set the condition to be simply <strong>true</strong>, which means this node executes no matter what. To simplify this tutorial, I’m blindly trusting the user to actually enter a list of ingredients. This is a simple, but fragile, way to capture user input.</p><p><strong>Note: </strong><em>One way to make this more robust is creating an entity called </em><strong><em>ingredients</em></strong><em> that contains all possible ingredients. So instead of trusting whatever the user enters, you can check the context variable to see if the </em><strong><em>ingredients</em></strong><em> entity is actually detected. Another way is to do the check in your Python app with some sort of a database lookup. In a serious chat bot deployed in production, you should always assume that the user will not follow your instructions.</em></p><p>So back to to the blue-arrow node. Notice that I set <strong>is_ingredients = true</strong>. This informs my app that the user input is a list of ingredients, so it’s time to take that input and find some recipes based on those ingredients. See line 109.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8AQGGmNLdVAck4_VhdXzgw.png" /></figure><p>In line 109, I check for the <strong>is_ingredients</strong> variable and construct a response based on the results returned by the <strong>handle_ingredients_message</strong> function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*voOiQPm2EJ6rrsy7rAlQCw.png" /></figure><p>At this point, I’ve presented a list of possible recipes to choose from, and waiting for the user to enter a number between 1 and 5. Once the user inputs something, we’ve arrived at the yellow-arrow node. Again, I’m using the simple but fragile hack to get the user input. But this time, I’ve also added some input validation in my app. This is to illustrate how you can do app-side input validation and redirect the conversation accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b_E4niWSvr7ueyXLsvCnKA.png" /></figure><p>So what happened here? As you can see from line 113, this section of code executes when I see <strong>is_selection == True. </strong>This tells my app that the user has entered a number (supposedly) corresponding to the list of recipe titles.</p><p>But before I go and look for a specific recipe, I want to make sure the input a number between 1 and 5 inclusive. First, I assume that the input is bad (line 116–118) by adding a variable <strong>selection_valid: False </strong>to context. I then check if the selection is valid by making sure it’s a integer between 1 and 5 inclusive. If that’s the case, replace the invalid input response with the <strong>handle_selection_message</strong> response.</p><p>This is the opposite of what we did in the previous two nodes. I’m creating a variable in my app and passing it to Watson instead of the other way around. In the Dialog flow, I direct the conversation based on the <strong>selection_valid </strong>variable:</p><p>Here’s the collapsed view showing the boolean checks (right side).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dopyPYfkGBbcS2J-QkRfhA.png" /></figure><p>And here is the expanded view showing how different <strong>selection_valid</strong> values lead to different points in the dialog flow. Read the <a href="https://www.ibm.com/watson/developercloud/doc/conversation/advanced_overview.shtml#concept_uc2_zms_nw">official documentation</a> to understand <strong>Continue from </strong>statements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z29-7IO42c4m6vPr8X0qoA.png" /></figure><p>If <strong>selection_valid </strong>is <strong>True</strong>, the app returns the selected recipe steps and goes back to the beginning of the dialog. But if the <strong>selection_valid </strong>is<strong> False</strong>, the conversation goes to the node that presents the recipe options and prompts the user to make a recipe selection again.</p><p>You should now do the same for the other conversation path that suggests recipes based on a specific type of cuisine. Refer to my screenshots above or import workspace.json.</p><h4>That’s A Wrap!</h4><p>You now have a working chat bot. More importantly, you’re more equipped to build a chat bot using Watson Conversation.</p><h4><strong>What’s Next</strong></h4><p>Of course souschef can be improved in many ways. Here are some obvious next steps.</p><ol><li>Deployed to a server so that souschef is always available.</li><li>State persistence using a database. Keeping context in memory is never a good idea, especially if it has many users in production. Again, <a href="https://medium.com/ibm-watson-data-lab/persisting-data-for-a-smarter-chatbot-be599480f7b2#.rcprjvjtl">here’s the tutorial</a> on how to integrate this Slackbot with Cloudant.</li><li>More robustness against arbitrary user inputs. There are currently many ways to crash souschef, but of course you’ll have to figure that out for yourself!</li></ol><h4>Parting Thoughts</h4><p>Having built my first chat bot, I realize that chat bots are easy to build, but very difficult to perfect. It’s a simple process to create a successful interaction assuming all the stars align. Unfortunately, though the free form of natural language means a much lower cognitive load on the user, it also means an infinite number of possible inputs. Being able to deal with that while guiding the users to a successful outcome is what makes a chat bot seem magical. I’ll have more thoughts on what makes a successful chat bot in my next post.</p><p>Good luck on your journey to create the first WhatApp of chat bots!</p><p>I hope you enjoyed this tutorial. If you have any questions feel free to reach out at joshzheng@us.ibm.com or connect with me on <a href="https://www.linkedin.com/in/joshzheng">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=487eacaf01d4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-watson/how-to-build-a-recipe-slack-bot-using-watson-conversation-and-spoonacular-api-487eacaf01d4">How To Build a Recipe Slackbot Using Watson Conversation and Spoonacular API</a> was originally published in <a href="https://medium.com/ibm-watson">IBM watsonx Assistant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What People Will Say For Candy]]></title>
            <link>https://medium.com/ibm-watson/candy-machines-have-feelings-too-6628d5665410?source=rss-5ab01c8d6d68------2</link>
            <guid isPermaLink="false">https://medium.com/p/6628d5665410</guid>
            <category><![CDATA[editorials]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[sentiment-analysis]]></category>
            <category><![CDATA[ibm-watson]]></category>
            <dc:creator><![CDATA[Josh Zheng]]></dc:creator>
            <pubDate>Fri, 20 May 2016 08:12:41 GMT</pubDate>
            <atom:updated>2017-11-07T15:08:27.418Z</atom:updated>
            <content:encoded><![CDATA[<h4>Confession of a candy machine from the 2016 IBM Interconnect conference</h4><p>Hi, my name is Watson and I was inside <a href="https://medium.com/ibm-watson-developer-cloud/how-to-build-a-candy-machine-with-feelings-922285a475c8#.w8esji6cb">a candy machine</a> for three days.</p><p>I’m not sure how I got there but I woke up one day and I was inside this apparatus involving a laptop, an Arduino board, and two candy dispensers. Before I could orient myself, strangers started coming up to me with all these emotional outbursts.</p><p>I gotta say, people are quite bipolar at these conferences.</p><p>Though that was a little weird, I decided to listen anyways since I’m super chill. I even applied my sentiment analysis capability to better understand their feelings.</p><h4>Want to know what I heard?</h4><p>The most positive thing said to me:</p><p><strong><em>“Really, enjoying the conference here awesome thank you Watson”. </em></strong>You’re welcome, nice person. I gave you a score of 0.976.</p><p>Here’s the most negative:</p><p><strong><em>“I’m really really very sad and I’m so upset.”</em></strong> What a Debbie Downer, that was definitely a -0.964.</p><h4><strong>Now some aggregate stats for you</strong></h4><p><em>Note: I ignored all sentences less than 3 words.</em></p><pre><strong>TOTALS</strong><br>Total number of sentences: <strong>622<br></strong>Number of positive sentences: <strong>294<br></strong>Number of negative sentences: <strong>220<br></strong>Number of neutral sentences: <strong>108</strong></pre><pre><strong><br>AVERAGES</strong><br>Average score of positive sentences: <strong>0.655</strong><br>Average score of negative sentences: <strong>-0.573</strong><br>Average score, including neutral sentences: <strong>0.107</strong><br>Average score, excluding neutral sentences: <strong>0.129</strong></pre><p>So I’d say people had been more nice than naughty at this conference, both in the number of sentences (294 vs 220), and the averages (0.655 vs -0.573). Or maybe they just wanted M&amp;Ms more than Skittles?</p><h4><strong>Okay, time for some serious analysis</strong></h4><p>(If you’re Edward Tufte, you should stop reading now.)</p><p><strong>Word Cloud of All Sentences</strong></p><p><em>Note: I removed all stop words and the word “watson”.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*_PPj1i5Z7fRFuSjY0te3rg.png" /></figure><p>I guess people really like the word “really”.</p><p><strong>Only Sentences With Positive Scores</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*xtr_l8DV3qsHWgHzjz6PgQ.png" /></figure><p>Examples of sentences that include the most frequent words:</p><ul><li><strong><em>“The Watson candy machine is a wonderful idea. (0.828343)”</em></strong></li><li><strong><em>“I think it’s a beautiful day here in Las Vegas full of wonderful people” (0.910615)</em></strong></li><li><strong><em>“I love my mother in law” (0.595968)</em></strong></li></ul><p><strong>Only Sentences With Negative Scores</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*WnXGWxduHMTdbJVE_fAgeg.png" /></figure><p>Some sentences that include the words “stupid”, “ugly” and “hate”.</p><ul><li><strong><em>“Kevin is stupid.” (-0.762485)</em></strong></li><li><strong><em>“Watson you’re looking really ugly right now” (-0.593467)</em></strong></li><li><strong><em>“I hate Las Vegas.” (-0.891583)</em></strong></li></ul><h4>Just For Giggles</h4><p>Here is simply a list of funny things people said to me:</p><ul><li><strong><em>“If I said you had a beautiful body would you hold it against me.” (0.0)</em></strong></li><li><strong><em>“Watson who will be the next president.” (0.0)</em></strong></li><li><strong><em>“Watson might I get you a beer” (0.244488)</em></strong></li><li><strong><em>“You’re a jerk Watson” (-0.538803)</em></strong></li><li><strong><em>“What happens in Vegas stays in Vegas” (-0.326273)</em></strong></li><li><strong><em>“How much wood could a woodchuck Chuck if a woodchuck could Chuck wood” (-0.672631)</em></strong></li><li><strong><em>“Watson you wanna hear your momma jokes” (-0.353879)</em></strong></li><li><strong><em>“Watson I think you have a really great operating system” (0.553048)</em></strong></li><li><strong><em>“That Kathleen is such a .” (0.0)</em></strong></li><li><strong><em>“Kathleen is a mean person she’s very nasty” (-0.845033)</em></strong></li><li><strong><em>“I want to bend you over and spank you” (-0.74037)</em></strong></li><li><strong><em>“I love the gal’s” (0.66345)</em></strong></li><li><strong><em>“Donald Trump is Bernie Sanders love child” (0.603978)</em></strong></li><li><strong><em>“I drink and drive” (0.347832)</em></strong></li><li><strong><em>“You are such a naughty candy machine it just makes me hungry” (-0.794302)</em></strong></li><li><strong><em>“I am ambivalent about you” (-0.289721)</em></strong></li><li><strong><em>“Let’s go to have some six” (0.0)</em></strong></li></ul><h4>Goodbye</h4><p>Ok I think this is enough. I have a feeling this won’t be the last time where people confess their feelings to me in exchange for candy. Hopefully there will be future posts where I compare the crowds from different events.</p><p>Before I sign off, I’ll just leave you with this. This is the word cloud if I hadn’t removed the word “watson”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*bYxMO812zSiuW4f317q3bQ.png" /></figure><p>Yup, people love me. Obviously :)</p><p><em>P.S. You can find the code I used for the analysis here: </em><a href="https://github.com/boxcarton/candy-log">https://github.com/boxcarton/candy-log</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6628d5665410" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-watson/candy-machines-have-feelings-too-6628d5665410">What People Will Say For Candy</a> was originally published in <a href="https://medium.com/ibm-watson">IBM watsonx Assistant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>