toPinyin 0.0.1 → 0.0.2

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 CHANGED
@@ -0,0 +1,17 @@
1
+ require 'toPinyin'
2
+
3
+ words = "
4
+
5
+ 没有
6
+ 理想
7
+
8
+ 咸鱼
9
+
10
+ 什么
11
+ 区别
12
+ ".split("\n")
13
+
14
+ words.sort! {|a ,b| a.pinyin.join <=> b.pinyin.join }
15
+
16
+
17
+ <b>see ./lib/toPinyin/test.rb for more usage. </b>
data/lib/test.rb CHANGED
@@ -11,28 +11,30 @@ raise "toUnicode failed" if s.unicode != ["6625", "82B1", "79CB", "6708", "4F55"
11
11
  #let's sort it
12
12
 
13
13
  words = "
14
- 检查
15
- 我们
16
- 的二
17
- 进制
18
- 是否
19
- 适合
20
- 你的
21
- 平台".split("\n")
14
+
15
+ 没有
16
+ 理想
17
+
18
+ 咸鱼
19
+
20
+ 什么
21
+ 区别
22
+ ".split("\n")
22
23
 
23
24
  #for debug
24
25
  #words.each {|w| puts w.pinyin.inspect ; puts w.unicode.inspect ; puts w.utf8.inspect}
25
26
  words.sort! {|a ,b| a.pinyin.join <=> b.pinyin.join }
26
27
 
27
28
  sorted = "
28
- 的二
29
- 检查
30
- 进制
31
- 你的
32
- 平台
33
- 适合
34
- 是否
35
- 我们".split("\n")
29
+
30
+ 理想
31
+ 没有
32
+ 区别
33
+
34
+ 什么
35
+ 咸鱼
36
+
37
+ ".split("\n")
36
38
 
37
39
  raise "sort failed" if words.join != sorted.join
38
40
 
data/lib/toPinyin.rb CHANGED
@@ -1,7 +1,6 @@
1
1
 
2
2
  require 'iconv'
3
- require './toPinyin/uniToPyMap'
4
-
3
+ require File.join(File.dirname(__FILE__),'toPinyin/uniToPyMap')
5
4
 
6
5
  #The string should be UTF-8 encoded
7
6
  class String
@@ -1,3 +1,3 @@
1
1
  module Topinyin
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toPinyin
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - pierr.chen