Chatbots have experienced significant development during recent years and numerous sectors (e.g. customer service) are now starting to use them. But what are they, how do they work and what do they bring to the table?
Chatbots: what are they?
Generally, a bot answers questions asked by human beings, and not the other way round. There are two ways in which to chat with a bot: through writing or speech. In the first case, we talk about a chatbot, and in the second, a voicebot.
- Facebook Messenger
- Mobile application
- Mega AI Bot (Google assistant, Amazon Alexa, Apple Siri, Microsoft Cortona)
- Skype for Business
Voicebots are, for their part, more specifically accessible through, (amongst others) connected speakers, the most popular being:
- The Amazon Echo range (Amazon Echo Dot, Amazon Echo Plus, Amazon Echo Spot…)
- The Google Home range (Google Home Mini, Google Home, Google Home Maxi)
- The Apple speaker (HomePod)
The first 2 manufacturers also provide voice assistants on other devices, sometimes in quite an original manner such as the inclusion of Amazon Echo in a microwave oven.
How a chatbot operates
Regardless of the solution used to build chatbots, all of them are based on the following notions to help them extract meaning from a sentence and formulate a response.
Intents and Entities
In order to understand what is an intent and what is an entity, let us use the following sentence (written or dictated).
“I would like to book a table for this evening at 6pm, for 4 people”
In this sentence:
- The intent is identified thanks to the words “book a table.” So, the user wishes to book a table. (S)He could have used other words (or couples of words) instead, such as:
- set aside a table,
- make a reservation,
- make an appointment,
In all cases, the system would still have associated them with the same intent.
2. There are three entities: the date (this evening), the time (6pm), the number of people (4). As with the intent, the user could have used other words:
- Date: tonight, this Saturday, for 2 March 2019, next Friday…
- Time: 8am, 8pm, 4 in the afternoon…
- Number of people: 2 guests, party of 3…
“Will it rain this week-end?”
In this sentence:
- The intent “rain or no rain” is identified thanks to the “will it rain” (other sets of words could have been used and identified, as for example: rain forecast…)
- The “date” entity thanks to “this week-end
To sum up, the intent helps identify the objective and/or the meaning of the sentence whilst the entities represent the variables.
Chatbots use decision trees
As in the vast majority of IT projects, chatbots use conditions and consequently, decision trees.
For instance, if the chatbot must satisfy the “weather forecast” intent (what will the weather be like? what is the weather forecast? …), the user must provide variables – the so-called entities (a location, a date). The decision tree will help cover situations in which one or more of these entities are missing.
|SITUATION||INTENT||LOCATION-TYPE ENTITY||DATE-TYPE ENTITY||CONCLUSION|
|1. What will the weather be like this week-end in Lille?||OK||OK||OK||The bot can provide an answer since it has all the necessary information to do so.|
|2. What will the weather be like this week-end?||OK||Not OK||OK||The bot cannot provide an answer since it is missing the location information. It could then ask: “Could you please specify a location?”|
|3. What will the weather be like in Lille?||OK||OK||Not OK||The bot cannot provide an answer since it is missing the date information. It could then ask: “Could you please specify a date?”|
|4. What will the weather be like?||OK||Not OK||Not OK||The bot cannot provide an answer since it is missing both the date and location information. It could then ask: “Could you please specify a date and location?”|
Steps involved in building a chatbot
In order to understand the usefulness of a decision tree when building a chatbot, you must first understand the main steps involved in creating a chatbot. In concrete terms, what must the administrator/developer do to create a chatbot?
1/ (S)He must select the intents and entities that (s)he wants the machine to recognise, regardless of the tool used (DialogFlow, IBM Watson Assistant, Clustaar, etc.).
2/ The automated chat must then get the system to learn those. To do so, it will input a certain number of sentences and/or words for each pre-identified intent and entity.
Note: this task does not have to be performed for some entities, such as date for instance, since they are natively managed by the system (e.g. for hours, the administrator does not have to input: 00H00, 00H01, 00H02, 00H03, 00H04…, for dates: 01/01/2019, 02/01/2019, 03/01/2019…).
Moreover, the highest quality tools on the market integrate a thesaurus and know the singular/plural forms of words. There is hence no need to, for example, get the system to learn:
- What is a horse? AND “Tell me about horses”,
- Do you sell fruits? AND “Do you have pineapples?”
3/ Finally, the chatbot will set up a decision tree. In concrete terms:
- If intent A + entity A are identified, system responds XXX
- If intent A + entity B are identified, system responds YYY
- If intent B + entity A are identified, system responds ZZZ
- … etc.
The tool can, in the majority of cases, identify the variables missing to be able to formulate a correct answer to the question asked. In which case, it will invite the user to specify them.
In this article, we have tried to show you how a new generation chatbot (i.e. one that recognises intents and entities in a sentence) works and the main steps involved in its creation. These chatbots do not use machine learning-type processes (the continuous improvement process requires human intervention and is not automatic). The coming years should however see the emergence of a future generation of chatbot creation tools that integrate machine learning.
Our teams remain of course at your disposal to exchange ideas on these subjects.