Skip to content

Commit

Permalink
Merge pull request #436 from axa-group/feature/fix_stem_dict
Browse files Browse the repository at this point in the history
fix: stem dict replicates intent. Reduce edges also replicates entity.
  • Loading branch information
Jesús Seijas authored May 4, 2020
2 parents 0f08809 + 5d08163 commit 0758ea0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 32 deletions.
44 changes: 13 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions packages/ner/src/reduce-edges.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ function runDiscard(srcEdge, srcOther, useMaxLength) {
other.len <= edge.len
) {
// Do nothing! entities have same priority
if (
other.start === edge.start &&
other.end === edge.end &&
other.type === 'enum' &&
edge.type === 'enum' &&
other.entity === edge.entity &&
other.option === edge.option
) {
other.discarded = true;
}
} else if (
(useMaxLength ||
other.entity === edge.entity ||
Expand Down
4 changes: 3 additions & 1 deletion packages/nlu/src/domain-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ class DomainManager extends Clonable {
});
const intents = Object.keys(this.intentDict);
for (let i = 0; i < intents.length; i += 1) {
classifications.push({ intent: intents[i], score: 0 });
if (intents[i] !== resolved.intent) {
classifications.push({ intent: intents[i], score: 0 });
}
}
return { domain: resolved.domain, classifications };
}
Expand Down

0 comments on commit 0758ea0

Please sign in to comment.