Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
node-wordnet
Advanced tools
This is an implementation of a Wordnet API in pure JavaScript. It was initially adapted from NaturalNode/natural, which had the original core implementation, but which was very basic and hard to use for higher-level tasks.
This is a drop-in replacement for the Wordnet access in NaturalNode/natural, but with additional methods that make it easier to use for other tasks, and probably higher in performance too. For example, the original implementation opens file handles for more or less each individual low-level query.
More recently, it includes a promise-based set of methods parallel to callback ones.
Because most of the access is asynchronous, this does make it easier to use. Methods
ending Async
return promises. This will also assist error handling, when we get to
implement that, as it was not the strongest part of the original implementation.
Here's an example of looking up definitions for the word, "node".
var wordnet = new WordNet()
wordnet.lookup('node', function(results) {
results.forEach(function(result) {
console.log('------------------------------------');
console.log(result.synsetOffset);
console.log(result.pos);
console.log(result.lemma);
console.log(result.synonyms);
console.log(result.pos);
console.log(result.gloss);
});
});
Similar to lookup(word, callback)
but returning a promise.
Given a synset offset and a part of speech, a definition can be looked up directly.
var wordnet = new WordNet()
wordnet.get(4424418, 'n', function(result) {
console.log('------------------------------------');
console.log(result.lemma);
console.log(result.pos);
console.log(result.gloss);
console.log(result.synonyms);
});
Similar to get(offset, pos, callback)
but returning a promise.
Returns valid morphological exceptions.
var wordnet = new WordNet()
wordnet.validForms('axes#n', console.log);
Similar to validForms(word, callback)
but returning a promise.
Queries WordNet to find all the senses of a given word, optionally with a part-of-speech.
var wordnet = new WordNet()
wordnet.querySense('axes#n', console.log);
Similar to querySense(query, callback)
but returning a promise.
Error handling needs to be tightened a fair bit, and there is plenty of room to make the API a bit easier to use as well.
FAQs
Node.js interface for Wordnet
The npm package node-wordnet receives a total of 134 weekly downloads. As such, node-wordnet popularity was classified as not popular.
We found that node-wordnet demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.