How to Make an Awesome Chatbot with NLP and AI

How to Make an Awesome Chatbot with NLP and AI

SnatchBot Team SnatchBot Team, 07/03/2018

It’s easier than you think

Natural Language Processing is the way in which computer software gets to grips with human conversation and analyses the meaning of sentences. Until recently, deploying NLP in a chatbot was a task for someone with coding experience and a large budget. But no longer. We’ve built the tools for anyone to use our state-of-the-art NLP in their chatbots. And here’s how you do it.

Let’s suppose you have a scripted chatbot and it’s doing a good job in answering queries 24/7, perhaps as an SMS chatbot, conversing with someone by text. But you want to take it to a whole new level, because you know from the analytics that several users have broken off from the conversation in frustration. Good communication with your customers and clients is important to you. You don’t want to lose a single person. So you want to create a chatbot that is sensitive to the emotions being expressed by your chatbot user. No problem at all.

One of the really efficient features of chatbots, compared to other forms of software like Apps, is that you can add extra layers and depth to the chatbot’s conversation without having to invest time and effort in a big rewrite. Adding a valuable NLP AI to your existing chatbot is easy. You can do it in just three steps.

STEP 1

Firstly, create a new interaction that the user will reach if the NLP assessment is that the emotion of the user is one of frustration or negativity. If you are a large company that can offer human live chat around the clock, then this interaction would be one that has the option to send an email or SMS to your staff, while the chatbot would say something like this to the user: ‘It seems that you might not be enjoying talking to a chatbot, would you like to speak to one of our staff instead?’ If you can’t offer instant live chat, then a simple email or phone extraction interaction is probably what you want, with an appropriate message from the chatbot, saying that someone will be in touch soon.

Having made your landing point in this way, now you need to set up an NLP model that the chatbot can access. The great news here is that we have pre-trained NLP models with some of the more important challenges facing chatbots in mind. These models have been trained with huge numbers of sentence examples and they are really effective. The one we want in this case is ‘Negative Words’.

Log in to your SnatchBot account and click NLP. Then click on the Pre-Trained Models button.

SMS Chatbot

STEP 2

Click the Default Models button and you may as well avail of them all. You can choose the language you want the NLP model to work in and you’ll be given a warning that importing these models will overwrite any existing ones. That’s not an issue, so go ahead and say YES.

How to Make an Awesome Chatbot with NLP and AI

That’s your second step completed. You now have our pretrained NLP models available for all of your chatbots. That has to have been easier than you thought it would be!

STEP 3

The third step is to integrate the chatbot’s new ability to analyse sentences for different kinds of meanings with your existing conversation. Again, it’s straightforward. You just need to decide: do you want the NLP to apply to the whole conversation or just certain parts of it? Either way, the method of applying an NLP model to the chatbot is similar.

pretrained NLP models

For individual interactions to be analysed by the NLP model, you simply add a new connection to the interaction. When you edit the connection you’ll see it has a drop-down choice: Standard or NLP. Obviously, here, we want NLP. So pick that. You’ll notice that the interaction now gets a small, blue, ‘AI Connection’ tag beside it in the top left corner.

The next menu choice is Entity or Intent. Intent refers to the purpose of the sentence: to make a booking, buy a product, or find out about opening hours, etc are examples of Intent. Entities are the parts of a sentence that refer to places, people, times, etc. Importantly, we consider words that express negative (or positive) sentiment to be entities too. So Entity is the choice to make here. Next you pick your language.

The next drop down menu is crucial, it lists all the NLP models you’ve created, whether custom ones or the pre-trained ones. Here you’ll find, ‘negative words’, which is the model you want for this example. The final step in establishing the connection is to tell the chatbot what to do if the NLP analysis establishes that there are negative words in the response of the user. This is where you direct the conversation to the landing interaction you created earlier.

To achieve the same integration of your NLP model with the whole conversation, just click Global Connections and create a connection in exactly the same way. Remember, a global connection will always override an individual interaction, so if your user expresses something negative at any point, the chatbot will immediately bring him or her to the landing interaction.

That’s it! You now have a powerful NLP system in place and your chatbot is suddenly capable of appraising a conversation — in this case for negative statements — and reacting accordingly.


SnatchBot’s platform is the best for building chatbots for several reasons. One of which is that using NLP is so easy. It’s a bit like having the most beautifully made engine in the world in your car. And you don’t need to be a mechanic to use it, you just have to put the car in gear and off you go!