cjkradlib

Generate compositions, supercompositions and variants for a given Hanzi / Kanji


Keywords
cjk, hanzi, kanji, kangxi, radical, cjk-characters
License
MIT
Install
pip install cjkradlib==0.2.0.1

Documentation

CJKradlib

Build Status PyPI version shields.io PyPI license PyPI pyversions

Generate compositions, supercompositions and variants for a given Hanzi / Kanji, based on cjkvi-ids. (Previously, cjk-decomp.)

Installation

pip install cjkradlib

Also, IDS sequences use full range of CJK ideographs, so the fonts that covers all encoded ideographs (such as HanaMin or Hanamin AFDKO ) should be used.

Usage

from cjkradlib import RadicalFinder
finder = RadicalFinder(lang='zh')  # default is 'zh'
result = finder.search('')
print(result.compositions)  # ['广', '林']
print(result.supercompositions)  # ['摩', '魔', '磨', '嘛', '麽', '靡', '糜', '麾']
print(result.variants)  # ['菻']

Supercompositions are based on the character frequency in each language, so altering the language give slightly different results.

from cjkradlib import RadicalFinder
finder = RadicalFinder(lang='jp')
result = finder.search('')
print(result.supercompositions)  # ['摩', '磨', '魔', '麿']

Related projects

Plan