cantonese 0.1.1 → 0.1.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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ae7740aa252f2be334b9f68abfcf916fe692320f
|
|
4
|
+
data.tar.gz: a4dbd9c30c8bea7fdfd197cd43c801f0c7a53d6c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: baaa4749abad128a550b0a56d3157c2380a06cc9c0974c234d1356772a2d6bfe3974493a664d7a5b47a357817b001e5ff3c1ede3a9faa4e076423d457a4b2690
|
|
7
|
+
data.tar.gz: a1c385ecedc1f7175080a6059263215db08170b74db5c004fb0ddc9a2ba8699c52ae9eeacedbcf48809117e68f16140862207ea5dbf0d39b673f865f0fd1216b
|
|
@@ -18,10 +18,10 @@ module Cantonese
|
|
|
18
18
|
def process(html)
|
|
19
19
|
doc = Nokogiri::HTML(html, nil, 'UTF-8')
|
|
20
20
|
doc.search("//table//tr[position()>1]").collect do |row|
|
|
21
|
-
radical_id = row.xpath("
|
|
22
|
-
types = {
|
|
21
|
+
radical_id = row.xpath("./td[position()=1]//text()").text.gsub(%r|[\[\]]|, "").to_i
|
|
22
|
+
types = {2 => :'單讀音字', 3 => :'破音字', 4 => :'異讀字', 5 => :'異讀破音字'}
|
|
23
23
|
types.collect do |index, type|
|
|
24
|
-
row.xpath("
|
|
24
|
+
row.xpath("./td[position()=#{index}]/a").collect do |link|
|
|
25
25
|
{:radical_id => radical_id, :text => link.text, :type => type}
|
|
26
26
|
end
|
|
27
27
|
end
|
data/lib/cantonese/version.rb
CHANGED