mw_dictionary_api 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mw_dictionary_api/parsers/entry_parser.rb +20 -7
- data/lib/mw_dictionary_api/result.rb +1 -1
- 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: fde666fe3da63ac495854526b7290e75c88139d0
|
4
|
+
data.tar.gz: 8c495dedbdec5aea75ded362b8286ad615744daf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be5bfd04c8bc8a3d16317ee28fa398efcf0f6a45a200c0c0eacceb8ffe66f907ff84a32a8b42258477f4ecab276c05f0e240481e16d714adc48eab0fe3974631
|
7
|
+
data.tar.gz: 17e34ff4252c94e7c927bba6cf22212a21ade65ee34edf4cf88958dbb54584c6aa8024362e7ecbc26af221be956185103aa7e1496e90208c11363c651676b67c
|
@@ -49,15 +49,28 @@ module MWDictionaryAPI
|
|
49
49
|
end
|
50
50
|
|
51
51
|
rule :inflections do |data, opts|
|
52
|
-
data.xpath("in
|
53
|
-
hash =
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
52
|
+
inflections = data.xpath("in").inject([]) do |inflections, in_node|
|
53
|
+
hash = {}
|
54
|
+
in_node.xpath("il | if").each do |node|
|
55
|
+
if node.name == "il"
|
56
|
+
hash[:inflection_label] = node.content
|
57
|
+
else
|
58
|
+
hash[:inflected_form] = node.content.gsub(/\W/, "").force_encoding("UTF-8")
|
59
|
+
end
|
60
|
+
|
61
|
+
if hash.has_key? :inflected_form
|
62
|
+
inflections << hash
|
63
|
+
hash = {}
|
64
|
+
end
|
65
|
+
end
|
59
66
|
inflections
|
60
67
|
end
|
68
|
+
inflections.each_index do |index|
|
69
|
+
if inflections[index][:inflection_label] == "or"
|
70
|
+
inflections[index][:inflection_label] = inflections[index-1][:inflection_label] if index > 0
|
71
|
+
end
|
72
|
+
end
|
73
|
+
inflections
|
61
74
|
end
|
62
75
|
|
63
76
|
rule_helpers do
|