Difference between revisions of "Qubot NLU"

From QuData
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 27: Line 27:
 
</table>
 
</table>
  
В каждом из представленных примеров бот, несмотря на схожие намерения и распознанные сущности бот дает осмысленные ответы. В случае намерения '''greet''', мы понимаем что $NAME - имя клиента, а в случае намерения '''want''' мы понимаем что $NAME название пиццы.
+
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==
Описанные ранее общие сведения применяются для работы NLP у многих компаний, это довольно простая схема, только у неё есть недостаток - бот не способен ориентироваться в контексте. Это значит что во всех примерах из таблицы 1 всегда будет один и тот же ответ.
+
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.
  
Для предоставления боту большего интеллекта в NLP от QuData используются '''забываемые намерения''', а также механизм сохраняющий историю общения с клиентом.  
+
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.''
  
 
<table style="border-style: solid; border-width: 1px; border-color: lightgray;">
 
<table style="border-style: solid; border-width: 1px; border-color: lightgray;">
     <tr><td>'''Сообщение 👩'''</td><td>'''Сущности'''</td><td>'''Намерение'''</td><td>'''Ответ 💻'''</td></tr>
+
     <tr><td>'''Message 👩'''</td><td>'''Entities'''</td><td>'''Intents'''</td><td>'''Reply 💻'''</td></tr>
     <tr><td>Хочу фанту</td><td>$DRINKS = фанта</td><td>want</td><td>Сколько фанты Вы хотите?</td></tr>
+
     <tr><td>I want fanta</td><td>$DRINKS = fanta</td><td>want</td><td>How many bottles of fanta do you want?</td></tr>
     <tr style="background-color: lightyellow"><td>А сколько она стоит?</td><td>-</td><td>[ want, what-is-the-price ]</td><td>Фанта стоит 20 гривен.</td></tr>
+
     <tr style="background-color: lightyellow"><td>How much does it cost?</td><td>-</td><td>[ want, what-is-the-price ]</td><td> Fanta costs 20 UAH.</td></tr>
     <tr><td>Тогда три</td><td>$NUMBER = 3</td><td>[ want, number ]</td><td>Я добавила в заказ 3 фанты</td></tr>
+
     <tr><td>Then 3</td><td>$NUMBER = 3</td><td>[ want, number ]</td><td>I added 3 bottles of fanta to the order</td></tr>
 
</table>
 
</table>
  
  
 
<table style="border-style: solid; border-width: 1px; border-color: lightgray;">
 
<table style="border-style: solid; border-width: 1px; border-color: lightgray;">
     <tr><td>'''Сообщение 👩'''</td><td>'''Сущности'''</td><td>'''Намерение'''</td><td>'''Ответ 💻'''</td></tr>
+
     <tr><td>'''Message 👩'''</td><td>'''Entities'''</td><td>'''Intents'''</td><td>'''Reply 💻'''</td></tr>
     <tr><td>/start</td><td>-</td><td>start</td><td>Здравствуйте. Меня зовут Бот. Как Вас зовут?</td></tr>
+
     <tr><td>/start</td><td>-</td><td>start</td><td>Hello. My name is Bot. What is your name?</td></tr>
     <tr><td>Меня зовут Катя</td><td>$NAME = Екатерина</td><td>[start, my name is]</td><td>Очень приятно Екатерина, рад знакомству.</td></tr>
+
     <tr><td>My name is Katya</td><td>$NAME = Katherine</td><td>[start, my name is]</td><td>It's nice to meet you, Katherine.</td></tr>
     <tr style="background-color: lightyellow"><td>Привет</td><td>-</td><td>greet</td><td>Всегда рад поздороваться повторно.</td></tr>
+
     <tr style="background-color: lightyellow"><td>Hi</td><td>-</td><td>greet</td><td>Always happy to say hello again.</td></tr>
     <tr style="background-color: lightyellow"><td>Meня зовут Маша</td><td>$NAME = Мария</td><td>my name is</td><td>Понятно... То есть Вас зовут Мария?</td></tr>
+
     <tr style="background-color: lightyellow"><td>My name is Masha</td><td>$NAME = Maria</td><td>my name is</td><td>I see... So your name is Maria?</td></tr>
     <tr style="background-color: lightyellow"><td>Нет.</td><td>-</td><td>deny</td><td>Как же Вас тогда зовут?</td></tr>
+
     <tr style="background-color: lightyellow"><td>No.</td><td>-</td><td>deny</td><td>What is your name then?</td></tr>
     <tr style="background-color: lightyellow"><td>Даша</td><td>$NAME = Дарья</td><td>name</td><td>Понятно... То есть Вас зовут Дарья?</td></tr>
+
     <tr style="background-color: lightyellow"><td>Dasha</td><td>$NAME = Daria</td><td>name</td><td>I see... So your name is Daria?</td></tr>
     <tr style="background-color: lightyellow"><td>Да</td><td>-</td><td>yes</td><td>Хорошо, Дарья, я это запомню.</td></tr>
+
     <tr style="background-color: lightyellow"><td>Yes</td><td>-</td><td>yes</td><td>Okay, Daria, I'll remember that.</td></tr>
     <tr style="background-color: lightyellow"><td>Meня зовут Даша</td><td>$NAME = Дарья</td><td>my name is</td><td>Да, Дарья, я знаю.</td></tr>
+
     <tr style="background-color: lightyellow"><td>My name is Dasha</td><td>$NAME = Daria</td><td>my name is</td><td>Yes, Daria, I know.</td></tr>
     <tr><td>Я хочу фанту</td><td>$DRINKS = фанта</td><td>want</td><td>Сколько фанты Вы хотите?</td></tr>
+
     <tr><td>I want fanta</td><td>$DRINKS = fanta</td><td>want</td><td>How many bottles of fanta do you want?</td></tr>
 
</table>
 
</table>
  
 
[[Category:Qubot]]
 
[[Category:Qubot]]
 
[[Category:ru]]
 
[[Category:ru]]

Latest revision as of 08:52, 6 July 2022

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?