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

Uploaded Source

Built Distribution

cihai-0.29.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cihai-0.29.0.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for cihai-0.29.0.tar.gz
Algorithm Hash digest
SHA256 5c765f1041e9fe58502e994662b4b2efb6b09765d07bad20004b63f227d26f22
MD5 cf6ee9051897c77d40c4de3a42fc0789
BLAKE2b-256 fb08e5331ce346302b69ccdcc5a84d01ce44d79e0b7413b61c9104ef66f23832

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: cihai-0.29.0-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for cihai-0.29.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f323b7fc7160f7fa4bd5066c853a87eaeef514c399f6bef7b24c064ee1cec457
MD5 8462cc304e565c67556239e068916c07
BLAKE2b-256 0d48fff167fa18114a6edf551f5f31e8a5864c984078f033ebf74b3521e3849d

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