要求是从聊天窗口中给出的用户输入中捕获关键字,并进行 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);
}
}
但是,我们没有可以在实体列表中预先配置的一组固定关键字。
我想你误解了什么是实体。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
实体
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句