How to define entity synonyms

Hello, Can someone help me in How to define entity_synonyms in markdown format. I am able to define synonyms in file and train them. But when I try to test it by giving examples. It is not extracting them as entities. Here is my file. (1.3 KB)

Do you have examples of sentences with entity in your training data ?

For example :

  "text": "show me chinese restaurants",
  "intent": "restaurant_search",
  "entities": [
      "start": 8,
      "end": 15,
      "value": "chinese",
      "entity": "cuisine"

You can use : RASA NLU Trainer to define do it easily

Hello @huberrom. Thanks for responding. I want to know how to define entity synonyms and how to train them. please find my examples or sentences in file in the issue I created.

Thank (1.4 KB)

I don’t know how to use the .md format since i’m using the json format for my bot, but your file looks ok to me. Do you have the components ner_synonyms (Component Configuration) and ner_crf (Component Configuration) in your pipeline ?

Yes. I am using tensorflow_embedding pipeline. Here is my configuration file. Can I see your examples with entities and synonyms which are in json format.

nlu_config.yml (43 Bytes)

testData (1).json (3.9 KB)

I can’t give you my examples, but it looks like this for an example with restaurant

Thank you @huberrom. I will have a look at it and let you know if they works.

Hello, Can you help me in command to train the model, if the data is in .json format. I have been using this command python -m rasa_nlu.train -c nlu_config.yml --data -o models --fixed_model_name nlu --project current --verbose if the data is in markdown file. but this command is not correct for json file format. can you tell me command to train the data.

It should be the same but nlu.json instead of (if your file is name nlu of course)


I am facing this error sir. I attached screenshot of it.

I think it’s because of the ‘,’ after “bharath”, try without it. My bad

Hey @huberrom. I trained the model and tried to run the model with some examples. But it is not extracting the entities which are named with synonyms. It only extracts entities when I give direct entity name in the sentence. Will this work for you everytime? Is my configuration file fine?

I didn’t try with this example, but it should work and your configuration file is fine. I don’t think I can help you more, someone else need to take a look at that.

Maybe you need more example with entity

No problem @huberrom. Thanks for your help till this point.

hi Manoj,

Were you able to solve this problem? I am facing the exact same issue. I am using nlu 0.13.2

Best, Shruti

Hello @Sandy. This problem can be solved by training the NLU(Natural Language Understanding) with the examples that has synonyms in it. Then only NLU will be able to recognize them as entities.

@Teluguntla123 I understand some time has passed since you made the comment. If we have to use all the synonyms in the training samples what exactly is the point in having the synonym section, is it just that any synonym one uses will be converted to the same name used in the synonym attribute?

Thanks in advance.


1 Like

Did you find a solution to that? I am trying exactly the same thing