February 20, 2018

2 Ways to Linux CommandLine Thesaurus Synonyms

icon

[How to] Linux CommandLine Thesaurus | Linux CommandLine Synonyms


I wanted to use my linux commandline to lookup synonyms (thesaurus) recently but didn’t know how.

After some searching I was able to find 2 alternatives that worked very differently, yet helped me tremendously on each account.

Method 1 - DICT

sudo apt install dict dictd dict-gcide dict-moby-thesaurus
sudo systemctl enable dictd
sudo systemctl start dictd
dict --help # or try 'man dict'
#dict -d moby-thesaurus YOURWORDHERE
alias thes='dict -d moby-thesaurus'
thes engineer

Method 2 - WordNet

sudo apt install wordnet
man wn | grep -B1 synon
#wn YOURWORDHERE -syns#, where # is n, v, a, or r
#wn YOURWORDHERE -simsv
wn # or try 'man wn'
wn engineer -synsn | grep -v ^$   #grep just strips empty lines from output
wn engineer -synsv | grep -v ^$

Script for both:

#!/bin/sh
if [ "$1" = "" ] ; then
   echo "usage: $0 WORD"
fi
wn $1 -synsn | grep -v ^$
wn $1 -synsv | grep -v ^$
wn $1 -synsa | grep -v ^$
wn $1 -synsr | grep -v ^$
dict -d moby-thesaurus $1



~~
As always, good luck!

Please consider crypto tipping:
  

1 comment:

Comments, Suggestions or "Thank you's" Invited! If you have used this info in any way, please comment below and link/link-back to your project (if applicable). Please Share.
I accept Bitcoin tips of ANY amount to: 1GS3XWJCTWU7fnM4vfzerrVAxmnMFnhysL
I accept Litecoin tips of ANY amount to: LTBvVxRdv2Lz9T41UzqNrAVVNw4wz3kKYk