petrovich 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +2 -2
- data/README.md +11 -6
- data/lib/petrovich/rules.rb +1 -1
- data/lib/tasks/evaluate.rake +4 -0
- data/{lib/petrovich → rules}/rules.yml +49 -37
- metadata +17 -38
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e254345aa99e9b41420872a0a26772a591770d11
|
4
|
+
data.tar.gz: 06d8364dc873d2d8240b47214820ab226d8027e6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cd90dab2d64215eaa63e405577cf24a78193057f978f719d46f016e58a23f19b4b8ff1ab1408abf78c1fb332f6e0ecd2714c14f81dbd1c39d0308c970dfc2aa5
|
7
|
+
data.tar.gz: 50c85d2aaf853a2d709ab1672641cd47cef24d72eeb947370ad74d3ceffa6e78a8f1b5b0188796453e3cc4dae49cd43287e4949f693c54fb5579203e7fb5f235
|
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2013
|
1
|
+
Copyright (c) 2013 Petrovich Developers
|
2
2
|
|
3
3
|
MIT License
|
4
4
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Склонение падежей русских имён, фамилий и отчеств. Вы задаёте начальное имя
|
4
4
|
в именительном падеже, а получаете в нужном вам.
|
5
5
|
|
6
|
-
[![Build Status](https://secure.travis-ci.org/
|
6
|
+
[![Build Status](https://secure.travis-ci.org/petrovich/petrovich-ruby.png)](http://travis-ci.org/petrovich/petrovich-ruby)
|
7
7
|
|
8
8
|
#### Посмотреть в действии: http://petrovich.rocketscience.it
|
9
9
|
|
@@ -168,11 +168,11 @@ person.my_lastname_dative # => Сафронову
|
|
168
168
|
|
169
169
|
```
|
170
170
|
Pr(nominative|male) = 100.0000%
|
171
|
-
Pr(genitive|male) = 99.
|
172
|
-
Pr(dative|male) = 99.
|
171
|
+
Pr(genitive|male) = 99.7261%
|
172
|
+
Pr(dative|male) = 99.7510%
|
173
173
|
Pr(accusative|male) = 99.7635%
|
174
|
-
Pr(instrumental|male) =
|
175
|
-
Pr(prepositional|male) = 99.
|
174
|
+
Pr(instrumental|male) = 99.2664%
|
175
|
+
Pr(prepositional|male) = 99.7386%
|
176
176
|
```
|
177
177
|
```
|
178
178
|
Pr(nominative|female) = 100.0000%
|
@@ -183,7 +183,7 @@ Pr(instrumental|female) = 99.4636%
|
|
183
183
|
Pr(prepositional|female) = 99.9401%
|
184
184
|
```
|
185
185
|
|
186
|
-
В настоящий момент наблюдается точность в 99.
|
186
|
+
В настоящий момент наблюдается точность в 99.7815% на основе обработки
|
187
187
|
88314 примеров.
|
188
188
|
|
189
189
|
[АОТ]: http://seman.svn.sourceforge.net/viewvc/seman/trunk/Docs/Morph_UNIX.txt?revision=HEAD&view=markup
|
@@ -197,6 +197,11 @@ Pr(prepositional|female) = 99.9401%
|
|
197
197
|
* [Андрей Козлов](https://github.com/tanraya)
|
198
198
|
* [Дмитрий Усталов](http://eveel.ru)
|
199
199
|
|
200
|
+
## Портирование
|
201
|
+
|
202
|
+
Существуют официальные порты Petrovich на другие языке и платформы. Их список
|
203
|
+
доступен по адресу <https://github.com/petrovich>. Ребята, спасибо!
|
204
|
+
|
200
205
|
## Дальнейшее развитие
|
201
206
|
|
202
207
|
Мы планируем и далее улучшать этот проект. Поэтому нам важен отклик от
|
data/lib/petrovich/rules.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
class Petrovich
|
4
4
|
# Загрузка правил происходит один раз
|
5
|
-
RULES = YAML.load_file(File.
|
5
|
+
RULES = YAML.load_file(File.expand_path('../../../rules/rules.yml', __FILE__))
|
6
6
|
|
7
7
|
class UnknownCaseException < Exception;;end
|
8
8
|
class UnknownRuleException < Exception;;end
|
data/lib/tasks/evaluate.rake
CHANGED
@@ -80,6 +80,10 @@ task :evaluate => :petrovich do
|
|
80
80
|
|
81
81
|
correct_size = correct.values.inject(&:+)
|
82
82
|
total_size = total.values.inject(&:+)
|
83
|
+
|
83
84
|
puts 'Well, the precision on %d examples is about %.4f%%.' %
|
84
85
|
[total_size, (correct_size / total_size.to_f * 100)]
|
86
|
+
|
87
|
+
puts 'Sum of the %d correct examples and %d mistakes is %d.' %
|
88
|
+
[correct_size, total_size - correct_size, total_size]
|
85
89
|
end
|
@@ -14,7 +14,7 @@
|
|
14
14
|
#
|
15
15
|
# * Пол (gender). Допустимые значения: +male+, +female+, +androgynous+
|
16
16
|
# * Что заменять (test). Массив суффиксов для замены.
|
17
|
-
# * На что заменять (mods). Массив модификаторов. Модификатор может иметь впереди один или
|
17
|
+
# * На что заменять (mods). Массив модификаторов. Модификатор может иметь впереди один или
|
18
18
|
# дефис, он означает количество символов, которые нужно будет вырезать из слова.
|
19
19
|
#
|
20
20
|
# Правила отделяются друг от друга переносом строки для лучшего восприятия.
|
@@ -47,11 +47,12 @@ lastname:
|
|
47
47
|
- призван
|
48
48
|
- мелик
|
49
49
|
- вар
|
50
|
+
- фон
|
50
51
|
mods: [., ., ., ., .]
|
51
52
|
tags: [first_word]
|
52
53
|
|
53
54
|
- gender: androgynous
|
54
|
-
test: [дюма, тома, дега, люка, ферма, гамарра, петипа, шандра,
|
55
|
+
test: [дюма, тома, дега, люка, ферма, гамарра, петипа, шандра, скаля, каруана]
|
55
56
|
mods: [., ., ., ., .]
|
56
57
|
|
57
58
|
- gender: androgynous
|
@@ -62,6 +63,10 @@ lastname:
|
|
62
63
|
test: [вий, сой, цой, хой]
|
63
64
|
mods: [-я, -ю, -я, -ем, -е]
|
64
65
|
|
66
|
+
- gender: androgynous
|
67
|
+
test: [я]
|
68
|
+
mods: [., ., ., ., .]
|
69
|
+
|
65
70
|
suffixes:
|
66
71
|
- gender: female
|
67
72
|
test: [б, в, г, д, ж, з, й, к, л, м, н, п, р, с, т, ф, х, ц, ч, ш, щ, ъ, ь]
|
@@ -79,7 +84,7 @@ lastname:
|
|
79
84
|
test: [ая]
|
80
85
|
mods: [--ой, --ой, --ую, --ой, --ой]
|
81
86
|
|
82
|
-
- gender:
|
87
|
+
- gender: female
|
83
88
|
test: [ская]
|
84
89
|
mods: [--ой, --ой, --ую, --ой, --ой]
|
85
90
|
|
@@ -87,11 +92,11 @@ lastname:
|
|
87
92
|
test: [на]
|
88
93
|
mods: [-ой, -ой, -у, -ой, -ой]
|
89
94
|
|
90
|
-
- gender:
|
95
|
+
- gender: male
|
91
96
|
test: [иной]
|
92
97
|
mods: [-я, -ю, -я, -ем, -е]
|
93
98
|
|
94
|
-
- gender:
|
99
|
+
- gender: male
|
95
100
|
test: [уй]
|
96
101
|
mods: [-я, -ю, -я, -ем, -е]
|
97
102
|
|
@@ -99,7 +104,7 @@ lastname:
|
|
99
104
|
test: [ца]
|
100
105
|
mods: [-ы, -е, -у, -ей, -е]
|
101
106
|
|
102
|
-
- gender:
|
107
|
+
- gender: male
|
103
108
|
test: [рих]
|
104
109
|
mods: [а, у, а, ом, е]
|
105
110
|
|
@@ -111,7 +116,7 @@ lastname:
|
|
111
116
|
test: [иа, аа, оа, уа, ыа, еа, юа, эа]
|
112
117
|
mods: [., ., ., ., .]
|
113
118
|
|
114
|
-
- gender:
|
119
|
+
- gender: male
|
115
120
|
test: [их, ых]
|
116
121
|
mods: [., ., ., ., .]
|
117
122
|
|
@@ -119,7 +124,7 @@ lastname:
|
|
119
124
|
test: [о, е, э, и, ы, у, ю]
|
120
125
|
mods: [., ., ., ., .]
|
121
126
|
|
122
|
-
- gender:
|
127
|
+
- gender: female
|
123
128
|
test: [ова, ева]
|
124
129
|
mods: [-ой, -ой, -у, -ой, -ой]
|
125
130
|
|
@@ -135,7 +140,7 @@ lastname:
|
|
135
140
|
test: [а]
|
136
141
|
mods: [-ы, -е, -у, -ой, -е]
|
137
142
|
|
138
|
-
- gender:
|
143
|
+
- gender: male
|
139
144
|
test: [ь]
|
140
145
|
mods: [-я, -ю, -я, -ем, -е]
|
141
146
|
|
@@ -147,84 +152,92 @@ lastname:
|
|
147
152
|
test: [я]
|
148
153
|
mods: [-и, -е, -ю, -ей, -е]
|
149
154
|
|
150
|
-
- gender:
|
155
|
+
- gender: male
|
151
156
|
test: [ей]
|
152
157
|
mods: [-я, -ю, -я, -ем, -е]
|
153
158
|
|
154
|
-
- gender:
|
159
|
+
- gender: male
|
155
160
|
test: [ян, ан, йн]
|
156
161
|
mods: [а, у, а, ом, е]
|
157
162
|
|
158
|
-
- gender:
|
163
|
+
- gender: male
|
159
164
|
test: [ынец, обец]
|
160
165
|
mods: [--ца, --цу, --ца, --цем, --це]
|
161
166
|
|
162
|
-
- gender:
|
167
|
+
- gender: male
|
163
168
|
test: [онец, овец]
|
164
169
|
mods: [--ца, --цу, --ца, --цом, --це]
|
165
170
|
|
166
|
-
- gender:
|
171
|
+
- gender: male
|
167
172
|
test: [ай]
|
168
173
|
mods: [-я, -ю, -я, -ем, -е]
|
169
174
|
|
170
|
-
- gender:
|
175
|
+
- gender: male
|
171
176
|
test: [гой, кой]
|
172
177
|
mods: [-го, -му, -го, --им, -м]
|
173
178
|
|
174
|
-
- gender:
|
179
|
+
- gender: male
|
175
180
|
test: [ой]
|
176
181
|
mods: [-го, -му, -го, --ым, -м]
|
177
182
|
|
178
|
-
- gender:
|
183
|
+
- gender: male
|
179
184
|
test: [ах, ив]
|
180
185
|
mods: [а, у, а, ом, е]
|
181
186
|
|
182
|
-
- gender:
|
187
|
+
- gender: male
|
183
188
|
test: [ший, щий, жий, ний]
|
184
189
|
mods: [--его, --ему, --его, -м, --ем]
|
185
190
|
|
186
|
-
- gender:
|
191
|
+
- gender: male
|
187
192
|
test: [кий, ый]
|
188
193
|
mods: [--ого, --ому, --ого, -м, --ом]
|
189
194
|
|
190
|
-
- gender:
|
195
|
+
- gender: male
|
191
196
|
test: [ий]
|
192
197
|
mods: [-я, -ю, -я, -ем, -и]
|
193
198
|
|
194
|
-
- gender:
|
199
|
+
- gender: male
|
195
200
|
test: [ок]
|
196
201
|
mods: [--ка, --ку, --ка, --ком, --ке]
|
197
202
|
|
198
|
-
- gender:
|
203
|
+
- gender: male
|
199
204
|
test: [ец]
|
200
205
|
mods: [--ца, --цу, --ца, --цом, --це]
|
201
206
|
|
202
|
-
- gender:
|
207
|
+
- gender: male
|
203
208
|
test: [ц, ч, ш, щ]
|
204
209
|
mods: [а, у, а, ем, е]
|
205
210
|
|
206
|
-
- gender:
|
211
|
+
- gender: male
|
212
|
+
test: [ен, нн, он, ун]
|
213
|
+
mods: [а, у, а, ом, е]
|
214
|
+
|
215
|
+
- gender: male
|
207
216
|
test: [в, н]
|
208
217
|
mods: [а, у, а, ым, е]
|
209
218
|
|
210
|
-
- gender:
|
219
|
+
- gender: male
|
211
220
|
test: [б, г, д, ж, з, к, л, м, п, р, с, т, ф, х]
|
212
221
|
mods: [а, у, а, ом, е]
|
213
222
|
|
214
223
|
firstname:
|
215
224
|
exceptions:
|
216
|
-
- gender:
|
225
|
+
- gender: male
|
217
226
|
test: [лев]
|
218
227
|
mods: [--ьва, --ьву, --ьва, --ьвом, --ьве]
|
219
228
|
|
220
|
-
- gender:
|
229
|
+
- gender: male
|
221
230
|
test: [пётр]
|
222
231
|
mods: [---етра, ---етру, ---етра, ---етром, ---етре]
|
223
232
|
|
224
|
-
- gender:
|
233
|
+
- gender: male
|
225
234
|
test: [павел]
|
226
235
|
mods: [--ла, --лу, --ла, --лом, --ле]
|
227
236
|
|
237
|
+
- gender: male
|
238
|
+
test: [яша]
|
239
|
+
mods: [-и, -е, -у, -ей, -е]
|
240
|
+
|
228
241
|
- gender: male
|
229
242
|
test: [шота]
|
230
243
|
mods: [., ., ., ., .]
|
@@ -262,37 +275,36 @@ firstname:
|
|
262
275
|
test: [а]
|
263
276
|
mods: [-ы, -е, -у, -ой, -е]
|
264
277
|
|
265
|
-
- gender:
|
278
|
+
- gender: female
|
266
279
|
test: [ия]
|
267
280
|
mods: [-и, -и, -ю, -ей, -и]
|
268
281
|
|
269
|
-
- gender:
|
282
|
+
- gender: female
|
270
283
|
test: [я]
|
271
284
|
mods: [-и, -е, -ю, -ей, -е]
|
272
285
|
|
273
|
-
- gender:
|
286
|
+
- gender: male
|
274
287
|
test: [ей]
|
275
288
|
mods: [-я, -ю, -я, -ем, -е]
|
276
289
|
|
277
|
-
- gender:
|
290
|
+
- gender: male
|
278
291
|
test: [ий]
|
279
292
|
mods: [-я, -ю, -я, -ем, -и]
|
280
293
|
|
281
|
-
- gender:
|
294
|
+
- gender: male
|
282
295
|
test: [й]
|
283
296
|
mods: [-я, -ю, -я, -ем, -е]
|
284
297
|
|
285
|
-
- gender:
|
298
|
+
- gender: male
|
286
299
|
test: [б, в, г, д, ж, з, к, л, м, н, п, р, с, т, ф, х, ц, ч]
|
287
300
|
mods: [а, у, а, ом, е]
|
288
301
|
|
289
302
|
middlename:
|
290
303
|
suffixes:
|
291
|
-
- gender:
|
304
|
+
- gender: male
|
292
305
|
test: [ич]
|
293
306
|
mods: [а, у, а, ем, е]
|
294
307
|
|
295
|
-
- gender:
|
308
|
+
- gender: female
|
296
309
|
test: [на]
|
297
310
|
mods: [-ы, -е, -у, -ой, -е]
|
298
|
-
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: petrovich
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Andrew Kozloff
|
@@ -10,12 +9,11 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2013-
|
12
|
+
date: 2013-11-23 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: unicode_utils
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
18
|
- - ~>
|
21
19
|
- !ruby/object:Gem::Version
|
@@ -23,7 +21,6 @@ dependencies:
|
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
25
|
- - ~>
|
29
26
|
- !ruby/object:Gem::Version
|
@@ -31,37 +28,19 @@ dependencies:
|
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: rspec
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - '>='
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: '0'
|
39
35
|
type: :development
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - '>='
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: '0'
|
47
|
-
|
48
|
-
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.4.1
|
55
|
-
type: :development
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
|
-
requirements:
|
60
|
-
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 0.4.1
|
63
|
-
description: Вы задаёте начальное имя в именительном падеже, а получаете в нужном
|
64
|
-
вам
|
42
|
+
description: A library to inflect Russian anthroponyms such as first names, last names,
|
43
|
+
and middle names.
|
65
44
|
email:
|
66
45
|
- demerest@gmail.com
|
67
46
|
- dmitry@eveel.ru
|
@@ -71,34 +50,34 @@ extra_rdoc_files: []
|
|
71
50
|
files:
|
72
51
|
- lib/petrovich/extension.rb
|
73
52
|
- lib/petrovich/rules.rb
|
74
|
-
- lib/petrovich/rules.yml
|
75
|
-
- lib/petrovich.rb
|
76
53
|
- lib/tasks/evaluate.rake
|
54
|
+
- lib/petrovich.rb
|
55
|
+
- rules/rules.yml
|
77
56
|
- MIT-LICENSE
|
78
57
|
- Rakefile
|
79
58
|
- README.md
|
80
|
-
homepage: https://github.com/
|
81
|
-
licenses:
|
59
|
+
homepage: https://github.com/petrovich/petrovich-ruby
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
82
63
|
post_install_message:
|
83
64
|
rdoc_options: []
|
84
65
|
require_paths:
|
85
66
|
- lib
|
86
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
68
|
requirements:
|
89
|
-
- -
|
69
|
+
- - '>='
|
90
70
|
- !ruby/object:Gem::Version
|
91
71
|
version: 1.9.1
|
92
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
73
|
requirements:
|
95
|
-
- -
|
74
|
+
- - '>='
|
96
75
|
- !ruby/object:Gem::Version
|
97
76
|
version: '0'
|
98
77
|
requirements: []
|
99
78
|
rubyforge_project:
|
100
|
-
rubygems_version: 1.
|
79
|
+
rubygems_version: 2.1.11
|
101
80
|
signing_key:
|
102
|
-
specification_version:
|
103
|
-
summary:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Automatic inflection of Russian anthroponyms
|
104
83
|
test_files: []
|