Chapter 6

Chatbots: The Machine Learning You Are Already Interacting With

Chatbots are probably the most common format of reinforced learning that people are interacting with daily. Since chatbots can pass the Turing test, some people probably don’t know that they are interacting with chatbots in some cases.

The most widely used versions of chatbots today are likely the AI assistants from the major tech companies such as Siri from Apple and Alexa from Amazon. While chatbots differ widely in how advanced they are and how they’re built, most chatbots have some basic similarities.


Chatbots are usually hosted within a messaging platform of some type. If you use Slack, the chatbot that comes bundled with your account from the outset is the Slackbot. This bot can help with many Slack-based activities and reporting.

Another example that we already looked at is the way Facebook uses DeepText to interact with its users in the Messenger app.

Language Processing

This element is a vital layer of any chatbot. Human language communication between man and machine is impossible without a Natural Language Processor (NLP).

Essentially, an NLP refers to components that allow chatbots to carry out a conversation that’s nearly identical to a person-to-person human conversation. NLPs use deep learning to not only study human input but also generate a human response. According to Chatbots Magazine, newer, smarter chatbots using NLP should be able to carry out the following functions:

• Summarizing large quantities of text into concise explanations

• Responding to open or closed questions (“Is Washington, D.C., the capital of the United States” compared to “Why is Washington, D.C., the capital of the United States?”)

• Inferring conference clues (that is, relating an object with words in a sentence)

• Ambiguity (sorting out the context and meanings of words in sentences)

• Morphology (the ability to separate individual words into morphemes, the smallest unit of meaning for words)

• Semantics (the meaning of sentences or words in natural human language)

• Text structure (the usage of punctuation, spacing, and text)

• Sentiment (the emotional “feeling” conveyed by the speech patterning, for example, “happy” or

Amazon powers Alexa with its own NLP called Amazon Lex. Most chatbot builders use third-party NLPs rather than building their own, and Amazon has made Lex available to developers.


This stage is where the Machine Learning happens. Despite the advanced options we’ve shared with you, chatbots can run on simple supervised Machine Learning models. For example, you can train a chatbot to respond to various questions from customers with predetermined responses. As new questions come in from customers, you can classify them within various categories of responses, thus “training” the application. This part of bot development can now find a third-party home at services such as Amazon’s Machine Learning Service. When the process being used to manage the application moves into the neural network level of computing, the chatbot moves into the world of AI.


The database is the arrival location for the data points that the application computes. In the example in Chapter 5 with our customer service chatbot, this database can be as simple as the list of questions and responses. Obviously, the more advanced a chatbot is, the more data and the more advanced the Machine Learning that deals with that data will need to be.

As you can see, chatbots are a key application that connects the value of Machine Learning with tasks people do every day.

Now that we understand the basic components of a chatbot, let’s look at some use cases for the technology.

WeChat Empowers Its Users

WeChat is a social media application brought to life by Chinese company Tencent, the company behind the QQ desktop messaging software. The app has more than 899 million active users spending over an hour a day on the app on average. WeChat is huge in China, but it has yet to break through the social media realm internationally. A special projects team within Tencent created the product.

WeChat runs contrary to Facebook in many ways. Where Facebook launched Messenger to “unbundle” services that users may want to use, WeChat gives you everything you could want in a mobile experience in one application. In other words, WeChat is not only a social media home for many users, but it’s also the method for shopping and payment services.

WeChat has built an API for developers to build chatbots on their applications. Today, this API lets users do many interesting activities such as:

• get a ride share

• order food

• buy movie tickets

• order from the nearest Starbucks

• track your daily fitness progress

• book appointments

• pay bills

In many ways, WeChat served as the beta test for chatbots in the social media space for the U.S. market. Major technology companies in the West took notice, and Windows developed a chatbot called Xiaoice. This NLP application from Microsoft has more than 40 million users in China and Japan.

Xiaoice is capable of leading long conversations with distinct personalities. Microsoft mined the internet for human conversations on Chinese social media and used reinforced learning to develop a chatbot that can adapt its phrasing based on the positive or negative cues given by the user.

CNN’s Bots Share The Latest News

In 2016, CNN began rolling out a chatbot to interact with younger demographics on social media platforms. The first bots rolled out on Messenger and Kik, and they were created to give users the latest news in a conversational format that mirrors their everyday messaging application use.

CNN specifically launched the Kik application with an interactive explainer to help users understand the developing news better. Additionally, CNN launched bots on LINE and for Amazon Echo.

Commenting on the news organization’s view on its success, Alex Wellen, CNN’s senior vice president and chief product officer, told The Drum:

“We’ve seen the most growth on LINE, where our chatbot publishes a handful of international stories each week; we see high engagement on Kik, where our chatbots invite the audience to experience the news in a ‘choose-your-own-adventure’ format; and we’ve observed the most experimentation on Facebook Messenger and Amazon Alexa, where people can ask and receive responses to open-ended questions about the news. CNN defines success metrics for each platform, from reach to engagement to monetization, with the overarching goal to learn, scale up, or wind down the product.”

We’re still in the early days of chatbots. Companies are still trying to understand how to quantify the value of the interactions they’re having on the various applications.

Wellen gave a peek at the possible future for CNN’s chatbots: “The next frontier is real-time multimedia chat bots that return intelligent audio or video responses across mobile, IoT (Internet of Things), and connected TVs.”

Magic’s Chatbot Offers Complete Virtual Assistant Capabilities

Magic is an online virtual assistant service that launched in 2015. This service has created chatbots in several applications, including Slack, Messenger, and through SMS (Short Message Service). We might think about Magic as an example of conversational commerce, an important subset of chatbots.

We’ve already looked at a few examples of conversational commerce with the examples of WeChat and Messenger allowing you to order a ride share. Magic allows you to speak with a virtual assistant to help you with dozens of tasks that an administrative assistant would handle, all through the applications you use every day. These virtual assistants save data points that allow them to iterate the tasks later.

We know you might be thinking, but we’re going to tell you anyway: Magic is not a chatbot. While Magic is an interesting example of how companies can enter the conversational commerce space, live human operators manage the tasks in Magic. You won’t find any AI or reinforced learning happening as of the date of this writing.

However, with the capabilities of companies to leverage an ever-expanding world of third-party reinforced learning tools, the interactions happening at Magic today could serve as the training for tomorrow’s AI-based virtual assistant.

We’re still much entrenched in the early days of chatbots. This time period feels like the early days of mobile applications, and developers should be salivating at the untapped opportunities.

While the idea of developing a conversational bot may seem like a cumbersome task, remember that you can start small. A chatbot simply needs to be built on the four components we discussed earlier. A conversational commerce–based chatbot is possible with a human-generated database and basic training over a supervised Machine Learning model. The tools and infrastructure are becoming more readily available for all developers. With the increasing exposure of developers to these tools, we’re likely to see an explosion of chatbots and related environments and economies over the coming years.