Tool for finding ideographic (e.g. Han) characters from their components
Project description
ideograph
A tool to look up ideographs by their components. At the moment, it only contains Han characters, but it could be expanded to include other ideographic scripts such as Tangut or Sumero-Akkadian Cuneiform.
Installation
$ pip install ideograph
Usage
ideograph consists of a two functions, find()
and components()
:
find()
takes a string of ideograph components and returns a set of ideographs that include all of those components.
Characters in the component string that are not ideographic components are ignored.
Note that the current implementation is quite strict and relies on visual distinction for components rather than etymological connection: e.g. "人" ≠ "亻".
It can be called from the command line:
$ ideograph 木日勿
䵘楊鸉𣝻𣿘𥂸𥠜𦼴𩁒𪳷𬬍
or imported as a Python package:
>>> import ideograph
>>> ideograph.find("木日勿")
{'𣿘', '𣝻', '𥠜', '𪎥', '𩁒', '𪎧', '𥟘', '𣓗', '楊', '𣓾', '𬬍', '𪳷', '𦼴', '鸉', '䵘', '𥂸'}
components()
takes a string consisting of a single ideograph and returns a set of components. Note that the set contains components and the components of those components, and so on, down to the most basic of components contained in the cjkvi-ids data set.
>>> import ideograph
>>> ideograph.components("楊")
{'日', '木', '昜', '一', '勿', '旦', '勹', '丿', '\uf3e4'}
Data
Character components are derived from the cjkvi-ids database (included in this Git repository as a submodule), specifically the ids-cdp.txt
data file. As some components do not currently have a Unicode code point assigned to them, they are given code points in the Private Use Area of Unicode. Note that because of this, some of these characters may be returned by the find()
and components()
functions.
Data is stored in a sqlite3 database, which can be regenerated from cjkvi-ids data by running the generate_data.py
script.
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
Built Distribution
File details
Details for the file ideograph-1.1.0.tar.gz
.
File metadata
- Download URL: ideograph-1.1.0.tar.gz
- Upload date:
- Size: 5.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f668735a6295c53512a7c93feffd1a66f3f283fbbc9d74cae99cb9c3d45f1d81 |
|
MD5 | 53224cc431b4bc17aeab6f03f8ffadca |
|
BLAKE2b-256 | 45b81624a658191933a90b9795c01116a94d72a9664ba6c688ffd2e6d4c48a62 |
File details
Details for the file ideograph-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: ideograph-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ddb72777b95afecc11c43230a8d19b8aed348a4b683c0b47f2dfae59b0d1a0d |
|
MD5 | 9f5c67f078978e7a4d2e8dfeb2d47810 |
|
BLAKE2b-256 | c7bca28dc6d604be67d122836c769bd6da0e017059b34e8d7cb62a93764c5cf1 |