“Talk to Sara as you would a friend.”

“Talk to Siri as you would a friend.”

These two sentences differ by a single word, which your brain can quickly distinguish as a name. You brain can also assess that one name is likely that of a human, while the other belongs to Apple’s infamous chatbot. Finally, your brain can infer that the first sentence is a friendly recommendation to trust an unfamiliar person named Sara, while the latter is meant to help you have an effective interaction with a computer program.

The way your brain works is similar to how Siri and her chatbot counterparts — Amazon’s Alexa and Microsoft’s Cortana — figure out what you’re saying. Using machine learning techniques and natural language processing (NLP), these bots pick up context clues from human language inputs and learn from them, ultimately delivering outputs that a human would deem to be correct.

Chatbots aren’t just for fun; they are also becoming popular in business applications. From Taco Bell’s Tacobot, which aims to make it easier for teams to order Taco Bell at work via the messaging application Slack, to Tommy Hilfinger’s TMY.GRL bot, which promotes its collaboration with supermodel Gigi Hadid, bots are generating incremental revenue and improving brand affinity in innovative ways.

So how do you build your very own machine learning-based chat bot? It all starts with relevant text data. For example, to create a customer support bot, you’ll need to start with text data from past conversations between your customer support agents and customers. That could be online chat or phone logs, or whatever other form of data your company collects.

The second step is to leverage this data to create and train a predictive data model. Most likely, your data scientists will need to transform the data you’ve collected into a readable format that’s clean and primed for NLP. NLP is a machine learning technique that enables bots to understand the meaning of human-inputted language and even attribute sentiment to words or phrases. The goal is to produce an output that a human would deem “correct,” and it works in much the same way that the human brain uses context clues to arrive at a “correct” understanding of a sentence and respond accordingly.

Once the data has been cleaned and transformed, NLP is used to build a model that will essentially serve as your chatbot’s brain. A well-trained model will allow your bot to respond just like your top customer support agents do. When you’re satisfied with your chat bot’s responses, it’s time to deploy the bot. This means it’s ready to receive and read new text input, score possible outputs, and select the best output as its response to your customer’s question.

This whole process can take place almost instantaneously, so your customers never have to wait for an answer. It’s important to set up the bot in such a way that it constantly collects new data as it interacts with your customers. This way, the data can be used to “re-train” the model backing up your bot, so it can actually continue to learn from experience just as a human would. That way, your bot is always ready to chat. 

Paulina Goodman
Paulina Goodman