Saturday 31 March 2018

Chatbots : Intents or Entities ?

A general architecture of chatbots can be found in this article. Required reading, if you want to understand chatbots. As of now, the most popular open-source framework to create chatbots is RASA, which is made of RASA_NLU and RASA_CORE.



The NLU (National Language Understanding) component

A chatbot must have a NLU component, whose purpose is to identify the intents and the entities of user queries.

Intents : the bots must be able to understand what the intention of the user is. Whether he wants to make a reservation at a restaurant, for instance.

Entities: In the context of Bots, these are neither "Nouns" nor Named Entities that may be recognized by a NLP library such as Spacy (though these may overlap). An entity is an actionable piece of information.

For instance, if the user says : I want to reserve a table for two at Stacy's, tonight at 19:30 , the intent would be make_reservation, while the entities would be two, Stacy's and 19:30. We can use this information to book a table for two at Stacy at 19:30. However, for Christ's sake, table in this context is not an entity, it is actually part of the intent that we identified, make_reservation (at a restaurant)!

Intents or Entities?

 While it would be great to have a system which would be able to recognize a good amount of intents and entities, in practice you see that successful chatbots choose to concentrate either on one or the other.

Prioritize Intents ? : the typical use case of this is when you want your bot to answer users' Frequently Asked Questions. If the expected action is just give a canned answer once you recognized an intent, you don't need entities at all

Prioritize Entities ? : this is a typical scenario for the most focused (and usually most successful) bots. Usually these are the bots who drive the conversation so that they know exactly what intent to expect at a certain juncture. For instance:


ChatBot: Hi,  I am the Stacy's restaurant chatbot. Choose your action:
1. Make a Reservation
2. Cancel a Reservation

(User picks 1)
Please tell me about your reservation.
User: I want to reserve a table for two, tonight at 19:30

In this case, the chatbot knows that the user's next sentence will be about reserving a table, so it will just concentrate on getting the entities. Even easier is decomposing the query even further.

ChatBot: Hi,  I am the Stacy's restaurant chatbot. Choose your action:
1. Make a Reservation
2. Cancel a Reservation

(User picks 1)
For how many people?
User: Two
When?

User: Tonight, at 19:30


In this case, forget about intents, drive the conversation and just train your bot to recognize entities.  

No comments:

Post a Comment