Python library for CJK (Chinese, Japanese, and Korean) language data
Python Makefile
Latest commit 8483daf Jul 20, 2017 @tony tony committed on GitHub Merge pull request #52 from cihai/pyup-update-vulture-0.18-to-0.19
Update vulture to 0.19
Failed to load latest commit information.
doc docs: fix link to unihan-etl on datasets page Jun 6, 2017
examples chmod example usage May 20, 2017
requirements Update vulture from 0.18 to 0.19 Jul 20, 2017
.coveragerc update coveragerc to pytest layout Apr 16, 2017
.tmuxp.yaml refresh tmuxp.yaml and bootstrap tools Apr 16, 2017
CHANGES tag v0.7.4 May 26, 2017
LICENSE update LICENSE to MIT Apr 29, 2017 remove unused file from MANIFEST May 20, 2017
README.rst redirect unihan-tabular -> unihan-etl May 26, 2017 bootstrap any python 3 version May 19, 2017


cihai - Python library for CJK (chinese, japanese, korean) data

Python Package Documentation Status Build Status Code Coverage License

This project is under active development. Follow our progress and check back for updates!


Python library only

$ pip install --user cihai
from cihai.core import Cihai
from cihai.bootstrap import bootstrap_unihan

c = Cihai()
if not c.is_bootstrapped:  # download and install Unihan to db
    c.reflect_db()         # automap new table created during bootstrap

query = c.lookup_char('')
glyph = query.first()
print("lookup for 好: %s" % glyph.kDefinition)
# lookup for 好: good, excellent, fine; well

query = c.reverse_char('good')
print('matches for "good": %s ' % ', '.join([glph.char for glph in query]))
# matches for "good": 㑘, 㑤, 㓛, 㘬, 㙉, 㚃, 㚒, 㚥, 㛦, 㜴, 㜺, 㝖, 㤛, 㦝, ...

See API documentation and /examples.

CLI front-end (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

No library, just data

All datasets that cihai uses have stand-alone tools to export their data. No library required.

Quick links

Python support Python 2.7, >= 3.5, pypy
Test coverage
License MIT
git repo
$ git clone
install stable
$ pip install cihai
install dev
$ git clone cihai
$ cd ./cihai
$ virtualenv .env
$ source .env/bin/activate
$ pip install -e .
$ python test