dictionary-definitions-data

1.0.2 • Public • Published

DICTIONARY DEFINITIONS DATA

dictionary.com-logo.png

Data scraped with spiders from dictionary.com on 2018-03 NPM version Build Status

INSTALL PACKAGE 📦

npm i -S dictionary-definitions-data

USAGE

Zip files containing the data get uncompressed during postinstall.

WORDS INDEX

require('dictionary-definitions-data').loadSync('index')
[ { url: 'http://www.dictionary.com/browse/-a--game',
      text: '\'a\' game',
      letter: '0' },
    { url: 'http://www.dictionary.com/browse/-appen',
      text: '\'appen',
      letter: '0' },
    { url: 'http://www.dictionary.com/browse/-burb',
      text: '\'burb',
      letter: '0' },
    { url: 'http://www.dictionary.com/browse/-burbs',
      text: '\'burbs',
      letter: '0' },
    { url: 'http://www.dictionary.com/browse/-cause',
      text: '\'cause',
      letter: '0' },
    { url: 'http://www.dictionary.com/browse/-cept',
      text: '\'cept',
      letter: '0' },
    { url: 'http://www.dictionary.com/browse/-chine',
      text: '\'chine',
      letter: '0' },
    { url: 'http://www.dictionary.com/browse/-d',
      text: '\'d',
      letter: '0' },
...

LOAD SYNC

var data = require('dictionary-definitions-data').loadSync('a');
console.log(data[1].page_url)
'http://www.dictionary.com/list/a/1'

LOAD ASYNC

require('dictionary-definitions-data').load('b', function(err, data) {
    if (err) throw err;
    console.log(data[1].url)
});
'http://www.dictionary.com/browse/a-and-b'

FIND SYNC EXAMPLE

var _ = require('lodash');
var data = require('dictionary-definitions-data').loadSync('index');
 
function findSync(word) {
  return _.find(data, function(o) {
    return o.text === word.toLowerCase();
  } );
}
findSync('backlogged');
{ letter: 'b',
    url: 'http://www.dictionary.com/browse/backlogged',
    text: 'backlogged' }

FIND ASYNC EXAMPLE

var _ = require('lodash');
var load = require('dictionary-definitions-data').load;
 
function find(word, callback) {
  load(word, function(err, data) {
    if (err) callback(err);
    var result = _.find(data, function(o) {
      return o.key === word.toLowerCase();
    } );
    callback(null, result);
  });
}
find('blogging', function(err, data) {
    if (err) throw err;
    console.log(data.data[0]['source-luna'].definitions[0]);
});   
{ definition:
     [ { content: 'a website containing a writer\'s or group of writers\' own experiences, observations, opinions, etc., and often having images and links to other websites.',
         number: '1.',
         words: [Object] },
       { content: 'a single entry or post on such a website:',
         number: '2.',
         words: [Object],
         example: 'She regularly contributes a blog to the magazine\'s website.' } ],
    predicate: 'noun' }

RELATED PROJECTS

THESAURUS SYNONYMS DATA

WORDS COUNT

$ for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 0 index; do wc -l $i.json; done
 13163 a.json
 12591 b.json
 18392 c.json
  9783 d.json
  7009 e.json
  8045 f.json
  7533 g.json
  8930 h.json
  6677 i.json
  2072 j.json
  2926 k.json
  7414 l.json
 11660 m.json
  6205 n.json
  5469 o.json
 16380 p.json
   995 q.json
  8384 r.json
 21310 s.json
 10276 t.json
  4715 u.json
  3090 v.json
  5275 w.json
   250 x.json
   807 y.json
   708 z.json
   745 0.json
246016 index.json

Not sure if it's complete collection of words and definitions or not, but this was before dictionary.com started using React.js and so the spiders are in need of an update before running again to get a fresh dataset. Next release will included an updated dataset! The index supposedly has 45211 more words than the data files do. Hopefully next release will fix issues with inconsistencies.

JSONLINES FORMAT

Look at test.js to find out more about the object structure.

"letter" - str - word begins with this letter
"url" - str - word dictionary.com url
"datetime" - str - datetime when data was downloaded
"audio_urls" - arr - array with audio mp3/ogg url or empty array
"page_number" - str - the pagenumber the word was found on
"page_url" - str - page url to word on dictionary.com
"key" - str - word key
"data" - arr
    "source-luna" - obj
        "sup" - str
        "text" - str
        "variants" - str
        "source" - arr
        "syllable" - str
        "audio_urls" - arr
        "pronounce" - obj
            "spell" - str
            "ipa" - str
        "definitions" - arr
            "predicate" - str
            "definition" - obj
                "number" - str
                "content" - str
                "content_url" - str
                "words" - obj
                    "bold" - str
                    "italic" - str
                    "all_words" - arr
                "example" - str
                "sub_list" - arr
        "more" - arr
            "origin" - obj
                "header" - str
                "content" - str
            "related_forms" - obj
                "header" - str
                "content" - arr
                "syllables" - arr
            "synonyms" - obj
                "header" - str
                "content" - str
            "synonym_study" - obj
                "header" - str
                "content" - str
            "usage_notes" - obj
                "header" - str
                "content" - str
    "source-example-sentences" - obj
        "web_examples" - arr
            "text" - str
            "credit_url" - str
            "credit_name" - str

SAMPLE WORD - backlogged

{
  "letter": "b",
  "url": "http://www.dictionary.com/browse/backlogged",
  "datetime": "2018-03-17 00:03:22",
  "audio_urls": [
    "http://static.sfdict.com/audio/lunawav/B00/B0019300.ogg",
    "http://static.sfdict.com/audio/B00/B0019300.mp3"
  ],
  "page_number": 3,
  "key": "backlogged",
  "data": [
    {
      "source-luna": {
        "source": [
          "Dictionary.com Unabridged",
          "Based on the Random House Dictionary, \\u00a9 Random House, Inc. 2018."
        ],
        "syllable": "back\\u00b7log",
        "text": "backlog",
        "pronounce": {
          "ipa": "/\\u02c8b\\u00e6k\\u02ccl\\u0254g, -\\u02ccl\\u0252g/",
          "spell": "[bak-lawg, -log]"
        },
        "audio_urls": [
          "http://static.sfdict.com/audio/lunawav/B00/B0019300.ogg",
          "http://static.sfdict.com/audio/B00/B0019300.mp3"
        ],
        "definitions": [
          {
            "definition": [
              {
                "content": "a reserve or accumulation, as of stock, work, or business:",
                "number": "1.",
                "words": {
                  "all_words": [
                    "a",
                    "reserve",
                    "or",
                    "accumulation,",
                    "as",
                    "of",
                    "stock,",
                    "work,",
                    "or",
                    "business"
                  ]
                },
                "example": "a backlog of business orders."
              },
              {
                "content": "a large log at the back of a hearth to keep up a fire.",
                "words": {
                  "all_words": [
                    "a",
                    "large",
                    "log",
                    "at",
                    "the",
                    "back",
                    "of",
                    "a",
                    "hearth",
                    "to",
                    "keep",
                    "up",
                    "a",
                    "fire"
                  ]
                },
                "number": "2.",
                "content_url": [
                  "http://www.dictionary.com/browse/log",
                  "http://www.dictionary.com/browse/back"
                ]
              }
            ],
            "predicate": "noun"
          },
          {
            "definition": [
              {
                "content": "to hold in reserve, as for future handling or repair.",
                "number": "3.",
                "words": {
                  "all_words": [
                    "to",
                    "hold",
                    "in",
                    "reserve,",
                    "as",
                    "for",
                    "future",
                    "handling",
                    "or",
                    "repair"
                  ]
                }
              },
              {
                "content": "to enter and acknowledge (an order) for future shipment.",
                "number": "4.",
                "words": {
                  "all_words": [
                    "to",
                    "enter",
                    "and",
                    "acknowledge",
                    "(an",
                    "order)",
                    "for",
                    "future",
                    "shipment"
                  ]
                }
              }
            ],
            "predicate": "verb (used with object) backlogged, backlogging."
          },
          {
            "definition": [
              {
                "content": "to accumulate in a backlog:",
                "number": "5.",
                "words": {
                  "all_words": [
                    "to",
                    "accumulate",
                    "in",
                    "a",
                    "backlog"
                  ]
                },
                "example": "Orders are starting to backlog faster than we can process them."
              }
            ],
            "predicate": "verb (used without object) backlogged, backlogging."
          }
        ],
        "more": [
          {
            "origin": {
              "content": "First recorded in 1675-85; back + log",
              "header": "Origin of backlog"
            },
            "synonyms": {
              "content": "1. supply, stock, store, fund, cache, reservoir.",
              "header": "Synonyms"
            }
          }
        ]
      }
    },
    {
      "source-example-sentences": {
        "definitions": [],
        "web_examples": [
          {
            "text": [
              "Over 1,000 Iraqis were backlogged \\u2013 waiting for months or even years, stuck in various stages of the process."
            ],
            "credit_name": "Obama Went to War to Save Them, But They Can\\u2019t Get U.S. Visas - Christine van den Toorn, Sherizaan Minwalla",
            "credit_url": "http://www.thedailybeast.com/articles/2014/09/28/obama-went-to-war-to-save-them-but-they-can-t-get-u-s-visas.html?source=dictionary"
          },
          {
            "text": [
              "After 9/11, applications surged and backlogged processing for at times up to a year."
            ],
            "credit_name": "How Did He Get Clearance? - Miranda Green",
            "credit_url": "http://www.thedailybeast.com/articles/2013/06/13/how-did-he-get-clearance.html?source=dictionary"
          },
          {
            "text": [
              "Federal courthouses are backlogged and stuffed to the gills as it is."
            ],
            "credit_name": "The Biggest Lie of All - Michael Tomasky",
            "credit_url": "http://www.thedailybeast.com/articles/2012/08/30/the-biggest-lie-of-all.html?source=dictionary"
          },
          {
            "text": [
              "Meanwhile, the total number of backlogged cases actually grew."
            ],
            "credit_name": "Supreme Court Immigration Ruling in Arizona v. U.S. Got It Backward - Robert M. Morgenthau",
            "credit_url": "http://www.thedailybeast.com/articles/2012/07/11/supreme-court-immigration-ruling-in-arizona-v-u-s-got-it-backward.html?source=dictionary"
          }
        ]
      }
    }
  ],
  "page_url": "http://www.dictionary.com/list/b/3"
}

TESTS

Accepted param --verbose or -v to get detailed output of data being tested.

npm test -- --verbose
# or
npm run test
# or
node ./test.js -v
# or
./test.js

Should say: All tests passed!

LICENSE

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org

Dependents (0)

Package Sidebar

Install

npm i dictionary-definitions-data

Weekly Downloads

3

Version

1.0.2

License

SEE LICENSE IN license.txt

Unpacked Size

115 MB

Total Files

34

Last publish

Collaborators

  • gxela