wordpos is a set of fast part-of-speech (POS) utilities for Node.js and browser using fast lookup in the WordNet database.’


For in-browser use, see https://github.com/moos/wordpos-web

See also https://github.com/moos/wordnet-db

‘Please note: all API are async since the underlying WordNet library is async.’

wordpos.getNouns('The angry bear chased the frightened little squirrel.', console.log)
// [ 'bear', 'squirrel', 'little', 'chased' ]
wordpos.getPOS('The angry bear chased the frightened little squirrel.', console.log)
// output:
    nouns: [ 'bear', 'squirrel', 'little', 'chased' ],
    verbs: [ 'bear' ],
    adjectives: [ 'little', 'angry', 'frightened' ],
    adverbs: [ 'little' ],
    rest: [ 'the' ]

Determining the particular POS of a word.

wordpos.isVerb('fish', console.log);
// true 'fish'
wordpos.isNoun('fish', console.log);
// true 'fish'
wordpos.isAdjective('fishy', console.log);
// true 'fishy'
wordpos.isAdverb('fishly', console.log);
// false 'fishly'

Looking up words:

wordpos.lookupAdjective('awesome', console.log);
// output:
[ { synsetOffset: 1285602,
    lexFilenum: 0,
    lexName: 'adj.all',
    pos: 's',
    wCnt: 5,
    lemma: 'amazing',
    synonyms: [ 'amazing', 'awe-inspiring', 'awesome', 'awful', 'awing' ],
    lexId: '0',
    ptrs: [],
    gloss: 'inspiring awe or admiration or wonder; [...] awing majesty, so vast, so high, so silent"  '
    def: 'inspiring awe or admiration or wonder',     
} ], 'awesome'

See NLP (Natural language processing)