# CRF and DIET parse same entity problem

**URL:** <https://forum.rasa.com/t/crf-and-diet-parse-same-entity-problem/44603>\
**Category:** Rasa Open Source\
**Created:** [June 14, 2021, 2:54pm UTC](https://forum.rasa.com/t/crf-and-diet-parse-same-entity-problem/44603 "2021-06-14T14:54:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrbil208](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@mrbil208](https://forum.rasa.com/u/mrbil208)\
**Post date:** [June 14, 2021, 2:54pm UTC](https://forum.rasa.com/t/crf-and-diet-parse-same-entity-problem/44603/1 "2021-06-14T14:54:26Z")

</div>

Hi all, I have a problem as below:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/6/6367f42be93ad4ce6865fdd4af506ad4229e7203.png)

My config file as default as below:

![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/c/c383045c6e70f99d955565dd7ce1c98979f81feb.png)

Following the documentation, DIET and CRF can work together.

Doc : [Components](https://rasa.com/docs/rasa/components/)

How can I resolve this problem?

Thanks

---

<div class="post-metadata">

**Author:** ![fkoerner](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/fkoerner/32/11784_2.png) [@fkoerner](https://forum.rasa.com/u/fkoerner)\
**Post date:** [June 21, 2021, 12:06pm UTC](https://forum.rasa.com/t/crf-and-diet-parse-same-entity-problem/44603/2 "2021-06-21T12:06:42Z")

</div>

Hi, you shouldn’t need both `DIETClassifier` with entity extraction enabled and `CRFEntityExtractor`. I’d recommend you remove `CRFEntityExtractor` from your pipeline.

---

<div class="post-metadata">

**Author:** ![mrbil208](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@mrbil208](https://forum.rasa.com/u/mrbil208)\
**Post date:** [July 14, 2021, 2:06am UTC](https://forum.rasa.com/t/crf-and-diet-parse-same-entity-problem/44603/3 "2021-07-14T02:06:37Z")

</div>

Hi @fkoernerI’m using ducklingExtractor and DIETClassifier to parse entities. But it’s parsing wrong somehow. It’s return as below:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/8/844783aef390cf8ea46bf1d87d729039dbb03405.png)

I got the wrong timedate(2021-04-14) in this case.

Pls let me know how can i get right date

---

<div class="post-metadata">

**Author:** ![fkoerner](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/fkoerner/32/11784_2.png) [@fkoerner](https://forum.rasa.com/u/fkoerner)\
**Post date:** [July 16, 2021, 12:33pm UTC](https://forum.rasa.com/t/crf-and-diet-parse-same-entity-problem/44603/4 "2021-07-16T12:33:16Z")

</div>

This looks like an edge case: usually the warning refers to overlapping entities extracted by different extractors, but it seems Duckling interprets the above message two ways. Are you using these values in a form? In this case, I’d suggest you write a [slot validation method](https://rasa.com/docs/rasa/forms/#validating-form-input) to select the correct value. Otherwise, you could write this selection code in a [custom slot mapping](https://rasa.com/docs/rasa/forms/#slot-mappings).

---

<div class="post-metadata">

**Author:** ![mrbil208](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@mrbil208](https://forum.rasa.com/u/mrbil208)\
**Post date:** [July 17, 2021, 8:11am UTC](https://forum.rasa.com/t/crf-and-diet-parse-same-entity-problem/44603/5 "2021-07-17T08:11:17Z")

</div>

Hi @fkoernerI did not use form in this case.

I knew that DucklingExtractor is working 2 times. I think because time and number of Duckling are parsing same format regex like dd/mm and \d+\/\d+.

But i wonder why the resuilt got wrong time at second time ? And why did rasa get resuilt at 2 times ??

---

<div class="post-metadata">

**Author:** ![fkoerner](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/fkoerner/32/11784_2.png) [@fkoerner](https://forum.rasa.com/u/fkoerner)\
**Post date:** [July 19, 2021, 12:26pm UTC](https://forum.rasa.com/t/crf-and-diet-parse-same-entity-problem/44603/6 "2021-07-19T12:26:57Z")

</div>

Because Duckling and Rasa don’t know which of the two are right. As you noted, Duckling simply extracts any time value it finds. You will need to write code to select the correct value if there are multiple results. I’m not sure where the 14 comes from, but this may be the interpretation of the “2m” part of the message. Since you’re not using a form, you could write a custom slot mapping action to pick the right one, based on your criteria. Or, you could have the user select the right one using buttons like so:

```auto
 - bot: did you mean 12/7 or 14/7?
   {button: 12/7} {button: 14/7}

```
