Skip to content
translate chinese hanzi to pinyin
Ruby
Pull request Compare This branch is 48 commits behind flyerhzm:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
data
lib
test
.gitignore
README.md
Rakefile
VERSION
chinese_pinyin.gemspec

README.md

ChinesePinyin

Translate chinese hanzi to pinyin.

The dict is borrowed from http://github.com/fayland/perl-lingua-han/tree/master/Lingua-Han-PinYin/

Install

sudo gem install chinese_pinyin

Usage


require 'rubygems'
require 'chinese_pinyin'

Pinyin.t('中国')  => "zhong guo"
Pinyin.t('中国', '-') => "zhong-guo"
Pinyin.t('中国', '') => "zhongguo"
Pinyin.t('你好world') => "ni hao world"
Something went wrong with that request. Please try again.