Skip to main content

chinese-english-lookup

A simple Python package for Chinese-to-English word definition retrieval. Definitions sourced from Chinese-English dictionary CC-CEDICT.

Also includes utility for HSK3.0 (post-2020) and HSK2.0 (2010-2020).

Installation

pip install chinese-english-lookup

Usage

Running CLI demo for Dictionary

Run command chinese-english-lookup:

(Please note: script chinese-english-lookup contains hyphens)

chinese-english-lookup

Look up a Chinese word, type 'random', or type '!' to quit: 美好
美好 | 美好
【mei3 hao3】 beautiful; fine

Look up a Chinese word, type 'random', or type '!' to quit: random
赤贫如洗 | 赤貧如洗
【chi4 pin2 ru2 xi3】 without two nickels to rub together (idiom); impoverished

Using Dictionary utility

(Please note: package name chinese_english_lookup contains underscores rather than hyphens)

>>> from chinese_english_lookup import Dictionary
>>> d = Dictionary()
>>> word_entry = d.lookup('牛油果')
>>> print(word_entry)
牛油果 | 牛油果
【niu2 you2 guo3】 avocado (Persea americana)
>>> word_entry.simp
'牛油果'
>>> word_entry.trad
'牛油果'
>>> len(word_entry.definition_entries)
1
>>> word_entry.get_definition_entries_formatted()
'【niu2 you2 guo3】 avocado (Persea americana)'
>>> word_entry.definition_entries[0].pinyin
'niu2 you2 guo3'
>>> word_entry.definition_entries[0].definitions
['avocado (Persea americana)']

Using HSK3 utility

>>> from chinese_english_lookup import HSK3
>>> hsk3 = HSK3()
>>> intermediate_words = hsk3.get_intermediate()
>>> len(intermediate_words)
3167
>>> for word in intermediate_words:
...     print(str(word))    # output omitted

>>> print(intermediate_words[0])
阿姨 | 阿姨
【a1 yi2】 maternal aunt; step-mother; childcare worker; nursemaid; woman of similar age to one's parents (term of address used by child); CL:個|个[ge4]

>>> hsk3.get_category_for_word('醉')
'中级 - Intermediate Level'

Using HSK2 utility

>>> from chinese_english_lookup import HSK2
>>> hsk2 = HSK2()
>>> level_4_words = hsk2.get_words_for_level(4)
>>> len(level_4_words)
598
>>> for word in level_4_words:
...     print(str(word))    # output omitted

>>> print(level_for_words[0])
爱情 | 愛情
【ai4 qing2】 romance; love (romantic); CL:個|个[ge4],份[fen4]

>>> hsk2.get_level_for_word('梦')
4

License

MIT

Metadata

Release files for chinese-english-lookup 0.0.3

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

Source distribution (sdist)

Source distribution for chinese-english-lookup 0.0.3
File Size Uploaded Provenance Actions
chinese-english-lookup-0.0.3.tar.gz 3.8 MB Without provenance Details for chinese-english-lookup-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chinese-english-lookup 0.0.3
File Interpreter ABI Platform Actions
chinese_english_lookup-0.0.3-py3-none-any.whl Python 3 none any Details for chinese_english_lookup-0.0.3-py3-none-any.whl

Total release size: 7.5 MB

Release files / chinese-english-lookup-0.0.3.tar.gz

Download URL chinese-english-lookup-0.0.3.tar.gz
Size 3.8 MB
Tags Source
SHA-256 checksum
How to use checksums
d6ec6ba1ff0424d1af176098290426673572d4bedb5a4d56868c1a71a7730201
BLAKE2b-256 checksum
How to use checksums
66ba4f301312eac52dfbd046da713b9b327b4bfaf53dc97ec803efec6a5ca66d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.9

Release files / chinese_english_lookup-0.0.3-py3-none-any.whl

Download URL chinese_english_lookup-0.0.3-py3-none-any.whl
Size 3.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4552f78b0d342327b7a3079797d2b7220ca2fd158413850f90eb562ab17faa65
BLAKE2b-256 checksum
How to use checksums
f4a294dde4a172798c27f85ece3d273cb95fe2ee1af5c7771c6bc8cfaaeb4420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.9

Security for chinese-english-lookup 0.0.3

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.

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