Skip to main content

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

Project description

cihai · Python Package License Code Coverage

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

UNIHAN data

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

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

Docs Build Status

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

Uploaded Source

Built Distribution

cihai-0.35.0-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cihai-0.35.0.tar.gz
  • Upload date:
  • Size: 232.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for cihai-0.35.0.tar.gz
Algorithm Hash digest
SHA256 7b11ed857ad94e9fed05deff836fab6d8bc5b3c32621bb716720bb9bb4c3e188
MD5 d9846a3b2443a849340a9fff153f5f57
BLAKE2b-256 1daa198997bb600d51d564ad51944017e7883241ab585cc8dcf81640246f444b

See more details on using hashes here.

File details

Details for the file cihai-0.35.0-py3-none-any.whl.

File metadata

  • Download URL: cihai-0.35.0-py3-none-any.whl
  • Upload date:
  • Size: 25.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for cihai-0.35.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78642371ca70f8a0b6cc39540f1037cde32666f4301b07ed2bd110a26d42bdba
MD5 b11aae7914bc80b97162d1b6ba990f1a
BLAKE2b-256 bc6474569ad1c627a4ded7d10caae5a41ae738192fe3cfb97f0683c49f535fcc

See more details on using hashes here.

Supported by

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