namae 0.11.3 → 1.1.1
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 +32 -4
- data/features/examples.feature +16 -0
- data/features/lists.feature +13 -3
- data/features/step_definitions/namae_steps.rb +5 -0
- data/features/support/env.rb +0 -9
- data/lib/namae.rb +1 -1
- data/lib/namae/name.rb +7 -0
- data/lib/namae/parser.rb +223 -182
- data/lib/namae/parser.y +67 -42
- 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 +65 -6
- 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: 348bf4a2385c1aa56c35759cc2219a8163fa7cb76e3c05482cd6db7a207906fb
|
4
|
+
data.tar.gz: 4329ea23260aef483460581391fcd43c80bde61ecebef419f89c2d23f0cfeffc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 806964f1611f6931acd6e68e4f5a75069b30abf42795191bf084d89adbfe378d98f6b28f10f96cc5cc446ab9068ddafafd6794e71f2c53fd97d2a0aff5a59914
|
7
|
+
data.tar.gz: f235fb82617020393be215fe078bd74bbb947ab682f387f5aad87e7bb6e3b62323ee03da30409034ca747beca7b5319905f1a081a43bc8763a25dca5b40722c4
|
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,33 @@ 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
|
+
Namae tries to detect common particles using the `:uppercase_particle` lexer
|
125
|
+
pattern. If you prefer to always include particles with the family name, you
|
126
|
+
can set the the `:include_particle_in_family` parser option.
|
127
|
+
|
128
|
+
Namae.parse 'Ludwig von Beethoven'
|
129
|
+
#-> [#<Name family="Beethoven" given="Ludwig" particle="von">]
|
130
|
+
|
131
|
+
Namae.options[:include_particle_in_family] = true
|
132
|
+
#-> [#<Name family="von Beethoven" given="Ludwig">]
|
133
|
+
|
134
|
+
Configuration
|
135
|
+
-------------
|
136
|
+
You can tweak some of Namae's parse rules by configuring the parser's
|
137
|
+
options. Take a look at `Namae.options` to see your current settings.
|
138
|
+
If you want to change the default settings for all parsers, you can run
|
139
|
+
`Namae.configure` which will yield the default options (make sure to
|
140
|
+
change the configuration before using the parser).
|
141
|
+
|
142
|
+
A Note On Thread Safety
|
143
|
+
-----------------------
|
144
|
+
When using the top-level parse functions, Namae will re-use a thread-local
|
145
|
+
parser instance (`Namae::Parser.instance`); the instance is created, using
|
146
|
+
the current default options (`Namae::Parser.defaults`). If you need more
|
147
|
+
control, you are encouraged to create individual parser instances using
|
148
|
+
`Namae::Parser.new`.
|
149
|
+
|
150
|
+
|
124
151
|
Rationale
|
125
152
|
---------
|
126
153
|
Parsing human names is at once too easy and too hard. When working in the
|
@@ -170,7 +197,8 @@ Namae was written as a part of a Google Summer of Code project. Thanks Google!
|
|
170
197
|
|
171
198
|
Copyright
|
172
199
|
---------
|
200
|
+
Copyright (c) 2013-2020 Sylvester Keil
|
201
|
+
|
173
202
|
Copyright (c) 2012 President and Fellows of Harvard College.
|
174
|
-
Copyright (c) 2013-2014 Sylvester Keil
|
175
203
|
|
176
204
|
Namae is dual licensed under the AGPL and a BSD-style license.
|
data/features/examples.feature
CHANGED
@@ -34,3 +34,19 @@ Feature: Parse the names in the Readme file
|
|
34
34
|
| Mr. Yukihiro "Matz" Matsumoto | Yukihiro | | Matsumoto | | | Mr. | Matz |
|
35
35
|
| Yukihiro "Matz" Matsumoto Sr. | Yukihiro | | Matsumoto | Sr. | | | Matz |
|
36
36
|
| Mr. Yukihiro "Matz" Matsumoto Sr. | Yukihiro | | Matsumoto | Sr. | | Mr. | Matz |
|
37
|
+
|
38
|
+
@particle
|
39
|
+
Scenarios: Particles
|
40
|
+
| name | given | particle | family | suffix | title | appellation | nick |
|
41
|
+
| Ludwig von Beethoven | Ludwig | von | Beethoven | | | | |
|
42
|
+
| Beethoven, Ludwig von | Ludwig von | | Beethoven | | | | |
|
43
|
+
| Vincent Van Gogh | Vincent | Van | Gogh | | | | |
|
44
|
+
| Vincent van Gogh | Vincent | van | Gogh | | | | |
|
45
|
+
| Van Gogh, Vincent | Vincent | Van | Gogh | | | | |
|
46
|
+
| van Gogh, Vincent | Vincent | van | Gogh | | | | |
|
47
|
+
| Walther von der Vogelheide | Walther | von der | Vogelheide | | | | |
|
48
|
+
| Don De Lillo | Don | De | Lillo | | | | |
|
49
|
+
| De Lillo, Don | Don | De | Lillo | | | | |
|
50
|
+
| Tom Van de Weghe | Tom | Van de | Weghe | | | | |
|
51
|
+
| Tom Van De Weghe | Tom | Van De | Weghe | | | | |
|
52
|
+
|
data/features/lists.feature
CHANGED
@@ -115,14 +115,24 @@ 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 |
|
122
123
|
| M. | Di Proctor |
|
123
|
-
| P. | Cooper
|
124
|
+
| P. | von Cooper |
|
124
125
|
When I parse the names "Di Proctor, M, von Cooper, P"
|
125
126
|
Then the names should be:
|
126
127
|
| given | family |
|
127
128
|
| M | Di Proctor |
|
128
|
-
| P | Cooper
|
129
|
+
| P | von 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.rb
CHANGED
data/lib/namae/name.rb
CHANGED
@@ -183,6 +183,13 @@ module Namae
|
|
183
183
|
self
|
184
184
|
end
|
185
185
|
|
186
|
+
def merge_particles!
|
187
|
+
self.family = [dropping_particle, particle, family].compact.join(' ')
|
188
|
+
self.dropping_particle = nil
|
189
|
+
self.particle = nil
|
190
|
+
self
|
191
|
+
end
|
192
|
+
|
186
193
|
# @return [String] a string representation of the name
|
187
194
|
def inspect
|
188
195
|
"#<Name #{each_pair.map { |k,v| [k,v.inspect].join('=') if v }.compact.join(' ')}>"
|
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', 111)
|
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(D[aiu]|De[rs]?|St\.?|Saint|La|Les|V[ao]n)(\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,31 @@ 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
|
-
do_parse
|
93
|
+
names = do_parse
|
94
|
+
names.map(&:merge_particles!) if include_particle_in_family?
|
95
|
+
names
|
77
96
|
end
|
78
97
|
|
79
98
|
def normalize(string)
|
80
|
-
string
|
81
|
-
string
|
99
|
+
string.scrub.strip
|
82
100
|
end
|
83
101
|
|
84
102
|
def reset
|
@@ -129,11 +147,11 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 107)
|
|
129
147
|
end
|
130
148
|
|
131
149
|
def will_see_suffix?
|
132
|
-
input.
|
150
|
+
input.rest.strip.split(/\s+/)[0] =~ suffix
|
133
151
|
end
|
134
152
|
|
135
153
|
def will_see_initial?
|
136
|
-
input.
|
154
|
+
input.rest.strip.split(/\s+/)[0] =~ /^[[:upper:]]+\b/
|
137
155
|
end
|
138
156
|
|
139
157
|
def seen_full_name?
|
@@ -165,6 +183,8 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 107)
|
|
165
183
|
else
|
166
184
|
consume_word(:UWORD, input.matched)
|
167
185
|
end
|
186
|
+
when input.scan(uppercase_particle)
|
187
|
+
consume_word(:UPARTICLE, input.matched.strip)
|
168
188
|
when input.scan(/((\\\w+)?\{[^\}]*\})*[[:upper:]][^\s#{stops}]*/)
|
169
189
|
consume_word(:UWORD, input.matched)
|
170
190
|
when input.scan(/((\\\w+)?\{[^\}]*\})*[[:lower:]][^\s#{stops}]*/)
|
@@ -189,133 +209,142 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 107)
|
|
189
209
|
##### State transition tables begin ###
|
190
210
|
|
191
211
|
racc_action_table = [
|
192
|
-
-
|
193
|
-
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
212
|
+
-43, 36, 26, 37, -41, 38, 39, -43, -42, -43,
|
213
|
+
-43, -41, -40, -41, -41, -42, 45, -42, -42, -40,
|
214
|
+
50, -40, -40, 72, 59, 58, 60, 73, 16, 13,
|
215
|
+
17, -36, 61, 7, 18, 65, 14, 16, 25, 17,
|
216
|
+
16, 25, 17, 28, 18, 14, 65, 45, 14, 36,
|
217
|
+
34, 37, 68, 16, 13, 17, 26, 35, 7, 18,
|
218
|
+
18, 14, 16, 25, 17, 28, 36, 34, 37, 45,
|
219
|
+
14, 36, 34, 37, 35, 36, 34, 37, 45, 35,
|
220
|
+
36, 52, 37, 35, -22, -22, -22, 18, 35, 59,
|
221
|
+
58, 60, -22, 36, 34, 37, 45, 61, 36, 34,
|
222
|
+
37, 35, 59, 58, 60, 65, 35, nil, nil, 45,
|
223
|
+
61, 59, 58, 60, 59, 58, 60, nil, 45, 61,
|
224
|
+
19, nil, 61, 59, 58, 60, -40, 20, -24, nil,
|
225
|
+
nil, 61, nil, -40 ]
|
203
226
|
|
204
227
|
racc_action_check = [
|
205
|
-
14,
|
206
|
-
14,
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
228
|
+
14, 48, 8, 48, 16, 11, 19, 14, 17, 14,
|
229
|
+
14, 16, 25, 16, 16, 17, 27, 17, 17, 25,
|
230
|
+
31, 25, 25, 55, 55, 55, 55, 56, 0, 0,
|
231
|
+
0, 55, 55, 0, 0, 56, 0, 5, 5, 5,
|
232
|
+
9, 9, 9, 9, 43, 5, 44, 46, 9, 10,
|
233
|
+
10, 10, 49, 20, 20, 20, 64, 10, 20, 20,
|
234
|
+
66, 20, 23, 23, 23, 23, 24, 24, 24, 67,
|
235
|
+
23, 28, 28, 28, 24, 29, 29, 29, 70, 28,
|
236
|
+
33, 33, 33, 29, 34, 34, 34, 75, 33, 38,
|
237
|
+
38, 38, 34, 41, 41, 41, 38, 38, 47, 47,
|
238
|
+
47, 41, 50, 50, 50, 77, 47, nil, nil, 50,
|
239
|
+
50, 68, 68, 68, 73, 73, 73, nil, 68, 68,
|
240
|
+
1, nil, 73, 78, 78, 78, 13, 1, 13, nil,
|
241
|
+
nil, 78, nil, 13 ]
|
216
242
|
|
217
243
|
racc_action_pointer = [
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
nil, nil,
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
244
|
+
25, 120, nil, nil, nil, 34, nil, nil, -7, 37,
|
245
|
+
46, 3, nil, 126, 0, nil, 4, 8, nil, 6,
|
246
|
+
50, nil, nil, 59, 63, 12, nil, 6, 68, 72,
|
247
|
+
nil, 18, nil, 77, 81, nil, nil, nil, 86, nil,
|
248
|
+
nil, 90, nil, 35, 36, nil, 37, 95, -2, 50,
|
249
|
+
99, nil, nil, nil, nil, 21, 25, nil, nil, nil,
|
250
|
+
nil, nil, nil, nil, 47, nil, 51, 59, 108, nil,
|
251
|
+
68, nil, nil, 111, nil, 78, nil, 95, 120, nil ]
|
226
252
|
|
227
253
|
racc_action_default = [
|
228
|
-
-1, -
|
229
|
-
-
|
230
|
-
-
|
231
|
-
-
|
232
|
-
|
233
|
-
-
|
234
|
-
-
|
235
|
-
-
|
254
|
+
-1, -52, -2, -4, -5, -52, -8, -9, -10, -25,
|
255
|
+
-52, -52, -19, -22, -23, -30, -32, -33, -50, -52,
|
256
|
+
-52, -6, -7, -52, -52, -22, -51, -44, -52, -52,
|
257
|
+
-31, -15, -20, -25, -24, -23, -32, -33, -38, 80,
|
258
|
+
-3, -52, -15, -48, -45, -46, -44, -52, -25, -14,
|
259
|
+
-38, -21, -22, -16, -26, -39, -28, -34, -40, -41,
|
260
|
+
-42, -43, -14, -11, -49, -47, -48, -44, -38, -17,
|
261
|
+
-52, -35, -37, -52, -12, -48, -18, -27, -29, -13 ]
|
236
262
|
|
237
263
|
racc_goto_table = [
|
238
|
-
3,
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
nil, nil, nil, nil,
|
245
|
-
nil, nil, nil,
|
264
|
+
3, 30, 43, 1, 22, 21, 56, 53, 31, 27,
|
265
|
+
32, 63, 78, 70, nil, 30, nil, nil, 56, 69,
|
266
|
+
3, 66, 42, 27, 32, 30, 46, 49, 24, 32,
|
267
|
+
9, nil, 29, 51, 74, 23, 56, 76, 77, 62,
|
268
|
+
30, 32, 75, 79, 2, 67, 41, 32, 8, nil,
|
269
|
+
9, 47, nil, nil, nil, 71, nil, nil, 48, nil,
|
270
|
+
nil, nil, nil, nil, 40, nil, nil, nil, 8, nil,
|
271
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 71 ]
|
246
272
|
|
247
273
|
racc_goto_check = [
|
248
|
-
3,
|
249
|
-
|
250
|
-
3,
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
nil, nil, nil, nil,
|
255
|
-
nil, nil, nil, 3 ]
|
274
|
+
3, 19, 9, 1, 4, 3, 18, 13, 11, 3,
|
275
|
+
14, 10, 16, 17, nil, 19, nil, nil, 18, 13,
|
276
|
+
3, 9, 11, 3, 14, 19, 11, 11, 12, 14,
|
277
|
+
8, nil, 12, 14, 10, 8, 18, 13, 18, 11,
|
278
|
+
19, 14, 9, 10, 2, 11, 12, 14, 7, nil,
|
279
|
+
8, 12, nil, nil, nil, 3, nil, nil, 8, nil,
|
280
|
+
nil, nil, nil, nil, 2, nil, nil, nil, 7, nil,
|
281
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 3 ]
|
256
282
|
|
257
283
|
racc_goto_pointer = [
|
258
|
-
nil,
|
259
|
-
|
284
|
+
nil, 3, 44, 0, -1, nil, nil, 48, 30, -25,
|
285
|
+
-32, -2, 23, -31, 0, nil, -61, -42, -32, -8 ]
|
260
286
|
|
261
287
|
racc_goto_default = [
|
262
|
-
nil, nil, nil,
|
263
|
-
11, 10, nil,
|
288
|
+
nil, nil, nil, 57, 4, 5, 6, 64, 33, nil,
|
289
|
+
nil, 11, 10, nil, 12, 54, 55, nil, 44, 15 ]
|
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,
|
293
|
+
0, 13, :_reduce_1,
|
294
|
+
1, 13, :_reduce_2,
|
295
|
+
3, 13, :_reduce_3,
|
296
|
+
1, 14, :_reduce_4,
|
304
297
|
1, 14, :_reduce_none,
|
298
|
+
2, 14, :_reduce_6,
|
299
|
+
2, 14, :_reduce_7,
|
305
300
|
1, 14, :_reduce_none,
|
306
|
-
1,
|
307
|
-
|
308
|
-
|
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
|
+
2, 16, :_reduce_15,
|
308
|
+
3, 18, :_reduce_16,
|
309
|
+
4, 18, :_reduce_17,
|
310
|
+
5, 18, :_reduce_18,
|
311
|
+
1, 24, :_reduce_none,
|
312
|
+
2, 24, :_reduce_20,
|
313
|
+
3, 24, :_reduce_21,
|
314
|
+
1, 26, :_reduce_none,
|
315
|
+
1, 26, :_reduce_none,
|
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, 31, :_reduce_none,
|
325
|
+
1, 31, :_reduce_none,
|
326
|
+
1, 28, :_reduce_none,
|
327
|
+
2, 28, :_reduce_35,
|
328
|
+
0, 29, :_reduce_none,
|
313
329
|
1, 29, :_reduce_none,
|
314
|
-
|
330
|
+
0, 27, :_reduce_none,
|
331
|
+
1, 27, :_reduce_none,
|
332
|
+
1, 15, :_reduce_none,
|
333
|
+
1, 15, :_reduce_none,
|
334
|
+
1, 15, :_reduce_none,
|
335
|
+
1, 15, :_reduce_none,
|
336
|
+
0, 21, :_reduce_none,
|
337
|
+
1, 21, :_reduce_none,
|
338
|
+
1, 30, :_reduce_none,
|
339
|
+
2, 30, :_reduce_47,
|
340
|
+
0, 22, :_reduce_none,
|
341
|
+
1, 22, :_reduce_none,
|
342
|
+
1, 19, :_reduce_none,
|
343
|
+
2, 19, :_reduce_51 ]
|
315
344
|
|
316
|
-
racc_reduce_n =
|
345
|
+
racc_reduce_n = 52
|
317
346
|
|
318
|
-
racc_shift_n =
|
347
|
+
racc_shift_n = 80
|
319
348
|
|
320
349
|
racc_token_table = {
|
321
350
|
false => 0,
|
@@ -328,9 +357,10 @@ racc_token_table = {
|
|
328
357
|
:AND => 7,
|
329
358
|
:APPELLATION => 8,
|
330
359
|
:TITLE => 9,
|
331
|
-
:SUFFIX => 10
|
360
|
+
:SUFFIX => 10,
|
361
|
+
:UPARTICLE => 11 }
|
332
362
|
|
333
|
-
racc_nt_base =
|
363
|
+
racc_nt_base = 12
|
334
364
|
|
335
365
|
racc_use_result_var = true
|
336
366
|
|
@@ -362,6 +392,7 @@ Racc_token_to_s_table = [
|
|
362
392
|
"APPELLATION",
|
363
393
|
"TITLE",
|
364
394
|
"SUFFIX",
|
395
|
+
"UPARTICLE",
|
365
396
|
"$start",
|
366
397
|
"names",
|
367
398
|
"name",
|
@@ -369,18 +400,19 @@ Racc_token_to_s_table = [
|
|
369
400
|
"display_order",
|
370
401
|
"honorific",
|
371
402
|
"sort_order",
|
403
|
+
"titles",
|
372
404
|
"u_words",
|
373
405
|
"opt_suffices",
|
374
406
|
"opt_titles",
|
375
407
|
"last",
|
376
408
|
"von",
|
377
409
|
"first",
|
410
|
+
"particle",
|
378
411
|
"opt_words",
|
379
412
|
"words",
|
380
413
|
"opt_comma",
|
381
414
|
"suffices",
|
382
|
-
"u_word"
|
383
|
-
"titles" ]
|
415
|
+
"u_word" ]
|
384
416
|
|
385
417
|
Racc_debug_parser = false
|
386
418
|
|
@@ -450,36 +482,36 @@ module_eval(<<'.,.,', 'parser.y', 22)
|
|
450
482
|
|
451
483
|
module_eval(<<'.,.,', 'parser.y', 26)
|
452
484
|
def _reduce_11(val, _values, result)
|
453
|
-
result = Name.new(
|
454
|
-
:suffix => val[2], :title => val[3]
|
485
|
+
result = Name.new(
|
486
|
+
:given => val[0], :family => val[1], :suffix => val[2], :title => val[3]
|
487
|
+
)
|
455
488
|
|
456
489
|
result
|
457
490
|
end
|
458
491
|
.,.,
|
459
492
|
|
460
|
-
module_eval(<<'.,.,', 'parser.y',
|
493
|
+
module_eval(<<'.,.,', 'parser.y', 32)
|
461
494
|
def _reduce_12(val, _values, result)
|
462
|
-
result = Name.new(
|
463
|
-
:family => val[2], :suffix => val[3], :title => val[4]
|
495
|
+
result = Name.new(
|
496
|
+
:given => val[0], :nick => val[1], :family => val[2], :suffix => val[3], :title => val[4]
|
497
|
+
)
|
464
498
|
|
465
499
|
result
|
466
500
|
end
|
467
501
|
.,.,
|
468
502
|
|
469
|
-
module_eval(<<'.,.,', 'parser.y',
|
503
|
+
module_eval(<<'.,.,', 'parser.y', 38)
|
470
504
|
def _reduce_13(val, _values, result)
|
471
|
-
result = Name.new(
|
472
|
-
:particle => val[2], :family => val[3],
|
473
|
-
:suffix => val[4], :title => val[5])
|
505
|
+
result = Name.new(
|
506
|
+
:given => val[0], :nick => val[1], :particle => val[2], :family => val[3], :suffix => val[4], :title => val[5])
|
474
507
|
|
475
508
|
result
|
476
509
|
end
|
477
510
|
.,.,
|
478
511
|
|
479
|
-
module_eval(<<'.,.,', 'parser.y',
|
512
|
+
module_eval(<<'.,.,', 'parser.y', 43)
|
480
513
|
def _reduce_14(val, _values, result)
|
481
|
-
result = Name.new(:given => val[0], :particle => val[1],
|
482
|
-
:family => val[2])
|
514
|
+
result = Name.new(:given => val[0], :particle => val[1], :family => val[2])
|
483
515
|
|
484
516
|
result
|
485
517
|
end
|
@@ -495,26 +527,29 @@ module_eval(<<'.,.,', 'parser.y', 47)
|
|
495
527
|
|
496
528
|
module_eval(<<'.,.,', 'parser.y', 52)
|
497
529
|
def _reduce_16(val, _values, result)
|
498
|
-
result = Name.new({
|
499
|
-
:
|
530
|
+
result = Name.new({
|
531
|
+
:family => val[0], :suffix => val[2][0], :given => val[2][1]
|
532
|
+
}, !!val[2][0])
|
500
533
|
|
501
534
|
result
|
502
535
|
end
|
503
536
|
.,.,
|
504
537
|
|
505
|
-
module_eval(<<'.,.,', 'parser.y',
|
538
|
+
module_eval(<<'.,.,', 'parser.y', 58)
|
506
539
|
def _reduce_17(val, _values, result)
|
507
|
-
result = Name.new({
|
508
|
-
:
|
540
|
+
result = Name.new({
|
541
|
+
:particle => val[0], :family => val[1], :suffix => val[3][0], :given => val[3][1]
|
542
|
+
}, !!val[3][0])
|
509
543
|
|
510
544
|
result
|
511
545
|
end
|
512
546
|
.,.,
|
513
547
|
|
514
|
-
module_eval(<<'.,.,', 'parser.y',
|
548
|
+
module_eval(<<'.,.,', 'parser.y', 64)
|
515
549
|
def _reduce_18(val, _values, result)
|
516
|
-
result = Name.new({
|
517
|
-
:
|
550
|
+
result = Name.new({
|
551
|
+
:particle => val[0,2].join(' '), :family => val[2], :suffix => val[4][0], :given => val[4][1]
|
552
|
+
}, !!val[4][0])
|
518
553
|
|
519
554
|
result
|
520
555
|
end
|
@@ -522,14 +557,14 @@ module_eval(<<'.,.,', 'parser.y', 62)
|
|
522
557
|
|
523
558
|
# reduce 19 omitted
|
524
559
|
|
525
|
-
module_eval(<<'.,.,', 'parser.y',
|
560
|
+
module_eval(<<'.,.,', 'parser.y', 71)
|
526
561
|
def _reduce_20(val, _values, result)
|
527
562
|
result = val.join(' ')
|
528
563
|
result
|
529
564
|
end
|
530
565
|
.,.,
|
531
566
|
|
532
|
-
module_eval(<<'.,.,', 'parser.y',
|
567
|
+
module_eval(<<'.,.,', 'parser.y', 72)
|
533
568
|
def _reduce_21(val, _values, result)
|
534
569
|
result = val.join(' ')
|
535
570
|
result
|
@@ -540,60 +575,60 @@ module_eval(<<'.,.,', 'parser.y', 69)
|
|
540
575
|
|
541
576
|
# reduce 23 omitted
|
542
577
|
|
543
|
-
|
544
|
-
|
578
|
+
# reduce 24 omitted
|
579
|
+
|
580
|
+
# reduce 25 omitted
|
581
|
+
|
582
|
+
module_eval(<<'.,.,', 'parser.y', 78)
|
583
|
+
def _reduce_26(val, _values, result)
|
545
584
|
result = [nil,val[0]]
|
546
585
|
result
|
547
586
|
end
|
548
587
|
.,.,
|
549
588
|
|
550
|
-
module_eval(<<'.,.,', 'parser.y',
|
551
|
-
def
|
589
|
+
module_eval(<<'.,.,', 'parser.y', 79)
|
590
|
+
def _reduce_27(val, _values, result)
|
552
591
|
result = [val[2],val[0]]
|
553
592
|
result
|
554
593
|
end
|
555
594
|
.,.,
|
556
595
|
|
557
|
-
module_eval(<<'.,.,', 'parser.y',
|
558
|
-
def
|
596
|
+
module_eval(<<'.,.,', 'parser.y', 80)
|
597
|
+
def _reduce_28(val, _values, result)
|
559
598
|
result = [val[0],nil]
|
560
599
|
result
|
561
600
|
end
|
562
601
|
.,.,
|
563
602
|
|
564
|
-
module_eval(<<'.,.,', 'parser.y',
|
565
|
-
def
|
603
|
+
module_eval(<<'.,.,', 'parser.y', 81)
|
604
|
+
def _reduce_29(val, _values, result)
|
566
605
|
result = [val[0],val[2]]
|
567
606
|
result
|
568
607
|
end
|
569
608
|
.,.,
|
570
609
|
|
571
|
-
# reduce
|
610
|
+
# reduce 30 omitted
|
572
611
|
|
573
|
-
module_eval(<<'.,.,', 'parser.y',
|
574
|
-
def
|
612
|
+
module_eval(<<'.,.,', 'parser.y', 84)
|
613
|
+
def _reduce_31(val, _values, result)
|
575
614
|
result = val.join(' ')
|
576
615
|
result
|
577
616
|
end
|
578
617
|
.,.,
|
579
618
|
|
580
|
-
# reduce
|
619
|
+
# reduce 32 omitted
|
581
620
|
|
582
|
-
# reduce
|
621
|
+
# reduce 33 omitted
|
583
622
|
|
584
|
-
# reduce
|
623
|
+
# reduce 34 omitted
|
585
624
|
|
586
|
-
module_eval(<<'.,.,', 'parser.y',
|
587
|
-
def
|
625
|
+
module_eval(<<'.,.,', 'parser.y', 89)
|
626
|
+
def _reduce_35(val, _values, result)
|
588
627
|
result = val.join(' ')
|
589
628
|
result
|
590
629
|
end
|
591
630
|
.,.,
|
592
631
|
|
593
|
-
# reduce 34 omitted
|
594
|
-
|
595
|
-
# reduce 35 omitted
|
596
|
-
|
597
632
|
# reduce 36 omitted
|
598
633
|
|
599
634
|
# reduce 37 omitted
|
@@ -610,21 +645,27 @@ module_eval(<<'.,.,', 'parser.y', 84)
|
|
610
645
|
|
611
646
|
# reduce 43 omitted
|
612
647
|
|
613
|
-
|
614
|
-
|
648
|
+
# reduce 44 omitted
|
649
|
+
|
650
|
+
# reduce 45 omitted
|
651
|
+
|
652
|
+
# reduce 46 omitted
|
653
|
+
|
654
|
+
module_eval(<<'.,.,', 'parser.y', 99)
|
655
|
+
def _reduce_47(val, _values, result)
|
615
656
|
result = val.join(' ')
|
616
657
|
result
|
617
658
|
end
|
618
659
|
.,.,
|
619
660
|
|
620
|
-
# reduce
|
661
|
+
# reduce 48 omitted
|
621
662
|
|
622
|
-
# reduce
|
663
|
+
# reduce 49 omitted
|
623
664
|
|
624
|
-
# reduce
|
665
|
+
# reduce 50 omitted
|
625
666
|
|
626
|
-
module_eval(<<'.,.,', 'parser.y',
|
627
|
-
def
|
667
|
+
module_eval(<<'.,.,', 'parser.y', 104)
|
668
|
+
def _reduce_51(val, _values, result)
|
628
669
|
result = val.join(' ')
|
629
670
|
result
|
630
671
|
end
|