How to deal with negative entities using DIET architecture

Hello, I am using DIET architecture to extract entities from sentences. My question is: how can I tell if the entity is used in a negative context or not? for example, I want ice cream, I don’t want ice cream. ice-cream is an entity (food) but used in different contexts. How can i tell the DIET architecture that ice cream is in a negative context? i thought about adding two tags: negative_ice_cream, positive_ice_cream, but then the number of entities grows too much.

1 Like

I think the you could have 2 separate intents, positive_food and negative_food, with an entity food (whose value could be anything, in your case - “ice cream”).

In your training data give various examples for both intents (negative and positive) with various values for the entity food, so that it recognizes the intent whether positive or negative and also is generic for any food item.

yes it is good solution on small sentences but when sentences are complex such as: i don’t want ice-cream, i want candy. in this case i should add intent like: not_ice_cream_candy, and this will force me to create too many intents, because such sentences are vast

Not sure if this is a correct way to go but a possible solution could be to have another mixed_food intent which is trained on such complex sentences with the food slot of type list which will contain all the food items.

And for this intent you could trigger a custom action, where you parse the sentence to find with which food item the negation word is associated. Then based on that correctly identify the food wanted and the ones not wanted into more slots to be used appropriately.

P.S. not exactly making best use of DIET classifier