wordnet-parser v2.3.1
Wordnet Parser
The fastest WordNet node API out there ⚡
What is WordNet?
It is a large database for English words, their definitions, and other lexical information. The project is made by Princeton University.
API
Note on DBPATH
First of all: download the WordNet database files
The api provided below relies on a constant variable called DBPATH
which is initiliazed as such:
const DBPATH = process.env.DBPATH || "./dict";
If your WordNet database is in the root directory of your project you don't need to worry about anything, jump right in to the API. Otherwise if it isn't, you need to create a .env
file in the root directory of your project and write:
DBPATH="path/to/dict/folder"
listWords():void
This function is memoized using memoizee
. Thus it is lightning fast!
listWords()
.then((list)=>{
console.log(list)
})
// list of all words in WordNet database
Output:
In just 17.8ms
!
lookup():Promise<Word[] | undefined>
Uses a memoized map to lookup word. Also blazingly fast!
lookup("laugh")
.then((result)=>{
if (result !== undefined)
console.log(result)
})
Output:
In just 12.5ms
!
Downloads
linux
windows
Download the WordNet browser, command-line tool, and database files with InstallShield self-extracting installer
Follow the installation process and make sure you remember the folder where you installed
WordNet
.Go to the
dict
folder and copy the highlighted files (below) into a database folder (e.g. name itdict
) in your project: