Package: zdict
[ ~ Dependencies scanned by PyUp.io ~ ]zdict is a CLI dictionary framework mainly focus on any kind of online dictionary.
This project originally forked fromhttps://github.com/chenpc/ydict, which is a CLI tool for the Yahoo! online dictionary.
After heavily refactoring the original project including:Change from Python 2 to Python 3Focus on being a flexible framework for any kind online dicitionaries, not only just a CLI tool for querying Yahoo! online dictionary.Based on an open source project skeleton.So, we decided to create a new project.Table of ContentsInstallationUsageScreenshotsYahoo DictionaryMoe Dictionary 萌典Urban DictionarySpanishDictJisho Japanese DictionaryYandex TranslateOxford DictionaryWiktionaryiTaigi-愛台語國家教育研究院 - 雙語詞彙、學術名詞暨辭書資訊網Development & ContributingTestingDebuggingBug ReportRelated ProjectsInstallationfromPyPI:pipinstallzdictfromGitHub:pipinstallgit+https://github.com/zdict/zdict.gitfromDocker Hub:# Pull the image of latest commit of master branch from Docker Hubdockerpullzdict/zdict# Pull the image of latest release from Docker Hubdockerpullzdict/zdict:release# Pull the image of specific release version from Docker Hubdockerpullzdict/zdict:${version}dockerpullzdict/zdict:v0.10.0How to run the zdict docker image# Run interactive modedockerrun-it--rmzdict/zdict# latest commitdockerrun-it--rmzdict/zdict:release# latest releasedockerrun-it--rmzdict/zdict:v0.10.0# use zdict v0.10.0dockerrun-it--rmzdict/zdict:$tag# with specific tag# Run normal modedockerrun-it--rmzdict/zdictapplebird# latest commitdockerrun-it--rmzdict/zdict:releaseapplebird# latest releasedockerrun-it--rmzdict/zdict:v0.10.0applebird# use zdict v0.10.0dockerrun-it--rmzdict/zdict:$tagapplebird# with specific tag# You can also add the options while using docker run either interactive mode or normal modedockerrun-it--rmzdict/zdict:v0.10.0-dtmoe# use moe dict in interactive modedockerrun-it--rmzdict/zdict:v0.10.0-dtmoe哈# use moe dict in normal modeUsageusage: zdict [-h] [-v] [-d] [-t QUERY_TIMEOUT] [-j [JOBS]] [-sp] [-su]
                         [-dt itaigi,moe,moe-taiwanese,spanish,oxford,jisho,yahoo,naer,wiktionary,urban,yandex,all]
                         [-ld] [-V] [-c] [--dump [PATTERN]] [-D]
                         [word [word ...]]

positional arguments:
  word                  Words for searching its translation

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -d, --disable-db-cache
                                                Temporarily not using the result from db cache. (still
                                                save the result into db)
  -t QUERY_TIMEOUT, --query-timeout QUERY_TIMEOUT
                                                Set timeout for every query. default is 5 seconds.
  -j [JOBS], --jobs [JOBS]
                                                Allow N jobs at once. Do not pass any argument to use
                                                the number of CPUs in the system.
  -sp, --show-provider  Show the dictionary provider of the queried word
  -su, --show-url       Show the url of the queried word
  -dt itaigi,moe,moe-taiwanese,spanish,oxford,jisho,yahoo,naer,wiktionary,urban,yandex,all, --dict itaigi,moe,moe-taiwanese,spanish,oxford,jisho,yahoo,naer,wiktionary,urban,yandex,all
                                                Must be seperated by comma and no spaces after each
                                                comma. Choose the dictionary you want. (default:
                                                yahoo) Use 'all' for qureying all dictionaries. If
                                                'all' or more than 1 dictionaries been chosen, --show-
                                                provider will be set to True in order to provide more
                                                understandable output.
  -ld, --list-dicts     Show currently supported dictionaries.
  -V, --verbose         Show more information for the queried word. (If the
                                                chosen dictionary have implemented verbose related
                                                functions)
  -c, --force-color     Force color printing (zdict automatically disable
                                                color printing when output is not a tty, use this
                                                option to force color printing)
  --dump [PATTERN]      Dump the querying history, can be filtered with regex
  -D, --debug           Print raw html prettified by BeautifulSoup for
                                                debugging.ScreenshotsYahoo DictionaryNormal Modezdict helloInteractive ModezdictMoe Dictionary 萌典Urban DictionarySpanishDictJisho Japanese DictionaryYandex TranslateOxford DictionaryTo use this source, you should firstapplyan API key and place it under~/.zdict/oxford.keyin the format:app_id, app_keyWiktionaryiTaigi-愛台語國家教育研究院 - 雙語詞彙、學術名詞暨辭書資訊網Development & ContributingTestingDuring development, you can install our project aseditable.
If you usevirtualenv, you may want to create a new environment forzdict:$ git clone https://github.com/zdict/zdict.git
$ cd zdict
$ pip install -e .Once you installed it with the command above,
just executezdictafter modification.
No need to install it again.Install the packages for testing:$ pip install -r requirements-test.txtor:$ make install-test-depsUse the command below to execute the tests:$ py.testor:$ make testAfter runing testing, we will get a coverage report in html.
We can browse around it:$ cd htmlcov
$ python -m http.serverAlso, there is some configs forpy.testinsetup.cfg.
Change it if you need.Debuggingpy.testcan promptpdbshell when your test case failed:$ py.test --pdbor:$ make test-with-pdbBug ReportFeel free to send a bug report tohttps://github.com/zdict/zdict/issues.
Please attach the error message and describe how to reproduce the bug.
PR is also welcome.Please use the-d/--disable-db-cacheoption to query before sending the bug report.
Sometimes we modify the data schema in database for a dictionary,
but the default dictionary query of zdict uses the cache in the database which may be stored within an old schema.
This might cause an error while showing the result.
Just use the-d/--disable-db-cacheto update the cache in database.Related Projectszdict.vimA vim plugin integrates with zdict.zdict.shA collection of shell completion scripts for zdict.zdict_jupyterUse zdict in Jupyter Notebook.