Is there a way to add entities dynamically using python

Hi All, I have two questions

Question 1: Is there a way to add entities dynamically using python or any other language ? (Painful for manually creating entities for huge data)

Question 2: Rasa model utters correct responses only when user give’s exact question from training data and utters different responses if there is any little manipulation in same question? So how can I improve nlu confidence to recognize same intent( however the user ask’s question, Bot should provide exact response)

Thanks in advance!

To your second question: The best way to improve nlu predictions on unseen data is to improve (add to) your training data, preferably from real user input. The more examples there are to learn from, the better the model will generalise. How many examples do you have for the intents you wish to improve?

To your first question - when you say “add entities” do you mean annotating entities in existing NLU data? Could you give an example?

Thankyou @mloubser for quick response!

I have provided 6 to 8 alaternative’s for each intent .

Yes, I want to annotate entities in existing NLU data

For ex:


-  I want to  know about [rasa nlu](product)

Here is the original question that we’ve received from the FAQ.


- What is company name and address?

When we ask the bot with different question like,

What is your office address?

the bot is not responding the company address details. So we have decided to add alternative questions in the intent like below.


- What is company name and address?
- What is the company name ?
- Where your office is located?
- What is your office location?

So please suggest us, how I can add the alternative questions dynamically in the file or guide me, if I am doing wrong with Rasa nlu file.

@Yeshwanth_mandla Your model would definitely benefit from more examples then - if you can source them from test users or using interactive learning, even better.

Short answer on the entities - no, you need to annotate them manually if you want them to be reliable.

Slightly longer answer: you could write a script to find and annotate some specific word or sequence of words, but then

  1. you are assuming that that word/sequence of words should always be annotated as an entity, and will not vary (e.g. what about rasa_nlu or RASA Nlu?) and
  2. you’ll still have to manually define which sequences should be annotated.

In my experience this is not worth it.

It sounds like you’re still early in the training data collection phase, I would recommend annotating your entities manually as you go.

@muralidharand One way you can add alternative questions is using Interactive Learning. If you mean a way to do this automatically (without having a human write them) then no, that’s not possible with Rasa. It is best practice to generate training data from real conversations to prevent overfitting on training data that might not be representative of what real users say.

Thanks a lot.

Let me learn more about Interactive Learning and will implement.

Thanks for your valuable suggestion.:smiley:

@mloubser Thank you :blush:

Thought of one more thing: If you have entities whose scope is well defined (e.g. employee names, currencies), you can also use lookup tables to improve entity extraction. You still need to annotate all your entities manually, but this should help the extractor pick them up better