# How to deal with negative entities using DIET architecture

**URL:** <https://forum.rasa.com/t/how-to-deal-with-negative-entities-using-diet-architecture/49083>\
**Category:** Rasa Open Source\
**Created:** [November 8, 2021, 12:50pm UTC](https://forum.rasa.com/t/how-to-deal-with-negative-entities-using-diet-architecture/49083 "2021-11-08T12:50:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![datonefaridze](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/datonefaridze/32/17918_2.png) [@datonefaridze](https://forum.rasa.com/u/datonefaridze)\
**Post date:** [November 8, 2021, 12:50pm UTC](https://forum.rasa.com/t/how-to-deal-with-negative-entities-using-diet-architecture/49083/1 "2021-11-08T12:50:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Vin](https://avatars.discourse-cdn.com/v4/letter/v/a87d85/32.png) [@Vin](https://forum.rasa.com/u/Vin)\
**Post date:** [November 10, 2021, 11:15pm UTC](https://forum.rasa.com/t/how-to-deal-with-negative-entities-using-diet-architecture/49083/2 "2021-11-10T23:15:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![datonefaridze](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/datonefaridze/32/17918_2.png) [@datonefaridze](https://forum.rasa.com/u/datonefaridze)\
**Post date:** [November 11, 2021, 7:05am UTC](https://forum.rasa.com/t/how-to-deal-with-negative-entities-using-diet-architecture/49083/3 "2021-11-11T07:05:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Vin](https://avatars.discourse-cdn.com/v4/letter/v/a87d85/32.png) [@Vin](https://forum.rasa.com/u/Vin)\
**Post date:** [November 11, 2021, 11:17pm UTC](https://forum.rasa.com/t/how-to-deal-with-negative-entities-using-diet-architecture/49083/4 "2021-11-11T23:17:25Z")

</div>

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
