[R pinyin: New Features] User customized dictionaries

Repo

https://github.com/pzhaonet/pinyin

Brief Intro and curriculum

The 'pinyin' package was developed in R language. It can convert Chinese characters in to Latin letters, officially called pinyin, i.e. the romanization system for Standard Chinese in mainland China, Malaysia, Singapore, and Taiwan. An brief introduction can be referred to the post

New Features

What features did I add?

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.

pinyin2.jpg

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):

GitHub Account

https://github.com/pzhaonet

H2
H3
H4
3 columns
2 columns
1 column
6 Comments