zhongwen_tools 0.11.0 → 0.11.1
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.
- checksums.yaml +4 -4
- data/lib/zhongwen_tools/romanization.rb +3 -1
- data/lib/zhongwen_tools/version.rb +1 -1
- data/test/test_romanization.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9649f50da4798d4a4606af88575190af02466a4f
|
|
4
|
+
data.tar.gz: edd58503dbd3310b5e18569c45cfcba15301b5a9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: acccbe6b57274b2d706f7cf565e2b061580086be1ab52ae2aba99bafabc47f87d12bad1bbb44eed890564454c4bb9a37d6c6ae555e46a072ab30d883ca86f783
|
|
7
|
+
data.tar.gz: 0dd7a4044acbb69dac6f215752671426b36b646d0c6b81f452656a278bf3c68259843593367430ae951aea134acf8cff02dd357a1518b778f0b95fd164668b0c
|
|
@@ -149,6 +149,7 @@ module ZhongwenTools
|
|
|
149
149
|
words = pinyin.split(' ')
|
|
150
150
|
|
|
151
151
|
pyn = words.map do |word|
|
|
152
|
+
#binding.pry if word == "Wǒmen"
|
|
152
153
|
pys = word.split(/['\-]/).flatten.map{|x| x.scan(Regex.py).map{|x| (x - [nil])[0]}}.flatten
|
|
153
154
|
_current_pyn(word, pys)
|
|
154
155
|
end
|
|
@@ -170,8 +171,9 @@ module ZhongwenTools
|
|
|
170
171
|
py.include? x
|
|
171
172
|
end.sort{|x,y| x.length <=> y.length}[-1]
|
|
172
173
|
|
|
174
|
+
#binding.pry
|
|
173
175
|
# Edge case.. en/eng pyn -> py conversion is one way only.
|
|
174
|
-
match = match[/(
|
|
176
|
+
match = match[/(ē|é|ě|è|e)n?g?/].nil? ? match : match.chars[0]
|
|
175
177
|
|
|
176
178
|
replace = PYN_PY.find{|k,v| k if v == match}[0]
|
|
177
179
|
|
data/test/test_romanization.rb
CHANGED
|
@@ -40,6 +40,8 @@ class TestRomanization < Minitest::Test
|
|
|
40
40
|
assert_equal 'cao3 di4', 'tsau3 di4'.to_pyn(:yale)
|
|
41
41
|
assert_equal 'cao3 di4', 'tsau3 di4'.to_pyn
|
|
42
42
|
|
|
43
|
+
|
|
44
|
+
assert_equal 'Wo3men5', "Wǒmen".to_pyn(:py)
|
|
43
45
|
#assert_equal 'Wu1-lu2-ha1-nuo4-fu1', 'Wūlúhānuòfū'.to_pyn(:py)
|
|
44
46
|
#"007:Dàpò Liàngzǐ Wēijī", "007: Da4po4 Liang4zi3 Wei1ji1"
|
|
45
47
|
end
|