Generate compositions, supercompositions and variants for a given Hanzi / Kanji
pip install cjkradlib
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) # ['摩', '磨', '魔', '麿']
- Use https://github.com/cjkvi/cjkvi-ids as the source for CJK-decomposition.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for cjkradlib-0.2.0.1-py3-none-any.whl