Socket
Socket
Sign inDemoInstall

node-wordnet

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-wordnet - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

37

lib/wordnet.js

@@ -129,2 +129,39 @@ var DataFile, IndexFile, Promise, WordNet, async, fs, path,

WordNet.prototype.querySense = function(input, callback) {
var pos, word, wordnet, _ref;
wordnet = this;
_ref = input.split('#'), word = _ref[0], pos = _ref[1];
return wordnet.lookup(input, function(results) {
var i, sense, senseCounts, senses;
senseCounts = {};
senses = (function() {
var _i, _len, _results;
_results = [];
for (i = _i = 0, _len = results.length; _i < _len; i = ++_i) {
sense = results[i];
pos = sense.pos;
if (pos === 's') {
pos = 'a';
}
if (senseCounts[pos] == null) {
senseCounts[pos] = 1;
}
_results.push(word + "#" + pos + "#" + senseCounts[pos]++);
}
return _results;
})();
return callback(senses);
});
};
WordNet.prototype.querySenseAsync = function(input) {
var wordnet;
wordnet = this;
return new Promise(function(resolve, reject) {
return wordnet.querySense(input, function(data) {
return resolve(data);
});
});
};
WordNet.prototype.lookupFromFiles = function(files, results, word, callback) {

@@ -131,0 +168,0 @@ var file, wordnet;

2

package.json
{
"name": "node-wordnet",
"version": "0.1.4",
"version": "0.1.5",
"description": "Node.js interface for Wordnet",

@@ -5,0 +5,0 @@ "main": "lib/wordnet.js",

@@ -80,3 +80,17 @@ Wordnet

### querySense(query, callback)
Queries WordNet to find all the senses of a given word, optionally with a
part-of-speech.
```javascript
var wordnet = new WordNet()
wordnet.querySense('axes#n', console.log);
```
### querySenseAsync(query)
Similar to `querySense(query, callback)` but returning a promise.
Future work

@@ -83,0 +97,0 @@ -----------

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc