Alternative for having LUIS Intent

瘦欲@ 提交于 2019-12-25 02:58:00

问题


The requirement is to capture the keywords from the user input given in chat window and make a web api call to get a file link.

I have four different categories into which the user input query can be classified:

--Operating Group --Technology --Geography --Themes

I have configured a LUIS intent and listed these four categories as entitites. However, the issue now is that the entity list cannot be predefined since there can be any number of search keywords which can be passed to web api. I am now confused if there is any other way round for this requirement such as removing the stop words and passing the list of keywords Web API.

Code :

           [LuisIntent("Credentials")]
    public async Task Credentials(IDialogContext context, LuisResult result)
    {
        try
        {                
            if (result.Entities.Count() == 0)
            {
                if ((result.Query.ToString().ToLower() == "geo" || result.Query.ToString().ToLower() == "operating group" || result.Query.ToString().ToLower() == "technology" || result.Query.ToString().ToLower() == "Themes"))
                {

                }
                else
                {
                    await context.Forward(new QnABotFeedbackDialog(updateQna, result.Query, rotationTemStorage, qnaInvalidMessageCount), AfterCredentialDialog, context.Activity, CancellationToken.None);
                }
            }
            else if (result.Entities.Count() > 0)
            {                    
                string efilterType = string.Empty;
                if (result.Entities.Count() > 0)
                {
                    foreach (var i in result.Entities)
                    {
                        if (efilterType == string.Empty)
                        {
                            efilterType = i.Entity;
                        }
                        else
                        {
                            efilterType = efilterType + "," + i.Entity;
                        }
                    }
                }
                await CredentialsPersonalisation(context, efilterType);
            }

        }
        catch (Exception ex)
        {
            await context.PostAsync(ex.Message);
        }

    }

回答1:


However, we do not have a fixed set of keywords which we could pre-configure in Entity lists.

I think you misunderstood what an entity is. Simple entities are not pre-configured lists, it learns from your utterances and for the calls after. So it's basically what you want. So you have to create your three entities as simple, then add utterances and tag the entities in those utterances. Do not use always the same value for an entity.

For example, add the following utterances:

give me the file for fs in North America region on RPA

And tag fs as OperationGroup entity, North America as Geography entity, and RPA as Technology entity

Can I have the file for PRD in Europe about LUIS?

And tag PRD as OperationGroup entity, Europe as Geography entity, and LUIS as Technology entity

Sidenote: if you have fixed lists, which is not the case here, you must create an entity of type List:



来源:https://stackoverflow.com/questions/54918690/alternative-for-having-luis-intent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!