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"

Create a fuzzy matching entity

Console

  1. Open the Dialogflow CX Console.
  2. Choose your GCP project.
  3. Select your agent.
  4. Select the Manage tab.
  5. Click Entity Types.
  6. Click Create.
  7. Check Fuzzy matching.
  8. Complete remaining fields.
  9. Click Save.

API

Set the EntityType.enableFuzzyExtraction field to true.

Select a protocol and version for the EntityType reference:

Protocol V3 V3beta1
REST EntityType resource EntityType resource
RPC EntityType interface EntityType interface
C++ EntityTypesClient Not available
C# EntityTypesClient Not available
Go EntityTypesClient Not available
Java EntityTypesClient EntityTypesClient
Node.js EntityTypesClient EntityTypesClient
PHP Not available Not available
Python EntityTypesClient EntityTypesClient
Ruby Not available Not available

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.