Search code examples
botframeworkazure-language-understanding

How to get normalized value for List type Entity from Microsoft.Bot.Builder.RecognizerResult?


We're trying to leverage LUIS to get normalized value for a given synonyms from the user input.

In BF V3, we have the EntityRecommendation, and it has the Resolution property we can use for this purpose, like below.

But how do we archive the same goal in V4? the Microsoft.Bot.Builder.RecognizerResult does not contain the Resolution property while when we directly query LUIS Rest API, the response has it.

            EntityRecommendation serviceNameEntityRecommendation;

            if (luisResult.TryFindEntity("ServiceNames", out serviceNameEntityRecommendation))
            {
                if (serviceNameEntityRecommendation != null)
                {
                    var resolutions = serviceNameEntityRecommendation.GetResolutions();

Solution

  • You'll need to know what entity type is being returned. For example, I created a LUIS App with nothing by the "number" pre-built entity.

    I then used the NLP with LUIS Sample

    If I type "one thousand", I can retrieve the normalized, "1000" in recognizerResult.Entities["number"][0].

    Here's everything that RecognizerResult returns:

    enter image description here