Convert Chinese Charaters to Pinyin letters, better usage in Rails as gem or plugins
Ruby
Switch branches/tags
Nothing to show
Latest commit 972feb3 Mar 11, 2009 @chenillen reformat the readme doc
Permalink
Failed to load latest commit information.
dict
lib
.gitignore
README.rdoc
Rakefile
init.rb
pinyin.gemspec

README.rdoc

本类实现汉字转拼音功能,由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