
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A major goal for wn-ts is seamless support for both Node.js and browser environments, following the proven strategy of wordpos and wordpos-web. The plan includes:
wn-ts-web/README.md.Note: Tool-specific tests for browser tooling (such as the data conversion script) are colocated in
wn-ts/tools/tests/rather than the maintests/directory. This keeps the core test suite focused on the library itself and clarifies the external/plugin nature of these tools.
See the Implementation Plan & Checklist in wn-ts-web/README.md for detailed progress and technical steps.
A modern TypeScript implementation of the wn library for accessing WordNet data. This port provides full API parity with the Python wn library while leveraging TypeScript's type safety and modern JavaScript features.
Major Features Implemented:
morphyThis TypeScript port has undergone a thorough parity review against the Python wn library. All critical gaps identified in previous reviews have now been resolved:
All core logic, algorithms, and API signatures are now at full parity with the Python version. Remaining differences are limited to advanced features (see Roadmap below).
npm install wn-ts
# or
pnpm add wn-ts
The library includes a unified CLI for data management and querying:
# Install globally for CLI access
npm install -g wn-ts
# Download a WordNet project
wn-ts download oewn:2024
# Add a lexical resource
wn-ts add oewn-2024-english-wordnet-2024.xml.gz
# Query the database
wn-ts query run v
# Show database status
wn-ts db status
# Unlock locked databases
wn-ts db unlock
# Clean up cache directories
wn-ts db clean
# Export data
wn-ts export --format json --output export.json --include oewn
# List available projects
wn-ts projects
# Show configuration
wn-ts config
import { Wordnet, download, add } from 'wn-ts';
// Download and add a WordNet project
await download('oewn:2024');
await add('oewn-2024-english-wordnet-2024.xml.gz');
// Create a WordNet instance
const wn = new Wordnet('oewn');
// Look up words
const words = await wn.words('run', 'v');
console.log(words);
// Get synsets
const synsets = await wn.synsets('run', 'v');
for (const synset of synsets) {
console.log(`Synset: ${synset.id}`);
console.log(`Definition: ${synset.definitions[0]?.text}`);
console.log(`Examples: ${synset.examples.map(e => e.text).join(', ')}`);
console.log(`Members: ${synset.members.join(', ')}`);
}
// Get senses
const senses = await wn.senses('run', 'v');
for (const sense of senses) {
console.log(`Sense: ${sense.id}`);
console.log(`Examples: ${sense.examples.map(e => e.text).join(', ')}`);
}
getDownloadableLexicons(): string[]Returns a list of lexicons that are available for download from the online index. These are lexicons that can be downloaded but may not be currently installed locally.
Returns: Array of lexicon IDs (e.g., ['oewn', 'omw', 'odenet'])
Example:
import { getDownloadableLexicons } from 'wn-ts';
const downloadable = getDownloadableLexicons();
console.log(downloadable); // ['oewn', 'omw', 'odenet', ...]
getAllAvailableLexicons(): Promise<string[]>Returns a comprehensive list of all available lexicons, including both downloadable (online) and installed (offline) lexicons. This provides a complete view of what's available to the user.
Returns: Promise resolving to array of lexicon IDs
Example:
import { getAllAvailableLexicons } from 'wn-ts';
const allLexicons = await getAllAvailableLexicons();
console.log(allLexicons); // ['oewn', 'omw', 'odenet', 'installed-lexicon', ...]
getInstalledLexicons(): Promise<LexiconInfo[]>Returns detailed information about lexicons currently installed in the local database.
Returns: Promise resolving to array of lexicon information objects
Example:
import { getInstalledLexicons } from 'wn-ts';
const installed = await getInstalledLexicons();
console.log(installed);
// [
// { id: 'oewn', label: 'Open English WordNet', language: 'en', license: 'MIT' },
// { id: 'omw', label: 'Open Multilingual WordNet', language: 'mul', license: 'CC BY 3.0' }
// ]
// Download projects
await download('oewn:2024');
await download('omw:1.4');
// Add lexical resources
await add('path/to/lexical-resource.xml');
// Remove lexicons
await remove('lexicon-id');
// Export data
await exportData({
format: 'json',
output: 'export.json',
include: ['oewn']
});
import { getProjects, getProject, getProjectVersions } from 'wn-ts';
// Get all available projects
const projects = getProjects();
// Get specific project
const project = getProject('oewn');
// Get available versions
const versions = getProjectVersions('oewn');
import { compute, information_content } from 'wn-ts';
// Compute IC from corpus
const corpus = ['run', 'running', 'runner', 'runs'];
const freq = await compute(corpus, wn);
// Calculate IC for a synset
const ic = information_content(synset, freq);
import { path, wup, lch, res, jcn, lin } from 'wn-ts';
// Path similarity
const pathSim = await path(synset1, synset2, wn);
// Wu-Palmer similarity
const wupSim = await wup(synset1, synset2, wn);
// Leacock-Chodorow similarity
// Note: You need to calculate maxTaxonomyDepth for the relevant POS first.
// const maxDepth = await taxonomyDepth(wn, 'n');
// const lchSim = await lch(synset1, synset2, maxDepth, wn);
// Information Content-based metrics
// const ic = await compute(corpus, wn);
// const resSim = await res(synset1, synset2, ic, wn);
// const jcnSim = await jcn(synset1, synset2, ic, wn);
// const linSim = await lin(synset1, synset2, ic, wn);
// Get overall database statistics
const stats = await wn.getStatistics();
console.log(`Total words: ${stats.totalWords}`);
console.log(`Total synsets: ${stats.totalSynsets}`);
// Get lexicon-specific statistics
const lexiconStats = await wn.getLexiconStatistics();
lexiconStats.forEach(stat => {
console.log(`${stat.lexiconId}: ${stat.wordCount} words, ${stat.synsetCount} synsets`);
});
// Analyze data quality
const quality = await wn.getDataQualityMetrics();
console.log(`ILI coverage: ${quality.iliCoveragePercentage}%`);
// Get part-of-speech distribution
const posDist = await wn.getPartOfSpeechDistribution();
Object.entries(posDist).forEach(([pos, count]) => {
console.log(`${pos}: ${count} synsets`);
});
import { LexiconHelper } from 'wn-cli/src/utils/lexicon-helpers';
// List all lexicons available for download (online)
const downloadableLexicons = LexiconHelper.getDownloadableLexicons();
console.log(downloadableLexicons);
// List installed lexicons (offline)
import { lexicons } from 'wn-ts';
const installedLexicons = await lexicons();
console.log(installedLexicons);
import { config } from 'wn-ts';
// Set data directory
config.dataDirectory = '/path/to/wordnet/data';
// Set download directory
config.downloadDirectory = '/path/to/downloads';
The library supports downloading and using various WordNet projects:
And many more language-specific WordNets through the OMW project.
# Run all tests with verbose output
pnpm test
# Run tests with coverage
pnpm test:coverage
# Run e2e tests
pnpm test:e2e
The library is fully integrated with the workspace CI pipeline:
# Run the complete CI pipeline (from workspace root)
pnpm ci:full
# Run individual CI steps
pnpm ci:build # Build wn-ts library
pnpm ci:test # Run all tests (including e2e)
pnpm ci:demo # Run all demo use cases
pnpm ci:benchmark # Run all benchmark tests
Important: The library provides a clean API without direct database access. All functionality is available through:
new Wordnet() for all data accesswords(), synsets(), etc.wn-ts/similarity, wn-ts/taxonomy, etc.Do not use direct database access - the db export is for internal debugging only.
We welcome contributions! Please see our contributing guidelines and development setup:
pnpm install and pnpm build to set up the development environmentpnpm test to ensure all tests passMIT License - see LICENSE file for details.
wn library - The original implementationwn library (via wn-pybridge) to identify and address bottlenecks.Current Progress: 95% complete with all core functionality implemented and tested.
Recent Updates:
A major goal for wn-ts is to provide seamless support for both Node.js and browser environments, following the proven strategy of wordpos and wordpos-web. Here’s how this will be achieved:
wordpos uses a single codebase with separate entry points for Node.js and browser, exposing the same API in both environments.wordpos-web provides a static demo and distribution, bundling the browser build and data files for easy deployment.wn-ts will maintain a single codebase with environment-specific entry points (using the browser field in package.json).wn-ts-web will serve as a static demo and distribution, bundling the browser build and data files, and providing example usage.Next Steps:
wn-ts.wn-ts-web demo and static distribution.For more, see the wordpos README and wordpos-web for a working example of this strategy.
FAQs
Wordnet interface library - TypeScript port
The npm package wn-ts receives a total of 0 weekly downloads. As such, wn-ts popularity was classified as not popular.
We found that wn-ts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.