This commit is contained in:
Vishwac Sena Kannan 2019-09-25 14:47:20 -07:00
Родитель 8b78c1497d
Коммит ac87b96bdd
14 изменённых файлов: 34 добавлений и 99 удалений

Просмотреть файл

@ -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",