Using NER in Dialogs
This section covers deterministic NER, which refers to simple entities, that is, flat data type, type other than Entity and Entity List.
Prerequisite
- You need to have at least one simple entity (entity type other than Entity and Entity List) defined in the system. The entity should have at least one field.
To use NER in dialogs, follow these steps:
Step 1. Set flow utterance
Go to the desired flow details, click Training phrases and provide at least five utterances with sample value for NER.
On the flow set as many utterances as you need providing the entity field.
Step 2. Train the bot
Once you provide the desired flow utterance, you need to train the bot. To do so, go to bot details, NLP section and click the Train button.
From the moment the chatbot extracts the information from the utterance, the value set in the entity is available in the flow context and you can further use this value in the flow based on your needs.
Step 3. Create flow steps
After you train the bot for NLP, go back to the flow and add flow steps to accommodate your needs.
Even from the moment the intent is identified, DRUID extracts the value and sets it in the entity, which you provided in the flow utterance. You can further use the entity on the flow.
NER Best Practices
Do use the right preposition to extract a Location or Organization
There are two main prepositions of location in English, i.e., " in" and "at". Each of these prepositions has a different meaning when used in a sentence. The NLP model is trained on a per-keyword basis, so it is good to know how to use these prepositions in training phrases to extract either a location or an organization.
To extract a Location or Organization from user says and store it in a specific entity field (either of type Location or Organization), in the training phrase on the flow, use the proper preposition in front of the entity field as follows:
- use "in" to extract a larger location like: a country, a city, a neighborhood, etc.
- use "at" to extract an organization / object that is located at an exact position like: City Hall, hotel name, hospital name, etc.
Adding date range in training phrases
Provide complete training phrases with sample values for start date and end date. E.g.: "how many employees updated their personal data 01-01-2023 - 04-19-2023". In this example, the dates are sample values for the range (start date - end date).
Add target entity for the two sample values: [[Entity]].<start date field> - [[Entity]].<end date field>. To do that, select the date and click on the selection. In the pop-up that opens, click in the Target Entity / Entity field and select the desired entity / entity field (either the entity field that stores the start date or the one that stores the end date) and click Save.
The pop-up closes and the sample values are highlighted in blue and marked with the label Date.
Example:
Save the settings.