Delicate Intent Classification

Lets say we have two intent order.snacks and order.drinks and we have these two phrases in the intents order.snacks and order.drinks respectively. 1) i want to order french fries 2) i want to order coke now the word coke is in the lookup table but it is never trained through the training phrases. Bot extracted coke as a drink which is fine but how can we assure that this phrase “i want to order coke” will go to the order.drinks intent which it should go. As two intents are only being differentiating by the values of entities that is coke and french fries. Right now i am using EmbeddingIntentClassifier. Any smart way? Thanks

Hello @noman,

I have met the same problem. I wonder if there is a way to train the model to consider the entity’s type when predicting intent.

Anyway, for a temporary solution, maybe you can merge 2 intents as one (such as order), then when you handle the intent “order” you check for the role (or type) of the latest message entity to see if it is “food” or “drink” and process correspondingly. Not an ideal solution, but it can work if you don’t have a lot of overlap intents (2 in your case).

1 Like

Thanks @fuih for the response but in my case i have alot of overlapping intents 1- order.breakfast 2- order.drinks 3- order.salads 4- order.sandwiches 5- order.snacks and may be more.

I see, in your situation, does the model predict the wrong intent (order.snacks for order.drinks) or it execute fallback ?

I haven’t trained the model yet but its obvious that if we have only one word that is differentiating intents, then even if we are lucky to pick “coke” from the lookup table but it is not in the training data in the order.drink intent, we cannot assure that “i want to order coke” will be classified as order.drink?

Yes, that is correct, in my case the model will execute fallback since it can not be sure about what the intent is. If your model behaves the same as mine, you can somehow handle the situation in fallback action (as i did). Of course, this is only workaround since we don’t really have a way (as far as i know) to train the model to recognize overlap intents well.

Since the entity is picked up correctly, in the fallback action i will check the entity type, and prepare specific suggest template message for the corresponding entity, such as:

User: I want to order coke
Bot picked up [coke] as [drink], but can not predict the intent -> fallback
Bot suggest the action that involve drink:
    It seems like you want to do something with coke ?
    Button: Order (intent order)
    Button: Deliver (intent deliver)
    Button: Others (unknown intent)

If you always know that when the user mentions drink then they want to order, you can just make it a yes or no question:

Are you trying to order coke ?
Button: Yes
Button: No

It’s not ideal, i know, but it’s functional. And it works pretty well for me since my users are normally don’t even bother to enter the whole sentence but just the entity itself, such as Coke, French fries,…

@fuih its a fine work around but it would be preferable if we avoid the bot’s fall back, and instead model should able to handle coke and classify it as order.drinks intent. May be @Tobias_Wochinger or @maddymantha can help here.

May be you people can help me here @amn41 @erohmensing. Thanks

you should just use one intent and use the entity to determine the difference between a drink and a snack

1 Like

@amn41 ok so you are suggesting that i should make an intent “take_order” and create required slots “item_name” and “quantity” etc and now when i will ask the bot for “i want to order coke” or “i want to order french fries” it will always predict intent “take_order” which looks fine. But we can have different required slots for drinks(coke) and for snacks(french fries) i.e for snacks we may have an additional slot named as “sauce” but we dont need it for the drinks. Ho shall we handle this scenario then?

@amn41 if you may reply please. Thanks and Regards :slight_smile:

hi @noman - you can override the required_slots method to implement this logic, see Forms

1 Like

Thanks @amn41 for your precious time. :slight_smile: