Input a Chinese character. Output all the variant characters of it.
Project description
Yitizi
Input a Chinese character. Output all the variant characters of it.
輸入一個漢字,輸出它的全部異體字。
输入一个汉字,输出它的全部异体字。
Usage
Python
pip install yitizi
>>> import yitizi
>>> yitizi.get('和')
['咊', '龢']
JavaScript (Node.js)
npm install yitizi
> const Yitizi = require('yitizi');
> Yitizi.get('和');
[ '咊', '龢' ]
JavaScript (browser)
<script src="https://cdn.jsdelivr.net/npm/yitizi@0.0.2"></script>
> Yitizi.get('和');
[ '咊', '龢' ]
Design
As shown in the figure, the following information is stored in yitizi.csv
:
This file is processed by build/main.py
. The data in the file is converted into a graph.
Then, for each node in the graph, output the node and all its neighbor nodes. This becomes the final dictionary of the variant characters.
{ 正字: 異體字1, 異體字2,
異體字1: 正字,
異體字2: 正字
}
When using the library, the above dictionary is used to determine the variant characters of a given character.
Note for developers
You need to substitute all the occurrences of the version string when publishing a new release.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.