How to use synonyms without annotating entities in nlu

Hi all,

I already found some answers to my question but the workflow seems just too complex for something really simple. I was wondering if there is a way to use synonyms without using entities. Let’s say we have an intent: “order_pizza”:

- intent: order_pizza
  examples: |
    - I would like a pizza
    - I am hungry for a pizza

I would like to improve detection for this intent by giving some synonyms for pizza

- synonym: pizza
  examples: |
    - round doughy thing
    - italian pancake
    - heavenly food

This won’t work because the synonyms are only used after an entity is extracted. So in this case we could solve it by annotating pizza, round doughy thing and heavenly food as the entity food in the training data like so:

- intent: order_pizza
  examples: |
    - I would like a [pizza](food)
    - I am hungry for a [pizza](food)
    - I am hungry for a [round doughy thing](food)
    - I am hungry for [heavenly food](food)

But now I’m just adding the synonyms to the examples for the intent which seems like double work… Because if I’m not using entities I might as well just add the extra examples and not annotate the entities and synonyms. I’m looking for a way to not have to use entities when using synonyms while not having to add extra examples to the intent. I’ve read a bit about the regex featurizer but the documentation is not very clear to me. Also lookup tables only seem to work in combination with entities.

Maybe you don’t have enough examples. Try to add more.

Thanks for your reply but I’m sure this is not the case. In this example I only use a few examples to keep things clear while in the full model I use a lot of examples. I also feel like you didn’t get the question. The question is not about the examples i give. It’s about how to use synonyms without defining entities. Do you know how?

You have always to have a defined entity and use some synonyms in the examples, in order to generalise.

This is not true, when using lookup table you don’t need to use synonyms in the example data.

No?

In the docs

When using lookup tables with RegexFeaturizer, provide enough examples for the intent or entity you want to match so that the model can learn to use the generated regular expression as a feature. When using lookup tables with RegexEntityExtractor, provide at least two annotated examples of the entity so that the NLU model can register it as an entity at training time

try this:

- intent: order_pizza
  examples: |
    - I would like a [pizza](food)
    - I am hungry for a [pizza](food)

- lookup: food
  examples: |
    - round doughy thing
    - italian pancake
    - heavenly food

- synonym: pizza
  examples: |
    - round doughy thing
    - italian pancake
    - heavenly food

then ask: i would like a italian pancake

It will pick up italian pancake as entity “food” value “pizza”.

You are mixing values and entities I think.

Maybe I’m missing something but if you don’t need to extract entities, your example utterances should look like this:

- intent: order_pizza
  examples: |
    - I would like a pizza
    - I am hungry for a pizza
    - I am hungry for a round doughy thing
    - I am hungry for heavenly food

yes this would be a solution too but i’m looking for one where we don’t have to type a sentence for every instance of pizza. So where

- intent: order_pizza
  examples: |
    - I would like a pizza

- synonym: pizza
  examples: |
   - dough ball

would work for: “I would like a dough ball”