Intent is the goal behind the user input, in other words, the reason why the end user is starting the conversation with the chatbot. It comes down to what type of information is the end user after and this is something a good chatbot can figure out from the conversation outset and thus handle the conversation accordingly.
In the example below you can see a sentence broken down into separate categories. The intent is to learn the account balance. The entity mentioned below explains for which account does the end user require the status.
In short, the difference between the intent and entity as they often come together when it comes to chatbots:
- Intent: the end user’s intention. For example, if a user types “show me yesterday’s financial news”, the user’s intent is to retrieve a list of financial headlines. Intents are given a label, often a verb-noun compound, such as “showNews”.
- Entity: refines the intent with context. For example, if a user types “show me yesterday’s financial news”, the entities are “yesterday” and “financial”. Entities are given a label, such as “dateTime” and “newsType”. They are sometimes referred to as slots.
The core of a well-functioning conversational chatbot is intent classification. Intent classification is the process of understanding what the end user means by the text they type.
Infobip Answers enable the following intent functionalities during the chatbot creation:
- Create new intent
- Import/export of intents
- Deletion of intents
- Adding training phrases to each intent
NER stands for Named Entity Recognition and is part of the natural language processing (NLP). The goal of NER is to recognize and categorize information (entities) in the text. These entities can be any word (or multiple words) that typically refer to the same thing. Every entity that the Answers detect will be classified into a predetermined category.
Here is the list of categories we support for NER in Answers:
- Currencies Amount - recognizes numeric amounts and currency names/codes/symbols
- Dates - extracts dates and date parts from the text (day, month, year) written in different formats and converts them into Y-M-D formatted dates.
- Days of the week – recognizes text referring to days of the week in English.
- Locations (cities and countries) - searches the text for city/country names using provided data sets (data set in use taken from GeoNames)
- Numbers – recognizes the text for numbers written in digits.
You are able to create NER-enabled intents when you use NER-enabled attributes in the creation of intents.
Considering that a good chatbot contains a large set of data in order to better recognize the end-user intent, there should be plenty of training phrases for each intent. It is helpful to prepare a .csv or a .txt file that contains, for example, phrases taken from your customer service and organized per intent as that would be a faster way of training the chatbot (importing such a file into the system versus adding manually phrase by phrase).
If creating intents in the system, go to the Intents tab and to add a new intent to the chatbot, click the ADD INTENT button:
When the intent window opens, enter intent name by writing over the New intent phrase, or clicking the pencil icon
Each new intent has two configuration options:
- Attributes – only NER-enabled attributes can be selected here
- Training phrases – you need a minimum of 50 phrases (important words in intents are not counted as training phrases)
If you could get to around 100 of phrases for each intent, that would make your bot much smarter and enable it to understand the intents more easily.
Click on the +Add attribute action if you want to add attributes for the intent you are creating and select one of the available NER-enabled attributes you have in Answers.
For example, if you have an intent that deals with booking flights, attribute you can consider adding here is City (a NER-enabled attribute) which will recognize the city entity from your end users request.
The next part of intent configuration is to add training phrases to the intent. Click on the line saying Enter user expression and start adding phrases.
Click the action +Add training phrase to add a new phrase to your intent.
Training phrases should contain important words and whole phrases/sentences that might come up as part of the conversation with the user.
The X icon on the right side of each row will delete the phrase, while clicking the trash bin on the right side of the intent name will delete the whole intent.
The minimum requirement of training phrases in one intent is 50. If you have an NLP-enabled bot, it would be better if you could get to around 100 of phrases for each intent, that would make your bot much smarter and enable it to understand the intents more easily.
Important words for intents (keywords in intents)
When training the chatbot, bear in mind that you should use both single words (most important words for intents) and training phrases (some of which should contain those important words). Important words are words that belong logically to that intent and appear in the training phrases.
For successful validation of intents, the following criteria must be met when it comes to important words:
- Important word can appear in only one intent (cannot appear as important word in other intents)
- Each of the important words you added to the intent must appear in at least two training phrases (more than two is preferable)
Can you help me with booking a flight?
Is it possible to make a flight booking?
Validation will fail if you create one intent containing only important words and another intent containing both important words and phrases. This will become apparent once you validate your chatbot – if the validation fails, check that you have configured your intents properly (in the same manner).
Intent training phrases guidelines
This is a short reference guide to help you check whether your intents will pass validation.
- 50 intent phrases are the minimum
- Single words in phrases do not equal important words (important words appear in phrases)
- If using important words in intents, they do not count as part of those 50 phrases (meaning you need important words + 50 phrases)
- Training phrases (whether only one word or actual phrases) should not appear in different intents
- Important words need to appear in at least two training phrases
- Stop words (words that are filtered out in natural language processing) will be dismissed from training phrases so if you have a phrase containing an important word plus
- stop words, that phrase will not be counted as a training phrase containing an important word
STOP words for English: a, an, and, are, be, do, have, I, in, is, me, of, that, the, to, you.
STOP words for Spanish: de, la, que, el, en, y, a, los, se, del, las, un, por, con, una, su, para, es, al, lo, como, más, o, pero, sus, le, ha, me, si, son, mi, yo, nos, eso
STOP words for Croatian: a, ali, cu, da, i, ili, je, kako, li, me, mi, mogu, na, nego, ni, niti, no, pa, s, sa, sam, se, su, te, to, vec
STOP words for Arabic:
أن, عن, كيفية, يوجد, اود, إلى, في, أنت, هو, مع, هي, شو, هم, على, كيف, ما, أنا, هذا, هل, أو, لو, أستطيع, سمحت, التي, بدي, إذا, و, ذلك, أعلم, فقط, به, بها, بهذا, عليها, عليه, بعض, اريد, لكن, هنا
For example, if 'ticket' is your important word and you use it in a sentence ‘Do you have tickets?’ that sentence will not be counted as a training phrase containing important word because when you remove the stop words (do, you, and have), what you have left is only the important word (=tickets).
If you have decided to create your intent files outside of Answers, use one of these two file formats:
- .csv or
For example, you can use here the history of conversations your agents had with your end users and extract from those conversations mostly used phrases belonging to a particular intent.
To import the file, click the IMPORT button in the main intent frame and select the locally stored file.
Once the file is selected, it will be displayed and now confirm the import by clicking the IMPORT button:
The file needs to follow certain rules.
- It has to contain two columns, first one with phrases, the second one containing the intent name to which the phrase belongs.
- The intent name needs to be separated from the phrase by a delimiter - semicolon.
- The file shouldn’t contain a header.
- The file can only be in a .csv or a .txt format.
You can save the values as a .txt file as shown in the example below:
In cases where the import file has a wrong extension, or you mistype the delimiter, Answers will let you know what went wrong.
Situation where there is a wrong extension:
Or, a wrong delimiter:
When you want to export intents, select the checkboxes in front of the intents you plan to export (checking the one in front of Intent title will automatically select all the intents underneath).
Once one or more intents are selected, the EXPORT and DELETE buttons appear.
EXPORT button enables you to save the intents locally as a csv file, in the predefined format that is the same as the one for import.
DELETE button deletes the selected intents but first asks you to confirm the action.
When the intent is deleted, the Answers platform notifies you it was successful.
If you have configured NER-enabled attributes in intents, they will not be exported with intents.
Once the list of intents is ready, you can continue with the creation of attributes.