Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chinese-lexicon

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chinese-lexicon - npm Package Compare versions

Comparing version 1.0.24 to 1.0.25

20

gloss/index.js

@@ -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.");
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc