Search code examples
artificial-intelligenceazure-language-understanding

LUIS: Adding patterns to intents is not taking any effect


I followed what is described in the tutorial

  • I first added an Pattern.any entityenter image description here
  • Next, I added a pattern for the required intent enter image description here
  • I had already created an intent like shown and now I click on train enter image description here
  • When I test, the intent is not hit enter image description here

Any idea what's missing?


Solution

  • The patterns are extremely literal. If the part of the phrase does not match exactly, the intent won't get recognized. (Note: you can add these phrases to the intent directly, instead of in the pattern, in which case it will recognize the intent but not the entities. Can be helpful if you have a dialog to prompt users for the missing entities.)

    In your case, the way you have the pattern written you would need to write command create $mytest, which should recognize the intent as well as the entity mytest. Since you did not include the $ character in your test, neither the intent nor the entity was recognized.

    You do have the ability to mark a character as optional via brackets [], though I've had mixed success with this. Your phrases are specific enough that it may work in your case. So instead you could make your patterns like command create [$]command_params where both command create $mytest and command create mytest would work and have the correct entity. Do note that if someone types something like command create $mytest please, it's going to pick up the entire phrase mytest please as your entity. (If anyone knows how to create a pattern that avoids this, that would be fantastic!).