Created
January 15, 2020 05:40
-
-
Save davehouse/ce0bfc3b2d951f0213900e45e5ff7c8d to your computer and use it in GitHub Desktop.
bash local dictionary using wordnet+python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source or copy this in your .bashrc or where you keep your shell functions | |
function dict() { | |
python -c "from nltk.corpus import wordnet as wn;import json;\ | |
print(json.dumps({x.name(): [x.definition()] + x.examples() \ | |
for x in wn.synsets('$1')},indent=2))" \ | |
|| echo -e "\nSetup python NLTK + WordNet like: | |
pip install nltk && python -c \"import nltk; nltk.download('wordnet')\"" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment