By Peng Zhao | October 15, 2018
The pinyin package intended to convert Chinese characters into pinyin. However, more demands were called by users. That was why the features of converting to four-corner codes and five-stroke codes (version 98) were added. After my previous update, the utopian moderator @justyy kindly suggested adding the Five-Stroke-86 as well. I totally agree, and I think there could be more.
The pinyin package now has two new features:
- Supporting Five-stroke-86.
- User can customize his/her own dictionary, so that the pinyin package can convert Chinese characters (or other characters) according to the dictionary.
How did I implement them?
I modified the
pylib() (renamed as
pydic()) so as to be more flexible and open to different dictionaries. A Five-Stroke-86 dictionary was created. I also wrote a new function
load_dic() to load the dictionaries. The main function
pinyin() was renamed as
py(), which can convert Chinese characters (or other characters) into the destined characters.
Each part of the functions are well documented. Other files were updated automatically by compilation.
Link to relevant lines in the code on GitHub can be found mainly in my latest commit (click to see the details):