Having learned about Intents in our previous blog, in this blog we will shed light on another interesting topic of Entities in Dialogflow.
Entities provide an efficient way to capture and extract crucial information like name, country, location and any custom information from user inputs.
Entities can be mainly categorized into three types:
1. System Entities: These are build-in entities provided by Dialogflow through which you can identify and extract most common type of data like name, country, date, email address etc.2. Custom Entities: These are user-defined entities that are useful to extract custom data from the user inputs. For example, you can define a Fruit entity type that can identify and map different fruit types like Mango, Apple etc.
3. Session Entities: As the name suggests, these entities remain active only for the session for which they have been created. They provide additional capability through which we can update custom entity types with new entries.
Using System Entities in Dialogflow
To use system entities, follow the steps below:
- Open the Dialogflow Console.
- Select the desired agent.
- Click the Intents option.
The Intents screen displays.4. Click the desired intent.
7. Select the desired system entity.
Now the desired name will be extracted as @sys.given-name:name.
Creating Custom Entities in Dialogflow
To create custom entities, follow the steps below:
1. Click the Entities option.
2. Click the Custom tab.
3. Click the Create Entity option.
4. Enter the Entity name
5. Enter the reference value in Enter reference value.
6. Enter the synonyms associated with the particular reference value.
Giving more number of synonyms ensures that the bot gets trained properly to identify particular entity in user input.
7. Click the Save button.
8. Go to a desired intent.
9. Enter the training phrase as shown figure below.
Dialogflow automatically identifies the phrases and annotates them with desired entities.
There are also session entities, regexp entities, and fuzzy matching that provide more dynamic capability to extract various types of data from user input. We will further explore advanced topics in entities in our subsequent blogs.
Till that time, Happy Coding!