namae 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/features/suffix.feature +7 -0
- data/lib/namae/parser.rb +63 -56
- data/lib/namae/parser.y +5 -4
- data/lib/namae/version.rb +1 -1
- data/namae.gemspec +3 -3
- 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: 9fd611e09da3c6d134065dbe46162518556ce531
|
4
|
+
data.tar.gz: b91fd641df6a06e2b2da4bd8bcad70baa753a612
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa0a37702affcb7a5aa8c54961303cec1b7bfc45856bd364949a67251a66a5cde33365d0489cfe303d62beb5dd7a88c018b493b719d4d67793f8391f965a5cc5
|
7
|
+
data.tar.gz: 745d03394228e6420f1f95383ac62d76c9d46a4b2a101e42af6d8406e13edef0c17d3fae7740633c77504d745395427e3a996c4399e939e9bb4acf2d6afdd17f
|
data/.travis.yml
CHANGED
data/features/suffix.feature
CHANGED
@@ -23,6 +23,13 @@ Feature: Parse names with a suffix
|
|
23
23
|
| given | family | suffix |
|
24
24
|
| Ken | Griffey | Jr. |
|
25
25
|
|
26
|
+
@names @suffix
|
27
|
+
Scenario: Names with a suffix in sort-order with no comma
|
28
|
+
When I parse the names "Griffey, Ken Jr."
|
29
|
+
Then the names should be:
|
30
|
+
| given | family | suffix |
|
31
|
+
| Ken | Griffey | Jr. |
|
32
|
+
|
26
33
|
@names @suffix
|
27
34
|
Scenario: Names with a suffix in display-order no comma
|
28
35
|
When I parse the names "Ken Griffey Jr."
|
data/lib/namae/parser.rb
CHANGED
@@ -12,7 +12,7 @@ require 'strscan'
|
|
12
12
|
module Namae
|
13
13
|
class Parser < Racc::Parser
|
14
14
|
|
15
|
-
module_eval(<<'...end parser.y/module_eval...', 'parser.y',
|
15
|
+
module_eval(<<'...end parser.y/module_eval...', 'parser.y', 99)
|
16
16
|
|
17
17
|
include Singleton
|
18
18
|
|
@@ -180,72 +180,72 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 98)
|
|
180
180
|
##### State transition tables begin ###
|
181
181
|
|
182
182
|
racc_action_table = [
|
183
|
-
-
|
184
|
-
-
|
185
|
-
-
|
186
|
-
|
187
|
-
39,
|
188
|
-
8, 14, 12, 15,
|
189
|
-
15, 24,
|
190
|
-
30,
|
191
|
-
28, 31, 30,
|
192
|
-
|
183
|
+
-38, -40, -39, 14, 22, 15, 24, -38, -40, -39,
|
184
|
+
-38, -40, -39, 62, 53, 52, 54, 63, 58, -22,
|
185
|
+
-22, -34, -22, 56, 16, 56, -22, -22, 53, 52,
|
186
|
+
54, 17, 53, 52, 54, 39, 53, 52, 54, 39,
|
187
|
+
-38, 39, -22, 39, 14, 12, 15, -38, 33, 7,
|
188
|
+
8, 14, 12, 15, 39, 32, 7, 8, 14, 22,
|
189
|
+
15, 24, 30, 46, 31, 30, 42, 31, 53, 52,
|
190
|
+
54, 30, 28, 31, 30, 28, 31, 30, 28, 31,
|
191
|
+
30, 28, 31, 30, 28, 31, 14, 22, 15, 30,
|
192
|
+
56, 31, 53, 52, 54, 45 ]
|
193
193
|
|
194
194
|
racc_action_check = [
|
195
|
-
22, 15, 14,
|
196
|
-
22, 15, 14,
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
0, 17, 17, 17,
|
201
|
-
20, 20,
|
202
|
-
|
203
|
-
|
204
|
-
|
195
|
+
22, 15, 14, 9, 9, 9, 9, 22, 15, 14,
|
196
|
+
22, 15, 14, 49, 49, 49, 49, 50, 44, 42,
|
197
|
+
28, 49, 28, 38, 1, 50, 42, 28, 32, 32,
|
198
|
+
32, 1, 58, 58, 58, 32, 45, 45, 45, 58,
|
199
|
+
12, 23, 12, 45, 0, 0, 0, 12, 16, 0,
|
200
|
+
0, 17, 17, 17, 60, 11, 17, 17, 20, 20,
|
201
|
+
20, 20, 29, 29, 29, 24, 24, 24, 63, 63,
|
202
|
+
63, 25, 25, 25, 10, 10, 10, 35, 35, 35,
|
203
|
+
21, 21, 21, 41, 41, 41, 5, 5, 5, 43,
|
204
|
+
65, 43, 66, 66, 66, 27 ]
|
205
205
|
|
206
206
|
racc_action_pointer = [
|
207
|
-
41,
|
208
|
-
|
209
|
-
55,
|
210
|
-
nil, nil,
|
211
|
-
nil,
|
212
|
-
|
213
|
-
|
207
|
+
41, 24, nil, nil, nil, 83, nil, nil, nil, 0,
|
208
|
+
71, 53, 40, nil, 2, 1, 48, 48, nil, nil,
|
209
|
+
55, 77, 0, 31, 62, 68, nil, 93, 20, 59,
|
210
|
+
nil, nil, 25, nil, nil, 74, nil, nil, 13, nil,
|
211
|
+
nil, 80, 19, 86, 16, 33, nil, nil, nil, 11,
|
212
|
+
15, nil, nil, nil, nil, nil, nil, nil, 29, nil,
|
213
|
+
44, nil, nil, 65, nil, 80, 89 ]
|
214
214
|
|
215
215
|
racc_action_default = [
|
216
|
-
-1, -
|
217
|
-
-
|
218
|
-
-
|
219
|
-
-30, -31, -
|
220
|
-
-12, -
|
221
|
-
-26, -32, -
|
222
|
-
-
|
216
|
+
-1, -45, -2, -4, -5, -45, -8, -9, -10, -23,
|
217
|
+
-45, -45, -19, -28, -30, -31, -45, -45, -6, -7,
|
218
|
+
-45, -45, -19, -41, -45, -45, -29, -15, -20, -23,
|
219
|
+
-30, -31, -36, 67, -3, -45, -15, -11, -42, -43,
|
220
|
+
-12, -45, -19, -23, -14, -36, -21, -16, -24, -37,
|
221
|
+
-26, -32, -38, -39, -40, -14, -44, -13, -36, -17,
|
222
|
+
-45, -33, -35, -45, -18, -25, -27 ]
|
223
223
|
|
224
224
|
racc_goto_table = [
|
225
|
-
3, 38, 26,
|
226
|
-
37, 20, 21, 26,
|
227
|
-
23, 59, 26, 9, 34, 1,
|
228
|
-
43, 41, nil, nil,
|
225
|
+
3, 38, 26, 66, 27, 18, 9, 2, 47, 23,
|
226
|
+
37, 20, 21, 26, 60, 36, 25, 3, 40, 44,
|
227
|
+
23, 59, 26, 9, 34, 19, 1, 35, nil, 55,
|
228
|
+
43, 41, nil, nil, 64, 57, 26, nil, 65, nil,
|
229
229
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, 61,
|
230
230
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
231
|
-
nil, nil, nil, nil, nil, 61 ]
|
231
|
+
nil, nil, nil, nil, nil, nil, 61 ]
|
232
232
|
|
233
233
|
racc_goto_check = [
|
234
|
-
3,
|
235
|
-
8, 7, 10,
|
236
|
-
3, 11,
|
237
|
-
7, 10, nil, nil, 11, 9,
|
234
|
+
3, 15, 16, 13, 9, 3, 7, 2, 11, 3,
|
235
|
+
8, 7, 10, 16, 14, 9, 10, 3, 9, 9,
|
236
|
+
3, 11, 16, 7, 2, 4, 1, 10, nil, 9,
|
237
|
+
7, 10, nil, nil, 11, 9, 16, nil, 15, nil,
|
238
238
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, 3,
|
239
239
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
240
|
-
nil, nil, nil, nil, nil, 3 ]
|
240
|
+
nil, nil, nil, nil, nil, nil, 3 ]
|
241
241
|
|
242
242
|
racc_goto_pointer = [
|
243
|
-
nil,
|
244
|
-
7, -24, nil, -
|
243
|
+
nil, 26, 7, 0, 20, nil, nil, 6, -13, -6,
|
244
|
+
7, -24, nil, -60, -35, -22, -7 ]
|
245
245
|
|
246
246
|
racc_goto_default = [
|
247
247
|
nil, nil, nil, 51, 4, 5, 6, 29, nil, 11,
|
248
|
-
10, nil, 48, 49, 50, 13 ]
|
248
|
+
10, nil, 48, 49, nil, 50, 13 ]
|
249
249
|
|
250
250
|
racc_reduce_table = [
|
251
251
|
0, 0, :racc_error,
|
@@ -278,10 +278,12 @@ racc_reduce_table = [
|
|
278
278
|
3, 22, :_reduce_27,
|
279
279
|
1, 18, :_reduce_none,
|
280
280
|
2, 18, :_reduce_29,
|
281
|
-
1,
|
282
|
-
1,
|
281
|
+
1, 27, :_reduce_none,
|
282
|
+
1, 27, :_reduce_none,
|
283
283
|
1, 24, :_reduce_none,
|
284
284
|
2, 24, :_reduce_33,
|
285
|
+
0, 25, :_reduce_none,
|
286
|
+
1, 25, :_reduce_none,
|
285
287
|
0, 23, :_reduce_none,
|
286
288
|
1, 23, :_reduce_none,
|
287
289
|
1, 14, :_reduce_none,
|
@@ -289,12 +291,12 @@ racc_reduce_table = [
|
|
289
291
|
1, 14, :_reduce_none,
|
290
292
|
0, 19, :_reduce_none,
|
291
293
|
1, 19, :_reduce_none,
|
292
|
-
1,
|
293
|
-
2,
|
294
|
+
1, 26, :_reduce_none,
|
295
|
+
2, 26, :_reduce_44 ]
|
294
296
|
|
295
|
-
racc_reduce_n =
|
297
|
+
racc_reduce_n = 45
|
296
298
|
|
297
|
-
racc_shift_n =
|
299
|
+
racc_shift_n = 67
|
298
300
|
|
299
301
|
racc_token_table = {
|
300
302
|
false => 0,
|
@@ -355,6 +357,7 @@ Racc_token_to_s_table = [
|
|
355
357
|
"first",
|
356
358
|
"opt_words",
|
357
359
|
"words",
|
360
|
+
"opt_comma",
|
358
361
|
"suffices",
|
359
362
|
"u_word" ]
|
360
363
|
|
@@ -579,8 +582,12 @@ module_eval(<<'.,.,', 'parser.y', 81)
|
|
579
582
|
|
580
583
|
# reduce 41 omitted
|
581
584
|
|
582
|
-
|
583
|
-
|
585
|
+
# reduce 42 omitted
|
586
|
+
|
587
|
+
# reduce 43 omitted
|
588
|
+
|
589
|
+
module_eval(<<'.,.,', 'parser.y', 91)
|
590
|
+
def _reduce_44(val, _values, result)
|
584
591
|
result = val.join(' ')
|
585
592
|
result
|
586
593
|
end
|
data/lib/namae/parser.y
CHANGED
@@ -68,10 +68,10 @@ rule
|
|
68
68
|
|
69
69
|
last : LWORD | u_words
|
70
70
|
|
71
|
-
first : opt_words
|
72
|
-
| words
|
73
|
-
| suffices
|
74
|
-
| suffices COMMA words
|
71
|
+
first : opt_words { result = [nil,val[0]] }
|
72
|
+
| words opt_comma suffices { result = [val[2],val[0]] }
|
73
|
+
| suffices { result = [val[0],nil] }
|
74
|
+
| suffices COMMA words { result = [val[0],val[2]] }
|
75
75
|
|
76
76
|
u_words : u_word
|
77
77
|
| u_words u_word { result = val.join(' ') }
|
@@ -81,6 +81,7 @@ rule
|
|
81
81
|
words : word
|
82
82
|
| words word { result = val.join(' ') }
|
83
83
|
|
84
|
+
opt_comma : /* empty */ | COMMA
|
84
85
|
opt_words : /* empty */ | words
|
85
86
|
|
86
87
|
word : LWORD | UWORD | PWORD
|
data/lib/namae/version.rb
CHANGED
data/namae.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: namae 0.9.
|
5
|
+
# stub: namae 0.9.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "namae"
|
9
|
-
s.version = "0.9.
|
9
|
+
s.version = "0.9.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Sylvester Keil", "Dan Collis-Puro"]
|
14
|
-
s.date = "2014-
|
14
|
+
s.date = "2014-07-09"
|
15
15
|
s.description = " Namae (\u{540d}\u{524d}) is a parser for human names. It recognizes personal names of various cultural backgrounds and tries to split them into their component parts (e.g., given and family names, honorifics etc.). "
|
16
16
|
s.email = ["sylvester@keil.or.at", "dan@collispuro.com"]
|
17
17
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: namae
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: simplecov
|