0.0
No commit activity in last 3 years
No release in over 3 years
translate chinese hanzi to pinyin.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

 Project Readme

motion-pinyin

Translate chinese hanzi to pinyin.

A RubyMotion wrapper for (https://github.com/flyerhzm/chinese_pinyin).

Install

Add this line to your application's Gemfile:

gem 'motion-pinyin'

And then execute:

$ bundle

Usage

Pinyin.t('中国')  => "zhong guo"
Pinyin.t('你好world') => "ni hao world"
Pinyin.t('中国', splitter: '-') => "zhong-guo"
Pinyin.t('中国', splitter: '') => "zhongguo"
Pinyin.t('中国', tone: true) => "zhong1 guo2"

Polyphone Issue

use Words.dat to override default behavior.

by default

Pinyin.t('广州') => "yan zhou"

add file Words.dat

广州|guang3 zhou1

set ENV['WORDS_FILE'] for Words.dat

ENV['WORDS_FILE'] = "Words.dat path"
Pinyin.t('广州') => "guang zhou"