How to use entity patterns?
- Getting Started
- Bot Building
- Smart Agent Chat
- Conversation Design
-
Developer Guides
Code Step Integration Static Step Integration Shopify Integration SETU Integration Exotel Integration CIBIL integration Freshdesk KMS Integration PayU Integration Zendesk Guide Integration Twilio Integration Razorpay Integration LeadSquared Integration USU(Unymira) Integration Helo(VivaConnect) Integration Salesforce KMS Integration Stripe Integration PayPal Integration CleverTap Integration Fynd Integration HubSpot Integration Magento Integration WooCommerce Integration Microsoft Dynamics 365 Integration
- Deployment
- External Agent Tool Setup
- Analytics & Reporting
- Notifications
- Commerce Plus
- Troubleshooting Guides
- Release Notes
Entity Patterns
Entity Patterns allow the entities to be defined in such a manner that they can be detected on the basis of the context under which the utterance has been made by the User.
When to use it?
It can be used in the following cases -
- When an entitycan take an infinite set of values and using a pre-defined and limited list of values (read - Dictionary) isn't sustainable or possible.
- Examples of such entities could be a. person_name (Bob Marley, Nick Jonas, etc) b. movie_name (Harry Potter, Matrix Reloaded); or
- When names of things i.e nouns (proper or common) from a user utterance are to be extracted,
- When not to use - Phrase extraction tasks involving action-oriented statements like extracting set up a reminder from I want to set up a reminder should not be done through Entity Patterns. It is prone to unpredictable behavior.
How to use it?
- Go to the Entity Patterns section of an entity. This section is meant to train the bot on the context in which the entitywill be detected.
- The context is provided to the bot through sample user utterances or patterns. In this section, those sentences are to be added which contain the entity and the user is expected to utter them.
- It is shown in the image below where the names of courses are detected as an entity.
- Once sample utterances have been added, the entityvalue in the utterance needs to be tagged. The tags are used to explain the IVA about the presence of an entityin that mentioned pattern.
- The tags of the entity can be added by selecting the phrases and clicking “Add Tag" as shown below.
- The tags of the entity can be added by selecting the phrases and clicking “Add Tag" as shown below.
-
Provide some sample utterances which contain the entity value but not the context in which they are to be detected. They are called Negative examples. These utterances should be added but the entity value should not be tagged.
-
The below image can be checked where pattern numbers 7, 9, 10 in the image are negative examples. A side image showing a working example where negative intents have been added -
One more illustration below where row number 67 is an example where the pattern is with appropriate intent, but a different object has been entered to create a negative example.
-
The below image can be checked where pattern numbers 7, 9, 10 in the image are negative examples. A side image showing a working example where negative intents have been added -
-
After you are done adding or updating variations, please Train the bot. The entities that are tagged in the ‘Entity Patterns’, get auto-tagged in the User Message section of the steps well.
- As illustrated in the images below, the phrases with a green underline are entity values of the entity added on the step. You can select the phrase and see which entity was detected for the phrase.
-
To ensure that the IVA learns the context accurately, it’s recommended to add a minimum of 10 sentences for every intent which the user might utter while providing the entity value. User’s Intents form a crucial part of the context in which the entity will be detected.
- If the IVA is to be trained on detecting a new intent from a user utterance, then 10 more variations should be provided to improve the detection of the entity.
The emphasis on adding more variants in entity patterns is for ensuring that there is a reduced probability of false detections.
E.g - for the entity courses - The intent is to search for a course.
- I want to search for a course on Machine Learning
- I need to find a course on Marketing and so on till 10 variants have to be added.
But if the intent in the context expands to a new "Buy" intent and entity value has to be detected in that context as well, then 10 more variations need to be provided.
E.g - for the entity courses - The intent is to buy a course.
I want to buy a course on Machine Learning
Can you help me buy a course in Marketing and so on till 10 variations?
- The population of DICTIONARYfor EntityPatterns - Dictionary in the context of entitypatterns serves a different purpose, compared to normal text-based entities. It can be explained through an illustration -
- Let’s assume 10 patterns have been added to the Entity Patterns section. If no dictionary values are present, the IVA will be trained with training data of 10 variations.
- However, if 10 dictionary values are entered in the Dictionary section, the IVA will be trained on 10 patterns X 10 dictionary values i.e 100 variations.
- This helps in making the model more robust to the variations in contexts and values.
- It also helps the IVA understand the variation in the nature of entity values, as illustrated better in the example below.
Example - Here is the list of entity patterns -
Below is the dictionary for the same. Please check that there are variations in the character and word length of entity values as well. This will make the IVA understand variations better.
The below image shows the detection due to the presence of character and word count variation in the entity values.
Some guidelines to make Entity Patterns more robust -
- Vary the position of the entity in sentences in training data
- Avoid spelling errors
- Ensure variety in the usage of verbs. E.g if the intent is to find a course, it can be shown with verbs like the look, search, find, show, etc.
- Use complete sentences whenever possible. This enables the IVA to perform better on paraphrases
Aforesaid guidelines are illustrated in the image of Entity Patterns below -
How do Entity Patterns work?
When the entity patterns are defined, the IVA is trained on both the tagged term and the context in which the term is used. This enables the IVA to calculate a confidence score on every User Utterance, on how likely a word or phrase is going to be a value of an entity.
- When a User Utterance is received, the IVA looks for the context of the sentence in which the entity is mentioned to detect.
Troubleshooting
Entity Detection Failure - Case 1
The IVA should have detected an entity in a particular User Utterance, but it didn't detect the same. Following steps can be taken to fix the same -
Add that User Utterance to the Entity Patterns, ensuring that for a particular intent, 10 entity patterns are provided.
Example - Let's say the following User Utterance failed to get detected -
Add variations to the Entity Patterns as shown below. They are variations of the Buy intent in 10 different forms -
The IVA has been trained again after adding 10 variations and the Entity Pattern has been detected.
Case 2 - False Detection
This is a case where the IVA is detecting wrong phrases as an entity value. Illustration in the image below -
To fix the same, some Negative Variations without tagging the entity value have to be added to the Entity Patterns section, as shown in the image below. They communicate those cases to the IVA where detection need not occur.
Below is the case where the detection stopped once the Negative Variations were added to the Entity Patterns. Once the IVA is trained after adding Negative Variations, the detection doesn’t occur.