Я пытаюсь узнать, как использовать LUIS для обучения намерению искать мои данные в моей базе данных с использованием НЛП.Я создал Intent UIM.Search
и добавил следующий Utterance
, для которого token
выглядит так:
Я сопоставил их собъекты, чтобы я мог получить фактические пользовательские значения для запросов на основе API, как показано ниже
Проблема У меня есть этокогда я использую панель тестирования и ввожу такие тексты, как:
show customers in paris for chocolatemagic
сущности, которые она возвращает, такие, как показано ниже
где каккогда я ввожу точную фразу, используемую для обучения, я получаю правильный результат, например:
show me cakemagic customers from bangalore
возвращает
Может кто-нибудь помочь мне понять, чего мне здесь не хватает, чтобы перевести пользовательский запрос в фактическое намерение, а затем получить параметры запроса в виде сущностей для преобразования в запросы SQL.
EDIT1:
Добавление деталей модели, но на этот раз, включая фразы, , которые на самом деле работают .Но это не то, что я хотел бы сделать, так как тогда мне нужно будет добавить все возможные комбинации слов, которые можно использовать в запросе
{
"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": []
}
С уважением, Киран