Fixes
This commit is contained in:
Родитель
8b78c1497d
Коммит
ac87b96bdd
|
@ -622,12 +622,6 @@ const parseAndHandleIntent = function (parsedContent, luResource) {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
// if this intent does not have any utterances, push this pattern as an utterance as well.
|
||||
let intentInUtterance = helpers.filterMatch(parsedContent.LUISJsonStructure.utterances, 'intent', intentName);
|
||||
if (intentInUtterance.length === 0) {
|
||||
parsedContent.LUISJsonStructure.utterances.push(new helperClass.uttereances(utterance, intentName, []));
|
||||
}
|
||||
} else {
|
||||
entitiesFound.forEach(entity => {
|
||||
// throw an error if phraselist entity is explicitly labelled in an utterance
|
||||
|
@ -779,7 +773,7 @@ const parseAndHandleEntity = function (parsedContent, luResource, log, locale) {
|
|||
let parsedRoleAndType = helpers.getRolesAndType(entityType);
|
||||
let entityRoles = parsedRoleAndType.roles;
|
||||
entityType = parsedRoleAndType.entityType;
|
||||
let pEntityName = (entityName === 'PREBUILT') ? entityType : entityName;
|
||||
let pEntityName = (entityName.toLowerCase() === 'prebuilt') ? entityType : entityName;
|
||||
// see if we already have this as Pattern.Any entity
|
||||
// see if we already have this in patternAny entity collection; if so, remove it but remember the roles (if any)
|
||||
for (let i in parsedContent.LUISJsonStructure.patternAnyEntities) {
|
||||
|
|
|
@ -519,8 +519,6 @@ describe('parseFile correctly parses utterances', function () {
|
|||
- I want {foodType}`;
|
||||
parseFile.parseFile(testLUFile, false)
|
||||
.then(res => {
|
||||
assert.equal(res.LUISJsonStructure.utterances.length, 1);
|
||||
assert.equal(res.LUISJsonStructure.utterances[0].text, "I want {foodType}");
|
||||
assert.equal(res.LUISJsonStructure.patterns.length, 1);
|
||||
assert.equal(res.LUISJsonStructure.patterns[0].pattern, "I want {foodType}");
|
||||
assert.equal(res.LUISJsonStructure.patternAnyEntities.length, 1);
|
||||
|
@ -571,8 +569,6 @@ describe('parseFile correctly parses utterances', function () {
|
|||
- I want {foodType} and {foodType}`;
|
||||
parseFile.parseFile(testLUFile, false)
|
||||
.then(res => {
|
||||
assert.equal(res.LUISJsonStructure.utterances.length, 1);
|
||||
assert.equal(res.LUISJsonStructure.utterances[0].text, "I want {foodType} and {foodType}");
|
||||
assert.equal(res.LUISJsonStructure.patterns.length, 1);
|
||||
assert.equal(res.LUISJsonStructure.patterns[0].pattern, "I want {foodType} and {foodType}");
|
||||
assert.equal(res.LUISJsonStructure.patternAnyEntities.length, 1);
|
||||
|
@ -619,8 +615,6 @@ describe('parseFile correctly parses utterances', function () {
|
|||
- {userName}`;
|
||||
parseFile.parseFile(testLUFile, false)
|
||||
.then(res => {
|
||||
assert.equal(res.LUISJsonStructure.utterances.length, 1);
|
||||
assert.equal(res.LUISJsonStructure.utterances[0].text, "{userName}");
|
||||
assert.equal(res.LUISJsonStructure.patterns.length, 1);
|
||||
assert.equal(res.LUISJsonStructure.patterns[0].pattern, "{userName}");
|
||||
assert.equal(res.LUISJsonStructure.patternAnyEntities.length, 1);
|
||||
|
@ -969,4 +963,36 @@ describe('parseFile correctly parses utterances', function () {
|
|||
.catch(err => done())
|
||||
})
|
||||
|
||||
it ('patterns are handled correctly', function(done){
|
||||
let testLU = `# intent1
|
||||
- this is a {number}
|
||||
|
||||
$ prebuilt : number`;
|
||||
|
||||
parseFile.parseFile(testLU)
|
||||
.then(res => {
|
||||
assert.equal(res.LUISJsonStructure.patternAnyEntities.length, 0);
|
||||
assert.equal(res.LUISJsonStructure.prebuiltEntities.length, 1);
|
||||
done();
|
||||
})
|
||||
.catch(err => done('Fail!'))
|
||||
})
|
||||
|
||||
it ('patterns are handled correctly (with roles)', function(done){
|
||||
let testLU = `# intent1
|
||||
- this is a {number:one}
|
||||
|
||||
$ prebuilt : number`;
|
||||
|
||||
parseFile.parseFile(testLU)
|
||||
.then(res => {
|
||||
assert.equal(res.LUISJsonStructure.patternAnyEntities.length, 0);
|
||||
assert.equal(res.LUISJsonStructure.prebuiltEntities.length, 1);
|
||||
assert.equal(res.LUISJsonStructure.prebuiltEntities[0].roles.length, 1);
|
||||
done();
|
||||
})
|
||||
.catch(err => done('Fail!'))
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
@ -180,11 +180,6 @@
|
|||
"intent": "CreateAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "delete the {alarmTime} alarm",
|
||||
"intent": "DeleteAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "set phone call as my communication preference",
|
||||
"intent": "CommunicationPreference",
|
||||
|
|
|
@ -143,11 +143,6 @@
|
|||
"text": "set an alarm for 7AM next thursday",
|
||||
"intent": "CreateAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "delete the {alarmTime} alarm",
|
||||
"intent": "DeleteAlarm",
|
||||
"entities": []
|
||||
}
|
||||
],
|
||||
"patterns": [
|
||||
|
|
|
@ -174,11 +174,6 @@
|
|||
"intent": "CreateAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "delete the {alarmTime} alarm",
|
||||
"intent": "DeleteAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "set phone call as my communication preference",
|
||||
"intent": "CommunicationPreference",
|
||||
|
|
|
@ -174,11 +174,6 @@
|
|||
"intent": "CreateAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "delete the {alarmTime} alarm",
|
||||
"intent": "DeleteAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "set phone call as my communication preference",
|
||||
"intent": "CommunicationPreference",
|
||||
|
|
|
@ -200,11 +200,6 @@
|
|||
"intent": "CreateAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "delete the {alarmTime} alarm",
|
||||
"intent": "DeleteAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "set phone call as my communication preference",
|
||||
"intent": "CommunicationPreference",
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
|
||||
|
||||
## DeleteAlarm
|
||||
- delete the {alarmTime} alarm
|
||||
- delete alarm
|
||||
- delete the {alarmTime} alarm
|
||||
- remove the {alarmTime} alarm
|
||||
|
||||
|
||||
|
|
|
@ -226,11 +226,6 @@
|
|||
"intent": "CreateAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "delete the {alarmTime} alarm",
|
||||
"intent": "DeleteAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "set phone call as my communication preference",
|
||||
"intent": "CommunicationPreference",
|
||||
|
@ -291,11 +286,6 @@
|
|||
"intent": "AskForUserName",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "set {commPreference} as my communication preference",
|
||||
"intent": "CommunicationPreference",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "can I get some m&m",
|
||||
"intent": "Buy chocolate",
|
||||
|
|
|
@ -125,11 +125,6 @@
|
|||
"intent": "CreateAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "delete the {alarmTime} alarm",
|
||||
"intent": "DeleteAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "set phone call as my communication preference",
|
||||
"intent": "CommunicationPreference",
|
||||
|
@ -256,11 +251,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "set {commPreference} as my communication preference",
|
||||
"intent": "CommunicationPreference",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "can I get some m&m",
|
||||
"intent": "Buy chocolate",
|
||||
|
|
|
@ -90,16 +90,6 @@
|
|||
"text": "set an alarm for 7AM next thursday",
|
||||
"intent": "All",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "delete the {alarmTime} alarm",
|
||||
"intent": "All",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "set {commPreference} as my communication preference",
|
||||
"intent": "All",
|
||||
"entities": []
|
||||
}
|
||||
],
|
||||
"patterns": [],
|
||||
|
|
|
@ -90,26 +90,6 @@
|
|||
"text": "set an alarm for 7AM next thursday",
|
||||
"intent": "All",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "delete the {alarmTime} alarm",
|
||||
"intent": "All",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "set {commPreference} as my communication preference",
|
||||
"intent": "All",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "delete the {alarmTime} alarm",
|
||||
"intent": "All",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "set {commPreference} as my communication preference",
|
||||
"intent": "All",
|
||||
"entities": []
|
||||
}
|
||||
],
|
||||
"patterns": [],
|
||||
|
|
|
@ -177,11 +177,6 @@
|
|||
"intent": "CreateAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "delete the {alarmTime} alarm",
|
||||
"intent": "DeleteAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "set phone call as my communication preference",
|
||||
"intent": "CommunicationPreference",
|
||||
|
|
|
@ -174,11 +174,6 @@
|
|||
"intent": "CreateAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "delete the {alarmTime} alarm",
|
||||
"intent": "DeleteAlarm",
|
||||
"entities": []
|
||||
},
|
||||
{
|
||||
"text": "set phone call as my communication preference",
|
||||
"intent": "CommunicationPreference",
|
||||
|
|
Загрузка…
Ссылка в новой задаче