拥有LUIS Intent的替代方案

问题描述 投票:0回答:1

要求是从聊天窗口中给出的用户输入中捕获关键字,并进行web api调用以获取文件链接。

我有四个不同的类别,用户输入查询可以分类到:

- 运营集团 - 技术 - 地理 - 主题

我已经配置了LUIS意图并将这四个类别列为权限。但是,现在的问题是无法预定义实体列表,因为可以有任意数量的搜索关键字可以传递给web api。我现在很困惑,如果有任何其他方式来满足此要求,例如删除停用词并传递关键字Web API列表。

代码:

           [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);
        }

    }
asp.net-web-api botframework luis stop-words
1个回答
1
投票

但是,我们没有固定的关键字集,我们可以在实体列表中预先配置它们。

我想你误解了一个实体是什么。 Simple实体不是预先配置的列表,它可以从您的话语和之后的呼叫中学习。所以它基本上就是你想要的。因此,您必须创建简单的三个实体,然后添加话语并在这些话语中标记实体。不要对实体始终使用相同的值。

例如,添加以下话语:

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

并将fs标记为OperationGroup实体,将North America标记为Geography实体,将RPA标记为Technology实体

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

并将PRD标记为OperationGroup实体,将Europe标记为Geography实体,将LUIS标记为Technology实体

旁注:如果你有固定列表,这不是这里的情况,你必须创建一个类型为List的实体:enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.