Skip to main content

A command line dictionary toolset.

Project description

cmdict · pypi GitHub license CI codecov poetry black

cmdict not only is an English-to-Chinese dictionary application with a command-line interface, but also provide out-of-box features like extracting highlighted words from a PDF file. It runs on Linux, macOS, and Windows. Additionally, it can be used as a Python package.

How to install

The easiest way is to use Homebrew:

brew install pastydev/cmdict/cmdict

To install it from PyPI:

pip install cmdict

How to use

$ cmdict --help
Usage: cmdict [OPTIONS] COMMAND [ARGS]...

  Command line interface.

Options:
  --help  Show this message and exit.

Commands:
  download  Download necessary database before using cmdict.
  extract   Extract highlighted words with specified color in a PDF file.
  scan      Scan all words in a txt file and return search results.
  search    Type in one English word and echo its Chinese translation.

To echo Chinese translation for one or multiple English words.

$ cmdict search apple
--------
apple

    phonetic: 'æpl
    definition:
        - n. fruit with red or yellow or green skin and sweet to tart crisp whitish flesh
        - n. native Eurasian tree widely cultivated in many varieties for its firm rounded edible fruits
    trans:
        - n. 苹果, 家伙
        - [医] 苹果
    collins: 3
    oxford: 1
    bnc: 2446
    frq: 2695
$ cmdict search apple banana

To extract highlighted words in blue of sample.pdf:

$ cmdict extract sample.pdf --color blue
--------
apple

    phonetic: 'æpl
    definition:
        - n. fruit with red or yellow or green skin and sweet to tart crisp whitish flesh
        - n. native Eurasian tree widely cultivated in many varieties for its firm rounded edible fruits
    trans:
        - n. 苹果, 家伙
        - [医] 苹果
    collins: 3
    oxford: 1
    bnc: 2446
    frq: 2695

Data support

  • skywind3000/ECDICT: a free English to Chinese dictionary database (英中双解词典数据库).
$ cmdict download
--------
Downloading the dictionary...
100%|████████████████████████| 217M/217M [00:29<00:00, 666MiB/s]

cmdict is ready to use!

How to contribute

Open in GitHub Codespaces

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmdict-0.1.9.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

cmdict-0.1.9-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file cmdict-0.1.9.tar.gz.

File metadata

  • Download URL: cmdict-0.1.9.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for cmdict-0.1.9.tar.gz
Algorithm Hash digest
SHA256 ced3e80ab2478260d7296ce2ec34775a65906aeb26b88c0c34068446787ae22d
MD5 f95b567c9dea04bb9fa08ee8cb85ff36
BLAKE2b-256 e9418bf57f9e8ffc2389c5c15a0d433c8f2a2db961c0b956d1917bbf9dbe35b2

See more details on using hashes here.

File details

Details for the file cmdict-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: cmdict-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for cmdict-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 417c6dfb4c9beed52a91c1811c639828a4f3a50b98b58325bb8a200e6b042d67
MD5 449971b89f48037e5ec76f522a9a7f15
BLAKE2b-256 42c5b74091e1195a61d1e9194cef8a21614ab0c324044516db98d548e19af213

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page