LUIS没有返回正确的实体值

时间:2018-09-23 07:47:36

标签: azure luis azure-cognitive-services

我正在尝试学习如何使用LUIS来训练使用NLP在数据库中搜索数据的意图。我创建了一个Intent Utterance,并添加了以下token视图的以下show customers in paris for chocolatemagic

enter image description here

我将它们映射到实体,以便可以获取基于API的查询的实际用户值,如下所示

enter image description here

问题,当我使用测试面板并输入类似以下内容时遇到的问题:

show me cakemagic customers from bangalore它返回的实体如下

enter image description here

当我输入用于训练的确切短语时,我会得到正确的结果,如:

{ "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": [] }

返回

enter image description here

有人可以帮我理解我在这里将用户查询转换为实际意图然后将查询参数作为实体转换为SQL查询时所缺少的内容吗。

EDIT1:

添加了“模型”详细信息,但是这次包括短语,“ 实际上是有效的” 。但这不是我想做的事情,因为那样我就必须添加可以在查询中使用的所有可能的单词组合

Vector<Object> v = new Vector<>(SIZE);

问候 基兰

1 个答案:

答案 0 :(得分:0)

基兰,问题在于您的应用中只有两个包含附属实体的讲话。除此之外,“ cakemagic”一词不是一个真实的词,因此LUIS不知道如何处理该词。选项是包含更多可以用来训练LUIS的言语(即,更多的上下文示例,其中实体可以以这种言语出现,或者子公司可以具有不同的值),使用LUIS可以自然识别的真实单词,或者建立短语列表以包含您要包含的所有单词。