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

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(unihan_options)

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)

# stable
$ pip install --user cihai-cli

# pre-release
$ pip install --user --pre 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
--------

UNIHAN data

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

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.9.0a5.tar.gz (54.9 kB view details)

Uploaded Source

File details

Details for the file cihai-0.9.0a5.tar.gz.

File metadata

  • Download URL: cihai-0.9.0a5.tar.gz
  • Upload date:
  • Size: 54.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

File hashes

Hashes for cihai-0.9.0a5.tar.gz
Algorithm Hash digest
SHA256 33719417ff442b0b6bf735977debe08abec2a7328463aeb5ca4cb5e2aa65799f
MD5 2e6b6bb14b248b6ca0ab80747f0eec07
BLAKE2b-256 7bfd271d57f890d74851f00896f337a4acb861dd7a2e41bf21ea64ea73fd1d82

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