A Ruby gem that converts a string consisting of Simplified Chinese characters into Hanyu Pinyin.

It adds a ‘to_pinyin’ method to the String class.

Example Usage:

require ‘rubygems’ require ‘string_to_pinyin’

a = ‘名’ puts a.to_pinyin # “míng”

*Note: It requires the unix program ‘grep’ to be installed

Installation:

<sudo> gem install ruby_string_to_pinyin

License:

The MIT License. See LICENSE file for more information.

See also two alternative gems: github.com/superslau/pinyinify github.com/chenillen/pinyin