Registry / database / wordnet-db

wordnet-db

JSON →
library3.1.14jsnpmunverified

wordnet-db is a specialized Node.js package designed to provide the complete database files for WordNet 3.1 directly within an npm installation. Currently at version 3.1.14, it offers a robust solution for developers requiring offline access to the Princeton WordNet lexical database, which is particularly useful for natural language processing libraries like `wordpos` and `natural`. The package differentiates itself by pre-bundling the entire 34 MB uncompressed WordNet dictionary, eliminating the need for on-demand downloads or complex setup scripts during application runtime. Its release cadence is primarily reactive, addressing compatibility with newer Node.js versions, fixing installation-related issues, or updating to newer WordNet database versions (though it has been stable on WordNet 3.1 for a while). This ensures that applications can deploy with a guaranteed, self-contained WordNet data source, even in environments with restricted internet access.

npm install wordnet-db
INSTALL
IMPORT
SIG · WORDNET-DB
W
wordnet-db
databasejavascriptv3.1.14
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

wordnetDb
✓ const wordnetDb = require('wordnet-db');
✗ import wordnetDb from 'wordnet-db';
This package is CommonJS-only. ES modules import syntax will fail.
dbPath
✓ const dbPath = require('wordnet-db').path;
✗ import { path as dbPath } from 'wordnet-db';
Properties like `path`, `files`, `version`, and `libVersion` are accessed directly from the default export object.
dbVersion
✓ const dbVersion = require('wordnet-db').version;
✗ const { version: dbVersion } = require('wordnet-db');
While object destructuring works with `require`, direct property access is the idiomatic way shown in documentation for this package.

This script demonstrates how to import `wordnet-db`, access its properties (like path and versions), and verify the presence and content of a sample WordNet data file.

const wordnetDb = require('wordnet-db'); const fs = require('fs'); const path = require('path'); console.log('--- WordNet DB Information ---'); console.log(`Package version: ${wordnetDb.libVersion}`); console.log(`WordNet data version: ${wordnetDb.version}`); console.log(`Database files path: ${wordnetDb.path}`); console.log(`Number of files: ${wordnetDb.files.length}`); // Verify a common WordNet data file exists const exampleFile = 'data.noun'; const fullPath = path.join(wordnetDb.path, exampleFile); console.log(`\nChecking for existence of "${exampleFile}" at "${fullPath}"...`); try { fs.accessSync(fullPath, fs.constants.F_OK); console.log(`SUCCESS: "${exampleFile}" found. WordNet database seems correctly installed.`); // Optionally, read a few lines to confirm content const content = fs.readFileSync(fullPath, 'utf8'); console.log(`First 3 lines of ${exampleFile}:\n${content.split('\n').slice(0, 3).join('\n')}`); } catch (err) { console.error(`ERROR: "${exampleFile}" not found or inaccessible. Installation may be incomplete or corrupted.`); console.error(err.message); }
Debug
Known issues
breakingThe package name was changed from `WNdb` to `wordnet-db` to comply with npm naming rules. While old links might still resolve, all new installations and references should use `wordnet-db`.
fix
Update `package.json` dependencies and all `require()` statements from `WNdb` to `wordnet-db`.
affects: >=3.1.2
gotchaOlder Node.js versions (specifically <0.6) are not supported due to the package's internal reliance on Node.js's built-in `zlib` module for handling compressed data.
fix
Ensure your Node.js environment is version 0.6.0 or higher. For modern applications, use the latest LTS Node.js release.
affects: <3.0.1
breakingThe method of database file distribution and installation changed significantly. In versions prior to `3.1.12`, a `tar` dependency was used. From `3.1.12` onwards, `tar` was removed, and from `3.1.13`, the `.tar.gz` archive was removed from the npm package, with dictionary files included directly. This affects installation logic and potential `tar` related issues.
fix
No direct fix needed for newer versions, as it simplifies installation. If you encounter `tar` related errors on older versions, upgrade to `wordnet-db@^3.1.13`.
affects: >=3.1.12
gotchaOn Windows systems, if you are working with WordNet 3.0.0 directly from a git clone, automatic CRLF (Carriage Return Line Feed) conversion can corrupt the data files. This was relevant when text dict files were included uncompressed.
fix
Before cloning the repository on Windows for version 3.0.0, execute `git config core.autocrlf false` to prevent CRLF conversions that can damage data files.
affects: 3.0.0
gotchaInstallation issues were reported with `npm@5` due to postinstall script order. Version `3.1.6` introduced a fix by including `dict` files directly and disabling the postinstall script.
fix
If experiencing installation issues with `npm@5` on older versions, upgrade to `wordnet-db@^3.1.6` or later.
affects: ~3.1.4 - 3.1.5
Errors
Common errors & fixes
Error: Cannot find module 'tar'
An older version of `wordnet-db` was installed which had `tar` as a runtime dependency, and `tar` failed to install correctly.
fix
Upgrade to `wordnet-db@^3.1.13` to use the version where `tar` is no longer a dependency and dictionary files are directly bundled.
WordNet data files appear corrupted or have incorrect line endings on Windows.
When using `wordnet-db@3.0.0` or cloning the repository directly, Git's `core.autocrlf` setting on Windows converted line endings in the plain text data files, corrupting them.
fix
For version `3.0.0` specifically, ensure `git config core.autocrlf false` is set before cloning the repository. For later versions (3.1.x), this issue is largely mitigated by how files are packaged.
Upgrade
Version history
3.1.14latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
45 hits · last 30 days
node
40
OpenAI (training)
1
Resources
wordnet-db — npm install wordnet-db · libregistry