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.8, 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.html
- 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
File details
Details for the file cihai-0.33.0.tar.gz
.
File metadata
- Download URL: cihai-0.33.0.tar.gz
- Upload date:
- Size: 57.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 454a20636005ae6050af9d27b444189e25919c33c1a784d1c95b9364dcd09646 |
|
MD5 | bcaaaaf5b06acf137f0830d97151584b |
|
BLAKE2b-256 | 986812cf82243f72028e3343e7c0dbe252aea2e5cb54f88d16fc587b8f789533 |
File details
Details for the file cihai-0.33.0-py3-none-any.whl
.
File metadata
- Download URL: cihai-0.33.0-py3-none-any.whl
- Upload date:
- Size: 25.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4db5a8aa94aec0acd1a53f2e44eb5fd550c17a71d01d1382a8d40196684d29c3 |
|
MD5 | c938aaff0b8ea8aca7a8f162220c2537 |
|
BLAKE2b-256 | 780e60c88d6ed9fe0809ad98ae01e54f436a7b885ad4b974f4079d798380b398 |