cjk_converter 0.0.17 → 0.0.18
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/lib/cjk_converter/pinyin.rb +20 -1
- data/lib/cjk_converter/version.rb +1 -1
- metadata +2 -2
data/lib/cjk_converter/pinyin.rb
CHANGED
@@ -24,6 +24,19 @@ module CJKConverter
|
|
24
24
|
# end
|
25
25
|
# str
|
26
26
|
# end
|
27
|
+
def self.pinyin_to_pinyin_num(py)
|
28
|
+
pys = CJKConverter::PYN_PY.values.select{|x| py.include? x}
|
29
|
+
match = pys.sort{|x,y| x.length <=> y.length}[-1]
|
30
|
+
replace = CJKConverter::PYN_PY.find{|k,v| k if v == match}[0]
|
31
|
+
|
32
|
+
pyn = py.gsub(match, replace)
|
33
|
+
|
34
|
+
# if py[-1] == 'n' || py[-1] == 'g'
|
35
|
+
pyn = pyn.gsub(/[1-5]/,'') + pyn[/[1-5]/]
|
36
|
+
# binding.pry
|
37
|
+
# end
|
38
|
+
pyn
|
39
|
+
end
|
27
40
|
end
|
28
41
|
PYN_PY = {
|
29
42
|
"A1" => "Ā",
|
@@ -165,6 +178,12 @@ module CJKConverter
|
|
165
178
|
"ve2" => "üé",
|
166
179
|
"ve3" => "üě",
|
167
180
|
"ve4" => "üè",
|
168
|
-
"ve5" => "üe"
|
181
|
+
"ve5" => "üe",
|
182
|
+
'm1' => 'm̄',#using combining diacritical marks
|
183
|
+
'm2' => "ḿ",
|
184
|
+
'm3' => 'm̌',#using combining diacritical marks
|
185
|
+
'm4' => "m̀",
|
186
|
+
'm5' => 'm',
|
187
|
+
|
169
188
|
}
|
170
189
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cjk_converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-23 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A CJK (Chinese, Japanese, and Korean) romanization converter for CJK
|
15
15
|
languages.
|