Using single entity for two different intent's

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

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 :slight_smile:

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 intent’s but still intent is not getting picked right for my new intent !

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?

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 (ie. 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.

What I’d like is for my named entity recognition to be completely independent of any intent classification that occurs (similar to how ner_spacy or ner_duckling work). I have attempted to train my own spaCy model for named entity recognition but unfortunately I lack the quantity of data for it to work. Are there any other alternatives? Can I use ner_crf in this way? I’m getting decent results using ner_crf in the one intent so I know it’ll work with my data. @momo any thoughts?

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

no need for me i solved this issue today :slight_smile:

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.

My use case is somewhat similar, though not exactly the same and while it might be possible just use one intent (I can think of a way to make it work) I would really like to make my own NER as a custom pipeline component so that it can be updated independently and possibly used by multiple Rasa powered chatbots in the future.

I guess what my question boils down to is, can I use a independently trained Rasa NLU model as a component in another Rasa NLU model’s pipeline?

Or

Could I use a pre-trained CRF model (that I have created from another Rasa NLU stack) as a pipeline component in my current Rasa NLU model.

Hopefully that wasn’t too confusing of a question! And thank you in advance for all your help!

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 dependent on what the intent was.

You can create a custom component for NLU no problem though if you don’t think this is going to work for you

1 Like

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. It appears that slots set outside of the required fields can only get entities that share the name of the slot… (though I’m sure I’m missing something here).

Either way though, I had wanted to keep the data for the entity recognizer separate from that of the rest of the chatbot, and re usability was key. I ended up creating a custom component that works just like ner_duckling_http in that it talks to a server that’s running the rasa_nlu separately.

This set up allows us to use the same entity recognizer model for multiple projects while only having to train it once. Also any changes we make to the pipeline her will be replicated across all of our projects. Hopefully once we have enough data we might upgrade from ner_crf to a custom spaCy NER.

Thank you again for all your help and responsiveness. You guys are seriously the best! :slight_smile:

1 Like

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

2 Likes

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

how??

how