A Python parser for the CC-CEDICT Chinese-English dictionary
A parser for the CC-CEDICT Chinese-English dictionary.
Install
PIP
https://pypi.org/project/cedict-utils/
pip install cedict-utils
REPO
- Create virtualenv.
python3 -m venv ~/.virtualenvs/cedict-utils
- Activate venv.
source ~/.virtualenvs/cedict-utils/bin/activate
- Install requirements.
pip install -r requirements.txt
Dictionary
Download dictionary
wget -O - https://www.mdbg.net/chinese/export/cedict/cedict_1_0_ts_utf-8_mdbg.txt.gz | gunzip > data/cedict_ts.u8
Usage
$ python
>>> from cedict_utils.cedict import CedictParser
>>> parser = CedictParser()
>>> parser.read_file()
>>> entries = parser.parse()
>>> for e in entries:
... print(e)
...
..
龟缩 (龜縮) - gui1 suo1
龟背竹 (龜背竹) - gui1 bei4 zhu2
龟船 (龜船) - gui1 chuan2
..
>>> entries[200].simplified
'敦'
>>> entries[200].traditional
'㪟'
>>> entries[200].pinyin
'dun1'
>>> entries[200].raw_line
'㪟 敦 [dun1] /variant of 敦[dun1]/'
>>> entries[200].meanings
['variant of 敦[dun1]']
>>>
Tests
Running tests
$ make test
pytest
================================================================ test session starts ================================================================
platform linux -- Python 3.6.8, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
rootdir: /Development/cedict-utils, inifile:
collected 8 items
tests/test_cedict.py ........
============================================================= 8 passed in 0.09 seconds ==============================================================
Resources
- Cedict project https://www.mdbg.net/chinese/dictionary?page=cc-cedict
Metadata
Release files for cedict-utils 0.0.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cedict_utils-0.0.13.tar.gz | 7.9 MB | Without provenance | Details for cedict_utils-0.0.13.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cedict_utils-0.0.13-py3-none-any.whl | Python 3 | none | any | Details for cedict_utils-0.0.13-py3-none-any.whl |
Total release size: 12.2 MB
Release files / cedict_utils-0.0.13.tar.gz
| Download URL | cedict_utils-0.0.13.tar.gz |
|---|---|
| Size | 7.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
995e49150c315bb1cf96389c85b478b647bcb8df1eeb31ce3dc6edd6ae7d31d0
|
|
BLAKE2b-256 checksum How to use checksums |
c7622de2e37b7598e19b3aae203a10870e5c7f5944e615a7a0dc8df336587497
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.8
|
Release files / cedict_utils-0.0.13-py3-none-any.whl
| Download URL | cedict_utils-0.0.13-py3-none-any.whl |
|---|---|
| Size | 4.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
180f59f1ebb525b4735ac9e723c0ff74a8736f3c822c6852952a931fa10f6c41
|
|
BLAKE2b-256 checksum How to use checksums |
e0f8afcde9513cef5fa37e523665e27ece265f22f3cfdb044d4890827c56490c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.8
|
Security for cedict-utils 0.0.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.