0
votes

Can anyone make a suggestion about how to handle disambiguation when using Luis.ai and the Bot Framework?

I would like to ask the bot a simple question such as how many bets were placed on team X in 2015. The bot with the help of Luis.ai training should identify the team and the date/time from the question. If it has successfully done this then the bot queries the BigQuery API where we have all the records stored and returns the appropriate info such as vol of bets for team X.

Should the bot have problems understanding what I mean I would like the bot to prompt me to say "Sorry I didn't understand you" etc etc and then the user re-writes the query to a more appropriate format until such time as it get the query in the right format.

1
The Luis dialog should return with no recognized Intent. If you are using a class which inherits from Luis dialog, then you should be able to add a method which is decorated with [LuisIntent("")}, e.g. [LuisIntent("")] public async Task None(IDialogContext context, LuisResult result){...Andy Thomas
Thanks Andy. A typical question someone could ask the bot is "how much was placed on United in 2014". United in this scenario could mean Manchester United or Newcastle United, I take it the above approach is still valid?TheGoat
You could set up a Luis intent called, say, "Get bets on team" and have an entity called "Team'. You could then set up a Luis phrase list for Teams, which could include say, "Hammers" and "West Ham" and "West Ham United". That could train Luis to recognize a number of options for a team. It cannot determine that "Hammers" corresponds to "West Ham United", but rather would return an Luis item with an entity which had the value "Hammers". You would need to interpret that in your system, I think.Andy Thomas

1 Answers

0
votes

I'm not quite sure I understand your question exactly, but perhaps this will help...

Let's assume your LUIS model has an intent called Bet Count and it expects at least the following two entities to be found in a query: Team and Date. As long as the syntactic structure of the user's query is matched to that of Bet Count LUIS will return appropriate results. However, that's not to say the entities captured will be worthwhile. Consider the following user query:

How many bets were placed on Bananas in 2015?

In this case, LUIS has no problem identifying the intent of the query to be Bet Count and it will return 2015 as the date and Bananas as the team. It's up to your application to determine whether or not Bananas is a legitimate team name.

Finally, I have never used any of the bot framework SDK but in reading the documentation it appears that you might be able to make use of FormFlow.

Edit.......................................................................................................................

For the latter part of your question:

Should the bot have problems understanding what I mean I would like the bot to prompt me to say "Sorry I didn't understand you" etc etc and then the user re-writes the query to a more appropriate format until such time as it get the query in the right format.

LUIS models by default include a None intent that is used when a query cannot be mapped to a specific intent (you should be seeding it with queries as you train your model). It's important to note that in such cases the intents key in the JSON response (obtained by calling the LuisClient instance's raw_query method) will point to an empty list; it does not contain a dictionary for the None intent as you may expect.

By checking if this list is empty or not, you can easily determine if the query was understood by LUIS.