@nlpjs/ner
Advanced tools
Comparing version 4.14.3 to 4.17.0
{ | ||
"name": "@nlpjs/ner", | ||
"version": "4.14.3", | ||
"version": "4.17.0", | ||
"description": "Named Entity Recognition", | ||
@@ -28,7 +28,7 @@ "author": { | ||
"dependencies": { | ||
"@nlpjs/core": "^4.14.0", | ||
"@nlpjs/language-min": "^4.6.0", | ||
"@nlpjs/similarity": "^4.14.0" | ||
"@nlpjs/core": "^4.17.0", | ||
"@nlpjs/language-min": "^4.17.0", | ||
"@nlpjs/similarity": "^4.17.0" | ||
}, | ||
"gitHead": "1f8a3bcfe527f0dbb6c7effdfe092b9b9af0d02a" | ||
"gitHead": "5a7730f9460a741b56386c8bd7d90ca25b53435f" | ||
} |
@@ -185,3 +185,3 @@ /* | ||
} | ||
return allRules.filter((x) => x.type === 'enum'); | ||
return allRules; | ||
} | ||
@@ -264,21 +264,23 @@ | ||
const current = rule.rules[i]; | ||
for (let j = 0; j < current.texts.length; j += 1) { | ||
const newEdges = this.getBestSubstringList( | ||
text, | ||
current.texts[j], | ||
words, | ||
current.threshold || threshold | ||
); | ||
for (let k = 0; k < newEdges.length; k += 1) { | ||
edges.push({ | ||
...newEdges[k], | ||
entity: rule.name, | ||
type: rule.type, | ||
option: rule.rules[i].option, | ||
sourceText: current.texts[j], | ||
utteranceText: text.substring( | ||
newEdges[k].start, | ||
newEdges[k].end + 1 | ||
), | ||
}); | ||
if (current && current.option && Array.isArray(current.texts)) { | ||
for (let j = 0; j < current.texts.length; j += 1) { | ||
const newEdges = this.getBestSubstringList( | ||
text, | ||
current.texts[j], | ||
words, | ||
current.threshold || threshold | ||
); | ||
for (let k = 0; k < newEdges.length; k += 1) { | ||
edges.push({ | ||
...newEdges[k], | ||
entity: rule.name, | ||
type: rule.type, | ||
option: rule.rules[i].option, | ||
sourceText: current.texts[j], | ||
utteranceText: text.substring( | ||
newEdges[k].start, | ||
newEdges[k].end + 1 | ||
), | ||
}); | ||
} | ||
} | ||
@@ -285,0 +287,0 @@ } |
@@ -38,3 +38,3 @@ /* | ||
} | ||
return allRules.filter((x) => x.type === 'regex'); | ||
return allRules; | ||
} | ||
@@ -46,3 +46,3 @@ | ||
do { | ||
const match = regex.exec(utterance); | ||
const match = regex instanceof RegExp ? regex.exec(utterance) : null; | ||
if (match) { | ||
@@ -49,0 +49,0 @@ result.push({ |
@@ -250,16 +250,18 @@ /* | ||
const result = []; | ||
for (let i = 0; i < condition.words.length; i += 1) { | ||
const word = condition.options.noSpaces | ||
? condition.words[i] | ||
: ` ${condition.words[i]}`; | ||
const wordPositions = this.findWord(utterance, word); | ||
if (!condition.options.noSpaces) { | ||
const wordPositions2 = this.findWord(utterance, condition.words[i]); | ||
if (wordPositions2.length > 0 && wordPositions2[0].start === 0) { | ||
wordPositions.unshift(wordPositions2[0]); | ||
if (condition && Array.isArray(condition.words)) { | ||
for (let i = 0; i < condition.words.length; i += 1) { | ||
const word = condition.options.noSpaces | ||
? condition.words[i] | ||
: ` ${condition.words[i]}`; | ||
const wordPositions = this.findWord(utterance, word); | ||
if (!condition.options.noSpaces) { | ||
const wordPositions2 = this.findWord(utterance, condition.words[i]); | ||
if (wordPositions2.length > 0 && wordPositions2[0].start === 0) { | ||
wordPositions.unshift(wordPositions2[0]); | ||
} | ||
} | ||
if (wordPositions.length > 0) { | ||
result.push(...this.getResults(utterance, wordPositions, type, name)); | ||
} | ||
} | ||
if (wordPositions.length > 0) { | ||
result.push(...this.getResults(utterance, wordPositions, type, name)); | ||
} | ||
} | ||
@@ -280,3 +282,3 @@ const filteredResult = []; | ||
} | ||
return allRules.filter((x) => x.type === 'trim'); | ||
return allRules; | ||
} | ||
@@ -283,0 +285,0 @@ |
@@ -0,0 +0,0 @@ /* |
63553
1379
Updated@nlpjs/core@^4.17.0
Updated@nlpjs/language-min@^4.17.0
Updated@nlpjs/similarity@^4.17.0