LUISGen throws exception when generating cs classes from json - botframework

I am trying to generate cs calsses from json which I exported from luis.ai for one of my luis App.
But when I run the command LUISGen myLuisApp.json -cs myClassName I get below error on commandline
Snapshot of exception
below is the json I got from luis.ai
{
"luis_schema_version": "7.0.0",
"versionId": "0.1",
"name": "myBotName",
"desc": "",
"culture": "en-us",
"tokenizerVersion": "1.0.0",
"patternAnyEntities": [],
"regex_entities": [],
"phraselists": [],
"regex_features": [],
"patterns": [],
"intents": [
{
"name": "ApproveAllTasksOnMe"
},
{
"name": "ApproveTask"
},
{
"name": "GetApprovedTasks"
},
{
"name": "GetCompletedTasks"
},
{
"name": "GetLastApprovedTask"
},
{
"name": "GetLastNTasks"
},
{
"name": "GetLastRejectedTask"
},
{
"name": "GetRejectedTasks"
},
{
"name": "GetTaskDetails"
},
{
"name": "GetTasks"
},
{
"name": "GetTotalPendingTasks"
},
{
"name": "GetTotalTasksCompleted"
},
{
"name": "None"
},
{
"name": "RejectAllTasksOnMe"
},
{
"name": "RejectTask"
}
],
"entities": [
{
"name": "Application",
"children": [],
"roles": [],
"features": []
},
{
"name": "Email",
"children": [
{
"name": "AssignedTo",
"children": [],
"features": []
},
{
"name": "InitiatedBy",
"children": [],
"features": []
}
],
"roles": [],
"features": []
},
{
"name": "Name",
"children": [
{
"name": "AssignedTo",
"children": [],
"features": []
},
{
"name": "InitiatedBy",
"children": [],
"features": []
}
],
"roles": [],
"features": []
},
{
"name": "Status",
"children": [],
"roles": [],
"features": []
},
{
"name": "Workspace",
"children": [],
"roles": [],
"features": []
}
],
"hierarchicals": [],
"composites": [],
"closedLists": [],
"prebuiltEntities": [],
"utterances": [
{
"text": "all approved tasks",
"intent": "GetApprovedTasks",
"entities": []
},
{
"text": "all tasks",
"intent": "GetTasks",
"entities": []
},
{
"text": "approve all",
"intent": "ApproveAllTasksOnMe",
"entities": []
},
{
"text": "approve task",
"intent": "ApproveTask",
"entities": []
},
{
"text": "get all tasks i approved",
"intent": "GetApprovedTasks",
"entities": []
},
{
"text": "get all tasks i rejected",
"intent": "GetRejectedTasks",
"entities": []
},
{
"text": "get last 5 tasks",
"intent": "GetLastNTasks",
"entities": []
},
{
"text": "get last approved task",
"intent": "GetLastApprovedTask",
"entities": []
},
{
"text": "get last rejected task",
"intent": "GetLastRejectedTask",
"entities": []
},
{
"text": "get task details",
"intent": "GetTaskDetails",
"entities": []
},
{
"text": "get tasks pending on me",
"intent": "GetTasks",
"entities": [
{
"entity": "Name",
"startPos": 21,
"endPos": 22,
"children": [
{
"entity": "AssignedTo",
"startPos": 21,
"endPos": 22,
"children": []
}
]
}
]
},
{
"text": "how man tasks are pending on me",
"intent": "GetTotalPendingTasks",
"entities": []
},
{
"text": "how many tasks are assigned to me",
"intent": "GetTotalPendingTasks",
"entities": []
},
{
"text": "how many tasks i closed today",
"intent": "GetTotalTasksCompleted",
"entities": []
},
{
"text": "how many tasks were completed by me",
"intent": "GetTotalTasksCompleted",
"entities": []
},
{
"text": "last 7 tasks",
"intent": "GetLastNTasks",
"entities": []
},
{
"text": "last approved task",
"intent": "GetLastApprovedTask",
"entities": []
},
{
"text": "last task i approved",
"intent": "GetLastApprovedTask",
"entities": []
},
{
"text": "last task i rejected",
"intent": "GetLastRejectedTask",
"entities": []
},
{
"text": "list my tasks",
"intent": "GetTasks",
"entities": [
{
"entity": "Name",
"startPos": 5,
"endPos": 6,
"children": [
{
"entity": "AssignedTo",
"startPos": 5,
"endPos": 6,
"children": []
}
]
}
]
},
{
"text": "number of tasks closed",
"intent": "GetTotalTasksCompleted",
"entities": []
},
{
"text": "reject all",
"intent": "RejectAllTasksOnMe",
"entities": []
},
{
"text": "reject all my tasks",
"intent": "RejectAllTasksOnMe",
"entities": []
},
{
"text": "reject all tasks",
"intent": "RejectAllTasksOnMe",
"entities": []
},
{
"text": "reject this task",
"intent": "RejectTask",
"entities": []
},
{
"text": "show all completed tasks",
"intent": "GetCompletedTasks",
"entities": []
},
{
"text": "show all done tasks",
"intent": "GetCompletedTasks",
"entities": []
},
{
"text": "show all tasks approved by me",
"intent": "GetApprovedTasks",
"entities": []
},
{
"text": "show done tasks",
"intent": "GetCompletedTasks",
"entities": []
},
{
"text": "show how many tasks are closed",
"intent": "GetTotalTasksCompleted",
"entities": []
},
{
"text": "show last 2 tasks",
"intent": "GetLastNTasks",
"entities": []
},
{
"text": "show my tasks",
"intent": "GetTasks",
"entities": [
{
"entity": "Name",
"startPos": 5,
"endPos": 6,
"children": [
{
"entity": "AssignedTo",
"startPos": 5,
"endPos": 6,
"children": []
}
]
}
]
},
{
"text": "show tasks i took action on",
"intent": "GetCompletedTasks",
"entities": []
},
{
"text": "show tasks pending on me",
"intent": "GetTasks",
"entities": [
{
"entity": "Name",
"startPos": 22,
"endPos": 23,
"children": [
{
"entity": "AssignedTo",
"startPos": 22,
"endPos": 23,
"children": []
}
]
}
]
},
{
"text": "tasks assigned to me",
"intent": "GetTasks",
"entities": [
{
"entity": "Name",
"startPos": 18,
"endPos": 19,
"children": [
{
"entity": "AssignedTo",
"startPos": 18,
"endPos": 19,
"children": []
}
]
}
]
},
{
"text": "tasks i rejected",
"intent": "GetRejectedTasks",
"entities": []
},
{
"text": "tasks pending on me",
"intent": "GetTasks",
"entities": [
{
"entity": "Name",
"startPos": 17,
"endPos": 18,
"children": [
{
"entity": "AssignedTo",
"startPos": 17,
"endPos": 18,
"children": []
}
]
}
]
},
{
"text": "tasks rejected by me",
"intent": "GetRejectedTasks",
"entities": []
},
{
"text": "tasks waiting for my attention",
"intent": "GetTasks",
"entities": [
{
"entity": "Name",
"startPos": 18,
"endPos": 19,
"children": [
{
"entity": "AssignedTo",
"startPos": 18,
"endPos": 19,
"children": []
}
]
}
]
},
{
"text": "tasks waiting on me",
"intent": "GetTasks",
"entities": [
{
"entity": "Name",
"startPos": 17,
"endPos": 18,
"children": [
{
"entity": "AssignedTo",
"startPos": 17,
"endPos": 18,
"children": []
}
]
}
]
},
{
"text": "today's priorities",
"intent": "GetTasks",
"entities": []
},
{
"text": "total tasks for me",
"intent": "GetTotalPendingTasks",
"entities": []
},
{
"text": "what are my tasks for the day",
"intent": "GetTasks",
"entities": [
{
"entity": "Name",
"startPos": 9,
"endPos": 10,
"children": [
{
"entity": "AssignedTo",
"startPos": 9,
"endPos": 10,
"children": []
}
]
}
]
}
],
"settings": []
}
when run the same command with of the json from examples it generated the classes without any error.
Can anybody help me understand what I might be doing wrong or if I am missing something?
I have installed LUISGen with below comand dotnet tool install --global LUISGen --version 2.2.0

Normally I would say 'make sure you're using the most up-to-date version of the tool', but
LUISGen is deprecated (legacy tool). The new botframework-cli was designed to replace legacy standalone tools. I don't think you're missing anything, but it hasn't been updated in almost a year.
The botframework-cli has a similar command: bf luis:generate:cs meant to generate CS classes on LUIS models.
https://github.com/microsoft/botframework-cli/blob/main/packages/luis/README.md#bf-luisgeneratecs

Related

Can someone help me create a test in Postman in order to validate that a key has the expected value inside a nested group?

Can someone point me in the right direction to write a test in Postman in order to validate that a certain key or value from the following response is present. The response has a lot of nested objects.
Specifically I want to validate the following:
I want to validate that in the output.treatments there's a key "type" with the value "Diet" present
and I also want to validate that in the output.treatments.details there's a key "name" with the value "SULFAMETHOXAZOLE/TRIMETHOPRIM"
Thanks!
The API response looks like this:
{
"additionalInformation": {
"knownDrugAllergies": [],
"knownDrugConflicts": [
{
"conflict": "OXYBUTYNIN CHLORIDE",
"potentialDrugs": [
"item1",
"item2"
]
}
],
"knownPrecautionConflicts": [
{
"conflict": "OXYBUTYNIN CHLORIDE",
"potentialDrugs": [
"Drowsy",
"Gastroesophageal Reflux",
"Myasthenia Gravis",
"Parkinsonism",
"Ulcerative Colitis"
]
}
]
},
"output": [
{
"icdCode": "N39.3",
"icdDesc": "Stress incontinence (female) (male)",
"isIllness": true,
"treatments": [
{
"details": [],
"type": "Physical Exam"
},
{
"details": [
{
"directions": [],
"dosage": "",
"groupName": "Group Placeholder",
"longName": "Normal Diet",
"name": "Normal Diet",
"nameDetails": "The patient has no dietary restrictions",
"priority": 16,
"rank": 1,
"reasons": [],
"sources": [
[
"TEST",
"https://google.com"
],
[
"TEST",
"https://google.com"
]
]
}
],
"type": "Diet"
},
{
"details": [
{
"directions": [],
"dosage": "",
"groupName": "Group Placeholder",
"longName": "No Restrictions",
"name": "No Restrictions",
"nameDetails": "The patient has no activity restrictions",
"priority": 16,
"rank": 1,
"reasons": [],
"sources": [
[
"TEST",
"https://google.com"
],
[
"TEST",
"https://google.com"
]
]
}
],
"type": "Activity"
},
{
"details": [
{
"directions": [],
"dosage": "",
"groupName": "Group Placeholder",
"longName": "None Needed ",
"name": "None Needed",
"nameDetails": "No physical therapy is needed.",
"priority": 20,
"rank": 1,
"reasons": [],
"sources": [
[
"TEST",
"https://google.com"
],
[
"TEST",
"https://google.com"
]
]
}
],
"type": "Physical Therapy"
},
{
"details": [
{
"directions": [],
"dosage": "",
"groupName": "Group Placeholder",
"longName": "Kegel Exercises",
"name": "Kegel Exercises",
"nameDetails": "INCOMPLETE",
"priority": 20,
"rank": 1,
"reasons": [],
"sources": [
[
"TEST",
"https://google.com"
],
[
"TEST",
"https://google.com"
]
]
}
],
"type": "Counseling"
},
{
"details": [
{
"directions": [],
"dosage": "",
"groupName": "Group Placeholder",
"longName": "Patient Can Resume Work/School Immediately",
"name": "Immediately",
"nameDetails": "Patient Can Resume Work/School Immediately",
"priority": 8,
"rank": 1,
"reasons": [],
"sources": [
[
"TEST",
"https://google.com"
],
[
"TEST",
"https://google.com"
]
]
}
],
"type": "Return to Work/School Status"
},
{
"details": [
{
"directions": [],
"dosage": "",
"groupName": "Group Placeholder",
"longName": "Wound Care Not Needed",
"name": "Not Needed",
"nameDetails": "Wound Care Not Needed",
"priority": 20,
"rank": 1,
"reasons": [],
"sources": [
[
"TEST",
"https://google.com"
],
[
"TEST",
"https://google.com"
]
]
}
],
"type": "Wound Care"
},
{
"details": [
{
"directions": [],
"dosage": "",
"groupName": "Group Placeholder",
"longName": "Urine Analysis",
"name": "Urine Analysis",
"nameDetails": "Evaluate the urine for electrolytes and pH.",
"priority": 20,
"rank": 1,
"reasons": [],
"sources": [
[
"TEST",
"https://google.com"
]
]
}
],
"type": "Labs"
},
{
"details": [
{
"directions": [],
"dosage": "",
"groupName": "Group Placeholder",
"longName": "Specialist Consultation",
"name": "Specialist Consult",
"nameDetails": "The patient should consult with a specialist in the appropriate field.",
"priority": 29,
"rank": 1,
"reasons": [],
"sources": [
[
"TEST",
"https://google.com"
]
]
}
],
"type": "Discharge Disposition"
},
{
"details": [
{
"directions": [],
"dosage": "",
"groupName": "Group 2",
"longName": "placeholder",
"name": "DULOXETINE HCL",
"nameDetails": "Name Details Placeholder",
"priority": 20,
"protocol": [
"example"
],
"rank": 1,
"reasons": [],
"sources": [
[
"TEST",
"https://google.com"
]
]
},
{
"directions": [],
"dosage": "",
"groupName": "Standard",
"longName": "placeholder",
"name": "SULFAMETHOXAZOLE/TRIMETHOPRIM",
"nameDetails": "Name Details Placeholder",
"priority": 20,
"protocol": [
"example"
],
"rank": 3,
"reasons": [],
"sources": [
[
"TEST",
"https://google.com"
]
]
},
{
"directions": [],
"dosage": "",
"groupName": "Standard",
"longName": "placeholder",
"name": "TOLTERODINE TARTRATE",
"nameDetails": "Name Details Placeholder",
"priority": 20,
"protocol": [
"example"
],
"rank": 1,
"reasons": [],
"sources": [
[
"no sources",
"no URL"
]
]
}
],
"type": "Prescription Drugs"
},
{
"details": [
{
"directions": [],
"dosage": "",
"groupName": "Standard",
"longName": "placeholder",
"name": "OXYBUTYNIN",
"nameDetails": "Name Details Placeholder",
"priority": 20,
"protocol": [
"example"
],
"rank": 2,
"reasons": [],
"sources": [
[
"TEST",
"https://google.com"
]
]
}
],
"type": "OTC Drugs"
}
]
}
],
"status": "Complete",
"version": 3
}
Found the solution:
var jsonData = pm.response.json();
pm.test("OXYBUTYNIN present", function () {
pm.expect(_isContains(jsonData.output, "name" ,"OXYBUTYNIN")).to.be.true;
});
pm.test("TOLTERODINE TARTRATE present", function () {
pm.expect(_isContains(jsonData.output, "name" ,"TOLTERODINE TARTRATE")).to.be.true;
});
pm.test("SULFAMETHOXAZOLE/TRIMETHOPRIM present", function () {
pm.expect(_isContains(jsonData.output, "name" ,"SULFAMETHOXAZOLE/TRIMETHOPRIM")).to.be.true;
});
pm.test("DULOXETINE HCL present", function () {
pm.expect(_isContains(jsonData.output, "name" ,"DULOXETINE HCL")).to.be.true;
});
function _isContains(json, keyname, value) {
return Object.keys(json).some(key => {
return typeof json[key] === 'object' ?
_isContains(json[key], keyname, value) : key === keyname && json[key] === value;
});
}

Luis not working due to its maintance (just in spanish culture)?

our staging application with spanish culture was not working yesterday, and today our production application is also not working. The problem is that some intents are not returning any entities. And in the web of luis is annunced that "We are performing system wide maintenance. Some apps may experience temporary unavailability. Thank you for your patience."
We want to know if it is a normal case and how long will it last. Our bot is in the production, which means it is a product. We ara caring about our product, and do not want interrupt its service with any accident.
Also we want to know is there any technical way to avoiding cases like this.
Detail of the error, when call version english https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/xxxx?subscription-key=xxxxxxxxxx&verbose=true&timezoneOffset=0&q=malaga
{
"query": "malaga",
"topScoringIntent": {
"intent": "sports_football_team_global",
"score": 0.989564657
},
"intents": [
{
"intent": "sports_football_team_global",
"score": 0.989564657
},
{
"intent": "sports_user_follow",
"score": 0.256285429
},
{
"intent": "sports_user_unfollow",
"score": 0.0624738075
},
{
"intent": "sports_football_team_information",
"score": 0.0452761
},
{
"intent": "sports_user_notification_level",
"score": 0.0250913966
},
{
"intent": "OPTA_Cancelar",
"score": 0.01700071
},
{
"intent": "None",
"score": 0.0113976067
},
{
"intent": "sports_user_enable_notification",
"score": 0.01062314
},
{
"intent": "sports_user_emotion_hate",
"score": 0.008717464
},
{
"intent": "sports_competition_classification",
"score": 0.006895263
},
{
"intent": "sports_user_welcome",
"score": 0.003931297
},
{
"intent": "root_change_user_info",
"score": 0.002939801
},
{
"intent": "sports_user_disable_notification",
"score": 0.00284402771
},
{
"intent": "sports_team_last_match",
"score": 0.002589234
},
{
"intent": "sports_next_match_bytime",
"score": 0.00225439551
},
{
"intent": "sports_showmore_team",
"score": 0.00210961024
},
{
"intent": "sports_competition_next_round",
"score": 0.00183723459
},
{
"intent": "sports_team_next_match",
"score": 0.0017626757
},
{
"intent": "sports_competition_last_round",
"score": 0.001716528
},
{
"intent": "sports_user_emotion_gol",
"score": 0.001380223
},
{
"intent": "sports_user_unfollow_all",
"score": 0.00104989111
},
{
"intent": "sports_user_current_match",
"score": 0.0008975425
},
{
"intent": "sports_user_last_match",
"score": 0.0005386151
},
{
"intent": "sports_user_show_follow",
"score": 0.0004062014
},
{
"intent": "sports_team_current_match",
"score": 0.000116936135
},
{
"intent": "sports_user_next_match",
"score": 1.70625044E-05
}
],
"entities": [
{
"entity": "malaga",
"type": "football_team",
"startIndex": 0,
"endIndex": 5,
"resolution": {
"values": [
"Málaga"
]
}
}
]
And version spanish https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/xxxxxx?subscription-key=xxxx&verbose=true&timezoneOffset=0&q=malaga
{
"query": "malaga",
"topScoringIntent": {
"intent": "sports_football_team_global",
"score": 0.9602209
},
"intents": [
{
"intent": "sports_football_team_global",
"score": 0.9602209
},
{
"intent": "sports_user_disable_notification",
"score": 0.130784482
},
{
"intent": "sports_team_last_match",
"score": 0.09194096
},
{
"intent": "sports_user_notification_level",
"score": 0.08853955
},
{
"intent": "sports_team_next_match",
"score": 0.0597797334
},
{
"intent": "sports_user_unfollow",
"score": 0.0510462932
},
{
"intent": "sports_football_team_information",
"score": 0.0401076
},
{
"intent": "sports_competition_classification",
"score": 0.03524222
},
{
"intent": "sports_user_follow",
"score": 0.02526744
},
{
"intent": "sports_next_match_bytime",
"score": 0.0111262156
},
{
"intent": "sports_user_enable_notification",
"score": 0.009637802
},
{
"intent": "sports_team_current_match",
"score": 0.00436334638
},
{
"intent": "sports_user_emotion_hate",
"score": 0.004245238
},
{
"intent": "None",
"score": 0.00323706563
},
{
"intent": "sports_user_show_follow",
"score": 0.00276356842
},
{
"intent": "sports_showmore_team",
"score": 0.00234427629
},
{
"intent": "sports_user_last_match",
"score": 0.00233005267
},
{
"intent": "sports_user_welcome",
"score": 0.00157872075
},
{
"intent": "sports_competition_next_round",
"score": 0.00108685123
},
{
"intent": "sports_user_emotion_gol",
"score": 0.000902815256
},
{
"intent": "sports_competition_last_round",
"score": 0.000205698016
},
{
"intent": "sports_user_current_match",
"score": 0.000102570972
},
{
"intent": "sports_user_next_match",
"score": 3.606828E-05
},
{
"intent": "sports_user_unfollow_all",
"score": 3.43515676E-05
}
],
"entities": []
}
It was a temporary issue which has been resolved. Please contact Luisuservoice#microsoft.com if any issues.

Rasa nlu parse request giving wrong intent result

Rasa NLU version (e.g. 0.7.3): 0.10.0a6
Used backend / pipeline (mitie, spacy_sklearn, ...): ["nlp_spacy", "tokenizer_spacy", "intent_featurizer_spacy","ner_crf", "ner_synonyms", "intent_classifier_sklearn","ner_spacy"]
Operating system (windows, osx, ...): Windows server 2012 R2
Issue: I have installed Rasa nlu 0.10.0a6 version. My confi_spacy file looks like.
{
"project":"Project",
"pipeline" : ["nlp_spacy", "tokenizer_spacy", "intent_featurizer_spacy","ner_crf", "ner_synonyms", "intent_classifier_sklearn","ner_spacy"],
"path" : "./projects",
"cors_origins":["*"],
"data" : "./data/examples/rasa/People.json"
}
and my data file looks like.
{
"rasa_nlu_data": {
"regex_features": [
{
"name": "zipcode",
"pattern": "[0-9]{5}"
}
],
"entity_synonyms": [
{
"value": "chinese",
"synonyms": ["Chinese", "Chines", "chines"]
},
{
"value": "vegetarian",
"synonyms": ["veggie", "vegg"]
}
],
"common_examples": [
{
"text": "hey",
"intent": "greet",
"entities": []
},
{
"text": "howdy",
"intent": "greet",
"entities": []
},
{
"text": "hey there",
"intent": "greet",
"entities": []
},
{
"text": "hello",
"intent": "greet",
"entities": []
},
{
"text": "hi",
"intent": "greet",
"entities": []
},
{
"text": "good morning",
"intent": "greet",
"entities": []
},
{
"text": "good evening",
"intent": "greet",
"entities": []
},
{
"text": "dear sir",
"intent": "greet",
"entities": []
},
{
"text": "yes",
"intent": "affirm",
"entities": []
},
{
"text": "yep",
"intent": "affirm",
"entities": []
},
{
"text": "yeah",
"intent": "affirm",
"entities": []
},
{
"text": "indeed",
"intent": "affirm",
"entities": []
},
{
"text": "that's right",
"intent": "affirm",
"entities": []
},
{
"text": "ok",
"intent": "affirm",
"entities": []
},
{
"text": "great",
"intent": "affirm",
"entities": []
},
{
"text": "right, thank you",
"intent": "affirm",
"entities": []
},
{
"text": "correct",
"intent": "affirm",
"entities": []
},
{
"text": "great choice",
"intent": "affirm",
"entities": []
},
{
"text": "sounds really good",
"intent": "affirm",
"entities": []
},
{
"text": "i'm looking for a place to eat",
"intent": "restaurant_search",
"entities": []
},
{
"text": "I want to grab lunch",
"intent": "restaurant_search",
"entities": []
},
{
"text": "I am searching for a dinner spot",
"intent": "restaurant_search",
"entities": []
},
{
"text": "i'm looking for a place in the north of town",
"intent": "restaurant_search",
"entities": [
{
"start": 31,
"end": 36,
"value": "north",
"entity": "location"
}
]
},
{
"text": "show me chinese restaurants",
"intent": "restaurant_search",
"entities": [
{
"start": 8,
"end": 15,
"value": "chinese",
"entity": "cuisine"
}
]
},
{
"text": "show me chines restaurants",
"intent": "restaurant_search",
"entities": [
{
"start": 8,
"end": 14,
"value": "chinese",
"entity": "cuisine"
}
]
},
{
"text": "show me a mexican place in the centre",
"intent": "restaurant_search",
"entities": [
{
"start": 31,
"end": 37,
"value": "centre",
"entity": "location"
},
{
"start": 10,
"end": 17,
"value": "mexican",
"entity": "cuisine"
}
]
},
{
"text": "i am looking for an indian spot called olaolaolaolaolaola",
"intent": "restaurant_search",
"entities": [
{
"start": 20,
"end": 26,
"value": "indian",
"entity": "cuisine"
}
]
}, {
"text": "search for restaurants",
"intent": "restaurant_search",
"entities": []
},
{
"text": "anywhere in the west",
"intent": "restaurant_search",
"entities": [
{
"start": 16,
"end": 20,
"value": "west",
"entity": "location"
}
]
},
{
"text": "anywhere near 18328",
"intent": "restaurant_search",
"entities": [
{
"start": 14,
"end": 19,
"value": "18328",
"entity": "location"
}
]
},
{
"text": "I am looking for asian fusion food",
"intent": "restaurant_search",
"entities": [
{
"start": 17,
"end": 29,
"value": "asian fusion",
"entity": "cuisine"
}
]
},
{
"text": "I am looking a restaurant in 29432",
"intent": "restaurant_search",
"entities": [
{
"start": 29,
"end": 34,
"value": "29432",
"entity": "location"
}
]
},
{
"text": "I am looking for mexican indian fusion",
"intent": "restaurant_search",
"entities": [
{
"start": 17,
"end": 38,
"value": "mexican indian fusion",
"entity": "cuisine"
}
]
},
{
"text": "central indian restaurant",
"intent": "restaurant_search",
"entities": [
{
"start": 0,
"end": 7,
"value": "central",
"entity": "location"
},
{
"start": 8,
"end": 14,
"value": "indian",
"entity": "cuisine"
}
]
},
{
"text": "bye",
"intent": "goodbye",
"entities": []
},
{
"text": "goodbye",
"intent": "goodbye",
"entities": []
},
{
"text": "good bye",
"intent": "goodbye",
"entities": []
},
{
"text": "stop",
"intent": "goodbye",
"entities": []
},
{
"text": "end",
"intent": "goodbye",
"entities": []
},
{
"text": "farewell",
"intent": "goodbye",
"entities": []
},
{
"text": "Bye bye",
"intent": "goodbye",
"entities": []
},
{
"text": "have a good one",
"intent": "goodbye",
"entities": []
}
]
}
}
Using above config and json data I have trained Rasa using below HTTP end point
/train?project=Project
After training data there in one Project folder created with trained data.
And I started Rasa server with below command.
python -m rasa_nlu.server -c config_spacy.json
Now server started with port 5000.
When I can execute '/parse?q=hello&project=Project' parse end point am getting below response.
{
"intent": {
"name": "greet",
"confidence": 0.6409561289105246
},
"entities": [],
"intent_ranking": [
{
"name": "greet",
"confidence": 0.6409561289105246
},
{
"name": "goodbye",
"confidence": 0.16788352870824252
},
{
"name": "restaurant_search",
"confidence": 0.10908268742176423
},
{
"name": "affirm",
"confidence": 0.08207765495946878
}
],
"text": "hello"
}
When I can execute '/parse?q=Great choice&project=Project' parse end point am getting below response.
{
"intent": {
"name": "affirm",
"confidence": 0.7718580601897227
},
"entities": [],
"intent_ranking": [
{
"name": "affirm",
"confidence": 0.7718580601897227
},
{
"name": "goodbye",
"confidence": 0.11611828257295627
},
{
"name": "greet",
"confidence": 0.07060567364272623
},
{
"name": "restaurant_search",
"confidence": 0.04141798359459499
}
],
"text": "Great choice"
}
When I can execute '/parse?q=Great choice&Project=Project' parse end point am getting below response.
{
"intent": {
"name": "None",
"confidence": 1
},
"entities": [],
"text": "Great choice"
}
When I can execute "/parse?q=Book a cab&project=Project" parse end point am getting below response.
{
"intent": {
"name": "goodbye",
"confidence": 0.40930529216955336
},
"entities": [],
"intent_ranking": [
{
"name": "goodbye",
"confidence": 0.40930529216955336
},
{
"name": "restaurant_search",
"confidence": 0.31818118919270977
},
{
"name": "greet",
"confidence": 0.20524111006007764
},
{
"name": "affirm",
"confidence": 0.06727240857765926
}
],
"text": "Book a cab"
}
In this way for each request it is responding with proper results some times and sometime not. If you can observe Parse_reponce2.txt and Parse_reponce3.txt in these both the response I just changed from small 'p' to capital 'P' in place 'Project' because of this change, i got different results for each request.
And in trained data there is no 'Book a cab' text or any related intent to it. But when I send parse using this text I am not getting None intent, it is returning intent result. for any parse request with any random am not getting None intent.
Is this my training issue or what went wrong in it.
Please let me know how can I get proper intent results as well as entities result.
Content of configuration file (if used & relevant):
{
"project":"Project",
"pipeline" : ["nlp_spacy", "tokenizer_spacy", "intent_featurizer_spacy","ner_crf", "ner_synonyms", "intent_classifier_sklearn","ner_spacy"],
"path" : "./projects",
"cors_origins":["*"],
"data" : "./data/examples/rasa/People.json"
}
URL parameters are case sensitive, which is why the two great choice examples had different outputs. In the 2nd case Rasa wasn't finding a project/model to parse against.
Rasa NLU will always return a matched intent. So in the last example you can see that it returned an intent, but the confidence was low. Handling this is what would be called a fallback or out of scope. The two primary ways discussed for handling fallback is to implement logic that takes over when the confidence falls below a certain threshold or to train an actual fallback intent that has all the non-intent examples you want to catch.
I had the same issue with using Rasa NLU where I had around 120 examples for 5 different intents, and 5-7 entities as well. Here, you seem to have used the spacy-sklearn pipeline.
spaCy typically requires more data to train and detect intents and (more so) entities. The docs say 500-1000 examples would be considered "decent and good" for the library.
In my case I changed my pipeline to MITIE-sklearn and I got a decent model trained with only 80 examples and same number of intents as before.
Also spaCy tends to be faster as you would have noted, but MITIE does take around 6 minutes for an 80-example model.

When connecting to LUIS, what does the "forceset" parameter do

In my LUIS app I have an intent called GetWeather requiring a Location to be set.
When connecting to the app using the query
What is the weather in london
it correctly returns
{
"query": "what is the weather in london",
"topScoringIntent": {
"intent": "GetWeather",
"score": 0.999875546,
"actions": [
{
"triggered": true,
"name": "GetWeather",
"parameters": [
{
"name": "Location",
"type": "Location",
"required": true,
"value": [
{
"entity": "london",
"type": "Location",
"resolution": {}
}
]
}
]
}
]
},
"entities": [
{
"entity": "london",
"type": "Location",
"startIndex": 23,
"endIndex": 28,
"score": 0.832388461,
"resolution": {}
}
],
"dialog": {
"contextId": "e1df6c2d-e691-4fc6-89f2-3ee2ef519724",
"status": "Finished"
}
}
If I instead use the query
What is the weather
It returns the following expected result.
{
"query": "what is the weather",
"topScoringIntent": {
"intent": "GetWeather",
"score": 1.0,
"actions": [
{
"triggered": false,
"name": "GetWeather",
"parameters": [
{
"name": "Location",
"type": "Location",
"required": true,
"value": null
}
]
}
]
},
"entities": [],
"dialog": {
"prompt": "Where",
"parameterName": "Location",
"parameterType": "Location",
"contextId": "3b0725f4-7d6f-43fd-ab6e-02fc11c3eed1",
"status": "Question"
}
}
I thought that using the contextID together with the forceSet parameter in my next call would set the parameter Location to whatever I send as the query. The conection string I use is this:
https://api.projectoxford.ai/luis/v2.0/apps/{APP_ID}?subscription-key={SUBSCRIPTION_KEY}&q=london&contextid=3b0725f4-7d6f-43fd-ab6e-02fc11c3eed1&forceset=Location
Instead I get the following response back:
{
"query": "london",
"topScoringIntent": {
"intent": "GetWeather",
"score": 1.0,
"actions": [
{
"triggered": false,
"name": "GetWeather",
"parameters": [
{
"name": "Location",
"type": "Location",
"required": true,
"value": null
}
]
}
]
},
"entities": [],
"dialog": {
"prompt": "Where",
"parameterName": "Location",
"parameterType": "Location",
"contextId": "3b0725f4-7d6f-43fd-ab6e-02fc11c3eed1",
"status": "Question"
}
}
I had expected to get something like my first response back.
Am I doing something wrong or just misunderstanding what the forceSet parameter is supposed to do?

REQL to match string expression

I have the following json:
{
"release": {
"genres": {
"genre": "Electronic"
},
"identifiers": {
"identifier": [
{
"description": "Text",
"value": "5 709498 101026",
"type": "Barcode"
},
{
"description": "String",
"value": 5709498101026,
"type": "Barcode"
}
]
},
"status": "Accepted",
"videos": {
"video": [
{
"title": "Future 3 - Renaldo",
"duration": 446,
"description": "Future 3 - Renaldo",
"src": "http://www.youtube.com/watch?v=hpc9aQpnUjc",
"embed": true
},
{
"title": "Future 3 - Silver M from album We are the Future / 1995 Denmark / Archivos de Kraftwerkmusik",
"duration": 461,
"description": "Future 3 - Silver M from album We are the Future / 1995 Denmark / Archivos de Kraftwerkmusik",
"src": "http://www.youtube.com/watch?v=nlcHRI8iV4g",
"embed": true
},
{
"title": "Future 3 - Bubbles At Dawn",
"duration": 710,
"description": "Future 3 - Bubbles At Dawn",
"src": "http://www.youtube.com/watch?v=ABBCyvGMOFw",
"embed": true
}
]
},
"labels": {
"label": {
"catno": "APR 010CD",
"name": "April Records"
}
},
"companies": {
"company": {
"id": 26184,
"catno": "",
"name": "Voices Of Wonder",
"entity_type_name": "Published By",
"resource_url": "http://api.discogs.com/labels/26184",
"entity_type": 21
}
},
"styles": {
"style": [
"Abstract",
"IDM",
"Downtempo"
]
},
"formats": {
"format": {
"text": "",
"name": "CD",
"qty": 1,
"descriptions": {
"description": "Album"
}
}
},
"country": "Denmark",
"id": 5375,
"released": "1995-00-00",
"artists": {
"artist": {
"id": 5139,
"anv": "",
"name": "Future 3",
"role": "",
"tracks": "",
"join": ""
}
},
"title": "We Are The Future 3",
"master_id": 638422,
"tracklist": {
"track": [
{
"position": 1,
"duration": "8:04",
"title": "Future 3"
},
{
"position": 2,
"duration": "7:38",
"title": "Silver M"
},
{
"position": 3,
"duration": "7:27",
"title": "Renaldo"
},
{
"position": 4,
"duration": "6:04",
"title": "B.O.Y.D."
},
{
"position": 5,
"duration": "6:12",
"title": "Fumble"
},
{
"position": 6,
"duration": "6:12",
"title": "Dawn"
},
{
"position": 7,
"duration": "11:54",
"title": "Bubbles At Dawn"
},
{
"position": 8,
"duration": "6:03",
"title": "D.A.W.N. At 6"
},
{
"position": 9,
"duration": "8:50",
"title": 4684351684651
}
]
},
"data_quality": "Needs Vote",
"extraartists": {
"artist": [
{
"id": 2647642,
"anv": "",
"name": "Danesadwork",
"role": "Cover",
"tracks": "",
"join": ""
},
{
"id": 2647647,
"anv": "",
"name": "Djon Edvard Petersen",
"role": "Photography By",
"tracks": "",
"join": ""
},
{
"id": 114164,
"anv": "",
"name": "Anders Remmer",
"role": "Written-By",
"tracks": "",
"join": ""
},
{
"id": 435979,
"anv": "",
"name": "Jesper Skaaning",
"role": "Written-By",
"tracks": "",
"join": ""
},
{
"id": 15691,
"anv": "",
"name": "Thomas Knak",
"role": "Written-By",
"tracks": "",
"join": ""
}
]
},
"notes": "© 1995 April Records APS ℗ 1995 April Records APS"
}
}
I am trying to get those titles which end with 'At Dawn'.
I am using the following command
r.db("discogs1").table("releases").filter(function(doc){ return doc('release')('title').match('At Dawn$')})
But I get errors as follows:
RqlRuntimeError: Expected type STRING but found NUMBER in:r.db("discogs1").table("releases").filter(function(var_24) { return var_24("release")("title").match("At Dawn$"); })
I tried different combinations but I can't seem to get it to work
It seems that some of your documents don't have a row('release')('title') property that is a string. Some of them are numbers, so when you try to call .match on them, they throw an error because .match only works on strings.
To see if this is true, try the following:
r.db("discogs1").table("releases")
.filter(r.row('release')('title').typeOf().ne('STRING'))
.count()
Ideally, the result of this should be 0, since no document should have a title property that's not a string. If it's higher than 0, that's why you're getting an error.
If you want to only get documents where the title is a string, you can do the following:
r.db("discogs1").table("releases")
.filter(r.row('release')('title').typeOf().eq('STRING'))
.filter(function(doc){ return doc('release')('title').match('At Dawn$')})
This query will work, because it will filter our all documents where the title is not a string.
If you want to coerce all title into strings, you can do the following:
r.db("discogs1").table("releases")
.filter(r.row('release')('title').typeOf().ne('STRING'))
.merge(function (row) {
return {
'title': row('title').coerceTo('string')
}
})
If you want to delete all documents where the title is not a string, you can do this:
r.db("discogs1").table("releases")
.filter(r.row('release')('title').typeOf().ne('STRING'))
.delete()

Resources