I have an entity that is a LoV; if the entity receives an utterance that causes it to be ambiguous, I want it to either choose the first ambiguous option OR use the default value (as though the entity didn’t find an option at all). Is there a way to do this?
Stacy,
I think your only option is to capture the utterance in an entity node (not List of Items) and then use a script node to search for a match in your list of values. Here’s what I tested that didn’t seem to work:
Setting the entity input to ‘optional’ still returned the ambiguous message and didn’t set the default value
Changing the ‘Ambiguous Intents’ event handler changes the behavior for intents but doesn’t apply to node values.
I would try creating the list of values as an array and looping through each value to test against the utterance value. If no exact match is found, you could provide a default value.
Here is a simple script example that will return a value from a list (an array):
var pickList = [{“title”: “12345”, “value” : “apple”},{“title”: “23456”, “value” : “orange”},{“title”: “34567”, “value” : “grape”},{“title”: “12345”, “value” : “banana”}]
var testValue = “12345”;
for (var i = 0; i< pickList.length; i++){
if (testValue === pickList[i].title){
context.selectedValue = pickList[i].value;
i = pickList.length; //remove this line to select the last matching value in the list
};
}
koreDebugger.log(context.selectedValue);