# Multiple values for the same entity in a single response

**URL:** <https://forum.rasa.com/t/multiple-values-for-the-same-entity-in-a-single-response/383>\
**Category:** Rasa Open Source\
**Created:** [August 11, 2018, 5:57am UTC](https://forum.rasa.com/t/multiple-values-for-the-same-entity-in-a-single-response/383 "2018-08-11T05:57:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![deepshet](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@deepshet](https://forum.rasa.com/u/deepshet)\
**Post date:** [August 11, 2018, 5:57am UTC](https://forum.rasa.com/t/multiple-values-for-the-same-entity-in-a-single-response/383/1 "2018-08-11T05:57:24Z")

</div>

Im wondering what is a good option to handle something like I need 2 rooms that can allow 6 people. Here 2 and 4 will be a “number” entities (extracted say by ner\_duckling\_http) but we need 2 slots populated for say number\_rooms and number\_people.

---

<div class="post-metadata">

**Author:** ![souvikg10](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/souvikg10/32/93_2.png) [@souvikg10](https://forum.rasa.com/u/souvikg10)\
**Post date:** [August 11, 2018, 7:37pm UTC](https://forum.rasa.com/t/multiple-values-for-the-same-entity-in-a-single-response/383/2 "2018-08-11T19:37:43Z")

</div>

You need ner\_crf for this. Duckling can only extract the number but cannot contextualize it.

It is similar to the probem of origin and destination. I want to fly to New york from LA. Both cities but in order to give it context, you need ner\_crf

Read into CRF to understand how to tackle such problem. You will need many variations to training data.

---

<div class="post-metadata">

**Author:** ![deepshet](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@deepshet](https://forum.rasa.com/u/deepshet)\
**Post date:** [August 12, 2018, 1:12am UTC](https://forum.rasa.com/t/multiple-values-for-the-same-entity-in-a-single-response/383/3 "2018-08-12T01:12:52Z")

</div>

Are you saying that ner\_crf can handle any number ?(It would not be feasible to give every possible number including text variations in training data) - it was my impression that duckling is needed for anything dealing with numbers/time etc.

---

<div class="post-metadata">

**Author:** ![souvikg10](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/souvikg10/32/93_2.png) [@souvikg10](https://forum.rasa.com/u/souvikg10)\
**Post date:** [August 12, 2018, 8:56am UTC](https://forum.rasa.com/t/multiple-values-for-the-same-entity-in-a-single-response/383/4 "2018-08-12T08:56:06Z")

</div>

Yeah duckling can handle numbers, but in your case you need more than numbers. Users says- I need 2 rooms that can allow 6 people Duckling will get you 2 and 6 as numbers which doesn’t help you contextualize it.

You should train the CRF to get “2 rooms” and “6 people”. And use that to process the context.

---

<div class="post-metadata">

**Author:** ![souvikg10](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/souvikg10/32/93_2.png) [@souvikg10](https://forum.rasa.com/u/souvikg10)\
**Post date:** [August 12, 2018, 8:58am UTC](https://forum.rasa.com/t/multiple-values-for-the-same-entity-in-a-single-response/383/5 "2018-08-12T08:58:04Z")

</div>

You are not handling numbers with CRF rather context

2 rooms 5 people

Basically to determine a pattern that essentially should follow a keyword (room,people,persons,guests) preceded by a number

---

<div class="post-metadata">

**Author:** ![deepshet](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@deepshet](https://forum.rasa.com/u/deepshet)\
**Post date:** [August 12, 2018, 5:38pm UTC](https://forum.rasa.com/t/multiple-values-for-the-same-entity-in-a-single-response/383/6 "2018-08-12T17:38:10Z")

</div>

So if I understand you correctly I should train the system to recognize the entities as normal and then use something else to say convert either the word two or the numeric 2 to 2 ?

---

<div class="post-metadata">

**Author:** ![souvikg10](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/souvikg10/32/93_2.png) [@souvikg10](https://forum.rasa.com/u/souvikg10)\
**Post date:** [August 12, 2018, 7:07pm UTC](https://forum.rasa.com/t/multiple-values-for-the-same-entity-in-a-single-response/383/7 "2018-08-12T19:07:07Z")

</div>

Use the CRF to find 2 persons or 3 rooms and then you can use regex to find the number. Look into CRF a bit to tackle this kind of problem, it is not easy and your dataset should really be well balanced

---

<div class="post-metadata">

**Author:** ![deepshet](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@deepshet](https://forum.rasa.com/u/deepshet)\
**Post date:** [August 13, 2018, 1:09am UTC](https://forum.rasa.com/t/multiple-values-for-the-same-entity-in-a-single-response/383/8 "2018-08-13T01:09:41Z")

</div>

Ok thank you for your suggestions

---

<div class="post-metadata">

**Author:** ![shota](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/shota/32/228_2.png) [@shota](https://forum.rasa.com/u/shota)\
**Post date:** [August 14, 2018, 4:02pm UTC](https://forum.rasa.com/t/multiple-values-for-the-same-entity-in-a-single-response/383/9 "2018-08-14T16:02:53Z")

</div>

Hi,

I have the same question but I think it’s a bit complicated: What if I need similar functionality, but not for English? Currently, we are using Tensor Flow pipeline as it’s language agnostic + translating Duckling, but as duckling just extracts everything it finds in the data, it won’t work in such situations. What approach should be taken in this situation?

---

<div class="post-metadata">

**Author:** ![souvikg10](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/souvikg10/32/93_2.png) [@souvikg10](https://forum.rasa.com/u/souvikg10)\
**Post date:** [August 14, 2018, 4:16pm UTC](https://forum.rasa.com/t/multiple-values-for-the-same-entity-in-a-single-response/383/10 "2018-08-14T16:16:00Z")

</div>

@shota can you explain the problem or an example of your scenario
