Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/lu/src/parser/lu/luMerger.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const resolveRefs = function(refTree, srcId) {
if (result.utterances !== undefined) {
result.utterances.forEach(utt => {
if (luObj.uttHash[utt] === undefined) {
luObj.utterances.push(new hClasses.uttereances(utt, ref.uttObj.intent));
luObj.utterances.push(new hClasses.utterances(utt, ref.uttObj.intent));
luObj.uttHash[utt] = '';
}
})
Expand Down
2 changes: 1 addition & 1 deletion packages/lu/src/parser/lufile/classes/hclasses.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const readerObj = {
this.utterances = utterances?utterances:[]
}
},
uttereances: class {
utterances: class {
constructor(text, intent, entities) {
this.text = text?text:'';
this.intent = intent?intent:'';
Expand Down
2 changes: 1 addition & 1 deletion packages/lu/src/parser/lufile/newEntitySection.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class NewEntitySection extends BaseSection {

ExtractType(parseTree) {
if (parseTree.newEntityDefinition().newEntityLine().newEntityType()) {
return parseTree.newEntityDefinition().newEntityLine().newEntityType().getText().trim();
return parseTree.newEntityDefinition().newEntityLine().newEntityType().getText().trim().toLowerCase();
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/lu/src/parser/lufile/parseFileContents.js
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ const parseAndHandleSimpleIntentSection = function (parsedContent, luResource, c
if (hashTable[uttHash]) {
utteranceObject = hashTable[uttHash];
} else {
utteranceObject = new helperClass.uttereances(utterance, intentName, []);
utteranceObject = new helperClass.utterances(utterance, intentName, []);
parsedContent.LUISJsonStructure.utterances.push(utteranceObject);
hashTable[uttHash] = utteranceObject;
}
Expand Down Expand Up @@ -1230,7 +1230,7 @@ const parseAndHandleSimpleIntentSection = function (parsedContent, luResource, c
}
} else {
if(!hashTable[uttHash]) {
let utteranceObject = new helperClass.uttereances(utterance, intentName, []);
let utteranceObject = new helperClass.utterances(utterance, intentName, []);
parsedContent.LUISJsonStructure.utterances.push(utteranceObject);
hashTable[uttHash] = utteranceObject;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/lu/src/parser/luis/luConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ const addUtteranceToCollection = function (attribute, srcItem, matchInTarget) {
if(attribute === 'text') {
matchInTarget.utterances.push(srcItem);
} else {
matchInTarget.utterances.push(new helperClasses.uttereances(srcItem.pattern.replace('{', '{@'),srcItem.intent,[]));
matchInTarget.utterances.push(new helperClasses.utterances(srcItem.pattern.replace('{', '{@'),srcItem.intent,[]));
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/lu/test/parser/lufile/classes/classes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ describe('Testing all classes', function() {
});
});

describe('uttereances class', function() {
describe('utterances class', function() {
it('can create a new instance with no values passed in', function() {
assert.equal(new hClasses.uttereances().text, '');
assert.equal(new hClasses.utterances().text, '');
});
});

Expand Down
22 changes: 22 additions & 0 deletions packages/lu/test/parser/lufile/parseFileContents.parseFile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1090,4 +1090,26 @@ describe('parseFile correctly parses utterances', function () {
})
.catch(err => done(err))
})

it ('Correctly parses entity type that is case insensitive', function(done){
let testLU = `
@ ML test
@ PREbuilt personName
@ phraseList abc(interchangeable) disabledforallmodels =
- a, b, c`;
parseFile.parseFile(testLU)
.then(res => {
assert.equal(res.LUISJsonStructure.entities.length, 1);
assert.equal(res.LUISJsonStructure.entities[0].name, "test");
assert.equal(res.LUISJsonStructure.prebuiltEntities.length, 1);
assert.equal(res.LUISJsonStructure.prebuiltEntities[0].name, "personName");
assert.equal(res.LUISJsonStructure.model_features[0].enabledForAllModels, false);
assert.equal(res.LUISJsonStructure.model_features.length, 1);
assert.equal(res.LUISJsonStructure.model_features[0].name, "abc");
assert.equal(res.LUISJsonStructure.model_features[0].words, "a,b,c");
assert.equal(res.LUISJsonStructure.model_features[0].enabledForAllModels, false);
done();
})
.catch(err => done(err))
})
})