How to capture multiple number entites with context (... for 1 adult and 2 children ...)

Hello For my travel assistant I would like to extract as much information from initial input as I can. The user might say Search a flight for 3 adults and 2 children. How would you extract entity adults_count with value 3 and entity children_count with value 2?

One idea I had is to annotate like this Search a flight for [3 adults](adult_count) and [2 children](children_count) and then using custom action, extract integer with a regex. Would that be a good approach?

Thanks

1 Like

It looks like a solution, but you would have to take into account different variations of “adults” and “children”… Like “miniors”, “kids”, “son”, “sons”, “daughter”, “daughters”, “grown-ups”, etc… and have different examples in your NLU file for each one.

Filter might be quicker than a regex though:

children = tracker.get_slot('children_count')
children_value = int(''.join(filter(str.isdigit, children)))

I have a similar problem with extracting through context, that is still unsolved: