Customer Support Chatbots: Easier & More Effective Than You Think

Create your own free chatbot environment with just a few commands and learn more about the benefits of customer service chatbots in this post.

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:

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.


Figure 1: chatbot interaction for tracking package delivery

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, 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.


Figure 2: chatbot escalation/de-escalation to a real person
 

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:

  1. 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
  2. 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
  3. 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:

  • tensorflow-gpu>=1.4.0
    • Utilizes TensorFlow’s Neural Machine Translation (seq2seq) capabilities to perform natural language processing
  • tqdm
    • Implements a progress bar
  • colorama
    • For producing colored terminal text and cursor positioning
  • regex
    • For parsing text
  • python-Levenshtein
    • For manipulating strings, including determining string similarity, median and average
  • requests
    • 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:

  1. 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):
    https://platform.activestate.com/Pizza-Team/Chatbot/auto-fork
  2. Install the State Tool:
    sh <(curl -q https://platform.activestate.com/dl/cli/install.sh)
  3. Install the runtime on your system with ActiveState’s State Tool, which will automatically:
    1. Create a virtual environment, and then
    2. 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:

  1. $ git clone --branch v0.1 --recursive https://github.com/daniel-kukiela/nmt-chatbot.git
    $ cd nmt-chatbot/
  2. $ cd setup
    $ python3 prepare_data.py
    $ cd ..
  3. $ 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.

Happy chatting!

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.

Dana Crane

Dana Crane

Experienced Product Marketer and Product Manager with a demonstrated history of success in the computer software industry. Strong skills in Product Lifecycle Management, Pragmatic Marketing methods, Enterprise Software, Software as a Service (SaaS), Agile Methodologies, Customer Relationship Management (CRM), and Go-to-market Strategy.