How to handle shared entities (e.g. size)

125 views Asked by At

Trying to build a PoC that allows a user to ask something such as "I want a small pizza with a drink". Since drink didn't have a size, I would then prompt for the desired drink size.

Going with the restaurant example, should sizes (small, medium, large) be individual entities (e.g. @small, @medium, @large)? Does it matter that these entities would be used for both pizza size and drink size, or should we have a @pizza_small, @pizza_medium, @drink_small, @drink_medium, etc. entity? With this, I may need a @drink_no_size so I would know that I need to prompt for a size.

Thanks!

1

There are 1 answers

0
Michal Bida On

One solution to this problem could be that you would create the following entities: @size for general size, @pizza_size for pizza sizes, @drink_size for drink sizes. You could use this then to disambiguate which sizes were specified in the user input. If only general size was specified you'll get entity @size back, if explicit size for pizza or drink would get specified you would also get the particular entity. The "no size" would be specified by no size entity detected in the user input.

Here is the example entity definition in the csv format.

size,small,tiny,little
size,medium,normal,standard
size,large,big,biggest,gigantic

pizza_size,psmall,small pizza,tiny pizza,little pizza
pizza_size,pmedium,medium pizza,normal pizza,standard pizza
pizza_size,plarge,large pizza,big pizza,biggest pizza,gigantic pizza

drink_size,dsmall,small drink,tiny drink,little drink,short drink
drink_size,dmedium,medium drink,normal drink,standard drink
drink_size,dlarge,large drink,big drink,biggest drink,tall drink,gigantic drink