Socket
Book a DemoInstallSign in
Socket

wordnet

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wordnet

English-English dictionary with 140k+ words from WordNet.

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
2
Created
Source

WordNet.js

Simple Node.js module for accessing Princeton University's WordNet dictionary.

Installation

$ npm install wordnet

Usage

const wordnet = require('wordnet');

// (Required) Load the WordNet database.
await wordnet.init();

// List all available words.
let list = await wordnet.list();

// All methods return promises.
wordnet.lookup('enlightened')
  .then((definitions) => {
    definitions.forEach((def) => {
      console.log(`type: ${def.meta.synsetType}`)
      console.log(`${def.glossary}\n`);
    });
  })
  .catch((e) => {
    console.error(e);
  });

Check out the examples folder for more.

API

wordnet.init([database_dir])

Loads the WordNet database. Takes an optional folder path (as a String).

wordnet.lookup(word, [skipPointers])

Returns definitions (metadata and glossary) for the given word. The definitions include pointers to related words, which can be omitted by passing skipPointers = true.

wordnet.list()

Lists all available words in the WordNet database. If called before wordnet.init() finishes, it will return an empty array.

License

MIT License

3rd-party License

Princeton University's WordNet License

Keywords

wordnet

FAQs

Package last updated on 30 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts