chinese_convt 0.0.2 → 0.0.5
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 +1 -1
- data/chinese_convt.gemspec +4 -4
- data/lib/chinese_convert/zh_convt +1 -1
- data/lib/chinese_convert/zh_convt.rb +13 -9
- data/test/test_chinese_convt.rb +5 -5
- metadata +5 -5
@@ -9,19 +9,23 @@ module Chinese
|
|
9
9
|
type.first.split(',').each{ |term| convt_table.last.last[ term.split(':').first ] = term.split(':').last }
|
10
10
|
end
|
11
11
|
end
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
begin
|
13
|
+
str0 = String.new( str )
|
14
|
+
str1 = String.new( str )
|
15
|
+
convt_table.each do |group|
|
16
|
+
arr.each do |t|
|
17
|
+
group[t].each do |key , value|
|
18
|
+
while ( q = str0.index( key ) ) != nil
|
19
|
+
str0[q...(q + key.size)] = "#" * value.size
|
20
|
+
str1[q...(q + key.size)] = value
|
21
|
+
end
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
25
|
+
return str1
|
26
|
+
rescue
|
27
|
+
return $!
|
23
28
|
end
|
24
|
-
return str1
|
25
29
|
end
|
26
30
|
end
|
27
31
|
end
|
data/test/test_chinese_convt.rb
CHANGED
@@ -3,11 +3,11 @@ require 'test/unit'
|
|
3
3
|
require 'chinese_convt'
|
4
4
|
|
5
5
|
class TestChineseConvt < Test::Unit::TestCase
|
6
|
-
Str_tra = { 0 => "
|
7
|
-
Str_sim = { 0 => "
|
8
|
-
Str_tw = { 0 => "
|
9
|
-
Str_hk = { 0 => "
|
10
|
-
Str_cn = { 0 => "
|
6
|
+
Str_tra = { 0 => "幹部一干人等幹事不乾不淨", 1 => "後天來去后里天后宮", 2 => "這是從前面茶棚里留聲機上放出來的", 3 => "觸摸屏取代鼠標對互聯網的影響", 4 => "舊金山檯球冠軍是諧星"}
|
7
|
+
Str_sim = { 0 => "干部一干人等干事不干不净", 1 => "后天来去后里天后宫", 2 => "这是从前面茶棚里留声机上放出来的", 3 => "触摸屏取代鼠标对互联网的影响", 4 => "旧金山台球冠军是谐星"}
|
8
|
+
Str_tw = { 0 => "幹部一干人等幹事不乾不淨", 1 => "後天來去后里天后宮", 2 => "這是從前面茶棚里留聲機上放出來的", 3 => "觸控螢幕取代滑鼠對網際網路的影響", 4 => "舊金山撞球冠軍是諧星"}
|
9
|
+
Str_hk = { 0 => "幹部一干人等幹事不乾不淨", 1 => "後天來去后里天后宮", 2 => "這是從前面茶棚里留聲機上放出來的", 3 => "觸摸屏取代鼠標對互聯網的影響", 4 => "三藩市桌球冠軍是諧星"}
|
10
|
+
Str_cn = { 0 => "干部一干人等干事不干不净", 1 => "后天来去后里天后宫", 2 => "这是从前面茶棚里留声机上放出来的", 3 => "触摸屏取代鼠标对互联网的影响", 4 => "旧金山台球冠军是笑星"}
|
11
11
|
|
12
12
|
def test_zh2tra
|
13
13
|
Str_sim.each{ |i , w| assert_equal( Str_tra[i] , Chinese.zh2tra( w ) ) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chinese_convt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description:
|
15
|
-
|
14
|
+
description: Conversion between Traditional and Simplified Chinese. furthermore, adjusting
|
15
|
+
phrases to conform in Taiwan or Hong Kong or China.
|
16
16
|
email: xxxooo.tw@gmail.com
|
17
17
|
executables: []
|
18
18
|
extensions: []
|
@@ -48,5 +48,5 @@ rubyforge_project:
|
|
48
48
|
rubygems_version: 1.8.15
|
49
49
|
signing_key:
|
50
50
|
specification_version: 3
|
51
|
-
summary:
|
51
|
+
summary: Traditional and Simplified Chinese conversion~~
|
52
52
|
test_files: []
|