Defining entities; Single entity for all modes or individual entities for each mode

Our Travel-bot provides Users the ability to get Flight & Hotel options. We have 2 options in defining how we handle the type of travel the User is requesting.

Option 1: Map request for both Flights & Hotels to a single entity. Example nlu.md below where Flights & Hotels are both mapped to "travel_mode

[Flights] (travel_mode) [from DEL]{“entity”: “city”, “role”: “orgn”} [to MUM]{“entity”: “city”, “role”: “destn”}

Hotels] (travel_mode) in [Bangalore]{“entity”: “city”, “role”: “hotel_city”}

[Flight options] (travel_mode) [to DEL]{“entity”: “city”, “role”: “orgn”} [from BLR]{“entity”: “city”, “role”: “destn”}. Hotels in [DEL]{“entity”: “city”, “role”: “hotel_city”}

Option 2: Map request Flights and Hotels to different entities. Example nlu.md below where Flights are mapped to flight_options & Hotels are mapped to hotel_options

[Flights] (flight_options) [from DEL]{“entity”: “city”, “role”: “orgn”} [to MUM]{“entity”: “city”, “role”: “destn”}

[Hotels] (hotel_options) in [Bangalore]{“entity”: “city”, “role”: “hotel_city”}

[Flight options] (flight_options) [to DEL]{“entity”: “city”, “role”: “orgn”} [from BLR]{“entity”: “city”, “role”: “destn”}. Hotels in [DEL]{“entity”: “city”, “role”: “hotel_city”}

With Option #1; I need to distinguishing travel types has to be handled in Application logic. In Option #2; the classification is done by the model itself.

With the above logic; I have choosen to go with Option #2. Is this a valid approach? Please provide feedback. Thank you

Hi! I think option 2 is the better approach. I would just change how you annotate the cities. I think it is easier for our entity extractor to extract cities if you leave out the to and from. For example:

[Flights](flight_options) from [DEL]{“entity”: “city”, “role”: “orgn”} to [MUM]{“entity”: “city”, “role”: “destn”}

[Hotels](hotel_options) in [Bangalore]{“entity”: “city”, “role”: “hotel_city”}

[Flight options](flight_options) to [DEL]{“entity”: “city”, “role”: “orgn”} from [BLR]{“entity”: “city”, “role”: “destn”}. [Hotels](hotel_options) in [DEL]{“entity”: “city”, “role”: “hotel_city”}

Tanja;

Thx for your feedback on Option #2.

Regarding leaving out from & to in [from DEL], [to BLR].
I was under the impression that from & to provide context that made entity extraction easier. Thx for the clarification. Can you recommend NLU articles that will provide me deeper understanding of these details?

from and to does not really belong to the entity itself. It belongs to the context. Whether the context is relevant, e.g. which surrounding words the machine learning model should focus on, is decided by the machine learning model itself. So it does not help to include that inside the entity. I think it would even confuse the model a bit.

I think you can find quite some useful input on our youtube channel. Especially the NLP for developers and the algorithm whiteboard might be interesting for you.

Thx Tanja. Will look into NLP for developers on YouTube. Appreciate the help.