Difficulties in training the bot with similar text for differrent intents

Hello friends,

How to deal with the 2 intents having similar kind of text?
For example, I am having following Intents:
image \

Also, I do have both these intents in the stories.md as the initial point(entry point).
But, when I request for the text: “sales by period”, it correctly gives a response i.e classifies as intent “sales_function” but when querying with text: “compare sales over by period”, also RASA marks as the intent “sales_function”, which is wrong. It must identify as “compare_sales_over_period”.

How to overcome this?

Thanking you!

Regards, Krunal Jain

How to deal with the 2 intents having similar kind of text?

Don’t have 2 intents with similar text :sweat_smile:

Essentially the bot looks at the words to decide what goes where, and if the data is the same, it rightfully doesn’t have any idea how to decide what goes where. Have you tried using entities for the sales_function? it would look something like this:

##intent:compare_sales
- compare [sales by period](sales_function)
- want to compare [sales by period](sales_function)
- I want to compare [sales by geography](sales_function)
- Can I look at [sales by product](sales_function)?
...

Etc. You can even use synonyms to map things like sales over period to the entity value sales by period.

This makes more sense, as the general intent is the same, and how it handles it will depend on the entity. I.e. in your stories, the compare_sales intent would lead to a custom action, in which you can pull the latest sales_function entity in order to decide what to compare over.

Thanks for your suggestion, @erohmensing! Would definitely try it.

Coolio! Let me know if you run into any issues. :slight_smile:

Hey @erohmensing, Is there way to execute particular story (i.e. calling particular intent) in actions.py

Thanks,
Krunal

What do you mean, why would you want to make a user intent from within a story?

Hey @erohmensing,\

I am having confusion regarding what value my entity would hold if, I use synonyms?

Eg. What value entity “sales_function” might hold, If message is “sales over period” ??

Thanks,
Krunal

Hi! I would say that in that case, the whole message would be the entity, so:

intent:compare_sales
- [sales over period](sales_function: sales by period)

you also need to make sure to add synonyms to your nlu data:

synonym:sales by period
- sales over period
- sales per period

and make sure to add the EntitySynonymMapper to your pipeline.

So sales over period would map to (essentially be replaced by) sales by period.

Thanks for the help @erohmensing!!!

Sure thing! :smiley:

Hey Ella @erohmensing Can you please help me out on this?