Skip to main content

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

Metadata

Release files for cmdict 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cmdict 0.1.10
File Size Uploaded
cmdict-0.1.10.tar.gz 9.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cmdict 0.1.10
File Interpreter ABI Platform
cmdict-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 21.1 kB

Release files / cmdict-0.1.10.tar.gz

Download URL cmdict-0.1.10.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a2baa8e2c34385daa4e124ca7ad6e354fce0c8d22bdb6ef7c24043cfb48262d4
BLAKE2b-256 checksum
How to use checksums
27347f074833d4c4b401cc4934fd8995b1ae69cc331ae4e65c7f43d2afc3d268
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / cmdict-0.1.10-py3-none-any.whl

Download URL cmdict-0.1.10-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5089220b4dbea5a42bdb6239f549bf7d1caab93b26df99449034b7ac45f7df36
BLAKE2b-256 checksum
How to use checksums
697fe25a3daa39759d07986e8fdd2c089a41b6aeeadaa2b78c5e7ab5821b4b88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.7

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page