4.8 KiB
4.8 KiB
wordpos CLI
Command-line
Version 0.1.6 introduces the command-line interface (./bin/wordpos-cli.js), available as 'wordpos' if installed globally
npm install -g wordpos
, otherwise as node_modules/.bin/wordpos
if installed without the -g.
Usage:
$ wordpos
Usage: wordpos <command> [options] [word ... | -i <file> | <stdin>]
Commands:
get get list of words for particular POS
def lookup definitions (use -b for brief definition, less examples)
syn lookup synonyms
exp lookup examples
rand get random words (starting with [word]). If first arg is a number, returns
that many random words. Valid options are -b, -f, -j, -s, -i.
parse show parsed words, deduped and less stopwords
stopwords show list of stopwords (valid options are -b and -j)
Options:
-h, --help output usage information
-V, --version output the version number
-n, --noun get nouns only
-a, --adj get adjectives only
-v, --verb get verbs only
-r, --adv get adverbs only
-c, --count get counts only, used with get
-b, --brief brief output (all on one line, no headers)
-f, --full full result object
-j, --json full result object as JSON string
-i, --file <file> input file
-w, --withStopwords include stopwords (default: stopwords are excluded)
Examples:
Get part-of-speech:
$ wordpos get The angry bear chased the frightened little squirrel
# Noun 4:
bear
chased
little
squirrel
# Adjective 3:
angry
frightened
little
# Verb 1:
bear
# Adverb 1:
little
Just the nouns, brief output:
$ wordpos get --noun -b The angry bear chased the frightened little squirrel
bear chased little squirrel
Just the counts:
$ wordpos get -c The angry bear chased the frightened little squirrel
# Noun Adjective Verb Adverb Parsed
4 3 1 1 7
Just the adjective count:
$ wordpos get --adj -c The angry bear chased the frightened little squirrel
# Noun Adjective Verb Adverb Parsed
0 3 0 0 7
Get definitions:
$ wordpos def git
git (def)
n: a person who is deemed to be despicable or contemptible; "only a rotter would do that"; "kill the rat"; "throw the bum out"; "you cowardly little pukes!"; "the British call a contemptible persona `git'"
Brief definition: (excludes examples)
$ wordpos def -b git
git (def)
n: a person who is deemed to be despicable or contemptible
Multiple definitions:
$ wordpos def git gat
git (def)
n: a person who is deemed to be despicable or contemptible
gat (def)
n: a gangster's pistol
Get full result object:
$ wordpos def git -f
{ git:
[ { synsetOffset: 10539715,
lexFilenum: 18,
pos: 'n',
wCnt: 0,
lemma: 'rotter',
synonyms: [],
lexId: '0',
ptrs: [],
gloss: 'a person who is deemed to be despicable or contemptible; "only a rotter would do that
"; "kill the rat"; "throw the bum out"; "you cowardly little pukes!"; "the British call a contemptib
le person a `git\'" ' } ] }
As JSON:
$ wordpos def git -j
{"git":[{"synsetOffset":10539715,"lexFilenum":18,"pos":"n","wCnt":0,"lemma":"rotter","synonyms":[],"
lexId":"0","ptrs":[],"gloss":"a person who is deemed to be despicable or contemptible; \"only a rotter
would do that\"; \"kill the rat\"; \"throw the bum out\"; \"you cowardly little pukes!\"; \"the British
call a contemptible person a `git'\" "}]}
Get synonyms:
$ wordpos syn git gat
git (syn)
n: rotter, dirty_dog, rat, skunk, stinker, stinkpot, bum, puke, crumb, lowlife, scum_bag, so-and-so, git
gat (syn)
n: gat, rod
Get examples:
$ wordpos syn git
git (exp)
n: "only a rotter would do that", "kill the rat", "throw the bum out", "you cowardly little pukes!", "the British call a contemptible person a `git'"
Get random words:
$ wordpos rand
# 1:
hopelessly
Get 5 random words:
$ wordpos rand 5
# 5:
bemire
swan
dignify
jaunt
daydream
Get a word staring with "foot":
$ wordpos rand foot
# foot 1:
footprint
Get 3 random words string with "foot" and "hand" each:
$ wordpos rand 3 foot hand
# foot 3:
footlocker
footmark
footwall
# hand 3:
hand-hewn
handstitched
handicap
Get a random adjective:
$ wordpos rand --adj
# Adjective 1:
soaked
Get a random adjective starting with "foot"
$ wordpos rand --adj foot
# foot 1:
foot-shaped
Stopwords
List stopwords:
$ wordpos stopwords -b
about after all also am an and another any are as at be because ...
Get definition of a stopword:
$ wordpos def both -w
both (def)
s: (used with count nouns) two considered together; the two; "both girls are pretty"