Closed rektdeckard closed 4 years ago
Apologies for all the formatting changes! I can resubmit without them if it's a problem.
Thanks @rektdeckard. Let me go through this now.
0c7758c also should solve #2, so you only need to:
const Dictionary = require('en-dictionary');
When making use of the library.
This patch fixes a bug in which loading a lemma from the database would clobber any existing entries to the database from a different part of speech but with same lemma. For example, the adjective sense of the word "smart" ("showing mental alterness...") was overwritten by the noun sense ("a kind of pain such as that caused by a wound...") when the
data.noun
file was loaded oninit()
.The Database now stores lemmas as a
Map<string, Map<string, Index>>
, where the outer key is the lemma itself, pointing to a map ofPOS -> Index
. In this way, you can access the requisite POS by callingindexLemmaIndex.get("smart")?.get("adjective");
.This affects the return signatures of
searchFor()
andsearchSimpleFor()
, and should be considered a major semver update.