0.0.2 • Published 8 years ago

define-it v0.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

DefineIt

Get dictionary definitions for any word in your Node app. Available on npm.

Usage

Setup

Install via npm.

npm install define-it

Running

Either request a full JSON response or only the words' meanings.

Full JSON

var defineJson = require('define-it').json;

defineJSON('big data', function(err, res) {
	if (err) console.error(err);
	if (res) console.log(res);
});

// will return
{
 "kind": "scribe#ReferenceGetResponse",
 "ttl": "900000",
 "data": [
  {
   "dataType": "dictionary",
   "numToShow": 1,
   "groupNumber": 0,
   "groupResult": {
    "query": "big data",
    "displayName": "\u003cb\u003ebig da·ta\u003c/b\u003e",
    "dataset": {
     "dataset": "dictionary"
    },
    "score": 1.0
   },
   "sectionType": "dictionary",
   "dictionaryData": {
    "word": "big data",
    "dictionaryType": "STANDARD",
    "definitionData": [
     {
      "word": "big data",
      "pos": "Noun",
      "meanings": [
       {
        "meaning": "extremely large data sets that may be analyzed computationally to reveal patterns, trends, and associations, especially relating to human behavior and interactions.",
        "examples": [
         "much IT investment is going towards managing and maintaining big data"
        ]
       }
      ],
      "phoneticText": "",
      "wordForms": [
       {
        "word": "big data",
        "form": "noun"
       }
      ]
     }
    ]
   }
  }
 ],
 "responseHandled": true
}

Definitions only (some most words have multiple meanings, so generally arr.length > 1)

var define = require('define-it').definitions;

define('big data', function(err, res) {
	if (err) console.error(err);
	if (res) console.log(res);
});

// will return
["extremely large data sets that may be analyzed computationally to reveal patterns, trends, and associations, especially relating to human behavior and interactions."]

Data source

All data is retrieved from the unofficial Google dictionary dataset. Link.

Contribute

Feel free to make a pull request or open an issue.

Update

Feb. 11, 2016 - The Google dictionairy api has been deprecated so the package is broken. Currently working on refactoring to use another source for definitions.

0.0.2

8 years ago

0.0.1

8 years ago