chinese_pinyin 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +18 -0
- data/test/pinyin_test.rb +12 -0
- data/test/test_helper.rb +3 -0
- metadata +56 -0
data/README.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# ChinesePinyin
|
2
|
+
|
3
|
+
Translate chinese hanzi to pinyin.
|
4
|
+
|
5
|
+
The dict is borrowed from http://github.com/fayland/perl-lingua-han/tree/master/Lingua-Han-PinYin/
|
6
|
+
|
7
|
+
## Install
|
8
|
+
|
9
|
+
<pre><code>sudo gem install chinese_pinyin</code></pre>
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
<pre><code>
|
14
|
+
Pinyin.t('中国') => "zhong guo"
|
15
|
+
Pinyin.t('中国', '-') => "zhong-guo"
|
16
|
+
Pinyin.t('中国', '') => "zhongguo"
|
17
|
+
Pinyin.t('你好world') => "ni hao world"
|
18
|
+
</code></pre>
|
data/test/pinyin_test.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class PinyinTest < Test::Unit::TestCase
|
4
|
+
def test_t
|
5
|
+
assert_equal("zhong guo", Pinyin.t('中国'))
|
6
|
+
assert_equal("zhong-guo", Pinyin.t('中国', '-'))
|
7
|
+
|
8
|
+
assert_equal("huangzhimin", Pinyin.t('黄志敏', ''))
|
9
|
+
|
10
|
+
assert_equal("zhong guo english ri", Pinyin.t('中国english日'))
|
11
|
+
end
|
12
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chinese_pinyin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Richard Huang
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-03-10 00:00:00 +08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: translate chinese hanzi to pinyin.
|
17
|
+
email: flyerhzm@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.md
|
24
|
+
files:
|
25
|
+
- README.md
|
26
|
+
has_rdoc: true
|
27
|
+
homepage: http://github.com/flyerhzm/chinese_pinyin
|
28
|
+
licenses: []
|
29
|
+
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options:
|
32
|
+
- --charset=UTF-8
|
33
|
+
require_paths:
|
34
|
+
- lib
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: "0"
|
40
|
+
version:
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
version:
|
47
|
+
requirements: []
|
48
|
+
|
49
|
+
rubyforge_project:
|
50
|
+
rubygems_version: 1.3.5
|
51
|
+
signing_key:
|
52
|
+
specification_version: 3
|
53
|
+
summary: translate chinese hanzi to pinyin.
|
54
|
+
test_files:
|
55
|
+
- test/test_helper.rb
|
56
|
+
- test/pinyin_test.rb
|