Fuzzy matching

By default, entity matching requires an exact match for one of the entity entries. This works well for single-word entity entry values and synonyms but may present a problem for multi-word values and synonyms. For example, consider a ball entity that should be matched for the following end-user expression parts:

  • "ball"
  • "red ball"
  • "ball red"
  • "small ball"
  • "ball small"
  • "small red ball"
  • "small ball red"
  • "red small ball"
  • "red ball small"
  • "ball small red"
  • "ball red small"

For a match to occur, you normally need to define an entity entry value and synonyms for each of these permutations. However, with fuzzy matching enabled, the ordering of the words in a value or synonym does not matter. The following will trigger a match for all of the examples above:

  • "ball"
  • "red ball"
  • "small ball"
  • "small red ball"

Where to find this data

When building an agent, it is most common to use the Dialogflow ES console (visit documentation, open console). The instructions below focus on using the console. To access entity data:

  1. Go to the Dialogflow ES console.
  2. Select an agent.
  3. Select Entities in the left sidebar menu.

If you are building an agent using the API instead of the console, see the EntityTypes reference. The API field names are similar to the console field names. The instructions below highlight any important differences between the console and the API.

Create a fuzzy matching entity

To create a fuzzy matching entity:

  1. Open an existing entity or create a new one.
  2. Check Fuzzy matching.
  3. Enter one or more entries in the table.
  4. Click Save.

If you are using the API to create or update entities, set the enable_fuzzy_extraction field to true for the EntityType.

Limitations

The following limitations apply:

  • Fuzzy matching cannot be enabled for regexp entities. These features are mutually exclusive.
  • Fuzzy matching should not be enabled for entities which are used to match strict values like IDs, national identification numbers, and so on.

Partial matches

When you define synonyms that contain multiple words, Dialogflow will attempt to match end-user input to the closest matching synonym, which may include partial matches. For example, if you define a synonym as "cold brew coffee", and the end-user input is "cold coffee", the associated entity will be matched unless there is a better match.

Spell correction

When end-user input could be considered a misspelling of an entity synonym, the associated entity may be matched. For example, if you define a synonym as "lumber", and the end-user input is "number", the associated entity may be matched.