Opinions are divided over the corporate use of chatbots: surprisingly, most people seem to love them (see below), while others find them annoying. What’s not up for debate is the cost savings and 24×7 customer service chatbots enable.
Some key points to consider:
- The top benefits of chatbots are 24/7 service, instant responses, and answers to simple questions.
- 63% of people prefer online bots to interacting with a company’s human resources.
- Chatbots will power 85% of customer service by 2020.
- Chatbots are expected to cut business costs by $8 billion by 2022.
While the Machine Learning (ML) technology on which chatbots are based has come a long way, it can’t yet fully replicate natural language comprehension. But there are still many potential applications for chatbots where complete comprehension is not required. It’s becoming commonplace to pay a bill, check an account balance or, as shown in figure 1, track a package with a chatbot. More and more companies turn over simple, routine consumer interactions to bots.
It’s now possible to complete most routine transactions without having to speak to a real person. Food companies like Subway, Dominos and Starbucks are all experimenting with letting people place orders using chatbots in Facebook Messenger (like MobileMonkey), or by verbally telling Amazon’s Alexa to order them a frappuccino.
And advances in natural language processing are being used to great effect today in relatively simplistic virtual assistants like Amazon’s Alexa, Apple Siri and Microsoft’s Cortana. Erica, a Bank of America chatbot goes a step further, leveraging “predictive analytics and cognitive messaging” to provide financial guidance to their customers.
Of course, chatbots aren’t infallible, especially when it comes to things like problem-solving, intuition, and empathy, which is where human interaction can make a tremendous difference to the outcome for a customer. In these cases, chatbots can be used for routine interactions, and then escalate to a real person for more complex interactions.
How do Chatbots Work?
A chatbot is simply an application that is governed by Machine Learning (ML) models in conjunction with a set of specified rules. Like most applications, chatbots are comprised of an application layer, a database and a set of APIs.
Chatbots simulate a real-life, two-way conversation when humans interact with it using either a chat or voice interface. Responses are based on the “knowledge” available to it at that point in time. If an interaction introduces a new concept, chatbots are typically trained to either deflect the conversation, or else escalate to a human operator. Logs of discussions between chatbots and customers are saved and dissected by researchers in order to retrain the chatbot. Thus, a chatbot’s interactions will gradually grow in scope and relevance.
There are generally three types of chatbots based on different classification methods and uses:
- Pattern Matching Bots – these bots parse an input phrase and try to match keywords or key phrases to an entry in its database. If found, the bot can then provide the corresponding response.
- Best suited for FAQ responses to common customer inquiries
- Natural Language Understanding Bots – these bots link entities (such as “ordering” or “purchasing”) with context (such as pattern matched keywords like “pizza types”) with expectations, which are what the customer is expecting in response to their interaction, such as “a list of toppings.”
- Best suited for simple transactional inquiries, such as ordering food
- Natural Language Processing (NLP) Bots – these bots convert the user’s speech or text into structured data through a series of processes that parse the language into grammatical entities (verbs, subjects, objects, etc), extract recognized words or phrases (such as product names), identify misspellings, and may even attempt sentiment analysis to understand the customer’s attitude.
- Best suited to complex customer service interactions
While it sounds complex, you may be surprised to learn that implementing a fully functioning chatbot is significantly cheaper than building a cross-platform app, and substantially less expensive than the human alternative (i.e., customer service reps).
Make Your Own Chatbot
Now that you understand the importance and utility of chatbots, you may be inspired to see if you can create one for yourself. Daniel Kukiela has a Python-based implementation of a chatbot on Github that you can try “out of the box” with just a few commands to setup your environment and clone the repo.
The Requirements.txt is pretty basic, and includes:
- Utilizes TensorFlow’s Neural Machine Translation (seq2seq) capabilities to perform natural language processing
- Implements a progress bar
- For producing colored terminal text and cursor positioning
- For parsing text
- For manipulating strings, including determining string similarity, median and average
- The de facto standard for making HTTP requests in Python
All of these packages are supported on the ActiveState Platform (except for the GPU-based version of TensorFlow which is replaced with the standard CPU version). If you’d like to try making Kukiela’s chatbot, the easiest way to set up your development environment is to:
- Fork my “Chatbot” runtime environment on the ActiveState Platform into your account (you’ll be prompted to create an account if you don’t already have one):
- Install the State Tool:
sh <(curl -q https://platform.activestate.com/dl/cli/install.sh)
- Install the runtime on your system with ActiveState’s State Tool, which will automatically:
- Create a virtual environment, and then
- Install the chatbot’s Python runtime into it (i.e., all 6 packages in Kukiela’s Requirements.txt plus their 50 dependencies)
To install the runtime, follow the instructions listed under the “Use via Command Line” heading. For example:
Now that your chatbot project’s environment is ready to go, you can grab Kukiela’s code and use the included training data to give it a try. Just issue the following commands from your new virtual environment:
- $ git clone –branch v0.1 –recursive https://github.com/daniel-kukiela/nmt-chatbot.git $ cd nmt-chatbot/
- $ cd setup $ python3 prepare_data.py $ cd ..
- $ python3 train.py
And now the hard part: waiting. Eventually the chatbot will chew through the training data and you’ll have a trained demo that’s ready to deploy and test out.
Got a Github project you’d like to simplify the setup for by offering a pre-built environment? Sign up for a free ActiveState Platform account and see how easy it can be.