azure - LUIS 未返回正确的实体值
问题描述
我正在尝试学习如何使用 LUIS 来训练使用 NLP 在我的数据库中搜索我的数据的意图。我创建了一个 IntentUIM.Search
并添加了以下内容Utterance
,其token
视图如下:
我将它们映射到实体,以便我可以获得基于 API 的查询的实际用户值,如下所示
我遇到的问题是当我使用测试面板并输入如下文本时:
show customers in paris for chocolatemagic
它返回的实体如下
当我输入一个用于训练的确切短语时,我会得到正确的结果,例如:
show me cakemagic customers from bangalore
返回
有人可以帮我理解我在这里缺少什么来将用户查询转换为实际意图,然后将查询参数作为实体获取以转换为 SQL 查询。
编辑1:
添加模型详细信息,但这次包括实际有效的短语。但这不是我想做的事情,因为我必须添加可以在查询中使用的所有可能的单词组合
{
"luis_schema_version": "3.1.0",
"versionId": "0.1",
"name": "UIM",
"desc": "",
"culture": "en-us",
"intents": [
{
"name": "None"
},
{
"name": "UIM.Search"
}
],
"entities": [
{
"name": "address.city",
"roles": []
},
{
"name": "address.country",
"roles": []
},
{
"name": "count",
"roles": []
},
{
"name": "search.order",
"roles": []
},
{
"name": "search.type",
"roles": []
},
{
"name": "subsidiary",
"roles": []
}
],
"composites": [
{
"name": "address",
"children": [
"address.city",
"address.country"
],
"roles": []
}
],
"closedLists": [],
"patternAnyEntities": [],
"regex_entities": [],
"prebuiltEntities": [
{
"name": "number",
"roles": []
}
],
"model_features": [
{
"name": "company Names",
"mode": true,
"words": "honeywell,chocolatemagic,boeing,jeppesen,cakemagic",
"activated": true
},
{
"name": "City Names",
"mode": true,
"words": "bangalore,paris,london,bellevue,berlin,amsterdam,rome,new york,madrid,moscow,sydney,tokyo,kirkland,redmond,frankfurt,barcelona,milan,vienna,prague,brussels,athens,lisbon,stockholm,munich,zurich,budapest,warsaw,copenhagen,dublin,hamburg,istanbul,oslo,bucharest,venice,helsinki,shanghai,geneva,beijing,zagreb,malaga,luxembourg,sofia,kiev,manchester,buenos aires,bangkok,singapore,tallinn,riga,seoul,melbourne,vilnius,toronto,cairo,dubai,los angeles,san francisco,montreal,vancouver,chicago,boston,mumbai,johannesburg,rio de janeiro,miami,seattle,new orleans,san diego,las vegas,houston,philadelphia,atlanta,dallas,denver,orlando,tampa,jacksonville,washington,detroit,phoenix,memphis,cleveland,pittsburgh,portland,baltimore,richmond,madison,nashville,san antonio,sacramento,charlotte,austin,indianapolis,minneapolis,columbus,buffalo,oakland,louisville,cincinnati,newark,milwaukee,san jose,birmingham,raleigh",
"activated": true
},
{
"name": "Country Names",
"mode": true,
"words": "india,usa,uk,france,australia,germany,u.s.a.,u.k.,ireland,austria,finland,denmark,spain,netherlands,sweden,italy,poland,norway,greece,cyprus,belgium,belfast,switzerland,russia,malta,romania,hungary,slovenia,croatia,portugal,european,iceland,slovakia,bulgaria,prague,serbia,estonia,lithuania,latvia,ukraine,albania,armenia,moldova,belarus,kazakhstan,ghana,uruguay,azerbaijan,moscow,paraguay,montenegro,eurovision,venezuela,algeria,burkina,cameroon,tunisia,guatemala,honduras,lesotho,angola,bolivia,nicaragua,grenada,liberia,tanzania,ecuador,cuba,tobago,zimbabwe,ethiopia,rwanda,trinidad,fiji,mozambique,guyana,namibia,belize,haiti,barbados,cambodia,mauritania,mauritius,uganda,maldives,nigeria,kenya,botswana,bahamas,vanuatu,seychelles,africa",
"activated": true
},
{
"name": "Entity Names",
"mode": true,
"words": "customers,suppliers,fleets,transactions,companies,services,employees,retailers,manufacturers,partners,fleet,products,transaction,events,contact,projects,clients,programs,facilities,client,consultant",
"activated": true
},
{
"name": "Services Names",
"mode": true,
"words": "parts,services,planes,applications,components,systems,subsystems,sensors,software,equipment,accessories,electronics,cakes",
"activated": true
}
],
"regex_features": [],
"patterns": [
{
"pattern": "show me {subsidiary} from {search.type} in {address.city}",
"intent": "UIM.Search"
},
{
"pattern": "show me {count} {search.type} from {address.city} in {address.country}",
"intent": "UIM.Search"
},
{
"pattern": "show me all {search.type} from {address.city}",
"intent": "UIM.Search"
}
],
"utterances": [
{
"text": "show 4 customers who bought cakes",
"intent": "UIM.Search",
"entities": [
{
"entity": "search.type",
"startPos": 7,
"endPos": 15
},
{
"entity": "search.order",
"startPos": 28,
"endPos": 32
}
]
},
{
"text": "show 5 customers who bought cakes from bangalore",
"intent": "UIM.Search",
"entities": [
{
"entity": "search.type",
"startPos": 7,
"endPos": 15
},
{
"entity": "search.order",
"startPos": 28,
"endPos": 32
},
{
"entity": "address.city",
"startPos": 39,
"endPos": 47
}
]
},
{
"text": "show all customers form bangalore",
"intent": "UIM.Search",
"entities": [
{
"entity": "search.type",
"startPos": 9,
"endPos": 17
},
{
"entity": "address.city",
"startPos": 24,
"endPos": 32
}
]
},
{
"text": "show customers in bangalore for cakemagic",
"intent": "UIM.Search",
"entities": [
{
"entity": "search.type",
"startPos": 5,
"endPos": 13
},
{
"entity": "address.city",
"startPos": 18,
"endPos": 26
},
{
"entity": "subsidiary",
"startPos": 32,
"endPos": 40
}
]
},
{
"text": "show me all indian customers for cakemagic",
"intent": "UIM.Search",
"entities": [
{
"entity": "address.country",
"startPos": 12,
"endPos": 17
},
{
"entity": "search.type",
"startPos": 19,
"endPos": 27
},
{
"entity": "search.order",
"startPos": 33,
"endPos": 41
}
]
},
{
"text": "show me cakemagic customers from bangalore",
"intent": "UIM.Search",
"entities": [
{
"entity": "subsidiary",
"startPos": 8,
"endPos": 16
},
{
"entity": "search.type",
"startPos": 18,
"endPos": 26
},
{
"entity": "address.city",
"startPos": 33,
"endPos": 41
}
]
},
{
"text": "show me customers from bangalore who liked our cakes",
"intent": "UIM.Search",
"entities": [
{
"entity": "search.type",
"startPos": 8,
"endPos": 16
},
{
"entity": "address.city",
"startPos": 23,
"endPos": 31
},
{
"entity": "search.order",
"startPos": 47,
"endPos": 51
}
]
},
{
"text": "show me customers from usa",
"intent": "UIM.Search",
"entities": [
{
"entity": "search.type",
"startPos": 8,
"endPos": 16
},
{
"entity": "address.country",
"startPos": 23,
"endPos": 25
}
]
},
{
"text": "show me customers who have ordered cake",
"intent": "UIM.Search",
"entities": [
{
"entity": "search.type",
"startPos": 8,
"endPos": 16
},
{
"entity": "search.order",
"startPos": 35,
"endPos": 38
}
]
},
{
"text": "show me customers who likes our cake",
"intent": "None",
"entities": [
{
"entity": "search.type",
"startPos": 8,
"endPos": 16
},
{
"entity": "search.order",
"startPos": 32,
"endPos": 35
}
]
},
{
"text": "show me top 3 customers from bangalore in india",
"intent": "UIM.Search",
"entities": [
{
"entity": "search.type",
"startPos": 14,
"endPos": 22
},
{
"entity": "address.city",
"startPos": 29,
"endPos": 37
},
{
"entity": "address.country",
"startPos": 42,
"endPos": 46
}
]
},
{
"text": "show me top 3 customers from india",
"intent": "UIM.Search",
"entities": [
{
"entity": "search.type",
"startPos": 14,
"endPos": 22
},
{
"entity": "address.country",
"startPos": 29,
"endPos": 33
}
]
},
{
"text": "show top 3 customers form bangalore who have ordered cakes in last 3 months",
"intent": "UIM.Search",
"entities": [
{
"entity": "search.type",
"startPos": 11,
"endPos": 19
},
{
"entity": "address.city",
"startPos": 26,
"endPos": 34
},
{
"entity": "search.order",
"startPos": 53,
"endPos": 57
}
]
},
{
"text": "which customers from usa bought cakes from me",
"intent": "UIM.Search",
"entities": [
{
"entity": "search.type",
"startPos": 6,
"endPos": 14
},
{
"entity": "address.country",
"startPos": 21,
"endPos": 23
},
{
"entity": "search.order",
"startPos": 32,
"endPos": 36
}
]
}
],
"settings": []
}
问候基兰
解决方案
Kiran,问题是您的应用程序中只有两个包含附属实体的话语。除此之外,“cakemagic”这个词不是一个真实的词,因此,LUIS 不知道如何处理这个词。选项是包含更多可以用来训练 LUIS 的话语(即更多上下文示例,实体可以出现在话语中,或者子公司可以是不同的值),使用 LUIS 自然会识别的真实单词,或者建立短语列表以包含您希望包含的所有单词。
推荐阅读
- next.js - 我可以在路由器返回 Next.js 后执行回调函数吗?
- javascript - 如何在反应式中使用剪贴板?
- python - 玛雅脚本选择一个频道?
- javascript - 等待 fs.promises 列表
- git - windows下通过cmd独立调用git-credential-manager-core.exe?
- javascript - 如何在 ejs 中更改部分弹出窗口
- php - Laravel 更新不返回数据
- python-3.x - 使用python从日期的左侧和右侧删除字符串
- django - Django、celery 和 kombu:如何允许泡菜?
- email - 使用 .net 在 Visual Studio 中发送电子邮件