# Entity detection problem

**URL:** <https://forum.rasa.com/t/entity-detection-problem/6155>\
**Category:** Rasa Open Source\
**Created:** [March 19, 2019, 11:20am UTC](https://forum.rasa.com/t/entity-detection-problem/6155 "2019-03-19T11:20:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nexemics](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nexemics/32/1927_2.png) [@Nexemics](https://forum.rasa.com/u/Nexemics)\
**Post date:** [March 19, 2019, 11:21am UTC](https://forum.rasa.com/t/entity-detection-problem/6155/1 "2019-03-19T11:21:00Z")

</div>

Hey guys I need a solution as soon as possible: During the slot filling part, I want to fill Melbourne to source\_airport slot, which extracts city entity from User message. However when the city entity is detected,it fills another slot called city for a different action. I want Melbourne to detect source\_airport and destination\_airport instead. I still didnt understand how to use same entity for different intents and different slots and this has been really frustrating for the past 2 weeks. Here are some screenshots:

1)Chat question:

 ![Capture2](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/b/bd7c054d48d53c7d3852956b6e4e2da8247695ee.jpeg)

2)Initial Entity detection:

 ![Capture](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/6/63c8d8f223b50aefaf112e65098eec08eeb10a3c.jpeg)

3)Slot filled as city.

 ![Capture3](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/5/5091b412569aa7235815162c28ddc8d17df6027d.jpeg)

4)I am forced to do this manually.

 ![Capture4](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/6/6d93354a85561acac940e943dd01bd49ef926861.jpeg)

5)Outcome needed:

 ![Capture5](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/f/f59de31d86f0f80f43f0940e85b71637ea778b49.jpeg)

---

<div class="post-metadata">

**Author:** ![mauricedoepke](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/mauricedoepke/32/1961_2.png) [@mauricedoepke](https://forum.rasa.com/u/mauricedoepke)\
**Post date:** [March 19, 2019, 2:13pm UTC](https://forum.rasa.com/t/entity-detection-problem/6155/2 "2019-03-19T14:13:08Z")

</div>

I don’t think rasa has a native solution for this. The easiest solution I can think of would be to write a custom action that copies the value of city to source\_airport.

Something like this(untested) should work:

```
from rasa_core_sdk import Action
from rasa_core_sdk.events import SlotSet

class SourceAirportAction(Action):
   def name(self):
      # type: () -> Text
      return "source_airport_action"

   def run(self, dispatcher, tracker, domain):
      city = tracker.get_slot('city')
      return [SlotSet("source_airport", city)]

```

Just add this action after the city slot is filled by the inform\_city intent and add an equivalent action for destination\_airport.

---

<div class="post-metadata">

**Author:** ![Nexemics](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nexemics/32/1927_2.png) [@Nexemics](https://forum.rasa.com/u/Nexemics)\
**Post date:** [March 19, 2019, 2:50pm UTC](https://forum.rasa.com/t/entity-detection-problem/6155/3 "2019-03-19T14:50:12Z")

</div>

I should’ve mentioned I have destination\_airport as well immediately after source\_airport. I have been following the same procedure you have mentioned with and all 3 of my slots and entities are named the same: source\_airport, destination\_airport, and city The problem is that the bot gets confused while detecting which entity the value belongs to, Hence I discarded the idea of having source\_airport and destination\_airport as entities and just stick to one entity called city that can feed data to 3 slots available,
