[R pinyin: New Features] User customized dictionaries

in #utopian-io6 years ago (edited)

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

Sort:  

Thanks @dapeng for your contribution especially adding support for 86-five-stroke. I would like to give some suggestions if you don't mind:

  1. It is better not to push to the master branch instead, git checkout -b NewFeatures, commit your changes, push to remote, and create a PR, I feel this brings advantages in many ways: (a) it will be easier to review your changes - code review (b) it makes it possible that if you decide to have some hot-patches based on a specific version. (c) it will label a batch of your commits and your master branch history will be well-maintained and clean.
  2. Some of your commit messages are not very clear, for example bug fixed, fix bugs, update readme try to write more and give more details.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Yes, I agree. The GIT things are really something tough for a non-professional programmer like me to learn. I wish I could do it in a proper way some day.

Thank you very much for the suggestions!

Thank you for your review, @justyy!

So far this week you've reviewed 5 contributions. Keep up the good work!

Hi @dapeng!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Congratulations @dapeng! You have received a personal award!

2 Years on Steemit
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard:

SteemitBoard Ranking update - Steem Power, Followers and Following added

Support SteemitBoard's project! Vote for its witness and get one more award!

Hey, @dapeng!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.31
TRX 0.11
JST 0.034
BTC 64060.81
ETH 3129.62
USDT 1.00
SBD 4.17