namae 0.11.1 → 1.0.2
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 +8 -0
- data/features/support/env.rb +0 -9
- data/lib/namae/parser.rb +29 -23
- data/lib/namae/parser.y +26 -20
- 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 +1 -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: 971aa03b31c2c4b0c853f777fbb103a8e15eb7c39a5be6c3e8c2bfbeb1825946
|
4
|
+
data.tar.gz: ffc6a59e69d7654f346c3b5e568b48bcb1bd537a83d1ee543eefc0f32db65119
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31e652932c388fc6c80429a9206682d1478b4470f5d338cd0564a19c31e785ce57bf9c4b333386d8803cb8f9e0235b624e9dca71aa3260b1f55444f25911b9af
|
7
|
+
data.tar.gz: c03466d1e028fa84e07ae994fe53a6c7c3ea66ea8344018e4ae5795f1cc9206a54f7df67b73e3cf8ae67043eece2929a7c27be7d194966f93cac86fd73867ada
|
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
@@ -126,3 +126,11 @@ Feature: Parse a list of names
|
|
126
126
|
| given | family |
|
127
127
|
| M | Di Proctor |
|
128
128
|
| P | Cooper |
|
129
|
+
|
130
|
+
Scenario: A list of names with two consecutive accented characters
|
131
|
+
Given a parser that prefers commas as separators
|
132
|
+
When I parse the names "Çakıroğlu, Ü., Başıbüyük, B."
|
133
|
+
Then the names should be:
|
134
|
+
| given | family |
|
135
|
+
| Ü. | Çakıroğlu |
|
136
|
+
| B. | Başıbüyük |
|
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,41 @@
|
|
1
1
|
#
|
2
2
|
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by Racc 1.4.
|
4
|
-
# from Racc
|
3
|
+
# This file is automatically generated by Racc 1.4.16
|
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',
|
14
|
+
module_eval(<<'...end parser.y/module_eval...', 'parser.y', 106)
|
16
15
|
|
17
|
-
|
16
|
+
@defaults = {
|
17
|
+
:debug => false,
|
18
|
+
:prefer_comma_as_separator => false,
|
19
|
+
:comma => ',',
|
20
|
+
:stops => ',;',
|
21
|
+
:separator => /\s*(\band\b|\&|;)\s*/i,
|
22
|
+
: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,
|
23
|
+
:suffix => /\s*\b(JR|Jr|jr|SR|Sr|sr|[IVX]{2,})(\.|\b)/,
|
24
|
+
:appellation => /\s*\b((mrs?|ms|fr|hr)\.?|miss|herr|frau)(\s+|$)/i
|
25
|
+
}
|
26
|
+
|
27
|
+
class << self
|
28
|
+
attr_reader :defaults
|
29
|
+
|
30
|
+
def instance
|
31
|
+
Thread.current[:namae] ||= new
|
32
|
+
end
|
33
|
+
end
|
18
34
|
|
19
35
|
attr_reader :options, :input
|
20
36
|
|
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
|
-
}
|
37
|
+
def initialize(options = {})
|
38
|
+
@options = self.class.defaults.merge(options)
|
32
39
|
end
|
33
40
|
|
34
41
|
def debug?
|
@@ -63,22 +70,21 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 107)
|
|
63
70
|
options[:prefer_comma_as_separator]
|
64
71
|
end
|
65
72
|
|
66
|
-
def parse(
|
67
|
-
parse!(
|
73
|
+
def parse(string)
|
74
|
+
parse!(string)
|
68
75
|
rescue => e
|
69
76
|
warn e.message if debug?
|
70
77
|
[]
|
71
78
|
end
|
72
79
|
|
73
80
|
def parse!(string)
|
74
|
-
input
|
81
|
+
@input = StringScanner.new(normalize(string))
|
75
82
|
reset
|
76
83
|
do_parse
|
77
84
|
end
|
78
85
|
|
79
86
|
def normalize(string)
|
80
|
-
string
|
81
|
-
string
|
87
|
+
string.scrub.strip
|
82
88
|
end
|
83
89
|
|
84
90
|
def reset
|
@@ -129,11 +135,11 @@ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 107)
|
|
129
135
|
end
|
130
136
|
|
131
137
|
def will_see_suffix?
|
132
|
-
input.
|
138
|
+
input.rest.strip.split(/\s+/)[0] =~ suffix
|
133
139
|
end
|
134
140
|
|
135
141
|
def will_see_initial?
|
136
|
-
input.
|
142
|
+
input.rest.strip.split(/\s+/)[0] =~ /^[[:upper:]]+\b/
|
137
143
|
end
|
138
144
|
|
139
145
|
def seen_full_name?
|
data/lib/namae/parser.y
CHANGED
@@ -100,26 +100,33 @@ rule
|
|
100
100
|
| titles TITLE { result = val.join(' ') }
|
101
101
|
|
102
102
|
---- header
|
103
|
-
require 'singleton'
|
104
103
|
require 'strscan'
|
105
104
|
|
106
105
|
---- inner
|
107
106
|
|
108
|
-
|
107
|
+
@defaults = {
|
108
|
+
:debug => false,
|
109
|
+
:prefer_comma_as_separator => false,
|
110
|
+
:comma => ',',
|
111
|
+
:stops => ',;',
|
112
|
+
:separator => /\s*(\band\b|\&|;)\s*/i,
|
113
|
+
: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,
|
114
|
+
:suffix => /\s*\b(JR|Jr|jr|SR|Sr|sr|[IVX]{2,})(\.|\b)/,
|
115
|
+
:appellation => /\s*\b((mrs?|ms|fr|hr)\.?|miss|herr|frau)(\s+|$)/i
|
116
|
+
}
|
117
|
+
|
118
|
+
class << self
|
119
|
+
attr_reader :defaults
|
120
|
+
|
121
|
+
def instance
|
122
|
+
Thread.current[:namae] ||= new
|
123
|
+
end
|
124
|
+
end
|
109
125
|
|
110
126
|
attr_reader :options, :input
|
111
127
|
|
112
|
-
def initialize
|
113
|
-
@
|
114
|
-
:debug => false,
|
115
|
-
:prefer_comma_as_separator => false,
|
116
|
-
:comma => ',',
|
117
|
-
:stops => ',;',
|
118
|
-
:separator => /\s*(\band\b|\&|;)\s*/i,
|
119
|
-
: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,
|
120
|
-
:suffix => /\s*\b(JR|Jr|jr|SR|Sr|sr|[IVX]{2,})(\.|\b)/,
|
121
|
-
:appellation => /\s*\b((mrs?|ms|fr|hr)\.?|miss|herr|frau)(\s+|$)/i
|
122
|
-
}
|
128
|
+
def initialize(options = {})
|
129
|
+
@options = self.class.defaults.merge(options)
|
123
130
|
end
|
124
131
|
|
125
132
|
def debug?
|
@@ -154,22 +161,21 @@ require 'strscan'
|
|
154
161
|
options[:prefer_comma_as_separator]
|
155
162
|
end
|
156
163
|
|
157
|
-
def parse(
|
158
|
-
parse!(
|
164
|
+
def parse(string)
|
165
|
+
parse!(string)
|
159
166
|
rescue => e
|
160
167
|
warn e.message if debug?
|
161
168
|
[]
|
162
169
|
end
|
163
170
|
|
164
171
|
def parse!(string)
|
165
|
-
input
|
172
|
+
@input = StringScanner.new(normalize(string))
|
166
173
|
reset
|
167
174
|
do_parse
|
168
175
|
end
|
169
176
|
|
170
177
|
def normalize(string)
|
171
|
-
string
|
172
|
-
string
|
178
|
+
string.scrub.strip
|
173
179
|
end
|
174
180
|
|
175
181
|
def reset
|
@@ -220,11 +226,11 @@ require 'strscan'
|
|
220
226
|
end
|
221
227
|
|
222
228
|
def will_see_suffix?
|
223
|
-
input.
|
229
|
+
input.rest.strip.split(/\s+/)[0] =~ suffix
|
224
230
|
end
|
225
231
|
|
226
232
|
def will_see_initial?
|
227
|
-
input.
|
233
|
+
input.rest.strip.split(/\s+/)[0] =~ /^[[:upper:]]+\b/
|
228
234
|
end
|
229
235
|
|
230
236
|
def seen_full_name?
|
data/lib/namae/utility.rb
CHANGED
data/lib/namae/version.rb
CHANGED
data/namae.gemspec
CHANGED
@@ -2,23 +2,22 @@
|
|
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.
|
5
|
+
# stub: namae 1.0.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "namae".freeze
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "1.0.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Sylvester Keil".freeze, "Dan Collis-Puro".freeze]
|
14
|
-
s.date = "
|
15
|
-
s.description = " Namae (\
|
14
|
+
s.date = "2021-01-07"
|
15
|
+
s.description = " Namae (\u540D\u524D) 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.). ".freeze
|
16
16
|
s.email = ["sylvester@keil.or.at".freeze, "dan@collispuro.com".freeze]
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"README.md"
|
19
19
|
]
|
20
20
|
s.files = [
|
21
|
-
".autotest",
|
22
21
|
".codeclimate.yml",
|
23
22
|
".coveralls.yml",
|
24
23
|
".document",
|
@@ -50,23 +49,22 @@ Gem::Specification.new do |s|
|
|
50
49
|
"spec/namae/name_spec.rb",
|
51
50
|
"spec/namae/parser_spec.rb",
|
52
51
|
"spec/namae/utility_spec.rb",
|
53
|
-
"spec/spec_helper.rb"
|
52
|
+
"spec/spec_helper.rb",
|
53
|
+
"spec/thread_safety_spec.rb"
|
54
54
|
]
|
55
55
|
s.homepage = "https://github.com/berkmancenter/namae".freeze
|
56
56
|
s.licenses = ["AGPL-3.0".freeze]
|
57
|
-
s.rubygems_version = "2.
|
58
|
-
s.summary = "Namae (\
|
57
|
+
s.rubygems_version = "3.2.3".freeze
|
58
|
+
s.summary = "Namae (\u540D\u524D) parses personal names and splits them into their component parts.".freeze
|
59
59
|
|
60
60
|
if s.respond_to? :specification_version then
|
61
61
|
s.specification_version = 4
|
62
|
+
end
|
62
63
|
|
63
|
-
|
64
|
-
|
65
|
-
else
|
66
|
-
s.add_dependency(%q<racc>.freeze, ["= 1.4.9"])
|
67
|
-
end
|
64
|
+
if s.respond_to? :add_runtime_dependency then
|
65
|
+
s.add_development_dependency(%q<racc>.freeze, ["~> 1.4"])
|
68
66
|
else
|
69
|
-
s.add_dependency(%q<racc>.freeze, ["
|
67
|
+
s.add_dependency(%q<racc>.freeze, ["~> 1.4"])
|
70
68
|
end
|
71
69
|
end
|
72
70
|
|
data/spec/namae/parser_spec.rb
CHANGED
@@ -1,10 +1,5 @@
|
|
1
1
|
module Namae
|
2
2
|
describe 'Parser' do
|
3
|
-
|
4
|
-
it 'does not respond to .new' do
|
5
|
-
expect(Parser).not_to respond_to(:new)
|
6
|
-
end
|
7
|
-
|
8
3
|
describe '.instance' do
|
9
4
|
let(:parser) { Parser.instance }
|
10
5
|
|
@@ -120,7 +115,7 @@ module Namae
|
|
120
115
|
end
|
121
116
|
end
|
122
117
|
|
123
|
-
%w{Pastor Pr. Reverend Rev. Elder Deacon Deaconess Father Fr. Vicar}.each do |title|
|
118
|
+
%w{Pastor Pr. Reverend Rev. Elder Deacon Deaconess Father Fr. Vicar Rabbi Cantor}.each do |title|
|
124
119
|
describe "the next token is #{title.inspect}" do
|
125
120
|
before { parser.send(:input).string = title }
|
126
121
|
it 'returns a TITLE token' do
|
@@ -149,10 +144,6 @@ module Namae
|
|
149
144
|
expect(parser.parse!('Ichiro')[0].given).to eq('Ichiro')
|
150
145
|
end
|
151
146
|
|
152
|
-
it 'removes numbers' do
|
153
|
-
expect(parser.parse!('Ichiro 20156')[0].given).to eq('Ichiro')
|
154
|
-
end
|
155
|
-
|
156
147
|
it 'treats "Lord Byron" as a title and family name' do
|
157
148
|
expect(parser.parse!('Lord Byron')[0].values_at(:family, :title)).to eq(['Byron', 'Lord'])
|
158
149
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Namae
|
2
|
+
describe 'Parser using threads' do
|
3
|
+
let(:name_1_str) { "Foo Bar" }
|
4
|
+
let(:name_2_str) { "Baz" }
|
5
|
+
let(:name_1) { Namae.parse(name_1_str).first }
|
6
|
+
let(:name_2) { Namae.parse(name_2_str).first }
|
7
|
+
|
8
|
+
def compare(string, expectation)
|
9
|
+
name = Namae.parse(string).first
|
10
|
+
given_name_match = expectation.given == name.given
|
11
|
+
family_name_match = expectation.family == name.family
|
12
|
+
raise unless given_name_match && family_name_match
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'has no conflicts' do
|
16
|
+
[[name_1_str, name_1], [name_2_str, name_2]].map do |string, expectation|
|
17
|
+
Thread.new do
|
18
|
+
1000.times do
|
19
|
+
compare(string, expectation)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end.each(&:join)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: namae
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
- Dan Collis-Puro
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: racc
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.4
|
20
|
+
version: '1.4'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.4
|
27
|
+
version: '1.4'
|
28
28
|
description: " Namae (名前) is a parser for human names. It recognizes personal names
|
29
29
|
of various cultural backgrounds and tries to split them into their component parts
|
30
30
|
(e.g., given and family names, honorifics etc.). "
|
@@ -36,7 +36,6 @@ extensions: []
|
|
36
36
|
extra_rdoc_files:
|
37
37
|
- README.md
|
38
38
|
files:
|
39
|
-
- ".autotest"
|
40
39
|
- ".codeclimate.yml"
|
41
40
|
- ".coveralls.yml"
|
42
41
|
- ".document"
|
@@ -69,11 +68,12 @@ files:
|
|
69
68
|
- spec/namae/parser_spec.rb
|
70
69
|
- spec/namae/utility_spec.rb
|
71
70
|
- spec/spec_helper.rb
|
71
|
+
- spec/thread_safety_spec.rb
|
72
72
|
homepage: https://github.com/berkmancenter/namae
|
73
73
|
licenses:
|
74
74
|
- AGPL-3.0
|
75
75
|
metadata: {}
|
76
|
-
post_install_message:
|
76
|
+
post_install_message:
|
77
77
|
rdoc_options: []
|
78
78
|
require_paths:
|
79
79
|
- lib
|
@@ -88,9 +88,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
|
-
|
92
|
-
|
93
|
-
signing_key:
|
91
|
+
rubygems_version: 3.2.3
|
92
|
+
signing_key:
|
94
93
|
specification_version: 4
|
95
94
|
summary: Namae (名前) parses personal names and splits them into their component parts.
|
96
95
|
test_files: []
|
data/.autotest
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
begin
|
3
|
-
if RUBY_PLATFORM =~ /darwin/
|
4
|
-
Bundler.setup(:default, :development, :debug, :test, :osx)
|
5
|
-
require 'autotest/fsevent'
|
6
|
-
else
|
7
|
-
Bundler.setup(:default, :development, :debug, :test)
|
8
|
-
end
|
9
|
-
rescue Bundler::BundlerError => e
|
10
|
-
$stderr.puts e.message
|
11
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
12
|
-
exit e.status_code
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
Autotest.add_hook :initialize do |at|
|
17
|
-
at.add_mapping(/.+\.y$/) do |f,_|
|
18
|
-
system 'rake clean racc'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|