Using single entity for two different intent's - Rasa Open Source - Rasa Community Forum

👋 Introducing the Rasa Playground

Using single entity for two different intent’s

post by NikhilBansal21 on Aug 6, 2018

Hi, I have a user ticket id which is being used by two totally different intents. One intent is being trained a lot of times by now but I have to use the same entity for another intent. I have added like 40-50 phrases for that too but my bot is getting the previous (older trained intent) intent on writing a phrase for a new intent!.

post by momo on Aug 6, 2018

Hey @NikhilBansal21, I don’t have a concrete solution for your problem, but have you tried running your bot in debug mode? It offers a lot of information about what’s going on “below the hood”. http://www.rasa.com/docs/core/debugging/

Hope this helps!

post by NikhilBansal21 on Aug 6, 2018

Hi @momo, I know using debugging I can be more clear, but I have debugged the response intent is wrongly picked in this case. I have trained my bot for both intents but still, intent is not getting picked right for my new intent!

post by momo on Aug 6, 2018

I’m afraid, I haven’t run into a similar problem yet. Maybe you could share some further information for people to better understand your issue?

post by ikhatri on Aug 6, 2018

I have a similar question so I’m just going to post here. Sorry in advance if I end up hijacking this thread but hopefully this may shed some light on @NikhilBansal21 question.

My issue is as follows: I need to use an entity in multiple places (i.e., the NER should work no matter the intent). I know that this happens automatically using the ner_crf component however as far as I am aware the only way to “train” the ner_crf component is to add training phrases to the training data, which requires intents. The result of this is that unless I add the entity that I want to train to every intent I’m going to mess up my intent classification.

post by akelad on Aug 7, 2018

Can you both provide some examples of these different intents you want to distinguish between but have the same entities extracted from please?

post by NikhilBansal21 on Aug 7, 2018

no need for me i solved this issue today!

post by ikhatri on Aug 7, 2018

I guess a simple example could be something like this:
“Set an alarm for 7:30PM”
“Delete my 7:30PM alarm”

Both of those contain a time entity but should be different intents. This will work because ner_duckling is a pipeline component and the entities extracted independent of the training phrases for intents.

post by akelad on Aug 9, 2018

Hmm ok so with the example you’ve given, there’s an easy solution. You can keep your different intents (e.g. set and delete), and just name your slots differently to the entity if you don’t want them to be automatically set. Then you can set the slots with the entity values in a custom action. Though in the particular example you provided I don’t think you would even need to do that, you can use a custom action to either delete or set an alarm clock depending on what the intent was.

post by ikhatri on Aug 9, 2018

Absolutely! Thanks for your insight. We are using the various slot names trick already for some of our use cases though I couldn’t figure out how to do that for a custom entity trained with the ner_crf component.

Which kind of is a side question in itself, is it possible to tell a named slot to use a specific entity outside of the FormAction's required_fields function? I’d like to make the association without using a FormAction or making the field required, but I can’t figure out how to do that.

post by akelad on Aug 24, 2018

Glad we could help! About assigning an entity name to a slot – this is something you can only do in a custom action. So get the entity value and then return a Slotset event, similar to what is shown here http://rasa.com/docs/core/customactions/#customactions

post by jerry3739 on Jul 11, 2019

Hey, @NikhilBansal21 please share your solution for this. I got stuck in the same problem.

post by Rashmi_Vish on May 13, 2020

how??

post by Rashmi_Vish on May 13, 2020

how?