Entity Extraction

Entity Terminology

The term entity is used in this documentation to describe the general concept of entities. When discussing entity details, it's important to understand more specific terms:

  • Entity type: Defines the type of information you want to extract from user input. For example, vegetable could be the name of an entity type.

  • Entity entry: For each entity type, there are many entity entries. Each entity entry provides a set of words or phrases that are considered equivalent. For example, if vegetable is an entity type, you could define these three entity entries:

    • carrot
    • scallion, green onion
    • bell pepper, sweet pepper
  • Entity reference value and synonyms: Some entity entries have multiple words or phrases that are considered equivalent, like the scallion example above. For these entity entries, you provide one reference value and one or more synonyms.

Create Entities

Each intent parameter has a type, called the entity type, which dictates exactly how data from an end-user expression is extracted.

Dialogflow provides predefined system entities that can match many common types of data. For example, there are system entities for matching dates, times, colors, email addresses, and so on. You can also create your own custom entities for matching custom data from Robolabs. For example, you could define a vegetable entity that can match the types of vegetables available for purchase with a grocery store agent.

System Entities

Dialogflow provides many system entities to extract common types from end-user expressions. For example, the @sys.color type can be used to extract values like "red" or "blue". You can see the full list of system entities in the System entity reference.

For most applications, the values provided by system entities work well. However, your application may need to add additional values for system entities. For example, you may want to add "blue-green" to the list of values for @sys.color. Some system entities can be extended for this purpose. The System entity reference lists the system entities that can be extended. The remaining sections of this document describe how to extend system entities.

System entity support differs for each language. See the system entity limitations for details.

To find this data go to Robolabs, then choose Entity Extraction menu in side bar, klik System in tab bar.

Custom Entities

You can create custom entities for matching data specific to your bot. For example, you could define a vegetable entity type that can match the types of vegetables available for purchase with a grocery store agent.

To create custom entities you can go to Entity Extraction menu, then click + Create Entity.

Then you can do the following:

  1. Enter a name for the entity.
  2. Note that Define synonyms is already checked.
  3. Click the first row and provide a reference value in the left column.
  4. Click the next column or press Enter and provide synonyms.
  5. Continue adding rows for other entity entries.

Limitation

Custom entity type names are unique for each project bot. Entity type names should start with a letter and can contain the following: A-Z, a-z, 0-9, _ (underscore), - (dash). Entity reference and synonym values have no such limitation.

Annotate Training Phrases

When an intent is matched at runtime, Dialogflow provides the extracted values from the end-user expression as parameters. Each parameter has a type, called the entity type, which dictates exactly how the data is extracted. Unlike raw end-user input, parameters are structured data that can easily be used to perform some logic or generate responses.

Go to Robolabs, then click Intent menu and select one of the intents.

Scroll down to the Training phrases section. You can click New Phrase or edit your trained phrases.

When building a bot, you control how data is extracted by annotating parts of your training phrases and configuring the associated parameters.

For example, consider a training phrase like "What is the forecast tomorrow for Tokyo?" You should annotate "tomorrow" with a date parameter and "Tokyo" with a location parameter. When you annotate parts of a training phrase, Dialogflow recognizes that these parts are just examples of actual values that will be provided by end-users at runtime. For an end-user expression like "What is the forecast on Friday for Sydney?", Dialogflow would extract the date parameter from "Friday" and the location parameter from "Sydney".

Here for the example:

Don't forget to double click a word to annotate it then select according to the entity.

When building a bot with the console, most annotations are automatically created for you when you add training phrases that contain parts that can be matched to an existing entity type. These parts are highlighted in the console. You can edit these annotations and parameters as needed.

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
  Last updated