namae 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/namae/parser.rb +4 -2
- data/lib/namae/version.rb +2 -2
- metadata +17 -33
- data/.codeclimate.yml +0 -16
- data/.coveralls.yml +0 -1
- data/.document +0 -7
- data/.rspec +0 -2
- data/.rubocop.yml +0 -1156
- data/.simplecov +0 -4
- data/.travis.yml +0 -38
- data/.yardopts +0 -3
- data/Gemfile +0 -26
- data/Rakefile +0 -74
- data/cucumber.yml +0 -1
- data/features/bibtex.feature +0 -78
- data/features/examples.feature +0 -52
- data/features/lists.feature +0 -138
- data/features/step_definitions/namae_steps.rb +0 -45
- data/features/suffix.feature +0 -49
- data/features/support/env.rb +0 -24
- data/features/title.feature +0 -17
- data/namae.gemspec +0 -70
- data/spec/namae/name_spec.rb +0 -133
- data/spec/namae/parser_spec.rb +0 -263
- data/spec/namae/utility_spec.rb +0 -21
- data/spec/spec_helper.rb +0 -32
- data/spec/thread_safety_spec.rb +0 -25
data/.simplecov
DELETED
data/.travis.yml
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
sudo: false
|
4
|
-
cache: bundler
|
5
|
-
|
6
|
-
matrix:
|
7
|
-
fast_finish: true
|
8
|
-
include:
|
9
|
-
- rvm: 3.0
|
10
|
-
env: WITH_COVERALLS=true
|
11
|
-
- rvm: 2.7
|
12
|
-
env: WITH_COVERALLS=false
|
13
|
-
- rvm: 2.6
|
14
|
-
env: WITH_COVERALLS=false
|
15
|
-
- rvm: 2.5
|
16
|
-
env: WITH_COVERALLS=false
|
17
|
-
- rvm: jruby-19mode
|
18
|
-
env: WITH_COVERALLS=false
|
19
|
-
|
20
|
-
before_install:
|
21
|
-
- gem update --system
|
22
|
-
|
23
|
-
install:
|
24
|
-
- if [[ $WITH_COVERALLS = "true" ]]; then
|
25
|
-
bundle install --without debug optional;
|
26
|
-
else
|
27
|
-
bundle install --without debug optional coverage;
|
28
|
-
fi
|
29
|
-
|
30
|
-
script:
|
31
|
-
- if [[ $WITH_COVERALLS = "true" ]]; then
|
32
|
-
bundle exec rake test_with_coveralls;
|
33
|
-
else
|
34
|
-
bundle exec rake;
|
35
|
-
fi
|
36
|
-
|
37
|
-
notifications:
|
38
|
-
email: false
|
data/.yardopts
DELETED
data/Gemfile
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
group :test do
|
4
|
-
gem 'rspec', '~> 3.7'
|
5
|
-
gem 'rake'
|
6
|
-
gem 'cucumber', '~> 3.1'
|
7
|
-
end
|
8
|
-
|
9
|
-
group :development do
|
10
|
-
gem 'racc', '~> 1.4', :platform => :ruby
|
11
|
-
end
|
12
|
-
|
13
|
-
group :coverage do
|
14
|
-
gem 'simplecov', :require => false, :platforms => :ruby
|
15
|
-
gem 'coveralls', :require => false if ENV['CI']
|
16
|
-
end
|
17
|
-
|
18
|
-
group :optional do
|
19
|
-
gem 'jeweler'
|
20
|
-
gem 'yard'
|
21
|
-
end
|
22
|
-
|
23
|
-
group :debug do
|
24
|
-
gem 'debugger', :platform => [:mri_19]
|
25
|
-
gem 'byebug', :platform => :mri if RUBY_VERSION > '2.0'
|
26
|
-
end
|
data/Rakefile
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'bundler'
|
4
|
-
begin
|
5
|
-
Bundler.setup(:default, :development, :debug, :test)
|
6
|
-
rescue Bundler::BundlerError => e
|
7
|
-
$stderr.puts e.message
|
8
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
-
exit e.status_code
|
10
|
-
end
|
11
|
-
require 'rake'
|
12
|
-
|
13
|
-
$:.unshift(File.join(File.dirname(__FILE__), './lib'))
|
14
|
-
require 'namae'
|
15
|
-
|
16
|
-
begin
|
17
|
-
require 'jeweler'
|
18
|
-
Jeweler::Tasks.new do |gem|
|
19
|
-
gem.name = 'namae'
|
20
|
-
gem.version = Namae::Version::STRING.dup
|
21
|
-
gem.homepage = 'https://github.com/berkmancenter/namae'
|
22
|
-
|
23
|
-
gem.email = ['sylvester@keil.or.at', 'dan@collispuro.com']
|
24
|
-
gem.authors = ['Sylvester Keil', 'Dan Collis-Puro']
|
25
|
-
|
26
|
-
gem.license = 'AGPL-3.0'
|
27
|
-
|
28
|
-
gem.summary =
|
29
|
-
'Namae (名前) parses personal names and splits them into their component parts.'
|
30
|
-
|
31
|
-
gem.description = %q{
|
32
|
-
Namae (名前) is a parser for human names. It recognizes personal names of
|
33
|
-
various cultural backgrounds and tries to split them into their component
|
34
|
-
parts (e.g., given and family names, honorifics etc.).
|
35
|
-
}.gsub(/\s+/, ' ')
|
36
|
-
|
37
|
-
end
|
38
|
-
Jeweler::RubygemsDotOrgTasks.new
|
39
|
-
rescue LoadError
|
40
|
-
warn 'failed to load jeweler'
|
41
|
-
end
|
42
|
-
|
43
|
-
desc 'Generate the name parser'
|
44
|
-
task :racc => ['lib/namae/parser.rb']
|
45
|
-
|
46
|
-
file 'lib/namae/parser.rb' => ['lib/namae/parser.y'] do
|
47
|
-
sh 'bundle exec racc -o lib/namae/parser.rb lib/namae/parser.y'
|
48
|
-
end
|
49
|
-
|
50
|
-
require 'rspec/core'
|
51
|
-
require 'rspec/core/rake_task'
|
52
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
53
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
54
|
-
end
|
55
|
-
|
56
|
-
require 'cucumber/rake/task'
|
57
|
-
Cucumber::Rake::Task.new(:features)
|
58
|
-
|
59
|
-
task :default => [:spec, :features]
|
60
|
-
|
61
|
-
begin
|
62
|
-
require 'coveralls/rake/task'
|
63
|
-
Coveralls::RakeTask.new
|
64
|
-
task :test_with_coveralls => [:spec, :features, 'coveralls:push']
|
65
|
-
rescue LoadError
|
66
|
-
# ignore
|
67
|
-
end
|
68
|
-
|
69
|
-
begin
|
70
|
-
require 'yard'
|
71
|
-
YARD::Rake::YardocTask.new
|
72
|
-
rescue LoadError
|
73
|
-
# ignore
|
74
|
-
end
|
data/cucumber.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
default: --format progress --require features --color
|
data/features/bibtex.feature
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
Feature: Parse BibTeX-style names
|
2
|
-
As a hacker who works with bibliographies
|
3
|
-
I want to be able to parse BibTeX-style names
|
4
|
-
|
5
|
-
Scenario Outline: Name splitting
|
6
|
-
When I parse the name "<name>"
|
7
|
-
Then the BibTeX parts should be:
|
8
|
-
| first | von | last | jr |
|
9
|
-
| <first> | <von> | <last> | <jr> |
|
10
|
-
|
11
|
-
@names @display
|
12
|
-
Scenarios: Decoret test suite (display order)
|
13
|
-
| name | first | von | last | jr |
|
14
|
-
| AA BB | AA | | BB | |
|
15
|
-
| AA BB CC | AA BB | | CC | |
|
16
|
-
# | AA | | | AA | |
|
17
|
-
| AA bb | AA | | bb | |
|
18
|
-
# | aa | | | aa | |
|
19
|
-
| aa bb | | aa | bb | |
|
20
|
-
| aa BB | | aa | BB | |
|
21
|
-
| AA bb CC | AA | bb | CC | |
|
22
|
-
| AA bb CC dd EE | AA | bb CC dd | EE | |
|
23
|
-
# | AA 1B cc dd | AA 1B | cc | dd | |
|
24
|
-
# | AA 1b cc dd | AA | 1b cc | dd | |
|
25
|
-
| AA {b}B cc dd | AA {b}B | cc | dd | |
|
26
|
-
| AA {b}b cc dd | AA | {b}b cc | dd | |
|
27
|
-
| AA {B}b cc dd | AA | {B}b cc | dd | |
|
28
|
-
| AA {B}B cc dd | AA {B}B | cc | dd | |
|
29
|
-
| AA \BB{b} cc dd | AA \\BB{b} | cc | dd | |
|
30
|
-
| AA \bb{b} cc dd | AA \\bb{b} | cc | dd | |
|
31
|
-
| AA {bb} cc DD | AA {bb} | cc | DD | |
|
32
|
-
| AA bb {cc} DD | AA | bb | {cc} DD | |
|
33
|
-
| AA {bb} CC | AA {bb} | | CC | |
|
34
|
-
|
35
|
-
@names @sort
|
36
|
-
Scenarios: Decoret test suite (sort order)
|
37
|
-
| name | first | von | last | jr |
|
38
|
-
| bb CC, AA | AA | bb | CC | |
|
39
|
-
| bb CC, aa | aa | bb | CC | |
|
40
|
-
| bb CC dd EE, AA | AA | bb CC dd | EE | |
|
41
|
-
| bb, AA | AA | | bb | |
|
42
|
-
| BB, | | | BB | |
|
43
|
-
| bb CC,II, AA | AA | bb | CC | II |
|
44
|
-
| bb CC,jr, AA | AA | bb | CC | jr |
|
45
|
-
# | BB,, AA | AA | | BB | |
|
46
|
-
| CC dd BB, AA | AA | CC dd | BB | |
|
47
|
-
| BB, AA | AA | | BB | |
|
48
|
-
|
49
|
-
@names @sort
|
50
|
-
Scenarios: Long von parts
|
51
|
-
| name | first | von | last | jr |
|
52
|
-
| bb cc dd CC, AA | AA | bb cc dd | CC | |
|
53
|
-
| bb CC dd CC, AA | AA | bb CC dd | CC | |
|
54
|
-
| BB cc dd CC, AA | AA | BB cc dd | CC | |
|
55
|
-
| BB CC dd CC, AA | AA | BB CC dd | CC | |
|
56
|
-
|
57
|
-
@names
|
58
|
-
Scenarios: Decoret further remarks
|
59
|
-
| name | first | von | last | jr |
|
60
|
-
| Dominique Galouzeau de Villepin | Dominique Galouzeau | de | Villepin | |
|
61
|
-
| Dominique {G}alouzeau de Villepin | Dominique | {G}alouzeau de | Villepin | |
|
62
|
-
| Galouzeau {de} Villepin, Dominique | Dominique | | Galouzeau {de} Villepin | |
|
63
|
-
|
64
|
-
@names
|
65
|
-
Scenarios: Some actual names
|
66
|
-
| name | first | von | last | jr |
|
67
|
-
| John Paul Jones | John Paul | | Jones | |
|
68
|
-
| Ludwig von Beethoven | Ludwig | von | Beethoven | |
|
69
|
-
| von Beethoven, Ludwig | Ludwig | von | Beethoven | |
|
70
|
-
| {von Beethoven}, Ludwig | Ludwig | | {von Beethoven} | |
|
71
|
-
| {{von} Beethoven}, Ludwig | Ludwig | | {{von} Beethoven} | |
|
72
|
-
| John {}Paul Jones | John {}Paul | | Jones | |
|
73
|
-
| Ford, Jr., Henry | Henry | | Ford | Jr. |
|
74
|
-
| Brinch Hansen, Per | Per | | Brinch Hansen | |
|
75
|
-
# | {Barnes and Noble, Inc.} | | | {Barnes and Noble, Inc.} | |
|
76
|
-
| {Barnes and} {Noble, Inc.} | {Barnes and} | | {Noble, Inc.} | |
|
77
|
-
| {Barnes} {and} {Noble,} {Inc.} | {Barnes} {and} {Noble,} | | {Inc.} | |
|
78
|
-
| Charles Louis Xavier Joseph de la Vallee Poussin | Charles Louis Xavier Joseph | de la | Vallee Poussin | |
|
data/features/examples.feature
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
Feature: Parse the names in the Readme file
|
2
|
-
As a hacker who works with Namae
|
3
|
-
I want to be able to parse all the examples in the Readme file
|
4
|
-
|
5
|
-
Scenario Outline: Names Parsing
|
6
|
-
When I parse the name "<name>"
|
7
|
-
Then the parts should be:
|
8
|
-
| given | particle | family | suffix | title | appellation | nick |
|
9
|
-
| <given> | <particle> | <family> | <suffix> | <title> | <appellation> | <nick> |
|
10
|
-
|
11
|
-
@readme @display
|
12
|
-
Scenarios: Readme examples (display-order)
|
13
|
-
| name | given | particle | family | suffix | title | appellation | nick |
|
14
|
-
| Charles Babbage | Charles | | Babbage | | | | |
|
15
|
-
| Mr. Alan M. Turing | Alan M. | | Turing | | | Mr. | |
|
16
|
-
| Yukihiro "Matz" Matsumoto | Yukihiro | | Matsumoto | | | | Matz |
|
17
|
-
| Sir Isaac Newton | Isaac | | Newton | | Sir | | |
|
18
|
-
| Prof. Donald Ervin Knuth | Donald Ervin | | Knuth | | Prof. | | |
|
19
|
-
| Lord Byron | | | Byron | | Lord | | |
|
20
|
-
| Ms. Sofia Kovalevskaya | Sofia | | Kovalevskaya | | | Ms. | |
|
21
|
-
| Countess Ada Lovelace | Ada | | Lovelace | | Countess | | |
|
22
|
-
| Augusta Ada King | Augusta Ada | | King | | | | |
|
23
|
-
| Julia Herr | Julia | | Herr | | | | |
|
24
|
-
| Herr, Julia | Julia | | Herr | | | | |
|
25
|
-
|
26
|
-
@readme @sort
|
27
|
-
Scenarios: Readme examples (sort-order)
|
28
|
-
| name | given | particle | family | suffix | title | appellation | nick |
|
29
|
-
| Carreño Quiñones, María-Jose | María-Jose | | Carreño Quiñones | | | | |
|
30
|
-
|
31
|
-
@issues @appellation @nick @suffix
|
32
|
-
Scenarios: Nicknames Appellations and Suffices
|
33
|
-
| name | given | particle | family | suffix | title | appellation | nick |
|
34
|
-
| Mr. Yukihiro "Matz" Matsumoto | Yukihiro | | Matsumoto | | | Mr. | Matz |
|
35
|
-
| Yukihiro "Matz" Matsumoto Sr. | Yukihiro | | Matsumoto | Sr. | | | Matz |
|
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
DELETED
@@ -1,138 +0,0 @@
|
|
1
|
-
Feature: Parse a list of names
|
2
|
-
As a hacker who works with Namae
|
3
|
-
I want to be able to parse multiple names in a list
|
4
|
-
|
5
|
-
@list
|
6
|
-
Scenario: A list of names separated by 'and'
|
7
|
-
When I parse the names "Plato and Archimedes and Publius Ovidius Naso"
|
8
|
-
Then there should be 3 names
|
9
|
-
And the names should be:
|
10
|
-
| given | family |
|
11
|
-
| Plato | |
|
12
|
-
| Archimedes | |
|
13
|
-
| Publius Ovidius | Naso |
|
14
|
-
|
15
|
-
@list
|
16
|
-
Scenario: A list of sort-order names separated by commas
|
17
|
-
When I parse the names "Kernighan, Brian, Ritchie, Dennis, Knuth, Donald"
|
18
|
-
Then there should be 3 names
|
19
|
-
And the names should be:
|
20
|
-
| given | family |
|
21
|
-
| Brian | Kernighan |
|
22
|
-
| Dennis | Ritchie |
|
23
|
-
| Donald | Knuth |
|
24
|
-
Given a parser that prefers commas as separators
|
25
|
-
When I parse the names "Kernighan, Brian, Ritchie, Dennis, Knuth, Donald"
|
26
|
-
Then there should be 3 names
|
27
|
-
And the names should be:
|
28
|
-
| given | family |
|
29
|
-
| Brian | Kernighan |
|
30
|
-
| Dennis | Ritchie |
|
31
|
-
| Donald | Knuth |
|
32
|
-
|
33
|
-
@list
|
34
|
-
Scenario: A list of names separated by semicolons
|
35
|
-
When I parse the names "John D. Smith; Jack R. Johnson; Emily Tanner"
|
36
|
-
Then there should be 3 names
|
37
|
-
And the names should be:
|
38
|
-
| given | family |
|
39
|
-
| John D. | Smith |
|
40
|
-
| Jack R. | Johnson |
|
41
|
-
| Emily | Tanner |
|
42
|
-
When I parse the names "Smith, John D.; Johnson, Jack R.; Tanner, Emily"
|
43
|
-
Then there should be 3 names
|
44
|
-
And the names should be:
|
45
|
-
| given | family |
|
46
|
-
| John D. | Smith |
|
47
|
-
| Jack R. | Johnson |
|
48
|
-
| Emily | Tanner |
|
49
|
-
|
50
|
-
@list
|
51
|
-
Scenario: A list of sort-order names with initials separated by commas
|
52
|
-
When I parse the names "Kernighan, B., Ritchie, D., Knuth, D."
|
53
|
-
Then there should be 3 names
|
54
|
-
And the names should be:
|
55
|
-
| given | family |
|
56
|
-
| B. | Kernighan |
|
57
|
-
| D. | Ritchie |
|
58
|
-
| D. | Knuth |
|
59
|
-
|
60
|
-
@list
|
61
|
-
Scenario: A list of mixed names separated by commas and 'and'
|
62
|
-
When I parse the names "Kernighan, Brian, Ritchie, Dennis and Donald Knuth"
|
63
|
-
Then there should be 3 names
|
64
|
-
And the names should be:
|
65
|
-
| given | family |
|
66
|
-
| Brian | Kernighan |
|
67
|
-
| Dennis | Ritchie |
|
68
|
-
| Donald | Knuth |
|
69
|
-
|
70
|
-
@list
|
71
|
-
Scenario: A list of mixed names separated by semicolons, commas and 'and'
|
72
|
-
Given a parser that prefers commas as separators
|
73
|
-
When I parse the names "John D. Smith, Jack R. Johnson & Emily Tanner"
|
74
|
-
Then there should be 3 names
|
75
|
-
And the names should be:
|
76
|
-
| given | family |
|
77
|
-
| John D. | Smith |
|
78
|
-
| Jack R. | Johnson |
|
79
|
-
| Emily | Tanner |
|
80
|
-
When I parse the names "C. Foster; C. Hamel, C. Desroches"
|
81
|
-
Then there should be 3 names
|
82
|
-
And the names should be:
|
83
|
-
| given | family |
|
84
|
-
| C. | Foster |
|
85
|
-
| C. | Hamel |
|
86
|
-
| C. | Desroches |
|
87
|
-
|
88
|
-
@list
|
89
|
-
Scenario: A list of display-order names separated by commas and 'and'
|
90
|
-
Given a parser that prefers commas as separators
|
91
|
-
When I parse the names "Brian Kernighan, Dennis Ritchie, and Donald Knuth"
|
92
|
-
Then there should be 3 names
|
93
|
-
And the names should be:
|
94
|
-
| given | family |
|
95
|
-
| Brian | Kernighan |
|
96
|
-
| Dennis | Ritchie |
|
97
|
-
| Donald | Knuth |
|
98
|
-
|
99
|
-
@list @wip
|
100
|
-
Scenario: A list of names separated by commas
|
101
|
-
Given a parser that prefers commas as separators
|
102
|
-
When I parse the names "G. Proctor, M. Cooper, P. Sanders & B. Malcom"
|
103
|
-
Then the names should be:
|
104
|
-
| given | family |
|
105
|
-
| G. | Proctor |
|
106
|
-
| M. | Cooper |
|
107
|
-
| P. | Sanders |
|
108
|
-
| B. | Malcom |
|
109
|
-
When I parse the names "G Proctor, M Cooper, PJ Sanders & B Malcom"
|
110
|
-
Then the names should be:
|
111
|
-
| given | family |
|
112
|
-
| G | Proctor |
|
113
|
-
| M | Cooper |
|
114
|
-
| PJ | Sanders |
|
115
|
-
| B | Malcom |
|
116
|
-
|
117
|
-
Scenario: A list of names with particles separated by commas
|
118
|
-
Given I want to include particles in the family name
|
119
|
-
And a parser that prefers commas as separators
|
120
|
-
When I parse the names "Di Proctor, M., von Cooper, P."
|
121
|
-
Then the names should be:
|
122
|
-
| given | family |
|
123
|
-
| M. | Di Proctor |
|
124
|
-
| P. | von Cooper |
|
125
|
-
When I parse the names "Di Proctor, M, von Cooper, P"
|
126
|
-
Then the names should be:
|
127
|
-
| given | family |
|
128
|
-
| M | Di Proctor |
|
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 |
|
@@ -1,45 +0,0 @@
|
|
1
|
-
Given /^a parser that prefers commas as separators$/ do
|
2
|
-
Namae::Parser.instance.options[:prefer_comma_as_separator] = true
|
3
|
-
end
|
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
|
-
|
10
|
-
When /^I parse the name "(.*)"$/ do |string|
|
11
|
-
@name = Namae.parse!(string)[0]
|
12
|
-
end
|
13
|
-
|
14
|
-
When /^I parse the names "(.*)"$/ do |string|
|
15
|
-
@names = Namae.parse!(string)
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
Then /^the BibTeX parts should be:$/ do |table|
|
20
|
-
table.hashes.each do |row|
|
21
|
-
expect(
|
22
|
-
@name.values_at(:given, :particle, :family, :suffix).map(&:to_s)
|
23
|
-
).to eq(row.values_at('first', 'von', 'last', 'jr'))
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
Then /^the parts should be:$/ do |table|
|
28
|
-
table.hashes.each do |row|
|
29
|
-
expect(
|
30
|
-
@name.values_at(:given, :particle, :family, :suffix, :title, :appellation, :nick).map(&:to_s)
|
31
|
-
).to eq(row.values_at('given', 'particle', 'family', 'suffix', 'title', 'appellation', 'nick'))
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
Then /^there should be (\d+) names$/ do |count|
|
36
|
-
expect(@names.length).to eq(count.to_i)
|
37
|
-
end
|
38
|
-
|
39
|
-
Then /^the names should be:$/ do |table|
|
40
|
-
table.hashes.each_with_index do |row, i|
|
41
|
-
expect(
|
42
|
-
@names[i].values_at(*row.keys.map(&:to_sym)).map(&:to_s)
|
43
|
-
).to eq(row.values)
|
44
|
-
end
|
45
|
-
end
|
data/features/suffix.feature
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
Feature: Parse names with a suffix
|
2
|
-
As a hacker who works with Namae
|
3
|
-
I want to be able to parse names with a suffix
|
4
|
-
|
5
|
-
@names @suffix
|
6
|
-
Scenario: Names with a suffix BibTeX style
|
7
|
-
When I parse the names "Griffey, Jr., Ken"
|
8
|
-
Then the names should be:
|
9
|
-
| given | family | suffix |
|
10
|
-
| Ken | Griffey | Jr. |
|
11
|
-
|
12
|
-
@names @suffix
|
13
|
-
Scenario: Names with a suffix in display-order
|
14
|
-
When I parse the names "Ken Griffey, Jr."
|
15
|
-
Then the names should be:
|
16
|
-
| given | family | suffix |
|
17
|
-
| Ken | Griffey | Jr. |
|
18
|
-
|
19
|
-
@names @suffix
|
20
|
-
Scenario: Names with a suffix in sort-order chicago style
|
21
|
-
When I parse the names "Griffey, Ken, Jr."
|
22
|
-
Then the names should be:
|
23
|
-
| given | family | suffix |
|
24
|
-
| Ken | Griffey | Jr. |
|
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
|
-
|
33
|
-
@names @suffix
|
34
|
-
Scenario: Names with a suffix in display-order no comma
|
35
|
-
When I parse the names "Ken Griffey Jr."
|
36
|
-
Then the names should be:
|
37
|
-
| given | family | suffix |
|
38
|
-
| Ken | Griffey | Jr. |
|
39
|
-
|
40
|
-
|
41
|
-
@names @suffix @list
|
42
|
-
Scenario: Names with a suffix
|
43
|
-
When I parse the names "Griffey, Jr., Ken and Ken Griffey, Jr. and Griffey, Ken, Jr. and Ken Griffey Jr."
|
44
|
-
Then the names should be:
|
45
|
-
| given | family | suffix |
|
46
|
-
| Ken | Griffey | Jr. |
|
47
|
-
| Ken | Griffey | Jr. |
|
48
|
-
| Ken | Griffey | Jr. |
|
49
|
-
| Ken | Griffey | Jr. |
|
data/features/support/env.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'simplecov'
|
3
|
-
require 'coveralls' if ENV['CI']
|
4
|
-
rescue LoadError
|
5
|
-
# ignore
|
6
|
-
end unless RUBY_VERSION < '1.9'
|
7
|
-
|
8
|
-
begin
|
9
|
-
case
|
10
|
-
when defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
|
11
|
-
require 'rubinius/debugger'
|
12
|
-
when RUBY_VERSION > '2.0'
|
13
|
-
require 'byebug'
|
14
|
-
else
|
15
|
-
require 'debugger'
|
16
|
-
end
|
17
|
-
rescue LoadError
|
18
|
-
# ignore
|
19
|
-
end
|
20
|
-
|
21
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
22
|
-
require 'namae'
|
23
|
-
|
24
|
-
require 'rspec/expectations'
|
data/features/title.feature
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
Feature: Parse names with a title
|
2
|
-
As a hacker who works with Namae
|
3
|
-
I want to be able to parse names with a title
|
4
|
-
|
5
|
-
Scenario Outline: Names with titles
|
6
|
-
|
7
|
-
When I parse the name "<name>"
|
8
|
-
Then the parts should be:
|
9
|
-
| given | particle | family | suffix | title | appellation | nick |
|
10
|
-
| <given> | <particle> | <family> | <suffix> | <title> | <appellation> | <nick> |
|
11
|
-
|
12
|
-
@names @title
|
13
|
-
Scenarios: Names with titles
|
14
|
-
| name | given | particle | family | suffix | title |
|
15
|
-
# | Bernado Franecki, PhD | Bernado | | Franecki | | PhD |
|
16
|
-
# | Dr. John Smith, Ph.D. | John | | Smith | | Dr. Ph.D. |
|
17
|
-
|
data/namae.gemspec
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: namae 1.1.1 ruby lib
|
6
|
-
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.name = "namae".freeze
|
9
|
-
s.version = "1.1.1"
|
10
|
-
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib".freeze]
|
13
|
-
s.authors = ["Sylvester Keil".freeze, "Dan Collis-Puro".freeze]
|
14
|
-
s.date = "2021-03-14"
|
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
|
-
s.email = ["sylvester@keil.or.at".freeze, "dan@collispuro.com".freeze]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"README.md"
|
19
|
-
]
|
20
|
-
s.files = [
|
21
|
-
".codeclimate.yml",
|
22
|
-
".coveralls.yml",
|
23
|
-
".document",
|
24
|
-
".rspec",
|
25
|
-
".rubocop.yml",
|
26
|
-
".simplecov",
|
27
|
-
".travis.yml",
|
28
|
-
".yardopts",
|
29
|
-
"AGPL",
|
30
|
-
"BSDL",
|
31
|
-
"Gemfile",
|
32
|
-
"README.md",
|
33
|
-
"Rakefile",
|
34
|
-
"cucumber.yml",
|
35
|
-
"features/bibtex.feature",
|
36
|
-
"features/examples.feature",
|
37
|
-
"features/lists.feature",
|
38
|
-
"features/step_definitions/namae_steps.rb",
|
39
|
-
"features/suffix.feature",
|
40
|
-
"features/support/env.rb",
|
41
|
-
"features/title.feature",
|
42
|
-
"lib/namae.rb",
|
43
|
-
"lib/namae/name.rb",
|
44
|
-
"lib/namae/parser.rb",
|
45
|
-
"lib/namae/parser.y",
|
46
|
-
"lib/namae/utility.rb",
|
47
|
-
"lib/namae/version.rb",
|
48
|
-
"namae.gemspec",
|
49
|
-
"spec/namae/name_spec.rb",
|
50
|
-
"spec/namae/parser_spec.rb",
|
51
|
-
"spec/namae/utility_spec.rb",
|
52
|
-
"spec/spec_helper.rb",
|
53
|
-
"spec/thread_safety_spec.rb"
|
54
|
-
]
|
55
|
-
s.homepage = "https://github.com/berkmancenter/namae".freeze
|
56
|
-
s.licenses = ["AGPL-3.0".freeze]
|
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
|
-
|
60
|
-
if s.respond_to? :specification_version then
|
61
|
-
s.specification_version = 4
|
62
|
-
end
|
63
|
-
|
64
|
-
if s.respond_to? :add_runtime_dependency then
|
65
|
-
s.add_development_dependency(%q<racc>.freeze, ["~> 1.4"])
|
66
|
-
else
|
67
|
-
s.add_dependency(%q<racc>.freeze, ["~> 1.4"])
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|