chinese-lexicon
Advanced tools
Comparing version 1.0.24 to 1.0.25
@@ -28,12 +28,12 @@ function scoreGloss(definition, word, index) { | ||
let definitions = []; | ||
for (let entry of matchingEntries) { | ||
if (!entry.definitions.length) return word; | ||
let index = 0; | ||
for (let definition of entry.definitions) { | ||
definitions.push({ | ||
definition, | ||
score: scoreGloss(definition, word, index) | ||
}); | ||
index++; | ||
} | ||
let entry = matchingEntries.filter(x => x.definitions.length).sort((a, b) => b.boost - a.boost)[0]; | ||
if (!entry) return word; | ||
let index = 0; | ||
for (let definition of entry.definitions) { | ||
definitions.push({ | ||
definition, | ||
score: scoreGloss(definition, word, index, entry.boost) | ||
}); | ||
index++; | ||
} | ||
@@ -40,0 +40,0 @@ definitions.sort((a, b) => b.score - a.score); |
{ | ||
"name": "chinese-lexicon", | ||
"version": "1.0.24", | ||
"version": "1.0.25", | ||
"description": "Chinese lexicon containing definitions, character origins, and statistics", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,3 +12,4 @@ let { getGloss, getEntries } = require("./index"); | ||
assert(getGloss("么") === "[particle]"); | ||
assert(getGloss("吗") === `(question particle for "yes-no" questions)`); | ||
console.log("All tests passed."); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13757083