asp.net-web-api - 具有 LUIS 意图的替代方法
问题描述
要求是从聊天窗口中给出的用户输入中捕获关键字,并进行 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
推荐阅读
- reactjs - 反应孩子与父母的沟通
- javascript - ajax拒绝向php提交数据进行处理
- android - 代号一 App上的暗色状态栏
- apache-kafka - 可以从 Kafka 紧凑主题中读取单个键控消息吗?
- powershell - 来自 Linux 的 Powershell 远程处理,New-PSSession 错误
- jquery - 如何确定返回的 Json 是简单字符串还是编码对象 - jQuery
- bash - 成功识别脚本中的 PID 后,如何终止进程?
- asp.net-mvc - Crystal Reports 中缺少参数
- regex - 正则表达式,帮助我只在字符串中首次出现,避免在某些字符 Vb.Net 之后进行搜索
- java - 将平面 JSON 结构转换为对象并添加另一个属性