The Fundamentals of NLP Design

Sam Ursu
Sam Ursu
Mar 3, 2020 · 5 min read

For whatever reason, if you’ve decided to ignore my advice and create an NLP chatbot, it is important to understand that they, too, have a structured flow.

Many builders, unfortunately, think that since NLP is all about “determining probabilities” or building a series of “top-level menus” managed by a “self-learning AI engine” that “leverages the new paradigm in data-driven UX” [feel free to insert your own corporate buzzwords here], there is no organized structure for an NLP chatbot.

This simply isn’t true.

Image for post
Image for post
So simple even a CEO can understand it!

The basic design of all successful NLP chatbots has three layers:

  • Greeting and general education
  • The intents or main executables
  • Continuing education plus the exit sequence

Greetings and Education Layer

The greeting part is the simplest. This is where your chatbot says hello to your users. It may, quite literally, be as simple as having your chatbot say, “Howdy!”.

The education part refers to two components:

  • Who the bot is
  • What the bot can do (overt intents)

I highly recommend having the chatbot introduce itself (by name, if there is one) and then say who it works for.

For example, if your chatbot works for a pizza restaurant, it might start off every new interaction by saying: “Hello! I’m SaucyBot, and I am Pizza Shack’s automated assistant.”

The second part of the education component is what I call revealing the “overt” intents. The word “overt” here means “something public, something not hidden.”

Since NLP chatbots rely on the user knowing which commands it can understand, you have to “educate” new users on what these are.

For the hypothetical SaucyBot, this would mean telling the user something like, “Just say “menu” if you want to browse our menu, or tell me “order” when you’re ready to make an order.”

Although the word intent is never said out loud by the chatbot, SaucyBot is, in the above example, letting the user know that there is a menu intent and an order intent. These are the overt or public intents.

But Saucybot also has other programmed intents or commands that it can understand. For example, cancel order might be an intent (command) that it understands. But because you don’t need to tell a user about this intent at the very beginning of an interaction, it is a covert intent.

Overt intents are ones the chatbot clearly identifies as possible choices or commands that your user can select from. Overt intents may also be those that you wish to emphasize or encourage your clients/users to choose more often (for example, an ask me about our daily specials intent for a restaurant bot).

Covert intents are ones that are not secret but are not publicized, especially in the beginning. It’s not that the ability to cancel an order is truly “secret”, it’s just that there’s no good reason for the chatbot to bring it up (especially before the user makes an order).

Remember: Due to the nature of NLP design, all intents, overt or covert, can be accessed at any time by a sufficiently educated user!

I highly recommend you focus on keeping the number of overt intents as small as possible, at least in the beginning, so as not to overwhelm the user with too many choices.

Intents Layer

In NLP speak, the “intents” are the main body of whatever it is your chatbot can do. You might also think of them as “blocks” or “interactions.”

They are called “intents” by chatbot designers because the user makes some kind of text/voice input (an “utterance”), and then the chatbot’s NLP engine has to try and decipher which of the “blocks” the user intended to select.

It is a very imperfect and time-consuming process to set up, of course. But hey, it’s what you get when you decide to go with an “AI” chatbot! 😉

The Intents layer (including both covert and overt intents) is the “meat” of your chatbot and does all the things that users want to do with your chatbot.

For our hypothetical Saucybot, it would mean things like going through the menus with the user, taking an order, and providing contact information for the restaurant, etc, etc.

Education and Goodbye Layer

Once an intent has been processed and completed, the chatbot then offers two kinds of follow-up responses:

  • Continuing education
  • Goodbye

Continuing education means that the chatbot will instruct the user on what they can do next after a given intent has been completed (or fulfilled).

Let’s say Saucybot takes an order from a user for four pizzas and four large colas. Saucybot will then educate the user on what they can do next. For example, “Okay, your order is on its way, {{username}}! If you need to cancel or update your order, just let me know.”

This is “educating” the user that canceling their order OR updating an existing order is now something that they can command the chatbot to do.

Other forms of “education” may be promotional in nature. For example, Saucybot saying (after a new user has completed an order), “If you join our loyalty program, you’ll get 10% off your next order. Would you like to sign up now?”

But even in the least complex chatbots, “continuing education” refers to the chatbot letting the user know what they can do next, which might be as simple as cycling back to the main menu.

Never leave your users in doubt about what they can do next!

I’ve already written an entire article about this, but every chatbot needs a way to say “goodbye.” Otherwise, your chatbot is just being rude.

For the fictional Saucybot, if the user completes their order and doesn’t want to do anything else, the goodbye intent will be triggered, saying something like, “Thanks for choosing Pizza Shack! Come back and visit me anytime, {{username}}.”

It’s not difficult or time-consuming to design an exit flow. What matters is that you have one.

The One True Flow

Now that you understand the three layers of NLP design, here is what all NLP chatbots look like “underneath the hood”:

Image for post
Image for post
One Flow to Bind Them All
  • The greeting is just saying hello.
  • Education is the chatbot introducing itself and then letting the users know SOME of the commands (the overt intents) that it can understand.
  • The user then “utters” something that is probability matched by the chatbot (NLP engine/AI brain) to an intent.
  • The user then completes the interaction with that intent.
  • The chatbot then educates the user on what else the user can do.
  • And because the chatbot is polite, it says goodbye when the conversation comes to an end.

And that’s really about all there is to it 😎

Have fun building chatbots, everybody!

The Chatbot Guru

An expert’s view on the emerging field of digital…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store