So I am trying to understand user's utterance for selecting an array of entities, here are some example utterances:
My choices are 1, 2, 3, and 4
Let's go with Red Blue Yellow
How about January and February and March
I want A & B & C
So in the example utterances above, I should be able to get the following entities:
[1,2,3,4]
[Red,Blue,Yellow]
[January,February,March]
[A,B,C]
I don't have the choices before hand so I can't train them. But I want to be able to understand multiple choices that the user select. Is this possible within Luis?
I guess I could mimic NLU by just use delimiter and regex to break up the user's input. But that wont work if the user use different delimiter. Or if the user append a lot of chatter before hand.
You can solve that by creating an Entity of type Simple
called Choice
and adding utterances like that and labeling the choices with said entity, like this:
Luis, as an AI, is very good at recognizing patterns and those utterances have a very definite pattern which is:
Utterance: Prefix
+ Choice1
+ delimiter
+ Choice2
+ delimiter
+ ... + ChoiceN
Being
Prefix
: "My choices are", "Let's go with", "How about", etc.Choice
: any worddelimiter
: ",", "and", " ", etcThat is roughly the pattern that Luis detects, in this case will detect anything after the prefix
separated by a delimiter
as a choice
. So an utterance like
I want a soda, burger and fries
Will result in:
Even though we haven't specified Luis that soda
burger
and fries
are valid choices, he still detected them as such!
Here's the Luis model I created for this answer: https://github.com/navelDirt/luis-apps/blob/master/ChoiceDetect/ChoicesApp.json
You can import it in Luis by going to YourApp -> Manage -> Versions -> Import Version
Edit:
It should detect N
choices