About multi word entity extraction and synonyms

Hello I am trying to build a bot that will do flight searches based on origin and destination. We will leave dates out of this for simplicity.

For the search API, I need to map user input to IATA codes (3 letter uppercase codes) ex: BUH - Bucharest, JFK - John F. Kennedy International Airport

Currently I have 2 questions:

  1. How can I efficiently map airport names and cities to these IATA codes? I have tried to use synonyms but they are working for me only for exact matches. For instance, “Kennedy Airport” will not be matched as “JFK” but “John F. Kennedy International Airport” will.
  2. Currently I have a form that asks user for origin and destination airport. For this purpose I created 2 entities (from_iata, to_iata). The problem is that NLU has hard time figuring out which is from_iata and which is to_iata because they both describe airports. What is a good solution to this?

Hi @eugeniumegherea, to your first question - if you’re having issues extracting all the different forms of the airport names, you could try using lookup tables to help with that. As long as all the versions of an airport are annotated with the same value and extracted successfully, the synonym mapper should be able to map them. Could you post the examples you are using for an airport?

To your second question - it sounds like you need two different slots, but to fill them with the same entity (“airport”). What do your slot mappings look like for this form?

Hello, thanks for your reply

I have actually moved on and tried another approach to these problems.

For the first problem, I am no longer attempting to train my NLU to map airports to IATA codes. Instead I figured I will use a pretrained model (like Spacy GPE or FAC Entity) to find these entities and using an internal API will find relevant IATA codes as a list of options.

The second problem is very closely related to RASA not filling in slots for entities detected by Spacy?. I am forced to use a workaround explained in the end of the post to achieve what I initially wanted: same entity in multiple slots. I will really appreciate if you can take a look and give feedback of the approaches discussed there


Ok great! I’ve run into this myself (can’t fill two slots from trigger sentence if both are mapped to the same entity) and I think the approach in the last answer is feasible. The other way (not as user friendly) is to accept that only the first slot (from airport) will be filled after trigger sentence and the user will have to input destination again during form.