/pinyin

Convert Chinese Charaters to Pinyin letters, better usage in Rails as gem or plugins

Primary LanguageRuby

本类实现汉字转拼音功能,由perl的Lingua::Han::PinYin包port而来(包括UniHan的数据)。

由于实际需要只实现utf-8版本,需要gbk等转拼音的请使用Iconv自行转换。

感谢Lingua::Han::PinYin原作者(www.fayland.org/journal/Han-PinYin.html)的工作.

Author H.J.Leochen ( www.upulife.com ) work on coding, I just move it to a gem and plugin for rails usage

License:: MIT

Builder: Allen Chan (allenchan.com.cn)

Pinyin (permlink)- Convert Chinese Characters to Pinyin letters, better usage in Rails as gem or plugins

Install

$ sudo gem install Pinyin --source http://gem.github.com

irb Usage

require 'rubygems'
require 'pinyin'
py = Pinyin.new
py.to_permlink("**")

>> zhong-guo

py.to_pinyin_abbr("**")

>> zg

Bugs

  1. 多音字不知道怎么处理

  2. 英文中文夹杂的string中间英文和中文字相间的会没有separator