Home » Misc » Display synonyms in …
Display synonyms in command line
To find the synonyms of a word, the simplest way is to go to thesaurus.com in a web browser. The following gives the alternative in a Linux command line.
wget -qO - http://thesaurus.com/browse/$1 | hxnormalize -x | hxselect '.relevancy-block' | w3m -dump -T text/html | sed -e 's/star//g' | tr -d '\n'
Just replace $1
with the word you want, or save the code to a script file, say synonym.sh
, and run ./synonym.sh word
.
Note hxnormalize
and hxselect
come from the html-xml-utils package. In arch Linux, it is available in the AUR.
— Last modified: xiaoke 2014/07/10 16:17