Library for CJK (chinese, japanese, korean) language data.
Project description
cihai ·

Python library for CJK (chinese, japanese, korean) data.
This project is under active development. Follow our progress and check back for updates!
Quickstart
API / Library (this repository)
$ pip install --user cihai
from cihai.core import Cihai
c = Cihai()
if not c.unihan.is_bootstrapped: # download and install Unihan to db
c.unihan.bootstrap()
query = c.unihan.lookup_char('好')
glyph = query.first()
print("lookup for 好: %s" % glyph.kDefinition)
# lookup for 好: good, excellent, fine; well
query = c.unihan.reverse_char('good')
print('matches for "good": %s ' % ', '.join([glph.char for glph in query]))
# matches for "good": 㑘, 㑤, 㓛, 㘬, 㙉, 㚃, 㚒, 㚥, 㛦, 㜴, 㜺, 㝖, 㤛, 㦝, ...
See API documentation and /examples.
CLI (cihai-cli)
$ pip install --user cihai-cli
Character lookup:
$ cihai info 好
char: 好
kCantonese: hou2 hou3
kDefinition: good, excellent, fine; well
kHangul: 호
kJapaneseOn: KOU
kKorean: HO
kMandarin: hǎo
kTang: "*xɑ̀u *xɑ̌u"
kTotalStrokes: "6"
kVietnamese: háo
ucn: U+597D
Reverse lookup:
$ cihai reverse library
char: 圕
kCangjie: WLGA
kCantonese: syu1
kCihaiT: '308.302'
kDefinition: library
kMandarin: tú
kTotalStrokes: '13'
ucn: U+5715
--------
UNIHAN data
All datasets that cihai uses have stand-alone tools to export their data. No library required.
- unihan-etl - UNIHAN data exports for csv, yaml and json.
Developing
$ git clone https://github.com/cihai/cihai.git`
$ cd cihai/
Bootstrap your environment and learn more about contributing. We use the same conventions / tools across all cihai projects: pytest, sphinx, mypy, ruff, tmuxp, and file watcher helpers (e.g. entr(1)).
Python versions
- 0.19.0: Last Python 3.7 release
Quick links
- Quickstart
- Datasets a full list of current and future data sets
- Python API
- Roadmap
- Python support: >= 3.10, pypy
- Source: https://github.com/cihai/cihai
- Docs: https://cihai.git-pull.com
- Changelog: https://cihai.git-pull.com/history.html
- API: https://cihai.git-pull.com/api/
- Issues: https://github.com/cihai/cihai/issues
- Test coverage: https://codecov.io/gh/cihai/cihai
- pypi: https://pypi.python.org/pypi/cihai
- OpenHub: https://www.openhub.net/p/cihai
- License: MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cihai-0.36.1.tar.gz.
File metadata
- Download URL: cihai-0.36.1.tar.gz
- Upload date:
- Size: 268.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4de73a73e583549b5ef8b827a28c8d9b003a7c49aa344105b2f8f47db57fc7bf
|
|
| MD5 |
cd6e9a52190f2c3797a86b6c5c47ec38
|
|
| BLAKE2b-256 |
67129336c1e9d7f9549e7fc7b1e8f893c4018141a437536f1896a9b6ff8191da
|
Provenance
The following attestation bundles were made for cihai-0.36.1.tar.gz:
Publisher:
tests.yml on cihai/cihai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cihai-0.36.1.tar.gz -
Subject digest:
4de73a73e583549b5ef8b827a28c8d9b003a7c49aa344105b2f8f47db57fc7bf - Sigstore transparency entry: 850131688
- Sigstore integration time:
-
Permalink:
cihai/cihai@76bfa9b8c242b9c55458519bf4269feb64f0339f -
Branch / Tag:
refs/tags/v0.36.1 - Owner: https://github.com/cihai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
tests.yml@76bfa9b8c242b9c55458519bf4269feb64f0339f -
Trigger Event:
push
-
Statement type:
File details
Details for the file cihai-0.36.1-py3-none-any.whl.
File metadata
- Download URL: cihai-0.36.1-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db22398e3a311f9d1ca12186ed6975e88814b8db5753fb18f7da35a632f7a82e
|
|
| MD5 |
ff47106ba699e2a04c22f774004d56c8
|
|
| BLAKE2b-256 |
1e811dc9d321fada6ffc5bfbc0512a3febcd107adfce94069b3795e5f951a796
|
Provenance
The following attestation bundles were made for cihai-0.36.1-py3-none-any.whl:
Publisher:
tests.yml on cihai/cihai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cihai-0.36.1-py3-none-any.whl -
Subject digest:
db22398e3a311f9d1ca12186ed6975e88814b8db5753fb18f7da35a632f7a82e - Sigstore transparency entry: 850131690
- Sigstore integration time:
-
Permalink:
cihai/cihai@76bfa9b8c242b9c55458519bf4269feb64f0339f -
Branch / Tag:
refs/tags/v0.36.1 - Owner: https://github.com/cihai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
tests.yml@76bfa9b8c242b9c55458519bf4269feb64f0339f -
Trigger Event:
push
-
Statement type: