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


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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cihai-0.37.0-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cihai-0.37.0.tar.gz
  • Upload date:
  • Size: 292.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cihai-0.37.0.tar.gz
Algorithm Hash digest
SHA256 e83ebc7b84990f24e930798a19ab3061c57f5af5492a3e890476dd831d9e4245
MD5 4ffa4e0928a5aa7af051ab882b65a67f
BLAKE2b-256 e039166a9cebb2cb8f0038cfaefdbd898eb46ec6d4a9f64a44f62ee30414746c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cihai-0.37.0.tar.gz:

Publisher: tests.yml on cihai/cihai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: cihai-0.37.0-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cihai-0.37.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3473acfebb00e9e9f9f9b1eb2bc4edc1b51c8ee6e141b688951ddb483f4a1c2
MD5 0702ae2f58cca145abbb623b80e3f53d
BLAKE2b-256 8729f1532d6d1e6577f35b81f05cbf8ee6a12ab2ef0da2c9c55dd620a549a213

See more details on using hashes here.

Provenance

The following attestation bundles were made for cihai-0.37.0-py3-none-any.whl:

Publisher: tests.yml on cihai/cihai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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