namae 0.11.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +9 -10
- data/BSDL +1 -1
- data/Gemfile +10 -24
- data/README.md +22 -4
- data/features/lists.feature +11 -1
- data/features/step_definitions/namae_steps.rb +5 -0
- data/features/support/env.rb +0 -9
- data/lib/namae/parser.rb +224 -170
- data/lib/namae/parser.y +56 -22
- data/lib/namae/utility.rb +4 -0
- data/lib/namae/version.rb +3 -3
- data/namae.gemspec +12 -14
- data/spec/namae/parser_spec.rb +61 -10
- data/spec/thread_safety_spec.rb +25 -0
- metadata +11 -12
- data/.autotest +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 82fa8955c4f650ccbcb6bf67db18f005eafd2f1f09252b8d98203a6f04949ed2
|
4
|
+
data.tar.gz: c96965c52193db381f8fceb0e8bfc34453f62127c846b6cb593e804c25394908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14644528eb8d587a2fd0064fbddfa6cfe8925d7a1b9b3f6a75b33c599f3bbb9a43b53e951e4ec8fab9506c5edc2ef62abff77fc1f43cca1ce3489c5ab4c36f8f
|
7
|
+
data.tar.gz: 921b0c60e964b8e5f6154008ab8923d59a2df5523484e38618f3ddddbd89eb2d0ad99ffdbbc9d90629cced3051e38fffb05617657338018afd8913cefc6e891c
|
data/.travis.yml
CHANGED
@@ -6,26 +6,25 @@ cache: bundler
|
|
6
6
|
matrix:
|
7
7
|
fast_finish: true
|
8
8
|
include:
|
9
|
-
- rvm:
|
9
|
+
- rvm: 3.0
|
10
10
|
env: WITH_COVERALLS=true
|
11
|
-
- rvm: 2.
|
11
|
+
- rvm: 2.7
|
12
12
|
env: WITH_COVERALLS=false
|
13
|
-
- rvm: 2.
|
13
|
+
- rvm: 2.6
|
14
14
|
env: WITH_COVERALLS=false
|
15
|
-
- rvm: 2.
|
16
|
-
env: WITH_COVERALLS=false
|
17
|
-
- rvm: 1.9.3
|
15
|
+
- rvm: 2.5
|
18
16
|
env: WITH_COVERALLS=false
|
19
17
|
- rvm: jruby-19mode
|
20
18
|
env: WITH_COVERALLS=false
|
21
|
-
|
22
|
-
|
19
|
+
|
20
|
+
before_install:
|
21
|
+
- gem update --system
|
23
22
|
|
24
23
|
install:
|
25
24
|
- if [[ $WITH_COVERALLS = "true" ]]; then
|
26
|
-
bundle install --without debug
|
25
|
+
bundle install --without debug optional;
|
27
26
|
else
|
28
|
-
bundle install --without debug
|
27
|
+
bundle install --without debug optional coverage;
|
29
28
|
fi
|
30
29
|
|
31
30
|
script:
|
data/BSDL
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Namae. A personal name parser.
|
2
2
|
Copyright (C) 2012 President and Fellows of Harvard College
|
3
|
-
Copyright (C) 2013-
|
3
|
+
Copyright (C) 2013-2020 Sylvester Keil
|
4
4
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
6
6
|
modification, are permitted provided that the following conditions are met:
|
data/Gemfile
CHANGED
@@ -1,40 +1,26 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
group :test do
|
4
|
-
gem 'rspec', '~>3.
|
5
|
-
gem 'rake'
|
6
|
-
gem 'cucumber', '~>1
|
4
|
+
gem 'rspec', '~> 3.7'
|
5
|
+
gem 'rake'
|
6
|
+
gem 'cucumber', '~> 3.1'
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
9
|
group :development do
|
11
|
-
gem 'racc', '1.4
|
10
|
+
gem 'racc', '~> 1.4', :platform => :ruby
|
12
11
|
end
|
13
12
|
|
14
13
|
group :coverage do
|
15
|
-
gem 'simplecov',
|
16
|
-
gem '
|
17
|
-
gem 'coveralls', '~>0.7', :require => false
|
14
|
+
gem 'simplecov', :require => false, :platforms => :ruby
|
15
|
+
gem 'coveralls', :require => false if ENV['CI']
|
18
16
|
end
|
19
17
|
|
20
18
|
group :optional do
|
21
|
-
gem '
|
22
|
-
gem '
|
23
|
-
gem 'yard', '~>0.8'
|
19
|
+
gem 'jeweler'
|
20
|
+
gem 'yard'
|
24
21
|
end
|
25
22
|
|
26
23
|
group :debug do
|
27
|
-
gem 'debugger',
|
28
|
-
gem 'byebug',
|
29
|
-
gem 'rubinius-compiler', '~>2.0', :platform => :rbx
|
30
|
-
gem 'rubinius-debugger', '~>2.0', :platform => :rbx
|
31
|
-
end
|
32
|
-
|
33
|
-
group :osx do
|
34
|
-
gem 'autotest-fsevent'
|
35
|
-
end
|
36
|
-
|
37
|
-
group :rbx do
|
38
|
-
gem 'rubysl', '~>2.0', :platform => :rbx
|
39
|
-
gem 'json', '~>1.8', :platform => :rbx
|
24
|
+
gem 'debugger', :platform => [:mri_19]
|
25
|
+
gem 'byebug', :platform => :mri if RUBY_VERSION > '2.0'
|
40
26
|
end
|
data/README.md
CHANGED
@@ -4,9 +4,9 @@ Namae is a parser for human names. It recognizes personal names of various
|
|
4
4
|
cultural backgrounds and tries to split them into their component parts
|
5
5
|
(e.g., given and family names, honorifics etc.).
|
6
6
|
|
7
|
-
[![Build Status](https://
|
8
|
-
[![Coverage Status](https://coveralls.io/repos/
|
9
|
-
[![Gem Version](https://badge.fury.io/rb/namae.
|
7
|
+
[![Build Status](https://travis-ci.org/berkmancenter/namae.svg?branch=master)](https://travis-ci.org/berkmancenter/namae)
|
8
|
+
[![Coverage Status](https://coveralls.io/repos/github/berkmancenter/namae/badge.svg?branch=master)](https://coveralls.io/github/berkmancenter/namae?branch=master)
|
9
|
+
[![Gem Version](https://badge.fury.io/rb/namae.svg)](http://badge.fury.io/rb/namae)
|
10
10
|
[![Code Climate](https://codeclimate.com/github/berkmancenter/namae/badges/gpa.svg)](https://codeclimate.com/github/berkmancenter/namae)
|
11
11
|
|
12
12
|
Quickstart
|
@@ -121,6 +121,23 @@ ambiguous. For example, multiple family names are always possible in sort-order:
|
|
121
121
|
Whilst in display-order, multiple family names are only supported when the
|
122
122
|
name contains a particle or a nickname.
|
123
123
|
|
124
|
+
Configuration
|
125
|
+
-------------
|
126
|
+
You can tweak some of Namae's parse rules by configuring the parser's
|
127
|
+
options. Take a look at `Namae.options` to see your current settings.
|
128
|
+
If you want to change the default settings for all parsers, you can run
|
129
|
+
`Namae.configure` which will yield the default options (make sure to
|
130
|
+
change the configuration before using the parser).
|
131
|
+
|
132
|
+
A Note On Thread Safety
|
133
|
+
-----------------------
|
134
|
+
When using the top-level parse functions, Namae will re-use a thread-local
|
135
|
+
parser instance (`Namae::Parser.instance`); the instance is created, using
|
136
|
+
the current default options (`Namae::Parser.defaults`). If you need more
|
137
|
+
control, you are encouraged to create individual parser instances using
|
138
|
+
`Namae::Parser.new`.
|
139
|
+
|
140
|
+
|
124
141
|
Rationale
|
125
142
|
---------
|
126
143
|
Parsing human names is at once too easy and too hard. When working in the
|
@@ -170,7 +187,8 @@ Namae was written as a part of a Google Summer of Code project. Thanks Google!
|
|
170
187
|
|
171
188
|
Copyright
|
172
189
|
---------
|
190
|
+
Copyright (c) 2013-2020 Sylvester Keil
|
191
|
+
|
173
192
|
Copyright (c) 2012 President and Fellows of Harvard College.
|
174
|
-
Copyright (c) 2013-2014 Sylvester Keil
|
175
193
|
|
176
194
|
Namae is dual licensed under the AGPL and a BSD-style license.
|
data/features/lists.feature
CHANGED
@@ -115,7 +115,8 @@ Feature: Parse a list of names
|
|
115
115
|
| B | Malcom |
|
116
116
|
|
117
117
|
Scenario: A list of names with particles separated by commas
|
118
|
-
Given
|
118
|
+
Given I want to include particles in the family name
|
119
|
+
And a parser that prefers commas as separators
|
119
120
|
When I parse the names "Di Proctor, M., von Cooper, P."
|
120
121
|
Then the names should be:
|
121
122
|
| given | family |
|
@@ -126,3 +127,12 @@ Feature: Parse a list of names
|
|
126
127
|
| given | family |
|
127
128
|
| M | Di Proctor |
|
128
129
|
| P | Cooper |
|
130
|
+
|
131
|
+
Scenario: A list of names with two consecutive accented characters
|
132
|
+
Given I want to include particles in the family name
|
133
|
+
And a parser that prefers commas as separators
|
134
|
+
When I parse the names "Çakıroğlu, Ü., Başıbüyük, B."
|
135
|
+
Then the names should be:
|
136
|
+
| given | family |
|
137
|
+
| Ü. | Çakıroğlu |
|
138
|
+
| B. | Başıbüyük |
|
@@ -2,6 +2,11 @@ Given /^a parser that prefers commas as separators$/ do
|
|
2
2
|
Namae::Parser.instance.options[:prefer_comma_as_separator] = true
|
3
3
|
end
|
4
4
|
|
5
|
+
Given /^I want to include particles in the family name$/ do
|
6
|
+
Namae::Parser.instance.options[:include_particle_in_family] = true
|
7
|
+
end
|
8
|
+
|
9
|
+
|
5
10
|
When /^I parse the name "(.*)"$/ do |string|
|
6
11
|
@name = Namae.parse!(string)[0]
|
7
12
|
end
|
data/features/support/env.rb
CHANGED
@@ -1,12 +1,3 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
begin
|
3
|
-
Bundler.setup(:default, :development)
|
4
|
-
rescue Bundler::BundlerError => e
|
5
|
-
$stderr.puts e.message
|
6
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
7
|
-
exit e.status_code
|
8
|
-
end
|
9
|
-
|
10
1
|
begin
|
11
2
|
require 'simplecov'
|
12
3
|
require 'coveralls' if ENV['CI']
|
data/lib/namae/parser.rb
CHANGED
@@ -1,34 +1,43 @@
|
|
1
1
|
#
|
2
2
|
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by Racc 1.
|
4
|
-
# from Racc
|
3
|
+
# This file is automatically generated by Racc 1.5.2
|
4
|
+
# from Racc grammar file "".
|
5
5
|
#
|
6
6
|
|
7
7
|
require 'racc/parser.rb'
|
8
8
|
|
9
|
-
require 'singleton'
|
10
9
|
require 'strscan'
|
11
10
|
|
12
11
|
module Namae
|
13
12
|
class Parser < Racc::Parser
|
14
13
|
|
15
|
-
module_eval(<<'...end parser.y/module_eval...', 'parser.y',
|
16
|
-
|
17
|
-
|
14
|
+
module_eval(<<'...end parser.y/module_eval...', 'parser.y', 122)
|
15
|
+
|
16
|
+
@defaults = {
|
17
|
+
:debug => false,
|
18
|
+
:prefer_comma_as_separator => false,
|
19
|
+
:include_particle_in_family => false,
|
20
|
+
:comma => ',',
|
21
|
+
:stops => ',;',
|
22
|
+
:separator => /\s*(\band\b|\&|;)\s*/i,
|
23
|
+
:title => /\s*\b(sir|lord|count(ess)?|(gen|adm|col|maj|capt|cmdr|lt|sgt|cpl|pvt|pastor|pr|reverend|rev|elder|deacon|deaconess|father|fr|rabbi|cantor|vicar|prof|dr|md|ph\.?d)\.?)(\s+|$)/i,
|
24
|
+
:suffix => /\s*\b(JR|Jr|jr|SR|Sr|sr|[IVX]{2,})(\.|\b)/,
|
25
|
+
:appellation => /\s*\b((mrs?|ms|fr|hr)\.?|miss|herr|frau)(\s+|$)/i,
|
26
|
+
:uppercase_particle => /\s*\b((Da|De|Di|De\sLa|Du|Der|Des|Da|St|Saint|Les|Van)\.?)(\s+|$)/
|
27
|
+
}
|
28
|
+
|
29
|
+
class << self
|
30
|
+
attr_reader :defaults
|
31
|
+
|
32
|
+
def instance
|
33
|
+
Thread.current[:namae] ||= new
|
34
|
+
end
|
35
|
+
end
|
18
36
|
|
19
37
|
attr_reader :options, :input
|
20
38
|
|
21
|
-
def initialize
|
22
|
-
@
|
23
|
-
:debug => false,
|
24
|
-
:prefer_comma_as_separator => false,
|
25
|
-
:comma => ',',
|
26
|
-
:stops => ',;',
|
27
|
-
:separator => /\s*(\band\b|\&|;)\s*/i,
|
28
|
-
:title => /\s*\b(sir|lord|count(ess)?|(gen|adm|col|maj|capt|cmdr|lt|sgt|cpl|pvt|pastor|pr|reverend|rev|elder|deacon|deaconess|father|fr|vicar|prof|dr|md|ph\.?d)\.?)(\s+|$)/i,
|
29
|
-
:suffix => /\s*\b(JR|Jr|jr|SR|Sr|sr|[IVX]{2,})(\.|\b)/,
|
30
|
-
:appellation => /\s*\b((mrs?|ms|fr|hr)\.?|miss|herr|frau)(\s+|$)/i
|
31
|
-
}
|
39
|
+
def initialize(options = {})
|
40
|
+
@options = self.class.defaults.merge(options)
|
32
41
|
end
|
33
42
|
|
34
43
|
def debug?
|
@@ -43,6 +52,10 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 107)
|
|
43
52
|
options[:comma]
|
44
53
|
end
|
45
54
|
|
55
|
+
def include_particle_in_family?
|
56
|
+
options[:include_particle_in_family]
|
57
|
+
end
|
58
|
+
|
46
59
|
def stops
|
47
60
|
options[:stops]
|
48
61
|
end
|
@@ -59,26 +72,29 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 107)
|
|
59
72
|
options[:appellation]
|
60
73
|
end
|
61
74
|
|
75
|
+
def uppercase_particle
|
76
|
+
options[:uppercase_particle]
|
77
|
+
end
|
78
|
+
|
62
79
|
def prefer_comma_as_separator?
|
63
80
|
options[:prefer_comma_as_separator]
|
64
81
|
end
|
65
82
|
|
66
|
-
def parse(
|
67
|
-
parse!(
|
83
|
+
def parse(string)
|
84
|
+
parse!(string)
|
68
85
|
rescue => e
|
69
86
|
warn e.message if debug?
|
70
87
|
[]
|
71
88
|
end
|
72
89
|
|
73
90
|
def parse!(string)
|
74
|
-
input
|
91
|
+
@input = StringScanner.new(normalize(string))
|
75
92
|
reset
|
76
93
|
do_parse
|
77
94
|
end
|
78
95
|
|
79
96
|
def normalize(string)
|
80
|
-
string
|
81
|
-
string
|
97
|
+
string.scrub.strip
|
82
98
|
end
|
83
99
|
|
84
100
|
def reset
|
@@ -129,11 +145,11 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 107)
|
|
129
145
|
end
|
130
146
|
|
131
147
|
def will_see_suffix?
|
132
|
-
input.
|
148
|
+
input.rest.strip.split(/\s+/)[0] =~ suffix
|
133
149
|
end
|
134
150
|
|
135
151
|
def will_see_initial?
|
136
|
-
input.
|
152
|
+
input.rest.strip.split(/\s+/)[0] =~ /^[[:upper:]]+\b/
|
137
153
|
end
|
138
154
|
|
139
155
|
def seen_full_name?
|
@@ -165,6 +181,8 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 107)
|
|
165
181
|
else
|
166
182
|
consume_word(:UWORD, input.matched)
|
167
183
|
end
|
184
|
+
when input.scan(uppercase_particle)
|
185
|
+
consume_word(:UPARTICLE, input.matched.strip)
|
168
186
|
when input.scan(/((\\\w+)?\{[^\}]*\})*[[:upper:]][^\s#{stops}]*/)
|
169
187
|
consume_word(:UWORD, input.matched)
|
170
188
|
when input.scan(/((\\\w+)?\{[^\}]*\})*[[:lower:]][^\s#{stops}]*/)
|
@@ -189,133 +207,143 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 107)
|
|
189
207
|
##### State transition tables begin ###
|
190
208
|
|
191
209
|
racc_action_table = [
|
192
|
-
-
|
193
|
-
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
210
|
+
-41, 18, 25, 34, -42, 35, 36, -41, 19, -41,
|
211
|
+
-41, -42, 40, -42, -42, 15, 13, 16, 46, 52,
|
212
|
+
7, 17, 62, 12, 15, 24, 16, 27, 15, 13,
|
213
|
+
16, 17, 29, 7, 17, 66, 12, 15, 24, 16,
|
214
|
+
27, 73, 60, 59, 61, 29, 74, 46, -40, -36,
|
215
|
+
-24, 60, 59, 61, 66, -40, 69, 25, 46, 60,
|
216
|
+
59, 61, 60, 59, 61, 17, 46, 46, 46, 46,
|
217
|
+
60, 59, 61, 15, 24, 16, 17, 46, 34, 32,
|
218
|
+
35, 34, 38, 35, 34, 32, 35, -21, -21, -21,
|
219
|
+
34, 49, 35, 34, 32, 35, 34, 38, 35, -22,
|
220
|
+
-22, -22, 34, 53, 35, 34, 32, 35, 34, 32,
|
221
|
+
35, -21, -21, -21, 60, 59, 61, 60, 59, 61,
|
222
|
+
66 ]
|
203
223
|
|
204
224
|
racc_action_check = [
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
225
|
+
15, 1, 8, 39, 16, 39, 11, 15, 1, 15,
|
226
|
+
15, 16, 18, 16, 16, 0, 0, 0, 26, 31,
|
227
|
+
0, 0, 37, 0, 9, 9, 9, 9, 19, 19,
|
228
|
+
19, 44, 9, 19, 19, 45, 19, 22, 22, 22,
|
229
|
+
22, 56, 56, 56, 56, 22, 57, 47, 13, 56,
|
230
|
+
13, 36, 36, 36, 57, 13, 50, 65, 36, 52,
|
231
|
+
52, 52, 62, 62, 62, 67, 52, 68, 71, 62,
|
232
|
+
69, 69, 69, 5, 5, 5, 77, 69, 10, 10,
|
233
|
+
10, 12, 12, 12, 23, 23, 23, 24, 24, 24,
|
234
|
+
27, 27, 27, 28, 28, 28, 29, 29, 29, 32,
|
235
|
+
32, 32, 33, 33, 33, 42, 42, 42, 48, 48,
|
236
|
+
48, 49, 49, 49, 74, 74, 74, 80, 80, 80,
|
237
|
+
79 ]
|
216
238
|
|
217
239
|
racc_action_pointer = [
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
nil,
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
240
|
+
12, 1, nil, nil, nil, 70, nil, nil, -7, 21,
|
241
|
+
75, 4, 78, 48, nil, 0, 4, nil, 12, 25,
|
242
|
+
nil, nil, 34, 81, 84, nil, 8, 87, 90, 93,
|
243
|
+
nil, 17, 96, 99, nil, nil, 48, 20, nil, 0,
|
244
|
+
nil, nil, 102, nil, 22, 25, nil, 37, 105, 108,
|
245
|
+
54, nil, 56, nil, nil, nil, 39, 44, nil, nil,
|
246
|
+
nil, nil, 59, nil, nil, 48, nil, 56, 57, 67,
|
247
|
+
nil, 58, nil, nil, 111, nil, nil, 67, nil, 110,
|
248
|
+
114, nil ]
|
226
249
|
|
227
250
|
racc_action_default = [
|
228
|
-
-1, -
|
229
|
-
-
|
230
|
-
|
231
|
-
-
|
232
|
-
|
233
|
-
-
|
234
|
-
-
|
235
|
-
-
|
251
|
+
-1, -51, -2, -4, -5, -51, -8, -9, -10, -25,
|
252
|
+
-51, -51, -51, -21, -30, -32, -33, -49, -51, -51,
|
253
|
+
-6, -7, -51, -51, -40, -50, -43, -51, -51, -51,
|
254
|
+
-31, -16, -24, -25, -32, -33, -38, -51, -24, -25,
|
255
|
+
82, -3, -51, -16, -47, -44, -45, -43, -51, -24,
|
256
|
+
-14, -15, -38, -23, -17, -26, -39, -28, -34, -40,
|
257
|
+
-41, -42, -38, -14, -11, -48, -46, -47, -43, -38,
|
258
|
+
-19, -51, -35, -37, -51, -18, -12, -47, -20, -27,
|
259
|
+
-29, -13 ]
|
236
260
|
|
237
261
|
racc_goto_table = [
|
238
|
-
3,
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
262
|
+
3, 1, 45, 44, 54, 20, 64, 21, 31, 26,
|
263
|
+
37, 23, 80, 2, 71, 28, 8, nil, 30, 3,
|
264
|
+
70, 43, 26, 45, 67, 47, 50, 51, 42, 76,
|
265
|
+
75, 30, 41, 48, nil, 8, nil, 78, 9, 81,
|
266
|
+
63, nil, 30, 22, 45, 77, 68, 79, 30, nil,
|
267
|
+
39, nil, nil, nil, nil, nil, 72, 9, nil, nil,
|
268
|
+
nil, nil, nil, nil, nil, 39, nil, 39, nil, nil,
|
243
269
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
244
|
-
|
245
|
-
nil, nil, nil, 65 ]
|
270
|
+
72 ]
|
246
271
|
|
247
272
|
racc_goto_check = [
|
248
|
-
3,
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
273
|
+
3, 1, 17, 9, 13, 3, 10, 4, 11, 3,
|
274
|
+
11, 12, 15, 2, 16, 12, 7, nil, 18, 3,
|
275
|
+
13, 11, 3, 17, 9, 11, 11, 11, 12, 10,
|
276
|
+
13, 18, 2, 12, nil, 7, nil, 13, 8, 10,
|
277
|
+
11, nil, 18, 8, 17, 9, 11, 17, 18, nil,
|
278
|
+
8, nil, nil, nil, nil, nil, 3, 8, nil, nil,
|
279
|
+
nil, nil, nil, nil, nil, 8, nil, 8, nil, nil,
|
254
280
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
255
|
-
|
281
|
+
3 ]
|
256
282
|
|
257
283
|
racc_goto_pointer = [
|
258
|
-
nil,
|
259
|
-
|
284
|
+
nil, 1, 13, 0, 2, nil, nil, 16, 38, -23,
|
285
|
+
-38, -2, 6, -32, nil, -62, -42, -24, 9 ]
|
260
286
|
|
261
287
|
racc_goto_default = [
|
262
|
-
nil, nil, nil,
|
263
|
-
11, 10, nil,
|
288
|
+
nil, nil, nil, 58, 4, 5, 6, 65, 33, nil,
|
289
|
+
nil, 11, 10, nil, 55, 56, nil, 57, 14 ]
|
264
290
|
|
265
291
|
racc_reduce_table = [
|
266
292
|
0, 0, :racc_error,
|
267
|
-
0,
|
268
|
-
1,
|
269
|
-
3,
|
270
|
-
1,
|
271
|
-
1, 13, :_reduce_none,
|
272
|
-
2, 13, :_reduce_6,
|
273
|
-
2, 13, :_reduce_7,
|
274
|
-
1, 13, :_reduce_none,
|
275
|
-
1, 16, :_reduce_9,
|
276
|
-
1, 16, :_reduce_10,
|
277
|
-
4, 15, :_reduce_11,
|
278
|
-
5, 15, :_reduce_12,
|
279
|
-
6, 15, :_reduce_13,
|
280
|
-
3, 15, :_reduce_14,
|
281
|
-
2, 15, :_reduce_15,
|
282
|
-
3, 17, :_reduce_16,
|
283
|
-
4, 17, :_reduce_17,
|
284
|
-
5, 17, :_reduce_18,
|
285
|
-
1, 22, :_reduce_none,
|
286
|
-
2, 22, :_reduce_20,
|
287
|
-
3, 22, :_reduce_21,
|
288
|
-
1, 21, :_reduce_none,
|
289
|
-
1, 21, :_reduce_none,
|
290
|
-
1, 23, :_reduce_24,
|
291
|
-
3, 23, :_reduce_25,
|
292
|
-
1, 23, :_reduce_26,
|
293
|
-
3, 23, :_reduce_27,
|
294
|
-
1, 18, :_reduce_none,
|
295
|
-
2, 18, :_reduce_29,
|
296
|
-
1, 28, :_reduce_none,
|
297
|
-
1, 28, :_reduce_none,
|
298
|
-
1, 25, :_reduce_none,
|
299
|
-
2, 25, :_reduce_33,
|
300
|
-
0, 26, :_reduce_none,
|
301
|
-
1, 26, :_reduce_none,
|
302
|
-
0, 24, :_reduce_none,
|
303
|
-
1, 24, :_reduce_none,
|
304
|
-
1, 14, :_reduce_none,
|
293
|
+
0, 13, :_reduce_1,
|
294
|
+
1, 13, :_reduce_2,
|
295
|
+
3, 13, :_reduce_3,
|
296
|
+
1, 14, :_reduce_4,
|
305
297
|
1, 14, :_reduce_none,
|
298
|
+
2, 14, :_reduce_6,
|
299
|
+
2, 14, :_reduce_7,
|
306
300
|
1, 14, :_reduce_none,
|
307
|
-
|
308
|
-
1,
|
309
|
-
|
310
|
-
|
311
|
-
|
301
|
+
1, 17, :_reduce_9,
|
302
|
+
1, 17, :_reduce_10,
|
303
|
+
4, 16, :_reduce_11,
|
304
|
+
5, 16, :_reduce_12,
|
305
|
+
6, 16, :_reduce_13,
|
306
|
+
3, 16, :_reduce_14,
|
307
|
+
3, 16, :_reduce_15,
|
308
|
+
2, 16, :_reduce_16,
|
309
|
+
3, 18, :_reduce_17,
|
310
|
+
4, 18, :_reduce_18,
|
311
|
+
4, 18, :_reduce_19,
|
312
|
+
5, 18, :_reduce_20,
|
313
|
+
1, 24, :_reduce_none,
|
314
|
+
2, 24, :_reduce_22,
|
315
|
+
3, 24, :_reduce_23,
|
316
|
+
1, 23, :_reduce_none,
|
317
|
+
1, 23, :_reduce_none,
|
318
|
+
1, 25, :_reduce_26,
|
319
|
+
3, 25, :_reduce_27,
|
320
|
+
1, 25, :_reduce_28,
|
321
|
+
3, 25, :_reduce_29,
|
312
322
|
1, 20, :_reduce_none,
|
323
|
+
2, 20, :_reduce_31,
|
324
|
+
1, 30, :_reduce_none,
|
325
|
+
1, 30, :_reduce_none,
|
326
|
+
1, 27, :_reduce_none,
|
327
|
+
2, 27, :_reduce_35,
|
328
|
+
0, 28, :_reduce_none,
|
329
|
+
1, 28, :_reduce_none,
|
330
|
+
0, 26, :_reduce_none,
|
331
|
+
1, 26, :_reduce_none,
|
332
|
+
1, 15, :_reduce_none,
|
333
|
+
1, 15, :_reduce_none,
|
334
|
+
1, 15, :_reduce_none,
|
335
|
+
0, 21, :_reduce_none,
|
336
|
+
1, 21, :_reduce_none,
|
313
337
|
1, 29, :_reduce_none,
|
314
|
-
2, 29, :
|
338
|
+
2, 29, :_reduce_46,
|
339
|
+
0, 22, :_reduce_none,
|
340
|
+
1, 22, :_reduce_none,
|
341
|
+
1, 19, :_reduce_none,
|
342
|
+
2, 19, :_reduce_50 ]
|
315
343
|
|
316
|
-
racc_reduce_n =
|
344
|
+
racc_reduce_n = 51
|
317
345
|
|
318
|
-
racc_shift_n =
|
346
|
+
racc_shift_n = 82
|
319
347
|
|
320
348
|
racc_token_table = {
|
321
349
|
false => 0,
|
@@ -328,9 +356,10 @@ racc_token_table = {
|
|
328
356
|
:AND => 7,
|
329
357
|
:APPELLATION => 8,
|
330
358
|
:TITLE => 9,
|
331
|
-
:SUFFIX => 10
|
359
|
+
:SUFFIX => 10,
|
360
|
+
:UPARTICLE => 11 }
|
332
361
|
|
333
|
-
racc_nt_base =
|
362
|
+
racc_nt_base = 12
|
334
363
|
|
335
364
|
racc_use_result_var = true
|
336
365
|
|
@@ -362,6 +391,7 @@ Racc_token_to_s_table = [
|
|
362
391
|
"APPELLATION",
|
363
392
|
"TITLE",
|
364
393
|
"SUFFIX",
|
394
|
+
"UPARTICLE",
|
365
395
|
"$start",
|
366
396
|
"names",
|
367
397
|
"name",
|
@@ -369,6 +399,7 @@ Racc_token_to_s_table = [
|
|
369
399
|
"display_order",
|
370
400
|
"honorific",
|
371
401
|
"sort_order",
|
402
|
+
"titles",
|
372
403
|
"u_words",
|
373
404
|
"opt_suffices",
|
374
405
|
"opt_titles",
|
@@ -379,8 +410,7 @@ Racc_token_to_s_table = [
|
|
379
410
|
"words",
|
380
411
|
"opt_comma",
|
381
412
|
"suffices",
|
382
|
-
"u_word"
|
383
|
-
"titles" ]
|
413
|
+
"u_word" ]
|
384
414
|
|
385
415
|
Racc_debug_parser = false
|
386
416
|
|
@@ -487,14 +517,26 @@ module_eval(<<'.,.,', 'parser.y', 42)
|
|
487
517
|
|
488
518
|
module_eval(<<'.,.,', 'parser.y', 47)
|
489
519
|
def _reduce_15(val, _values, result)
|
490
|
-
|
520
|
+
result = if include_particle_in_family?
|
521
|
+
Name.new(:given => val[0], :family => val[1,2].join(' '))
|
522
|
+
else
|
523
|
+
Name.new(:given => val[0], :particle => val[1], :family => val[2])
|
524
|
+
end
|
491
525
|
|
492
526
|
result
|
493
527
|
end
|
494
528
|
.,.,
|
495
529
|
|
496
|
-
module_eval(<<'.,.,', 'parser.y',
|
530
|
+
module_eval(<<'.,.,', 'parser.y', 55)
|
497
531
|
def _reduce_16(val, _values, result)
|
532
|
+
result = Name.new(:particle => val[0], :family => val[1])
|
533
|
+
|
534
|
+
result
|
535
|
+
end
|
536
|
+
.,.,
|
537
|
+
|
538
|
+
module_eval(<<'.,.,', 'parser.y', 60)
|
539
|
+
def _reduce_17(val, _values, result)
|
498
540
|
result = Name.new({ :family => val[0], :suffix => val[2][0],
|
499
541
|
:given => val[2][1] }, !!val[2][0])
|
500
542
|
|
@@ -502,8 +544,20 @@ module_eval(<<'.,.,', 'parser.y', 52)
|
|
502
544
|
end
|
503
545
|
.,.,
|
504
546
|
|
505
|
-
module_eval(<<'.,.,', 'parser.y',
|
506
|
-
def
|
547
|
+
module_eval(<<'.,.,', 'parser.y', 65)
|
548
|
+
def _reduce_18(val, _values, result)
|
549
|
+
result = if include_particle_in_family?
|
550
|
+
Name.new({ :family => val[0,2].join(' '), :suffix => val[3][0], :given => val[3][1] }, !!val[3][0])
|
551
|
+
else
|
552
|
+
Name.new({ :particle => val[0], :family => val[1], :suffix => val[3][0], :given => val[3][1] }, !!val[3][0])
|
553
|
+
end
|
554
|
+
|
555
|
+
result
|
556
|
+
end
|
557
|
+
.,.,
|
558
|
+
|
559
|
+
module_eval(<<'.,.,', 'parser.y', 73)
|
560
|
+
def _reduce_19(val, _values, result)
|
507
561
|
result = Name.new({ :particle => val[0], :family => val[1],
|
508
562
|
:suffix => val[3][0], :given => val[3][1] }, !!val[3][0])
|
509
563
|
|
@@ -511,8 +565,8 @@ module_eval(<<'.,.,', 'parser.y', 57)
|
|
511
565
|
end
|
512
566
|
.,.,
|
513
567
|
|
514
|
-
module_eval(<<'.,.,', 'parser.y',
|
515
|
-
def
|
568
|
+
module_eval(<<'.,.,', 'parser.y', 78)
|
569
|
+
def _reduce_20(val, _values, result)
|
516
570
|
result = Name.new({ :particle => val[0,2].join(' '), :family => val[2],
|
517
571
|
:suffix => val[4][0], :given => val[4][1] }, !!val[4][0])
|
518
572
|
|
@@ -520,80 +574,76 @@ module_eval(<<'.,.,', 'parser.y', 62)
|
|
520
574
|
end
|
521
575
|
.,.,
|
522
576
|
|
523
|
-
# reduce
|
577
|
+
# reduce 21 omitted
|
524
578
|
|
525
|
-
module_eval(<<'.,.,', 'parser.y',
|
526
|
-
def
|
579
|
+
module_eval(<<'.,.,', 'parser.y', 84)
|
580
|
+
def _reduce_22(val, _values, result)
|
527
581
|
result = val.join(' ')
|
528
582
|
result
|
529
583
|
end
|
530
584
|
.,.,
|
531
585
|
|
532
|
-
module_eval(<<'.,.,', 'parser.y',
|
533
|
-
def
|
586
|
+
module_eval(<<'.,.,', 'parser.y', 85)
|
587
|
+
def _reduce_23(val, _values, result)
|
534
588
|
result = val.join(' ')
|
535
589
|
result
|
536
590
|
end
|
537
591
|
.,.,
|
538
592
|
|
539
|
-
# reduce
|
593
|
+
# reduce 24 omitted
|
540
594
|
|
541
|
-
# reduce
|
595
|
+
# reduce 25 omitted
|
542
596
|
|
543
|
-
module_eval(<<'.,.,', 'parser.y',
|
544
|
-
def
|
597
|
+
module_eval(<<'.,.,', 'parser.y', 89)
|
598
|
+
def _reduce_26(val, _values, result)
|
545
599
|
result = [nil,val[0]]
|
546
600
|
result
|
547
601
|
end
|
548
602
|
.,.,
|
549
603
|
|
550
|
-
module_eval(<<'.,.,', 'parser.y',
|
551
|
-
def
|
604
|
+
module_eval(<<'.,.,', 'parser.y', 90)
|
605
|
+
def _reduce_27(val, _values, result)
|
552
606
|
result = [val[2],val[0]]
|
553
607
|
result
|
554
608
|
end
|
555
609
|
.,.,
|
556
610
|
|
557
|
-
module_eval(<<'.,.,', 'parser.y',
|
558
|
-
def
|
611
|
+
module_eval(<<'.,.,', 'parser.y', 91)
|
612
|
+
def _reduce_28(val, _values, result)
|
559
613
|
result = [val[0],nil]
|
560
614
|
result
|
561
615
|
end
|
562
616
|
.,.,
|
563
617
|
|
564
|
-
module_eval(<<'.,.,', 'parser.y',
|
565
|
-
def
|
618
|
+
module_eval(<<'.,.,', 'parser.y', 92)
|
619
|
+
def _reduce_29(val, _values, result)
|
566
620
|
result = [val[0],val[2]]
|
567
621
|
result
|
568
622
|
end
|
569
623
|
.,.,
|
570
624
|
|
571
|
-
# reduce
|
625
|
+
# reduce 30 omitted
|
572
626
|
|
573
|
-
module_eval(<<'.,.,', 'parser.y',
|
574
|
-
def
|
627
|
+
module_eval(<<'.,.,', 'parser.y', 95)
|
628
|
+
def _reduce_31(val, _values, result)
|
575
629
|
result = val.join(' ')
|
576
630
|
result
|
577
631
|
end
|
578
632
|
.,.,
|
579
633
|
|
580
|
-
# reduce
|
634
|
+
# reduce 32 omitted
|
581
635
|
|
582
|
-
# reduce
|
636
|
+
# reduce 33 omitted
|
583
637
|
|
584
|
-
# reduce
|
638
|
+
# reduce 34 omitted
|
585
639
|
|
586
|
-
module_eval(<<'.,.,', 'parser.y',
|
587
|
-
def
|
640
|
+
module_eval(<<'.,.,', 'parser.y', 100)
|
641
|
+
def _reduce_35(val, _values, result)
|
588
642
|
result = val.join(' ')
|
589
643
|
result
|
590
644
|
end
|
591
645
|
.,.,
|
592
646
|
|
593
|
-
# reduce 34 omitted
|
594
|
-
|
595
|
-
# reduce 35 omitted
|
596
|
-
|
597
647
|
# reduce 36 omitted
|
598
648
|
|
599
649
|
# reduce 37 omitted
|
@@ -610,21 +660,25 @@ module_eval(<<'.,.,', 'parser.y', 84)
|
|
610
660
|
|
611
661
|
# reduce 43 omitted
|
612
662
|
|
613
|
-
|
614
|
-
|
663
|
+
# reduce 44 omitted
|
664
|
+
|
665
|
+
# reduce 45 omitted
|
666
|
+
|
667
|
+
module_eval(<<'.,.,', 'parser.y', 110)
|
668
|
+
def _reduce_46(val, _values, result)
|
615
669
|
result = val.join(' ')
|
616
670
|
result
|
617
671
|
end
|
618
672
|
.,.,
|
619
673
|
|
620
|
-
# reduce
|
674
|
+
# reduce 47 omitted
|
621
675
|
|
622
|
-
# reduce
|
676
|
+
# reduce 48 omitted
|
623
677
|
|
624
|
-
# reduce
|
678
|
+
# reduce 49 omitted
|
625
679
|
|
626
|
-
module_eval(<<'.,.,', 'parser.y',
|
627
|
-
def
|
680
|
+
module_eval(<<'.,.,', 'parser.y', 115)
|
681
|
+
def _reduce_50(val, _values, result)
|
628
682
|
result = val.join(' ')
|
629
683
|
result
|
630
684
|
end
|