Qubot NLU

From QuData
Jump to navigation Jump to search

Introduction

If you want your bot to be up-to-date and able to process natural text input, then use our innovative technology - Natural Language Processing (NLP). It is NLP that allows your bot to understand the meaning of users' messages and generate appropriate responses. Whether the client wants “two Margherita pizzas and cola” or “cola and cheesecake for two”, the bot will understand and place the correct order.

How NLP works. General information

The essence of the work of NLP comes down to the analysis of the main components of any sentence - entities and intents.

  • Entities are any real world objects, e.g. cola (drink), Ukraine (country), 2022 (number), Dmitry (name).
  • Intents are the client's wishes described as a sentence, for example, I would like a cola (want), how to get to the theater (finding a way), hello (greeting).

To recognize intentions, machine learning methods are used based on prepared phrases as examples for each class. These methods range from a simple bag-of-words to neural networks of fairly complex architecture. Words, n-grams of words, n-grams of letters (combating typos), the presence of a question mark and others are used as features.

Using combinations of recognized entities and intents, we can confidently state what the client wants and take appropriate actions.

There are some simple examples from a pizzeria bot in the table below:

Message 👩EntitiesIntentsReply 💻
Hi-greetHello
Hi, I'm Margo$NAME = MargaretgreetNice to meet you, Margaret!
I would like two Margheritas and a cola$NUMBER = 2
$NAME = Margherita
$DRINK = cola
wantWould you like to place an order for:
2 Margherita pizzas and one cola?
I would like-wantWhat would you like?
I would like to go to Ukraine$COUNTRY = UkrainewantThe distance from you to Ukraine is 4768.95 km. It will be most convenient to fly by plane.

The bot gives meaningful answers in every given example despite similar intentions and recognized entities. In the intent greet, we understand that $NAME is the customer's name, while in the intent want we understand that $NAME is the name of the pizza.

Improving bot's intellectual development

The general information described earlier is used for the work of NLP in many companies, this is a fairly simple scheme, only it has a drawback - the bot is not able to navigate in the context. This means that in all examples from the first table there will always be the same answer.

To provide the bot with more intelligence, QuData's NLP uses forgettable intents, as well as a mechanism that saves the chat history with the customer.

Forgettable intents are intents that happen outside the bot's mainstream and are forgotten at the first normal intent.

This way, the bot can understand the context, as well as process more complex dialog chains, for example, these:

Forgotten intents are highlighted in yellow.

Message 👩EntitiesIntentsReply 💻
I want fanta$DRINKS = fantawantHow many bottles of fanta do you want?
How much does it cost?-[ want, what-is-the-price ] Fanta costs 20 UAH.
Then 3$NUMBER = 3[ want, number ]I added 3 bottles of fanta to the order


Message 👩EntitiesIntentsReply 💻
/start-startHello. My name is Bot. What is your name?
My name is Katya$NAME = Katherine[start, my name is]It's nice to meet you, Katherine.
Hi-greetAlways happy to say hello again.
My name is Masha$NAME = Mariamy name isI see... So your name is Maria?
No.-denyWhat is your name then?
Dasha$NAME = DarianameI see... So your name is Daria?
Yes-yesOkay, Daria, I'll remember that.
My name is Dasha$NAME = Dariamy name isYes, Daria, I know.
I want fanta$DRINKS = fantawantHow many bottles of fanta do you want?