thesaurus-synonyms-data

1.0.5 • Public • Published

THESAURUS SYNONYMS DATA

thesaurus.com-logo.png

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

INSTALL PACKAGE 📦

npm i -S thesaurus-synonyms-data

RELATED PROJECTS

DICTIONARY DEFINITIONS DATA NPM version Build Status

dependant packages of this package

Not sure if it's complete collection of words and definitions or not, but this was before thesaurus.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 2767 more words than the data files do. Hopefully next release will fix issues with inconsistencies.

USAGE

Zip files containing the data get uncompressed during postinstall.

WORDS INDEX

require('thesaurus-synonyms-data').loadSync('index')
[ { url: 'http://www.thesaurus.com/browse/d day',
    text: 'd day',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/d days',
    text: 'd days',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/d p',
    text: 'd p',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/d p s',
    text: 'd p s',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/d-day',
    text: 'D-day',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/d-days',
    text: 'd-days',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/d. p.',
    text: 'd. p.',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/d. p. s',
    text: 'd. p. s',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/d.p.',
    text: 'D.P.',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/d.p.s',
    text: 'd.p.s',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/d.t.',
    text: 'd.t.',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/d.t.\'s',
    text: 'd.t.\'s',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/d.t.s',
    text: 'd.t.s',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/da',
    text: 'DA',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/da\'s',
    text: 'da\'s',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/dab',
    text: 'dab',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/dab hand',
    text: 'dab hand',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/dab-hand',
    text: 'dab-hand',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/dabbing',
    text: 'dabbing',
    letter: 'd' },
  { url: 'http://www.thesaurus.com/browse/dabble',
    text: 'dabble',
    letter: 'd' },
...

LOAD SYNC

var data = require('thesaurus-synonyms-data').loadSync('a');
console.log(data[1].word_url)
'http://www.thesaurus.com/browse/a%20bomb%20shelter/1'

LOAD ASYNC

require('thesaurus-synonyms-data').load('b', function(err, data) {
    if (err) throw err;
    console.log(data[1].key)
});
'backwoodsman-woman'

FIND SYNC EXAMPLE

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

FIND ASYNC EXAMPLE

var _ = require('lodash');
var load = require('thesaurus-synonyms-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('a bomb shelter', function(err, data) {
    if (err) throw err;
    console.log(data.data);
});   
{
  "synonyms": [
    {
      "txt": "noun",
      "words": [
        {
          "category": 1,
          "url": "http://www.thesaurus.com/browse/retreat",
          "text": "retreat",
          "length": 1,
          "complexity": 1,
          "id": 1
        },
        {
          "category": 1,
          "url": "http://www.thesaurus.com/browse/A-bomb%20shelter",
          "text": "A-bomb shelter",
          "length": 3,
          "complexity": 3,
          "id": 2
        },
        {
          "category": 1,
          "url": "http://www.thesaurus.com/browse/air-raid%20shelter",
          "text": "air-raid shelter",
          "length": 3,
          "complexity": 3,
          "id": 3
        },
        {
          "category": 1,
          "url": "http://www.thesaurus.com/browse/fallout%20shelter",
          "text": "fallout shelter",
          "length": 3,
          "complexity": 3,
          "id": 4
        },
        {
          "category": 1,
          "url": "http://www.thesaurus.com/browse/safety%20island",
          "text": "safety island",
          "length": 2,
          "complexity": 3,
          "id": 5
        },
        {
          "category": 1,
          "url": "http://www.thesaurus.com/browse/safety%20isle",
          "text": "safety isle",
          "length": 2,
          "complexity": 3,
          "id": 6
        },
        {
          "category": 1,
          "url": "http://www.thesaurus.com/browse/safety%20zone",
          "text": "safety zone",
          "length": 2,
          "complexity": 3,
          "id": 7
        }
      ],
      "ttl": "bombproof shelter"
    }
  ],
  "citation": "Roget\'s 21st Century Thesaurus, Third Edition Copyright © 2013 by the Philip Lief Group.",
  "related": [
    {
      "url": "http://www.thesaurus.com/browse/bomb%20shelter",
      "text": "bomb shelter",
      "words": [
        {
          "url": "http://www.thesaurus.com/browse/A-bomb%20shelter",
          "word": "A-bomb shelter"
        },
        {
          "url": "http://www.thesaurus.com/browse/air-raid%20shelter",
          "word": "air-raid shelter"
        },
        {
          "url": "http://www.thesaurus.com/browse/fallout%20shelter",
          "word": "fallout shelter"
        },
        {
          "url": "http://www.thesaurus.com/browse/retreat",
          "word": "retreat"
        },
        {
          "url": "http://www.thesaurus.com/browse/safety%20island",
          "word": "safety island"
        },
        {
          "url": "http://www.thesaurus.com/browse/safety%20isle",
          "word": "safety isle"
        },
        {
          "url": "http://www.thesaurus.com/browse/safety%20zone",
          "word": "safety zone"
        }
      ],
      "def": "noun. bombproof shelter"
    }
  ]
}

JSONLINES FORMAT

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

"letter" - str - word begins with this letter
"word_url" or "url" - str - word thesaurus.com url
"datetime" - str - datetime when data was downloaded
"page_number" - str - the pagenumber the word was found on
"page_url" - str - page url to word on thesaurus.com
"key" - str - word key
"data" - obj
    "synonyms" - arr
        "txt" - str
        "words" - arr
            "category" - int
            "url" - str
            "text" - str
            "length" - int
            "complexity" - int
            "id" - int
        "ttl" - str
    "citation" - str
    "related" - arr
        "url" - str
        "text" - str
        "words" - arr
            "url" - str
            "word" - str
        "def" - str

SAMPLE WORD - mackinaws

{
  "key": "mackinaws",
  "datetime": "2018-03-28 09:10:11",
  "page_number": 1,
  "letter": "m",
  "word_url": "http://www.thesaurus.com/browse/mackinaws/1",
  "data": {
    "synonyms": [
      {
        "txt": "noun",
        "words": [
          {
            "category": 3,
            "url": "http://www.thesaurus.com/browse/frock",
            "text": "frock",
            "length": 1,
            "complexity": 2,
            "id": 1
          },
          {
            "category": 3,
            "url": "http://www.thesaurus.com/browse/raincoat",
            "text": "raincoat",
            "length": 2,
            "complexity": 2,
            "id": 2
          },
          {
            "category": 3,
            "url": "http://www.thesaurus.com/browse/overcoat",
            "text": "overcoat",
            "length": 2,
            "complexity": 2,
            "id": 3
          },
          {
            "category": 3,
            "url": "http://www.thesaurus.com/browse/cloak",
            "text": "cloak",
            "length": 1,
            "complexity": 2,
            "id": 4
          },
          {
            "category": 3,
            "url": "http://www.thesaurus.com/browse/jacket",
            "text": "jacket",
            "length": 2,
            "complexity": 1,
            "id": 5
          },
          {
            "category": 3,
            "url": "http://www.thesaurus.com/browse/suit",
            "text": "suit",
            "length": 1,
            "complexity": 1,
            "id": 6
          },
          {
            "category": 3,
            "url": "http://www.thesaurus.com/browse/wrap",
            "text": "wrap",
            "length": 1,
            "complexity": 1,
            "id": 7
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/threads",
            "text": "threads",
            "length": 2,
            "complexity": 1,
            "id": 8
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/trench",
            "text": "trench",
            "length": 2,
            "complexity": 1,
            "id": 9
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/cape",
            "text": "cape",
            "length": 1,
            "complexity": 1,
            "id": 10
          },
          {
            "category": 3,
            "url": "http://www.thesaurus.com/browse/tuxedo",
            "text": "tuxedo",
            "length": 2,
            "complexity": 2,
            "id": 11
          },
          {
            "category": 3,
            "url": "http://www.thesaurus.com/browse/windbreaker",
            "text": "windbreaker",
            "length": 3,
            "complexity": 3,
            "id": 12
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/tux",
            "text": "tux",
            "length": 1,
            "complexity": 3,
            "id": 13
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/anorak",
            "text": "anorak",
            "length": 2,
            "complexity": 2,
            "id": 14
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/slicker",
            "text": "slicker",
            "length": 2,
            "complexity": 3,
            "id": 15
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/mink",
            "text": "mink",
            "length": 1,
            "complexity": 2,
            "id": 16
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/ulster",
            "text": "ulster",
            "length": 2,
            "complexity": 2,
            "id": 17
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/cutaway",
            "text": "cutaway",
            "length": 2,
            "complexity": 2,
            "id": 18
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/mackinaw",
            "text": "mackinaw",
            "length": 2,
            "complexity": 3,
            "id": 19
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/topcoat",
            "text": "topcoat",
            "length": 2,
            "complexity": 3,
            "id": 20
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/tails",
            "text": "tails",
            "length": 1,
            "complexity": 2,
            "id": 21
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/greatcoat",
            "text": "greatcoat",
            "length": 3,
            "complexity": 3,
            "id": 22
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/pea",
            "text": "pea",
            "length": 1,
            "complexity": 2,
            "id": 23
          },
          {
            "category": 2,
            "url": "http://www.thesaurus.com/browse/flogger",
            "text": "flogger",
            "length": 2,
            "complexity": 3,
            "id": 24
          },
          {
            "category": 1,
            "url": "http://www.thesaurus.com/browse/duffle%20coat",
            "text": "duffle coat",
            "length": 3,
            "complexity": 3,
            "id": 25
          }
        ],
        "ttl": "personal outerwear"
      }
    ],
    "citation": "Roget's 21st Century Thesaurus, Third Edition Copyright \\u00a9 2013 by the Philip Lief Group.",
    "related": [
      {
        "url": "http://www.thesaurus.com/browse/coat",
        "text": "coat",
        "words": [
          {
            "url": "http://www.thesaurus.com/browse/anorak",
            "word": "anorak"
          },
          {
            "url": "http://www.thesaurus.com/browse/cape",
            "word": "cape"
          },
          {
            "url": "http://www.thesaurus.com/browse/cloak",
            "word": "cloak"
          },
          {
            "url": "http://www.thesaurus.com/browse/cutaway",
            "word": "cutaway"
          },
          {
            "url": "http://www.thesaurus.com/browse/duffle%20coat",
            "word": "duffle coat"
          },
          {
            "url": "http://www.thesaurus.com/browse/flogger",
            "word": "flogger"
          },
          {
            "url": "http://www.thesaurus.com/browse/frock",
            "word": "frock"
          },
          {
            "url": "http://www.thesaurus.com/browse/greatcoat",
            "word": "greatcoat"
          },
          {
            "url": "http://www.thesaurus.com/browse/jacket",
            "word": "jacket"
          },
          {
            "url": "http://www.thesaurus.com/browse/mackinaw",
            "word": "mackinaw"
          },
          {
            "url": "http://www.thesaurus.com/browse/mink",
            "word": "mink"
          },
          {
            "url": "http://www.thesaurus.com/browse/overcoat",
            "word": "overcoat"
          },
          {
            "url": "http://www.thesaurus.com/browse/pea",
            "word": "pea"
          },
          {
            "url": "http://www.thesaurus.com/browse/raincoat",
            "word": "raincoat"
          },
          {
            "url": "http://www.thesaurus.com/browse/slicker",
            "word": "slicker"
          },
          {
            "url": "http://www.thesaurus.com/browse/suit",
            "word": "suit"
          },
          {
            "url": "http://www.thesaurus.com/browse/tails",
            "word": "tails"
          },
          {
            "url": "http://www.thesaurus.com/browse/threads",
            "word": "threads"
          },
          {
            "url": "http://www.thesaurus.com/browse/topcoat",
            "word": "topcoat"
          },
          {
            "url": "http://www.thesaurus.com/browse/trench",
            "word": "trench"
          },
          {
            "url": "http://www.thesaurus.com/browse/tux",
            "word": "tux"
          },
          {
            "url": "http://www.thesaurus.com/browse/tuxedo",
            "word": "tuxedo"
          },
          {
            "url": "http://www.thesaurus.com/browse/ulster",
            "word": "ulster"
          },
          {
            "url": "http://www.thesaurus.com/browse/windbreaker",
            "word": "windbreaker"
          },
          {
            "url": "http://www.thesaurus.com/browse/wrap",
            "word": "wrap"
          }
        ],
        "def": "noun. personal outerwear"
      }
    ]
  },
  "page_url": "http://www.thesaurus.com/list/m/1"
}

TESTS

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

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

Should say: All tests passed!

Please note some of the data files are so large that they had to be left out of the tests, in fact some of the data files will give you FATAL ERROR when you try to load them, in that case give node more memory when you run the script, node --max_old_space_size=4096 test.js, increase size as necessary.

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

install

npm i thesaurus-synonyms-data

Downloadsweekly downloads

0

version

1.0.5

license

SEE LICENSE IN license.txt

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability