Match entities

Match entities are a type of entity that is detected when the user states a word that is part of a predefined list, or matches a certain pattern.

A match entity can be detected anywhere in the conversation, meaning it is context-independent.

Detect information anywhere

Entities can always be asked inside a Collect input block, but match entities can be detected anywhere in the conversation, which means they will skip the Collect input block in your flow. This would result in a conversation like this one:

Because you predefined the package number as a match entity, the bot was able to pick up on it in the user's expression, therefore skipping the Collect input block asking for it. The result is a much better user experience and a seemingly smarter bot 😉

Match text or patterns

Match entities have 2 options:

Note that match entities are context-independent, meaning that they can be detected at any place in the conversation. Therefore, they are very different from contextual entities which are context-dependent and can be detected only at certain places inside the conversation.

Add a match text entity

A match text entity will be detected when what the user says matches a value in a pre-defined list.

To add a Match text entity:

  1. From the Entities tab, click on the Add match entity button.

  2. Select Match text.

  3. Enter an Entity name.

  4. Enter different Entity values.

  5. If you want to, add Synonyms to these values by typing them in the field then clicking Enter on your keyboard.

Synonyms in match text entities

For each value of a matched text, you can add a synonym that will be detected as the original value. Synonyms allow you to add alternatives to entities that are assigned to the same value.

For example:

I want to go to Brussels

I want to go to Bruxelles

The meaning of the two expressions above is exactly the same, but you want to convert Bruxelles to Brussels so your bot can work with one and the same value.

Note that match entities are case insensitive, so there's no need to add capitalized synonyms.

  1. Click on Create entity.

When a user says "I want to know more about the Premium pack", the match entity @product will be recognized and saved with the value "Premium".

Add a match pattern entity

A match pattern entity will be detected when what the user says matches a certain regular pattern.

To add a match pattern entity:

  1. From the Entities tab, click on the Add match entity button.

  2. Select Match pattern.

  3. Add an Entity name.

  4. Add a regular expression under Pattern.

Regular expressions in match pattern entities

The pattern that you fill in match pattern entities should be written as a regular expression (RegEx) Python style. For more information check https://regex101.com/.

For example: you have defined @customer_ID as a match entity, and have provided the following regex pattern: [a-z]{5}[0-9]{2}. This means that when a users says "My customer ID is terwf33" – which consists of 5 letters and 2 numbers – it is saved as the match entity @customer_ID with the value "terwf33".

Last updated