/chinese_pinyin_rs

Primary LanguageRubyMIT LicenseMIT

ChinesePinyinRs

代码逻辑参照 chinese_pinyin , 使用 Rust 实现,

       user     system      total        real
  12.000000   0.080000  12.080000 ( 12.125784)
  29.320000   0.100000  29.420000 ( 29.536190)

Installation

Add this line to your application's Gemfile:

gem 'chinese_pinyin_rs'

And then execute:

$ bundle

Or install it yourself as:

$ gem install chinese_pinyin_rs

Usage

ChinesePinyinRs.t('**')  => "zhong guo"
ChinesePinyinRs.t('你好world') => "ni hao world"
ChinesePinyinRs.t('**', splitter: '-') => "zhong-guo"
ChinesePinyinRs.t('**', splitter: '') => "zhongguo"
ChinesePinyinRs.t('**', tone: true) => "zhong1 guo2"
ChinesePinyinRs.t('**', tonemarks: true) => "zhōng guó"

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/chinese_pinyin_rs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.