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!
Usage
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
bootstrap_unihan(c.metadata)
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": 㑘, 㑤, 㓛, 㘬, 㙉, 㚃, 㚒, 㚥, 㛦, 㜴, 㜺, 㝖, 㤛, 㦝, ...
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.
unihan-etl - UNIHAN data exports for csv, yaml and json.
Quick links
Python support |
Python 2.7, >= 3.5, pypy |
Source |
|
Docs |
|
Changelog |
|
API |
|
Issues |
|
Travis |
|
Test coverage |
|
pypi |
|
OpenHub |
|
License |
MIT |
git repo |
|
install stable |
|
install dev |
|
tests |
|
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
cihai-0.8.1.tar.gz
(43.7 kB
view details)
File details
Details for the file cihai-0.8.1.tar.gz
.
File metadata
- Download URL: cihai-0.8.1.tar.gz
- Upload date:
- Size: 43.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b163eb918f8c83082d227f9b7fb98de52b47f4023b3f799a86bd5ee4b37f563a |
|
MD5 | 84795ec82a7b18bd4f3bef4e406f9079 |
|
BLAKE2b-256 | 2b795ff3fa74da1e9c4961eb9a61912db5331f11357ddd69899d0a9651ff244f |