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: e57dfb90bd392ed0b638c24c90380bd00bd4d8b8
4
- data.tar.gz: b2f00dc258903c5ef9b62ed2551bbbfbdd79152a
3
+ metadata.gz: ae7740aa252f2be334b9f68abfcf916fe692320f
4
+ data.tar.gz: a4dbd9c30c8bea7fdfd197cd43c801f0c7a53d6c
5
5
  SHA512:
6
- metadata.gz: e29c827ceec28e744a8df176982077a6a059ca25e1d14576c8972dc0520e2639985055306474f64ad3d7487f915c4f6879592c9ebbbd198b5845611203ee6ae1
7
- data.tar.gz: 03914e85b518d0f35420dbe5788cc56e68ae4d15a3fd3d225d065fc9cf13a3b624bb5c52a6134fda6fefb1c0815a1f0ed1c91da02a3c2f2524d2b1afadd1d798
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(".//td[position()=1]//text()").text.gsub(%r|[\[\]]|, "").to_i
22
- types = {1 => :'單讀音字', 2 => :'破音字', 3 => :'異讀字', 4 => :'異讀破音字'}
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(".//td[position()=#{index}]/a").collect do |link|
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
@@ -1,3 +1,3 @@
1
1
  module Cantonese
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -10,6 +10,7 @@ describe Cantonese::Scraper::ClassifiedScraper do
10
10
  classified.each do |word|
11
11
  expect(word[:radical_id]).to_not be_nil
12
12
  expect(word[:text]).to_not be_nil
13
+ expect(word[:text].length).to eq(1)
13
14
  expect(word[:type]).to_not be_nil
14
15
  end
15
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cantonese
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francis Chong