nomener 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +29 -0
- data/lib/nomener/compounders.rb +1 -1
- data/lib/nomener/helper.rb +2 -1
- data/lib/nomener/parser.rb +89 -42
- data/lib/nomener/version.rb +1 -1
- data/spec/nomener/names/guardian_spec.rb +596 -0
- data/spec/nomener/names/wikiquote_spec.rb +1946 -0
- data/spec/nomener/nomener_parser_spec.rb +7 -7
- data/spec/nomener/titles_spec.rb +2 -1
- metadata +6 -2
|
@@ -24,10 +24,10 @@ RSpec.describe "Nomener::Parser" do
|
|
|
24
24
|
|
|
25
25
|
[
|
|
26
26
|
{from: "Joe Smith", to: { first: "Joe", last: "Smith"} },
|
|
27
|
-
{from: "Joe Smith Jr.", to: { first: "Joe", last: "Smith", suffix: "Jr
|
|
27
|
+
{from: "Joe Smith Jr.", to: { first: "Joe", last: "Smith", suffix: "Jr"} },
|
|
28
28
|
{from: "Joe Van 't Hooft", to: { first: "Joe", last: "Van 't Hooft"} },
|
|
29
29
|
{from: "Mr. Joe Smith", to: { title: "Mr", first: "Joe", last: "Smith"} },
|
|
30
|
-
{from: "Mr. Joe Smith Jr.", to: { title: "Mr", first: "Joe", last: "Smith", suffix:"Jr
|
|
30
|
+
{from: "Mr. Joe Smith Jr.", to: { title: "Mr", first: "Joe", last: "Smith", suffix:"Jr"} },
|
|
31
31
|
{from: "Mr. Joe Smith III", to: { title: "Mr", first: "Joe", last: "Smith", suffix:"III"} },
|
|
32
32
|
{from: "Mr. Joe \"Spud\" Smith III", to: { title: "Mr", first: "Joe", last: "Smith", suffix: "III", nick: "Spud"} },
|
|
33
33
|
].each do |name|
|
|
@@ -47,7 +47,7 @@ RSpec.describe "Nomener::Parser" do
|
|
|
47
47
|
{from: "Joe Smith", to: ""},
|
|
48
48
|
].each do |name|
|
|
49
49
|
it "returns the title from #{name[:from]}" do
|
|
50
|
-
parsed = Nomener::Parser.parse_title(name[:from])
|
|
50
|
+
parsed = Nomener::Parser.parse_title!(name[:from])
|
|
51
51
|
expect(parsed).to eq name[:to]
|
|
52
52
|
end
|
|
53
53
|
end
|
|
@@ -61,7 +61,7 @@ RSpec.describe "Nomener::Parser" do
|
|
|
61
61
|
{from: "Joe Smith Jr. DMD", to: "Jr. DMD"},
|
|
62
62
|
].each do |name|
|
|
63
63
|
it "returns the suffix from #{name[:from]}" do
|
|
64
|
-
parsed = Nomener::Parser.parse_suffix(name[:from])
|
|
64
|
+
parsed = Nomener::Parser.parse_suffix!(name[:from])
|
|
65
65
|
expect(parsed).to eq name[:to]
|
|
66
66
|
end
|
|
67
67
|
end
|
|
@@ -74,7 +74,7 @@ RSpec.describe "Nomener::Parser" do
|
|
|
74
74
|
{from: "Joe \"Spud\" Smith DMD", to: "Spud"},
|
|
75
75
|
].each do |name|
|
|
76
76
|
it "returns the suffix from #{name[:from]}" do
|
|
77
|
-
parsed = Nomener::Parser.parse_nick(name[:from])
|
|
77
|
+
parsed = Nomener::Parser.parse_nick!(name[:from])
|
|
78
78
|
expect(parsed).to eq name[:to]
|
|
79
79
|
end
|
|
80
80
|
end
|
|
@@ -88,7 +88,7 @@ RSpec.describe "Nomener::Parser" do
|
|
|
88
88
|
{from: "Smith, Joe Jr.", to: "Smith", opts: :lcf},
|
|
89
89
|
].each do |name|
|
|
90
90
|
it "returns the suffix from #{name[:from]}" do
|
|
91
|
-
parsed = Nomener::Parser.parse_last(name[:from], name[:opts])
|
|
91
|
+
parsed = Nomener::Parser.parse_last!(name[:from], name[:opts])
|
|
92
92
|
expect(parsed).to eq name[:to]
|
|
93
93
|
end
|
|
94
94
|
end
|
|
@@ -101,7 +101,7 @@ RSpec.describe "Nomener::Parser" do
|
|
|
101
101
|
{ from: "Mary Sue", to: ["Mary Sue", ""], opts: 1 },
|
|
102
102
|
].each do |name|
|
|
103
103
|
it "returns the first name #{name[:to][0]} from #{name[:from]}" do
|
|
104
|
-
parsed = Nomener::Parser.parse_first(name[:from], name[:opts])
|
|
104
|
+
parsed = Nomener::Parser.parse_first!(name[:from], name[:opts])
|
|
105
105
|
expect(parsed).to eq name[:to]
|
|
106
106
|
end
|
|
107
107
|
end
|
data/spec/nomener/titles_spec.rb
CHANGED
|
@@ -5,7 +5,7 @@ RSpec.describe "Title" do
|
|
|
5
5
|
[
|
|
6
6
|
{ name: "خانم Augusta Ada King", result: "خانم" },
|
|
7
7
|
{ name: "רעב Bertrand Russell", result: "רעב" },
|
|
8
|
-
{ name: "'ר Bertrand Russell", result: "'ר" },
|
|
8
|
+
{ skip: true, name: "'ר Bertrand Russell", result: "'ר" },
|
|
9
9
|
{ name: "አቶ Bertrand Russell", result: "አቶ" },
|
|
10
10
|
{ name: "Air Commander Bertrand Russell", result: "Air Commander" },
|
|
11
11
|
{ name: "Air Commodore Bertrand Russell", result: "Air Commodore" },
|
|
@@ -215,6 +215,7 @@ RSpec.describe "Title" do
|
|
|
215
215
|
{ name: "Very Reverand Bertrand Russell", result: "Very Reverand" },
|
|
216
216
|
].each do |name|
|
|
217
217
|
it "parses #{name[:result]} from #{name[:name]}" do
|
|
218
|
+
skip if name[:skip]
|
|
218
219
|
parsed = Nomener.parse(name[:name])
|
|
219
220
|
expect(parsed.title).to eq name[:result]
|
|
220
221
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nomener
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dante Piombino
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-04-
|
|
11
|
+
date: 2015-04-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -88,6 +88,8 @@ files:
|
|
|
88
88
|
- lib/nomener/version.rb
|
|
89
89
|
- nomener.gemspec
|
|
90
90
|
- spec/nomener/complex_spec.rb
|
|
91
|
+
- spec/nomener/names/guardian_spec.rb
|
|
92
|
+
- spec/nomener/names/wikiquote_spec.rb
|
|
91
93
|
- spec/nomener/names_spec.rb
|
|
92
94
|
- spec/nomener/nomener_componders_spec.rb
|
|
93
95
|
- spec/nomener/nomener_helper_spec.rb
|
|
@@ -124,6 +126,8 @@ specification_version: 4
|
|
|
124
126
|
summary: A(nother)? human name parser in ruby.
|
|
125
127
|
test_files:
|
|
126
128
|
- spec/nomener/complex_spec.rb
|
|
129
|
+
- spec/nomener/names/guardian_spec.rb
|
|
130
|
+
- spec/nomener/names/wikiquote_spec.rb
|
|
127
131
|
- spec/nomener/names_spec.rb
|
|
128
132
|
- spec/nomener/nomener_componders_spec.rb
|
|
129
133
|
- spec/nomener/nomener_helper_spec.rb
|