russian_word_forms 0.0.1 → 0.0.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 +4 -4
- data/lib/russian_word_forms/version.rb +1 -1
- data/lib/russian_word_forms.rb +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fccc2083fb316645995565120efd1094d1b9144d
|
|
4
|
+
data.tar.gz: 5e3d13e3c18417830e36adea90e5253cb13bba71
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c57efbca81e953dd9597dec4476f6c74dac693fed43ea407e9ab69e5c33d72b14d4ff2d67edc23892d3f4283118d42abb58b71f1e88612b5ba9f99ab3ee89dca
|
|
7
|
+
data.tar.gz: 6803a59a8d56ffc8ead2259334659beba43f4e23be48f55c7726f3d426c54287140ab3863c6648829f130972c2bf8f2bf43955efa6480d57ac3235791f0b2819
|
data/lib/russian_word_forms.rb
CHANGED
|
@@ -9,7 +9,8 @@ module RussianWordForms
|
|
|
9
9
|
word=word.mb_chars.upcase.to_s
|
|
10
10
|
flags=@dictionary.dictionary[word]
|
|
11
11
|
output=[]
|
|
12
|
-
|
|
12
|
+
output<<word if !flags.kind_of?(Array)
|
|
13
|
+
flags=@rules.rules.keys.join if flags.kind_of?(Array)&&flags.empty? # if not found in dictionary
|
|
13
14
|
flags.each_char do |flag|
|
|
14
15
|
rules=@rules.rules[flag]
|
|
15
16
|
rules.keys.each do |rule|
|
|
@@ -28,13 +29,13 @@ module RussianWordForms
|
|
|
28
29
|
end
|
|
29
30
|
end
|
|
30
31
|
end
|
|
31
|
-
output
|
|
32
|
+
output.uniq
|
|
32
33
|
end
|
|
33
34
|
def self.get_base_form(word)
|
|
34
35
|
word=word.mb_chars.upcase.to_s
|
|
35
36
|
flags=@dictionary.dictionary[word]
|
|
36
37
|
variants=[]
|
|
37
|
-
variants<<word if !flags.
|
|
38
|
+
variants<<word if !flags.kind_of?(Array)
|
|
38
39
|
@rules.rules.keys.each do |flag|
|
|
39
40
|
rules=@rules.rules[flag]
|
|
40
41
|
rules.keys.each do |rule|
|
|
@@ -58,7 +59,7 @@ module RussianWordForms
|
|
|
58
59
|
end
|
|
59
60
|
output=[]
|
|
60
61
|
variants.each do |variant|
|
|
61
|
-
if !@dictionary.dictionary[variant].
|
|
62
|
+
if !@dictionary.dictionary[variant].kind_of?(Array)&&self.inflect(variant).any? { |w| w==word }
|
|
62
63
|
output<<variant
|
|
63
64
|
end
|
|
64
65
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: russian_word_forms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maksatbek Mansurov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-01-
|
|
11
|
+
date: 2014-01-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|