wordnet-parser
TypeScript icon, indicating that this package has built-in type declarations

2.3.1 • Public • Published

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

License

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.3.12latest

Version History

VersionDownloads (Last 7 Days)Published
2.3.12
2.3.00
2.2.00
2.1.00
2.0.00
1.0.00

Package Sidebar

Install

npm i wordnet-parser

Weekly Downloads

1

Version

2.3.1

License

ISC

Unpacked Size

11.1 kB

Total Files

4

Last publish

Collaborators

  • bosari-a