Skip to main content

Building Contents of Watson Chatbots

In today’s world Chatbots are tremendously transforming the way we interact with software by providing a great business opportunity for almost every company. Chatbots are seen in almost all the websites and also in applications. The first question I ask to myself, what is Chatbot? Chatbots are known by different names some call it “conversational gents”, some “Chatter Robot”.

Chatbots are basically a computer program that mimics written or spoken human speech in its natural format using Artificial Intelligence techniques such as Natural Language Processing (NLP) which is used for conversation purpose. In today’s era Chatbots are most commonly used in customer service space, acts as a human face of the brand for support operatives and customer satisfaction reps. We all know virtual assistants like Apple Siri or Amazon Alexa, are two most popular chatbots interacting via voice rather than text. Chatbots engages their customers in the right place, at the right time, with right information in a cost- efficient way.

Building Chatbots: Intents
Intent is the goal or purpose of the user’s input. Watson conversation expects us to add examples for each intent that our chatbots needs to address. In other words, let’s think of intents as labels for a group of examples that express a common goal or purpose. For examples we might define intent called #greetings OR this intent might be “hello”, “hi”, “hey”, ”good morning”, “good evening” .

Good news is that you’re not stuck with initial examples that you picked, you can always go back and add, edit, or delete examples for a given intent. When user specifies “hola”, “aloha”, or even “yo”, Watson would go ahead recognize the user’s greetings intent for you. Will Watson detect a 100% of all possible greetings? Probably not, but it will correctly detect most them.

Building Chatbot: Entities
Entities enable Watson to identify details in the user’s input which we can then use to provide different responses to the users. For example, “Which flowers for a birthday?”  & “What are the best flowers for Valentine’s Day?’ both express the #flower_suggestions intent; however the two requests will require different responses. So, to differentiate these two requests, we can use entities. Entities have a name and a series of values. These values, in turn, have associated synonyms. These synonyms are optional, but recommended, given that the user might enter the same concept using a different word.

When Watson Conversation parses the question from the user, it will try to first detect the matching intent and then any matching entities. Watson will figure out on its own the user’s ultimate goal and match it to an intent based on the examples that you trained it on, for entities; Watson will only detect the exact values and synonyms that we’ve specified. If you enable the fuzzy matching option, which is currently in beta, then misspellings of the specified values and synonyms will also be detected. Also, unlike intents which start with a pound symbol, entities start with @ sign. Not to be confused with Twitter handles.

Building Chatbots: Dialog
Creating a dialogue defines how your bot will respond to what the user is asking. Dialogues in Watson conversation are defined visually through a user interface that is structured around the concept of nodes. Each node has a name, a condition, and one or more responses. There are a few more bells and whistles available, but at its core we're talking about name condition and responses. The dialogue starts executing from the first node at the top. If the condition is met, it will reply to a user with a response specified in that node and stop the execution until the user has entered some new input. If the condition is not met, it will skip the response and proceed to consider the next node below. If this second node's condition is met by the user's input, the nodes response will be sent to the user. If the condition is not met, we continue to the next node, and so on.

Essentially, the execution from top to bottom continues while the node conditions fail to meet what the user inputs have entered. For the condition you can use intents, entities, a specific entity value, and a few reserved conditions like welcome, “Anything else”, “true and false”. You can also combine intents and entities with “AND “- “OR” logical combinations?

Typically you'd want to greet the user as they arrive. So the first node might use a special word, "Welcome “as the condition. Ensuring that particular node is executed the first time that the user starts interacting with the chatbot. The response, we configured in that particular node, will be our initial prompt that greets the user, inviting them to chat with our chatbot. If the user input doesn't match any of the node's conditions, by default no response will be provided to the user; and this isn't great from a user experience standpoint because nobody likes to be ignored. So it's a good idea to have also a node at the very bottom of the dialog that is always executed if the user input failed to satisfy the conditions of any of the other nodes above.

The failover condition for this node is called “Anything else”. When will this note be executed? In practice, when our bot has failed to understand the user. So in this node we should have an appropriate response that invites the user to rephrase or maybe suggest some queries that we know our bot can handle. If we only included a single response in this node the bot could get annoying rather quickly. Imagine seeing I don't understand over and over again. Hopefully our user won't trigger the “Anything else” node too often.
It always good to have multiple responses with some variations to them even if they express the same concept. For example the parent node might be triggered by the user asking, "I'd like flower suggestions for a special occasion." It doesn't provide information about which specific occasion, so the response from the node might be, "which occasion?" When the user replies with say, "Birthday," the child node that matches the birthday condition will be executed and its response, displayed to the user. For this to work, we'll need multiple children nodes, each having as its condition an Occasion value like anniversary, funeral, etc., each having an appropriate response.

A node can have multiple responses that are only processed if their own condition is met. So, instead of having multiple children nodes, one for each occasion, we could have a single node that provides different responses, depending on which Occasion value is provided in response to our request for clarification. Children nodes can have children nodes of their own, giving us the ability to create a quite complex dialogue flow.

Kindly feel free to share your comments….


Popular posts from this blog

Where have you seen Machine Learning in your everyday life?

1 –  Google’s AI-Powered Predictions Using anonymized location data from smartphones, Google Maps (Maps) can analyze the speed of movement of traffic at any given time. And, with its acquisition of crowdsourced traffic app Waze in 2013, Maps can more easily incorporate user-reported traffic incidents like construction and accidents. Access to vast amounts of data being fed to its proprietary algorithms means Maps can reduce  commutes by suggesting the fastest routes to and from work. 2 –  Ridesharing Apps Like Uber and Lyft How do they determine the price of your ride? How do they minimize the wait time once you hail a car? How do these services optimally match you with other passengers to minimize detours? The answer to all these questions is ML. Engineering Lead for Uber ATC Jeff Schneider  discussed in an NPR interview how the company uses ML to predict rider demand to ensure that “surge pricing”(short periods of sharp price increases to decrease rider demand and increase driver supply…


I sometimes see people refer to neural networks as just “another tool in your machine learning toolbox”. They have some pros and cons, they work here or there, and sometimes you can use them to win Kaggle competitions. Unfortunately, this interpretation completely misses the forest for the trees. Neural networks are not just another classifier, they represent the beginning of a fundamental shift in how we write software. They are Software 2.0. The “classical stack” of Software 1.0 is what we’re all familiar with — it is written in languages such as Python, C++, etc. It consists of explicit instructions to the computer written by a programmer. By writing each line of code, the programmer is identifying a specific point in program space with some desirable behavior. In contrast, Software 2.0 is written in neural network weights. No human is involved in writing this code because there are a lot of weights (typical networks might have millions), and coding directly in weights is kind of …

How does a total beginner start to learn machine learning if they have some knowledge of programming languages?

I work with people who write C/C++ programs that generate GBs of data, people who manage TBs of data distributed across giant databases, people who are top notch programmers in SQL, Python, R, and people who have setup an organization wide databases working with Hadoop, Sap, Business Intelligence etc. My inspiration to anyone and everyone would be following: Learn all the basics from Coursera, but if I really have to compare what you would get out of Coursera compared to the vastness of data science, let us say ~ Coursera is as good as eating a burrito at Chipotle Mexican Grill. You certainly can satiate yourself, and you have a few things to eat there.The pathway to value adding data science is really quite deep, and I consider it equivalent to a five star buffet offering 20 cuisines and some 500 different recipes.Coursera is certainly a good starting point, and one should certainly go over these courses, but I personally never paid any money to Coursera, and I could easily learn a v…