botbuilder-js
botbuilder-js copied to clipboard
port: [#6434] Priority broken for RegexRecognizer (#6435)
The changes in [#6434] Priority broken for RegexRecognizer (#6435) may need to be ported to maintain parity with microsoft/botbuilder-dotnet.
Fixes #6434Description
This PR updates the AdaptiveDialog's OnRecognizeAsync method to take into consideration the priority set for the intents when there is more than one result with the same score.
Specific Changes
- Updated the
OnRecognizeAsyncmethod to choose the topIntent considering both score and priority.- Removed the break from the
RecognizeAsyncmethod to return all the intents that match the pattern.- Added a unit test to cover the priority scenario in
RegexRecognizerTests.- Added test script
RegexRecognizerTests_Priority.test.dialogTesting
These images show the bot not recognizing the correct intent before and the bot returning the right intent according to its priority after the changes.
Please review and, if necessary, port the changes.
