1
votes

I am trying to learn how to use LUIS to train for an intent to search my data on my database using NLP. I created an Intent UIM.Search and added the following Utterance for which the token view is as below:

enter image description here

I mapped them to the entities so that I can get the actual user values for API based queries as shown below

enter image description here

Issue I am having is when I use the testing panel and enter texts like:

show customers in paris for chocolatemagic the entities it returns are as below

enter image description here

where as when I enter an exact phrase used for training I get the correct result like:

show me cakemagic customers from bangalore

returns

enter image description here

Can someone please help me understand what am I missing here to translate the user query to actual intent and then get the query parameters as entities to convert to SQL queries.

EDIT1:

Adding the Model details, but this time including the Phrases, which actually works. But this is not something i would like to do as then i'll have to add all possible combinations of words that can be used in the query

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

Regards Kiran

1
Could you eventually add exported LUIS model? You might remove any unnecessary content upfront.rudolf_franek
@rudolf_franek: I added the model, but with the Phrase lists which starts to work. However that would mean I'll have to store all the city Names and User names etc in the list which may not be practical. is there any easier way out for this issue? - Thanks!Kiran

1 Answers

0
votes

Kiran, the issue is you only have two utterances in your app that contain the subsidiary entity. Additional to that, the word 'cakemagic' is not a real word and, thus, LUIS doesn't know how to handle that word. The option is to either include more utterances from which you can train LUIS with (i.e. more examples of context, where the entity can show up in the utterance, or different values the subsidiary can be), use real words LUIS would naturally recognize, or build out the phrase list to include all the words you are looking to have included.