Instruments to Develop NLP Chatbot
Alyona Oliynyk

In 2016 Facebook launched chatbots in their Messenger platform. Since then they have been quickly creeping their way into our daily life and business routines. If you are a business owner and want your business to be successful, you should definitely get to know more about the facts and capabilities of chatbots.

It’s easy enough to build NLP chatbot when you have several chatbot building platforms to choose from, even for beginners. We’ve gathered some info about these platforms, you can learn their pros and cons in this article. If you have experienced a chat with a few bots as a user, you may be familiar with a common frustration: This thing doesn’t understand what I’m saying.

However, thanks to artificial intelligence and natural language processing, such unpleasant experiences are now a thing of the past – AI is one of the most exciting aspects in the rise of chatbots. Bots, powered by AI and machine learning (ML) are intelligent: the more users that use these chatbots, the smarter they become. They can learn our habits and understand our tastes and preferences.

Forrester Research predicted a greater than 300% increase in investment in AI in 2017 compared with 2016. Companies of all sizes and across all industries are investing in this revolutionary technology.

38% of enterprises are already using artificial intelligence , growing to 62% by 2018

Narrative Science last year’s survey

NLP Chatbot Dialog Overview

Chatbots with AI and NLP are equipped with a dialog model, which use intents and entities and context from your application to return the response to each user. The dialog is a logical flow that determines the responses your bot will give when certain intents and/or entities are detected. In other words, entities are objects the user wants to interact with and intents are something that the user wants to happen.

You create a dialog branch for every intent that you define and in each box you can enter a condition based on the input, such as the name of the intent. Then you enter the response your bot should make when the condition is true, and you continue to build that with entities and their values.

Let’s get right into platforms for creating dialogues with the best AI available today:

Microsoft Language Understanding Intelligent Service (LUIS)

Free: 10,000 transactions per month; Basic: up to 50 transactions per second for $0.75 per 1,000 transactions

LUIS enables you to add conversational intelligence to your bot application and build your own language understanding models. You can use pre-existing, world-class, pre-built models from Bing and Cortana.  LUIS offers language-understanding tools, such as intents and entities in order to accomplish that.

Microsoft Language Understanding Intelligent Service LUIS
Travel Agent bot example flow in LUIS

All active learning applications are content-related or centered around a domain-specific topic. LUIS returns easy-to-use JSON and stores all incoming expressions in the Logs section. It also provides semi-automatic learning features with Suggestion when the system tries to predict the correct intents that are already present in the Model

For correct matching it’s seriously important to formulate main intents and entities clearly. If there is no intent matching a user request, LUIS will find the most relevant one which may not be correct. Unfortunately, there is no option to add a default answer, but there is a predefined intent called None which you should teach to recognize user statements that are irrelevant to your bot.

Viktoria Tymoshchuk,

Chatbot Product Manager

Pros and Cons of LUIS

Pros:

Recognises intention and entity.

Includes pre-built entities like number (in number or text), temperature, dimensions, money, age, geography, encyclopedia, percentage, and DateTime.

Any messaging platform.

Supports English, French, Italian, German, Spanish, Brazilian Portuguese, Japanese, Korean and Chinese.

Has SDKs for C#, Python, Node.js and Android.

LUIS leverages Microsoft’s wealth in ML to enable you to add conversational intelligence to your NLP chatbot and build language understanding models for any custom domain.

Cons:

Much needs to be managed on the developer side.

The imitations of up to 10 Entities of each type per application, which will only be enough for a middle-size service.

The option to add a default answer is missing.

Api.ai (Dialogflow)

Totally free

Api.ai’s key concepts to model the behavior of a chatbot are Intents and Contexts. With intents you can link what a user says and what action should be taken by the bot. The request might have different meaning depending on previous requests, which is when contexts come in handy. These string values are useful for differentiating intents.

Basically, when Api.ai (Dialogflow) receives a user request the first thing that occurs is that the request is classified to determine if it matches a known intent. Api.ai (Dialogflow) proposes a “Default Fallback intent” to deal with requests that do not match any user intent.

You can restrict the matching of an intent by specifying a list of contexts that have to be active.  The matching of an intent can create and delete contexts.

Of course, the bot logic will not be full without some custom coding on the server side. It’s pretty simple to develop with Api.ai (Dialogflow) and its webhook integration. Essentially, Api.ai (Dialogflow) passes information from a matched intent into a web service and gets a result from it.

API AI
Pizza bot example flow in Api.ai (Dialogflow)

When the user texts “I would like to order a large pizza”, this request matches the intent named order, which could create a context named ordering. When the user has indicated other parameters like toppings, crust, etc., you could create a context named pizza_selectedand keep the ordering context alive. Then later, if the user says “What is the delivery time?” the bot could match an intent named get_order_info only if the context named pizza_selected exists.

One of most important features of the API.AI bot platform is the usage of conversational flow contexts that help to organize nested flows with possibilities for creation of suggestive sentences, connected conversations, etc. Also this platform has rich built-in machine learning features like advanced entities that really helps to set up conversational flow easily. API.AI supports many human languages and a lot of messaging platforms out-of-the-box working across different types of devices.

Vitalii Hurin,

Back-end developer

Pros and Cons of Api.ai (Dialogflow)

Pros:

With Api.ai (Dialogflow) it is possible to model large and complex flows using Intents and Contexts.

Slot-filling is an integrated feature. A good part of the logic can be solved by the chatbot, which decreases the server side coding.

Domains are available, that are specifications that can deal with several common use cases and applications (e.g. small talk, wisdom, flight schedules, reminders, etc).

You can train the NLP chatbot with examples in  “Training” section (in beta).

One-click integration with several platforms like Facebook Messenger, Slack, Twitter and Telegram.

Cons:

It is impossible to block the matching of an intent if a context is present.

The training section is still in beta.

Wit.ai

Wit is free, including for commercial use

The key concepts to model bot behavior with Wit.ai are stories which represent an example of a possible conversation. In Wit.ai an “intent” is a user entity rather than a concept. This was a change of great impact in Wit.ai, motivated by the fact that a complex NLP chatbot needs a lot of intents that can, in some way, be grouped in stories. Bot developers basically teach Wit.ai by example. The subjacent idea is that when a user writes “similar” requests, Wit.ai will process the request, extract the entities and apply the logic defined by the developer

WIT AI
Example flow in Wit.ai

A story can be seen as a graph of user intents. You can add branches that are triggered by conditions such as the existence or lack of of specific variable values that are extracted from the user input. This allows you to define a conversation flow. Moreover, you have a bookmark mechanism, used to jump between intents and also between stories.

To interact with the server side, you have “Bot sends” commands, which basically calls to functions. A very interesting point is that you can set the role of the entities in a phrase. For example, in “I want to fly to Venice, Italy from Paris, France, on January 31”, you can state that the first city is the destination and the second one the departure.

Pros and Cons of Wit.ai

Pros:

The concept of story is powerful.

Wit.ai allows controlling the conversation flow using branches and also conditions on actions (e.g. show this message only if some specific variables are defined).

Assigning roles to entities helps server side processing.

A section “Understanding” is proposed to train the chatbot with examples.

An “Inbox” exists, where the requests that could not be processed by the chatbot are listed, so the developers can teach the bot.

Cons:

Stories are in beta.

Even if stories are a powerful concept, there are cases where it is difficult to control the flow of the conversation and the bot tends to misunderstand the user requests.

IBM Watson

Lite is free, Standard costs $0.0025 (USD) per API call

According to the research study by Mindbowser, IBM Watson is the go-to bot-building platform for 61% of businesses. IBM Watson includes a variety of services, and one of its most important parts is their Conversation Service. It is built on a neural network (one billion Wikipedia words) and provides a text-to-speech service and a speech-to-text service. Watson Conversation comes with web tooling that enables you to easily configure how your bot behaves. This is done by using three concepts: intents, entities and dialog. IBM Watson intent detection works best on smaller training datasets, although when trained on over 2000 samples the difference is indistinguishable.

The API set includes language understanding offerings from another IBM Watson product — Natural Language Classifier — to conceptualize insights and dialogue processing. There are a lot of building blocks that you can use in your chatbot application, but you probably will spend a fair amount of time integrating them into one solution: there is no single API that does intent and entity recognition in a single call. This is slightly inconvenient since you have to build your own pipeline with multiple API calls to extract all the information you need and it’s harder to link entities to intent. There is no service to manage the conversation using these APIs.

IBM Watson
Customer service bot example flow in IBM Watson

IBM Watson has a very good tool for making NLP chatbots. First of all, it’s an IBM Watson Conversation, which keeps conversation context and can be used with other IBM Watson services (Discovery and Classifier) to easily create a powerful FAQ functionality. If a user asked about how to check fuel in a car and after that tries to find a place where he can buy some food, then a bot will find gas stations with food being sold. And the best thing is that it’s really easy to build an intelligent bot without processing tons of manuals for that. Watson is good pretty much in everything connected with NLP. As for me it’s best, but unfortunately it’s not cheap at all.

Dmitriy Nechessa,

Software Developer

Pros and Cons of IBM Watson

Pros:

Has three main components: intents, entities and dialog.

Providing different interfaces such as speech input, which makes the experience with your bot more comfortable and interesting.

Supports English, Arabic, French, German, Italian, Japanese, Korean, Portuguese (Brazilian), and Spanish.

No need to write mathematical models and algorithms.

A wide range of programming languages: Node SDK, Java SDK, Python SDK, iOS SDK, Unity SDK.

Cons:

Does not answer questions for which answers are unknown.

There is no single API that does intent and entity recognition in a single call.

High in price.

The majority of AI engines are still heavy under development and adding features/changing pricing models. Try approaching them with a specific use-case and see which one can get you to where you need to go the quickest.

Want to learn more?

Master of Code designs, builds, and launches exceptional mobile, web, and conversational experiences.

















    By continuing, you're agreeing to the Master of Code
    Terms of Use and
    Privacy Policy and Google’s
    Terms and
    Privacy Policy

    Also Read

    All articles