我创建了一个像这样的 LUIS 话语,其中包含一个简单的实体: 客户 abc 的订单正在处理
其中 abc 被简单实体 vf_NARCName 替换
在机器人中,当我输入以下问题时: 客户动物皮肤科医院订单处理中
这里的客户名称是 Animal Dermatology Hospital,用空格分隔,然后当我通过 LUIS Rest API 获取数据时,我得到的是 Animal 作为实体值,而不是 Animal Dermatology Hospital,有时也没有实体值返回
{
"query": " orders in process for customer Animal Dermatology Service",
"topScoringIntent": {
"intent": "OrderDetails_2a598c9b-7cb5-4113-9aca-435b55bbe19e",
"score": 0.7547371
},
返回数据
{
"query": "how many orders are currently in process for customer Animal Dermatology Service",
"topScoringIntent": {
"intent": "OrderDetails_2a598c9b-7cb5-4113-9aca-435b55bbe19e",
"score": 0.6452578
},
"entities": []
}
但是如果我仅使用 Animal 查询它,则会返回正确的数据
返回数据
{
"query": "how many orders are currently in process for customer Animal",
"topScoringIntent": {
"intent": "OrderDetails_2a598c9b-7cb5-4113-9aca-435b55bbe19e",
"score": 0.8928922
},
"entities": [
{
"entity": "animal",
"type": "vf_NARCName",
"startIndex": 54,
"endIndex": 59,
"score": 0.500023663
}
]
}
最佳答案
您的 LUIS 应用本质上需要更多关于该实体如何发生的话语。
我想说策略 1.) 可能是最有用的,但请列出您可能包含的其他选项,以帮助您进行实体检测。
<小时/>- 通过 vf_NARCName 实体的有值(value)的变体添加更多话语
如 First Tutorial in the documentation 中所述在“构建应用程序”部分下,确保包含:
- 每个意图至少15 个话语,其中包括实体呈现的不同方式
您应该注意包含的变体是:
- 词序差异(实体在话语中出现的位置)
- 时态(如“was”、“is”、“will be”,如 this tutorial 所示)
- 语法正确性
- 话语和实体本身的长度(字数)
最后一点可能是您应该包含更多示例的一点。因此,请检查包含 vf_NARCName
实体的话语,这些实体的长度不仅仅是 1 个单词,而是 2 或 3 个单词,甚至更长(如果您的应用中可能存在这种情况)。
- 添加短语列表
如docs describing what Phrase Lists are状态,
A phrase list includes a group of values (words or phrases) that belong to the same class and must be treated similarly
这是您可以帮助向 LUIS 发送另一个信号以帮助检测您的 vf_NARCName
实体的另一种方式。
如何添加短语列表的教程 here .
<小时/>- 最后,您可能想研究使用 Pattern.any
作为Pattern.any docs在此声明,
use the pattern.any entity to extract data from utterances where the utterances are well-formatted and where the end of the data may be easily confused with the remaining words of the utterance
因此,如果您知道您可能拥有潜在的 vf_NARCName
实体,并且该实体本身的字数非常长,那么您可能会从使用 Pattern.any 实体中受益。
例如,您可能有“喜欢长名字但讨厌小说的部门
”作为 vf_NARCName
实体。 LUIS 可能很难确定该实体的确切结束位置,但可以通过使用 Pattern.any 来做到这一点。
关于.net - LUIS 意图不返回带有空格的实体的整个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52650025/