项目作者: empireshades

项目描述 :
Command line dictionary and thesaurus via google define
高级语言: Python
项目地址: git://github.com/empireshades/command-line-thesaurus.git
创建时间: 2014-05-29T18:46:15Z
项目社区:https://github.com/empireshades/command-line-thesaurus

开源协议:

下载


Google “define” from the command line

img

I love the simplicity of being able to look up words using google’s “define {word}” search feature, but sometimes don’t want to cutover to a browser to do this. There was at one point a google define API which would have made implementing this a lot easier but it seems to have been de-commed so here we are. This core logic is a python script which leverages Requests to fetch and BeautifulSoup to parse. Terminal color output is supported as well. It is called via a shell script wrapper called “def” which I realize raises some potential conflicts with reserved words so feel free to rename.

Dependencies

  • Python modules
    • Requests
    • BeautifulSoup

Usage

  1. # clone the repo
  2. cd ~/repos
  3. git clone https://github.com/empireshades/command-line-thesaurus
  4. # optionally add to PATH variable
  5. export PATH=$PATH:$HOME/repos/command-line-thesaurus
  6. # optionally modify the PYBIN variable in the def wrapper script
  7. PYBIN=/usr/bin/python
  8. # run it:
  9. $ def moo
  10. moo . moo . mo͞o/
  11. - make the characteristic deep vocal sound of a cow.
  12. - the characteristic deep vocal sound of a cow.
  13. forms:
  14. - verb: moo
  15. - 3rd person present: moos
  16. - past tense: mooed
  17. - past participle: mooed
  18. - gerund or present participle: mooing
  19. $

TODO

  • Fix synonyms and antonyms
  • Better error handling around timeouts
  • Create an output function to cut down on redundancy