Need suggestion for Lookup Table and Synonym

I have many city name. how can i used all of that without adding each city name to sample data?

example, i have list of city below:

  • New York
  • Jakarta
  • Bali
  • New York City

how to create it more simple like:

  • where is {city} located?
  • do you know {city}?

so i dont need to create many sample text to include each city

Hey @hanifabd, you can use Lookup Tables like this:

nlu:
- intent: inform
  examples: |   # you don't have to include all the cities here
     - where is [New York](city) located?
     - do you know [Bali](city)?
     - ...

- lookup: city
  examples: |
     - New York
     - Jakarta
     - Bali
     - New York City
     - ...

I see, thank you very much. can we implement regex in lookup?. so it can be more flexible

When you supply a lookup table in your training data, the contents of that table are combined into one large regular expression. This regex is used to check each training example to see if it contains matches for entries in the lookup table.

Lookup table regexes are processed identically to the regular expressions directly specified in the training data and can be used either with the RegexFeaturizer or with the RegexEntityExtractor. The name of the lookup table is subject to the same constraints as the name of a regex feature.

1 Like