Skip to main content

Library for CJK (chinese, japanese, korean) language data.

Project description

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!

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": 㑘, 㑤, 㓛, 㘬, 㙉, 㚃, 㚒, 㚥, 㛦, 㜴, 㜺, 㝖, 㤛, 㦝, ...

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: 
kTotalStrokes: '13'
ucn: U+5715
--------

Project details


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.7.2.tar.gz (50.2 kB view details)

Uploaded Source

File details

Details for the file cihai-0.7.2.tar.gz.

File metadata

  • Download URL: cihai-0.7.2.tar.gz
  • Upload date:
  • Size: 50.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cihai-0.7.2.tar.gz
Algorithm Hash digest
SHA256 744e7b943832eab434af596e55e28b6bc94ff5ea438d4c61f33486e5b44b5a17
MD5 cb7de95b0b66538be990b7869dca638d
BLAKE2b-256 a753f9f81c9f664c8222ceeae9c99890dc1cdc8a456f861cfeb1af82f5789539

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page