wordhippo

0.0.2 • Public • Published

This unofficial WordHippo API uses request to fetch HTML documents from wordhippo.com, then initializes jQuery on the response document body using mu.js (a convenient wrapper of cheerio) to extract the values from the virtual Document Object Model (DOM).

screenshot of WordHippo website

Some examples

const WordHippo = require('.')
 
WordHippo.definition('chair').then(console.log) // A person in charge of a meeting
 
WordHippo.related('stress').then(words => {
    console.log(words)
/*
[
  'anxiety',             'strain',           'pressure',
  'tension',             'worry',            'trauma',
  'distress',            'nervousness',      'tenseness',
  'hassle', ... 101 more
]
*/
})
 
WordHippo.opposites('productive').then(console.log) 
/*
[
  'fruitless',          'ineffective',     'ineffectual',
  'inefficient',        'inoperative',     'unfruitful',
  'unproductive',       'useless',         'barren',
  'dead',   ... 73 more items
]
*/
 
async (() => {
    await WordHippo.sentences('empty') 
/*
[
    'When she had finished, Rebekah picked up the empty wicker basket and turned to go inside.',
    'I stroll to the other end of the hall and the waitress seats me at an empty table.',
    'Mrs Watson gets to her feet and walks us back to our homeroom, which is empty because everyone has gone to class.',
    ... 214 more items
]
*/
}
 
WordHippo.rhymes('slam').then(words => {
    console.log(`slam rhymes with ${words[0]} and ${words[1]}`) // slam rhymes with jam and program
})

This function will call all of the above methods and will resolve an Object. It will also cache the word data to a JSON file in the cache folder if the second argument is not changed so that we only have to query WordHippo for a word once and not consume too much bandwidth.

WordHippo.getWord('apprehensive').then(meta => {
    console.log(meta)
})
 
// ignore cache and fetch again
WordHippo.getWord('apprehensive', true).then(meta => {
    console.log(meta)
})
 
/*
{
  word: 'apprehensive',
  definition: 'Anticipating something with anxiety or fear',
  related: [
    'afraid',             'alarmed',           'anxious',
    'concerned',          'fearful',           'nervous',
    'uneasy',             'worried',           'agitated',
    'edgy',               'restless',          'alive',
    'antsy',              'aware',             'cognizant',
    'conscious',          'disquieted',        'doubtful',
    'fidgety',            'foreboding',        'frightened',
    'mindful',            'mistrustful',       'neurotic',
    'panicky',            'scared',            'sensible',
    'sentient',           'strained',          'stressed',
    'suspicious',         'tense',             'twitchy',
    'ware',               'witting',           'angst-ridden',
    'butterflies',        'frozen',            'hesitant',
    'jellyfish',          'jittery',           'jumpy',
    'lily-livered',       'on edge',           'scaredy-cat',
    'shaky',              'stiff',             'stressy',
    'terrified',          'trepidatious',      'troubled',
    'uncertain',          'uptight',           'weak',
    'biting nails',       'get vibes',         'hung up',
    'on tenterhooks',     'running scared',    'worried sick',
    'feel in bones',      'have a hunch',      'have cold feet',
    'have funny feeling', 'have stage fright', 'in a dither',
    'in a sweat',         'in a cold sweat'
  ],
  opposites: [
    'confident',      'assured',       'composed',     'insensible',
    'oblivious',      'unafraid',      'unaware',      'unconscious',
    'unmindful',      'unwitting',     'calm',         'certain',
    'clear',          'collected',     'cool',         'definite',
    'easy-going',     'happy',         'laid-back',    'nonchalant',
    'quiet',          'sure',          'undoubting',   'unfearful',
    'unquestionable', 'unsuspicious',  'unworried',    'at ease',
    'ignorant',       'unknowing',     'uninformed',   'casual',
    'insouciant',     'indifferent',   'heedless',     'unsuspecting',
    'unruffled',      'together',      'unconcerned',  'unfazed',
    'apathetic',      'incognizant',   'innocent',     'unperturbed',
    'undisturbed',    'unenlightened', 'nescient',     'dispassionate',
    'controlled',     'detached',      'offhand',      'unemotional',
    'airy',           'relaxed',       'daring',       'fearless',
    'unflappable',    'sedate',        'disregardful', 'imperturbable',
    'untroubled',     'unobservant',   'unflustered',  'stout-hearted',
    'lionhearted',    'unheeding',     'serene',       'unbothered',
    'deaf',           'grounded',      'blind',        'unmoved',
    'inattentive',    'disinterested', 'chilled',      'placid',
    'equable',        'possessed',     'poised',       'unagitated',
    'stout',          'brave',         'audacious',    'bold',
    'courageous',     'gutsy',         'game',         'plucky',
    'spunky',         'dauntless',     'doughty',      'unfearing',
    'unflinching',    'mettlesome',    'unshakable',   'ballsy',
    'unshrinking',    'unblenching',   'unabashed by', 'undaunted by',
    ... 220 more items
  ],
  sentences: [
    'I was, however, apprehensive at the prospect of sitting through an even lengthier version.',
    'He watched the two birds glide away over the waves, an apprehensive glint in his eye.',
    'So I was a bit apprehensive about this, and roped in Jim to come with me for moral support.',
    'He invariably looks good, but his expression frequently verges on concerned and apprehensive.',
    'It was a mixture of anger, worry, and sadness with tears welling in her apprehensive eyes.',
    'The board of directors looked tense and apprehensive, anticipating the storm that was about to break.',
    'Naturally we were all a little apprehensive as we touched the ice and slid along the wild runway.',
    'He took a few deep, quiet breaths and looked away from her questioning, apprehensive expression.',
    'Those who are not medically insured are particularly apprehensive of the frequently high expense of medical treatment.',
    'Some bathers are unnecessarily apprehensive about being bitten by beach fleas, which feed only on organic debris.',
    'However, some residents were a bit apprehensive about having wild carnivorous beasts in their midst.',
    'On a wet and gloomy afternoon, 21 people gathered in the council chamber of the town hall, looking rather apprehensive and dressed in their best.',
    'Sheldon still walks her dogs in the forest, but is more apprehensive about letting the animals out of her sight when in the area.',
    'The same year there came into England Master John, a Scot by nation, a man of an apprehensive mind and of singular eloquence.',
    'He peers out from under his scruffy, unkempt hair with a slackjawed, apprehensive expression.',
    'At first the officers in charge of the troops garrisoned in the city were vaguely apprehensive of trouble in the ranks.',
    "Actually, I know a lot of people who are apprehensive about calling people they don't know on the telephone.",
    "John is apprehensive because he has done little caving, and doesn't like tight crawls.",
    'The new problem, the verroa mite, has not yet impinged in this area and we are all apprehensive as to what the effect will be.',
    'At this time Elizabeth began to become apprehensive in expectation of her monthly indisposition.',
    'Show More Sentences',
    'One of these youths stole a four-figure sum from me recently and I am now very apprehensive.',
    'The physician should maintain a gentle and calm demeanor and be considerate of the apprehensive child.',
    'She sits up with an apprehensive stare into the distance, as if she heard a footstep on the strange track she has elected to follow.',
    'Although neither of the pressmen has ever met Faldo previously, they are far from apprehensive at the prospect of doing so.',
    'I admit I am a bit apprehensive, but I am not sure if I believe in ghosts, although the other girls are quite scared.',
    'He remained apprehensive about returning to the United States, unsure of his legal jeopardy.',
    'When a mechanized force enters an area with friendly infantry, both light and mechanized soldiers get a little apprehensive.',
    'Fear makes people jumpy and apprehensive, and more apt to resort to violence.',
    "He was jumpy and apprehensive, and most likely wouldn't have been able to hit anything even surrounding the small oracle if pressed to.",
    "Tessa's tone was cool and aloof, but Rogers could sense the apprehensive undertone.",
    'The rest of their mates looked on in apprehensive silence, dreading what would happen next.',
    'But I was feeling so apprehensive that rephrasing my questions was the least of my problems.',
    'March in New York is a restless time, an anticipatory time, hopeful yet apprehensive.',
    "Cath's face grew apprehensive as she gathered her crutches and levered herself upright.",
    "Rebecca spent her entire taxi ride apprehensive about showing up at a stranger's place.",
    'Another pause and she strained for the answer, nervous and apprehensive all at once.',
    'For ten days or more I never heard a peep from him and I was beginning to feel less apprehensive about the whole experience.',
    'I am very nervous and apprehensive, particularly as the hours are ticking away.',
    'And I must confess to being a trifle apprehensive in the days leading up to the concert.',
    'If the horse gets apprehensive or frightened, his back tightens and shortens.',
    'Show More Sentences',
    "Obviously I'm still nervous and apprehensive, but sometimes you've got to do certain things.",
    "Her arms are crossed and her face apprehensive, but she claims she's not nervous.",
    'The marines were pumped up for action, but also thoughtful, nervous and even apprehensive.',
    'Our staff report feeling constantly afraid and apprehensive even when they are safe at home.',
    'In the absence of common interests states will be competitive, apprehensive, and even fearful.',
    'Approaching exam time children get apprehensive and nervous about learning and become worried about making a fool of themselves.',
    'She wore an expression that could either be read as apprehensive or frightened, depending.',
    'Why were these people frightened and so apprehensive if he had committed no crime?',
    'An anxious start I was a bit apprehensive at the start of this week.',
    "You couldn't blame me for being a teensy bit apprehensive, could you?",
    'Interpreters, feeling apprehensive about our departure, left to rejoin their families.',
    'His body had relaxed a bit, but his voice was tense and apprehensive.',
    'You need not be apprehensive about delays hindering professional growth!',
    'My colleagues and I were apprehensive, but when we were finally able to get hold of the parts it turned out to be music of incredible sensuousness and vitality.',
    'For their part, the zoo officials were also a mite apprehensive about letting a crowd form around the enclosure where the big cat was giving birth.',
    'A lot of those deals are very tight and clients become apprehensive.',
    'You find yourself reading, impressed, entertained, identifying, yet vaguely repulsed and apprehensive for him.',
    'So when it comes to creating a Palestinians state right next door, Israelis are apprehensive.',
    'At 31 in 1980, I was apprehensive about being a boss, a little neurotic even.',
    'People are apprehensive about trusting their food to an unknown business.',
    'Show More Sentences',
    'Adding to the rosiness of the outside world is an unexpected rise in the friendliness of the vet whom I was apprehensive about seeing earlier in the week.',
    'Those who were a bit apprehensive of venturing out had plenty of Dutch courage at their disposal at the nearby Anglers Rest bar, which was the headquarters for the day.',
    "I was apprehensive about my daughter's choice of professions from day one.",
    'At first, the couple is apprehensive, if not downright appalled.',
    'Hitler was also apprehensive, and on a visit to Army Group A headquarters on 24 May, he endorsed the order.',
    "Chinese authorities, apprehensive about possible instability on the country's borders, have ordered North Korea's escapers to be shot on sight.",
    'She clutched it in great haste, wrapped her apron about it, and carrying it baby-wise, ran fleetly off, casting apprehensive glances over her shoulder.',
    "However, your reviewer became apprehensive when reading the book's cover notes which describe how the programme has witnessed some of football's greatest moments.",
    'Frightened by the noises approaching them from the rear, and and apprehensive of the human silence ahead, the five roe deer were halted, their heads high in nervous alertness.',
    'Some political activists were apprehensive lest the amalgamation of jurisdictive and executive powers should revive or induce authoritarian practices.'
  ]
}
*/

Package Sidebar

Install

npm i wordhippo

Weekly Downloads

5

Version

0.0.2

License

ISC

Unpacked Size

265 kB

Total Files

14

Last publish

Collaborators

  • jochemstoel