Things That Matter When Building a Natural Language Chatbot

by Carlo GutierrezMay 10, 2018
Chatbots help to automate communication, streamline operations, get customer feedback, etc. Below are some recommendations for building a chatbot.

It’s the messenger era

In 2015, Business Insider released a report showing messaging apps equal social networks in monthly active users. In the succeeding years, messengers would surpass social networks as they evolve beyond simple chat interfaces.

With this growth, companies are now investing in expanding messaging apps with chatbots, especially with users beginning to favor automated systems. According to Forrester, two-fifths of adults in the U.S. prefer using digital systems over speaking with a live person on the phone.

Chatbots in various industries (Image credit)

At a recent TensorFlow meetup in New York, a data scientist Ruze Richards spoke about how chatbots are currently being employed and how natural language processing (NLP) can help to improve.


Where applied?

Many companies, including Amazon, Facebook, Google, and Microsoft, already have chatbots for scheduling appointments, voice search, shopping, automating payments, etc. Additionally, chatbots are enabling companies to improve across several business lines:

  • Online sales. Chatbots are also gaining popularity in online retail. 1-800-Flowers was one of the first businesses to integrate its chatbot with Facebook Messenger in 2016. In the first two months, 70% of sales going through the chatbot were from new customers.

  • Customer feedback. Customers expect quick replies. 53% of customers expect companies to respond to tweets within an hour.
  • Upselling. The open rate for mobile messages is at an astounding 98%. 90% of those messages are read in the first three minutes when received. In this case, companies can employ SMS chatbots to quickly promote new products and services, saving on contact centers and customer service teams.

Most chatbots serve as autoresponders, providing 24/7 service (Image credit)

“Businesses have seen an increase in sales just by creating chatbot systems. There’s an underserved market of people who would like to be using a text-based or voice-based interface rather than web-based.” —Ruze Richards

  • Chatbots are also used to optimize back-office operations. In 2016, JPMorgan Chase launched COiN—a contract intelligence platform that uses unsupervised machine learning to analyze legal documents and to extract important data points and clauses. Since then, it has saved the bank over 360,000 hours of manpower. COiN is also able to parse employee e-mails to provide common IT requests, such as resetting passwords and granting access to software.


Functionality driven by AI/ML

Slater Victoroff

The first step, naturally, is choosing what kind of a chatbot is needed. In another TensorFlow meetup in Boston, Slater Victoroff of Indico Data Solutions, categorized chatbots under the following groups:

  • Rule-based chatbots follow a set of the if/else statements.
  • Keyword-based chatbots grab keywords from the input to load pre-configured responses.
  • Chatbots using machine learning to adapt the responses over time through classification and regression, search and extraction, unsupervised discovery, or comparison.
  • Sequence generation chatbots are more complex versions of machine learning chatbots that can take any sequence of text and then generate the correct response.

With sequence generation chatbots is still a ways off in terms of development, modern chatbots are likely to be based on machine learning to allow more flexibility in user input and its responses.

“Machine learning–based chatbots are non-trivial to implement, but they’re really effective. You end up getting a lot of nuance that you can’t capture with a rule-based or keyword-based system. You have something that’s going to learn with time and adapt, as you keep feeding it data.” —Slater Victoroff, Indico Data Solutions

An example of a pizza delivery chatbot (Image credit)

The second step is determining what functions the chatbot will have. Will it be performing as a customer service representative, data hub, concierge, etc.?

Chatbot development key points (Image credit)

Next is figuring out how the conversations with the chatbot should flow given certain responses.

An example of a conversation flowchart for a sales chatbot (Image credit)


Powered by natural language processing

Chatbots with natural language processing under the hood are more intelligent in that they are able to:

  • Decompose input sentences into constituent parts
  • Translate parsed sentences into valid queries
  • Remember the results of previous queries to adjust future answers

A sample workflow of an intelligent chatbot (Image credit)

Ruze listed several elements, which in his view, are vital for creating chatbots:

    Ruze Richards

  • Chatbot response machine to serve as a central engine
  • Natural language processing for distinguishing the intent of a sentence, as well as recognizing mood and entities
  • Context recognition to understand how a single line fits into an entire conversation
  • CRM and history analysis for building context from the previous conversations
  • Training a model to enable learning over time

The process of training a model can be improved and optimized in many ways with the right tooling at hand. One of the popular machine learning frameworks on the market is TensorFlow, which is fit not only for building a chatbot, but a recommendation system, as well.

Regardless the complexity of a chatbot under development, it is important to keep track of a few other points:

  • Limit responses to less than 3–4 lines of text
  • Always design for the do-not-understand cases
  • Test a chatbot on difference devices
  • Add buttons and other UI components to help users to respond

As more companies invest in natural language processing and messaging apps, chatbot development will only continue to grow. By 2025, the Grand View Research estimates the global chatbot market to hit $1.25 billion with a compound annual growth rate of 24.3%


Want details? Watch the videos!

In this video, Ruze overviews different scenarios in which a chatbot can be of help and shares his view on what is needed to build one.

In this video, Slater details the creation of a modern chatbot.


Related slides

These slides are from Slater’s presentation from the meetup in Boston.


Further reading


About the experts

Ruze Richards is a data scientist working in the cybersecurity field. He builds systems based on machine learning and natural language processing to collect and analyze data to further detect and thwart attackers. Ruze has experience as an architect, developing big data and distributed systems for enterprises and startups.


Slater Victoroff is the Founder and CTO of Indico Data Solutions, an enterprise AI solution for unstructured content with an emphasis on text and natural language processing. He has been building machine learning solutions for startups, governments, and Fortune 100 companies for the past five years.


This post was written by Carlo Gutierrez with assistance from Sophie Turol and Alex Khizhniak.