garypretty / botframework

Microsoft Bot Framework helpers and additional dialogs
MIT License
60 stars 51 forks source link

Can LUIS intents be forwarded to the None handler if they have a low score? #13

Closed rickengle closed 6 years ago

rickengle commented 7 years ago

Hi Gary, this is way off topic but in case you know as you have deep knowledge in this area; I am using your combined LUIS+QnA handler technique within the None intent to handle phrases not picked up by the LUIS intent handlers. But every now and then my intent handlers will pick up a user's phrase that shouldn't have gone there and likely has a very low score for an entity. Do you by chance know of a way within an intent to check the score and if the score for an entity found in an intent is below a threshold, let's say < .75, that it could be rerouted to the None handler instead?

Thanks, Rick

garypretty commented 7 years ago

Hey, no problem! I think in this instance you should just be able to check the LuisResult object, specifically the TopScoringIntent.Score property to see if it falls below whatever threshold you would like to use. Then, if it does fall below your threshold then you should just be able to call await None(content, result) to pass over to the None intent handler. Make sense? Let me know if that doesn’t work.

Gary

rickengle commented 7 years ago

Yes that makes perfect sense! What is the syntax for calling the None intent handler from within another handler and shouldn't something be done with that code to make sure it doesn't continue executing through the original intent code? My None handler already finds legitimate matches using QnA or outputs a message that it wasn't understood so at that point it makes sense to immediately return to the user for more input. Thanks!

garypretty commented 7 years ago

I think in your intent code you would need a conditional statement along the lines of……

If(score < XX) { await None(context, result); } else { // handle the intent normally }