How to set priority in Microsoft Luis Patterns? - azure-language-understanding

I am using pattern recognition to catch entities with a variable size. Here are situation that i am trying to catch
1- {entity1} (has| had| have) [the] {entity2}
2.1- {entity1} (has| had| have) the {entity2}
2.2- {entity1} (has| had| have) {entity2}
i tried the 1 pattern or the 2.1 and 2.2 at the same time.
The problem is that when i enter: "Person have the properties"
the entity2 is marked as "the properties" instead of just "properties"
Is there a way to mark priority or work around this problem?
Sorry for english mistakes i hope that the question is clear enough.

There is no way you can set priority in LUIS patterns. However, given your situation above, where the entity is getting extracted incorrectly, you might want to make use of explicit lists. You can create an explicit list via the authoring API to allow the exceptions when:
Your pattern contains a Pattern.any
When that pattern syntax allows for the possibility of an incorrect entity extraction based on the utterance.
Also, make sure to refer to the best practices(https://learn.microsoft.com/en-us/azure/cognitive-services/luis/luis-concept-best-practices#do-and-dont) for LUIS apps to make sure your app behaves with improved accuracy.
Hope this helps.

Related

Handling typos / misspellings on list entities

What is the best practice approach to handle typos / misspelling on LUIS List Entities?
I have intents on LUIS which use a list entity (specifically Company Department - HR, Finance, etc). It is common for users to misspell this when putting forward their utterance. LUIS expects an exact match, it doesn't do a "smart" match, and therefore doesn't pick up the misspelled entity.
a) Using bing spell check is not necessarily a good solution. e.g. Certain departments are acronyms such as VRPA - and bing wont correct a typo there.
b) When I used LUIS a year ago, I would pre-process the utterance and use a Levenshtein distance algorithm to fix typos on list entities before feeding them to LUIS.
I would imagine that by now LUIS has some better out of the box way of handling this very common use case.
I'd appreciate input on what the best practice approach is to handle this.
#acambitsis and I exchanged messages via his UserVoice ticket, but I'm going to post the answer here for others.
A combination of Bing and Simple Entities might be what you're looking for, then (they're machine-learned).
I was able to accomplish something close and attached images.
In entities, I created a Simple entity with the role, VRPA. In intents, I created the Show Me intent and added sample utterances "Show me the VRPA" and "Show me the VPRA". I clicked on V**A and selected the Simple Entity:VRPA role. After training, I tried "show me the varp" and it correctly guessed "varp" was the "Simple:VRPA" entity.
You may also find RegEx entities useful. For acronyms, you could do something like: /[vrpa]/i and then any combination of VRPA/VPRA/VARP/ARVP would match.
I highly recommend reading through the Entity Types and Improve App Performance to see if anything jumps out to solve your particular issues.
This may not do exactly what you're looking for. If not, I'd recommend implementing a fuzzy-matching algo of your choice.
entities
intents

Correct way of using Phrase list and Pattern in Microsoft LUIS

I am a very new to LUIS. I am not able to use phrase list and pattern. Since I could not find any resource (Except Microsoft document), where I can get more details about it neither I could find any reference of demo.
It would be nice if any one can explain a bit in layman language in which scenario we can use both.
One more thing phrase list are not listing with entity while we are working on Utterance in intent creation
Since I could not find any resource (Except Microsoft document), where
I can get more details about it neither I could find any reference of
demo.
You can find more examples from this StackOverFlow answers about using Patterns feature and Phrase Lists other than Microsoft documentation.
It would be nice if any one can explain a bit in layman language in
which scenario we can use both.
In short Patterns are used for labeling entities which follow a specific pattern without providing more examples whereas Phrase Lists are used for providing synonyms of the utterances.
One more thing phrase list are not listing with entity while we are
working on Utterance in intent creation
Please read more about Phrase Lists about how to use it and how it works. If you still have issues send the snapshot with more details to Luisuservoice#microsoft.com.

How do you train LUIS to recognize general nouns?

I have a bot that was initially based on the Zummer example.
I would like the Search intent to pick up practically any topic you could search for as an entity.
I tried training using several example phrases but it became apparent that although the intent is correctly detected, the ArticleTopic entity only picks up the specific nouns provided as examples.
I also tried creating a regex entity using .* but this matches every complete utterance.
Is there a general approach to tell LUIS to capture some part of an utterance regardless of its contents?
Examples of what I would like to support:
Search for *, What is *, What are *, Tell me about *, etc.
You should use patterns and the entity which is specific to pattern which is Pattern.any. This entity return all the text which is where the entity has been marked.
It should give something like that :
Search for Entity
What is Entity
What are Entity
This issue could be covered with the new Patterns feature (using pattern.any).
This feature helps in labeling the noun following a specific pattern.
If you add the pattern.any entities to your LUIS app, you can't label utterances with these entities. They are only valid in patterns. Here is another example which explains how pattern.any feature resolves the issue of multi-word entity handling. I have reproduced your issue and it works. Hope this helps!!

How to handle misspelled LUIS entity

Lets suppose it is movie bot. I added entity MovieName, and phrase list containing movies. One of the movie name is "Star Wars", and if user misspell it to "Stra Wra" then how I can tackle this issue? Will Bing spell check service help for non English movie names, I'm not sure?
LUIS will not be able to capture misspelled entities by itself unless you provide examples with misspelled entities which is not practical.
So you need to feed the utterances corrected to LUIS.
For Bing spelling correction service you have to try it yourself, but I guess it will handle your case.
If you expect some common misspellings that you expect to be repeated, you could add them in an exchangeable phrase list feature. That will help with the prediction of these misspelled entities.
There are multiple ways to solve this:
Use synonyms with most common mistakes
Have another step in your pipeline (before going to LUIS), which matches user input to possible options and corrects them (even a self made solution would do great, but you can also try to add ElasticSearch with fuzzy queries)

Search and display all Exceptions in VisualStudio2010 solution in a grouped view/list

I am trying to find every exception used in within a big solution. I am doing this so I can replace generic Exceptions of Type "Exception" or "ArgumentException" with more specific ones.
What I tried at first was using the build in "Show Using"-Feature which, in case the Object is beeing used more than once" shows a nice tree-view of all the findings. It's great to navigate.
Only Problem ist that I don't know every Type that was used. If I use the normal search feature I get a simple List.
Using ReSharper I found that I can use the "Find" > "Search with PAttern" Feature. Only Problem here is that it is automatically case sensitive and "whole words" only.
Is there a build in feature like the "Usages"-Feature for a search?
PS: I also tried the "Find in File", that is just a list. I get every occurance of the word exception, which is helpfull but I lose the ability to navigate through a tree view.
You can use argument placeholders to search for anything that inherits from System.Exception
And I'm not sure what you mean about it being case-sensitive. I tried the below (notice that I'm in VB and I've failed to capitalize ThrowandNew`), but it still matched all the places I throw exceptions in my code.
I wasn't however able to search for just $type$, but this should catch any exceptions you throw in your code. You could try similar patterns to look for methods that handle exceptions. I'm using ReSharper 7.1.

Resources