biodiversity 3.5.1 → 4.0.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.
Files changed (40) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +9 -6
  4. data/.ruby-version +1 -1
  5. data/.travis.yml +1 -6
  6. data/CHANGELOG +3 -0
  7. data/Gemfile +2 -0
  8. data/README.md +37 -178
  9. data/Rakefile +15 -48
  10. data/biodiversity.gemspec +18 -21
  11. data/clib/linux/libgnparser.h +93 -0
  12. data/clib/linux/libgnparser.so +0 -0
  13. data/clib/mac/libgnparser.h +93 -0
  14. data/clib/mac/libgnparser.so +0 -0
  15. data/lib/biodiversity.rb +4 -9
  16. data/lib/biodiversity/parser.rb +65 -281
  17. data/lib/biodiversity/version.rb +8 -1
  18. data/spec/lib/biodiversity_spec.rb +9 -0
  19. data/spec/lib/parser_spec.rb +38 -0
  20. data/spec/spec_helper.rb +4 -81
  21. metadata +27 -102
  22. data/.byebug_history +0 -18
  23. data/.document +0 -5
  24. data/examples/socket_client.rb +0 -25
  25. data/lib/biodiversity/guid.rb +0 -1
  26. data/lib/biodiversity/guid/lsid.rb +0 -16
  27. data/lib/biodiversity/parser/scientific_name_canonical.rb +0 -528
  28. data/lib/biodiversity/parser/scientific_name_canonical.treetop +0 -120
  29. data/lib/biodiversity/parser/scientific_name_clean.rb +0 -8991
  30. data/lib/biodiversity/parser/scientific_name_clean.treetop +0 -1632
  31. data/lib/biodiversity/parser/scientific_name_dirty.rb +0 -1298
  32. data/lib/biodiversity/parser/scientific_name_dirty.treetop +0 -264
  33. data/spec/biodiversity_spec.rb +0 -11
  34. data/spec/files/test_data.txt +0 -490
  35. data/spec/files/todo.txt +0 -55
  36. data/spec/guid/lsid.spec.rb +0 -15
  37. data/spec/parser/scientific_name_canonical_spec.rb +0 -36
  38. data/spec/parser/scientific_name_clean_spec.rb +0 -1137
  39. data/spec/parser/scientific_name_dirty_spec.rb +0 -165
  40. data/spec/parser/scientific_name_spec.rb +0 -193
data/spec/files/todo.txt DELETED
@@ -1,55 +0,0 @@
1
- Rana aurora Baird and Girard, 1852; H.B. Shaffer et al., 2004 <---- WRONG CANONICAL FORM!!!!!!!!
2
-
3
- Gemmula cf. cosmoi NP-2008 <--- WRONG CANONICAL FORM
4
- Eupithecia cf. E. maestosa
5
- Eupithecia cf. maestosa
6
- Aleiodes Tetrasphaeropyx chumashanus => Aleiodes [subgenus] chumashanus
7
-
8
- Cucurbita pepo subsp. ovifera x subsp. fraterna
9
-
10
- Döringina Ihering 1929 (synonym) Dzzringina
11
- Doringina Ihering, 1929 (synonym) Döringina
12
-
13
- Lacanobia nr. subjuncta Bold:Aab, 0925 Lacanobia nr
14
- Lacanobia sp. nr. subjuncta Bold:Aab, 0925 Lacanobia sp
15
-
16
- Agropyron pectiniforme var. karabaljikji ined.? Agropyron pectiniforme
17
- Shaanxilithes Xing, Yue & Zhang, 1984 Shaanxilithes ing
18
- Parapandorina Xue, Tang, Yu & Zhou 1995 Parapandorina ue
19
-
20
- Potamogeton iilinoensis var. ventanicola (Hicken) Horn af Rantzien Potamogeton iilinoensis var. ventanicola af
21
- Rhododendron weyrichii Maxim. f. albiflorum T.Yamaz. Rhododendron
22
-
23
- Polypodium pectinatum L. f. typica Rosenst. Polypodium
24
- Polypodium lineare C.Chr. f. caudatoattenuatum Takeda Polypodium
25
-
26
-
27
- Rosa gallica × tomentosa var. eglandulosa R.Keller Rosa gallica
28
- Rosa gallica × afzeliana subsp. vosagiaca forma subcomplicata R.Keller Rosa gallica
29
-
30
- Salmonella sp. (ser.) brancaster Macdonald, Sivell, Emms and Taylor 1948
31
-
32
- Stanhopea tigrina Bateman ex Lindl. x S. ecornuta Lem.
33
-
34
-
35
- Junellia o'donelli Moldenke, 1946
36
-
37
- 119052670 | Human rhinovirus A11 |
38
-
39
- Rubus idaeus monst. obtusifolius (Willd.) Focke | Rubus idaeus
40
-
41
- Kerana var. cameroni |Kerana var
42
-
43
- A. alba
44
- A.alba
45
-
46
- Bangalaia viridis sbsp. distinctemaculata Lepesme & Breuning, 1956
47
-
48
- Clostridium sp. enrichment culture clone M4C16
49
-
50
-
51
- 000913765 Rubus x gracilidens Sudre
52
- Rubus gracilidens | 1
53
-
54
-
55
- Salix myrtilloides x starkeana ssp. starkeana
@@ -1,15 +0,0 @@
1
- describe LsidResolver do
2
- describe '.resolve' do
3
- let(:lsid) { 'urn:lsid:ubio.org:classificationbank:2232671' }
4
-
5
- it 'resolves lsid using tdwg service' do
6
- stub_request(:get,
7
- %r|#{Biodiversity::LSID_RESOLVER_URL + lsid}|).to_return do
8
- { body: File.read(File.expand_path('../../files/lsid.xml', __FILE__)) }
9
- end
10
- expect(LsidResolver.resolve lsid).
11
- to match %r|<dc:title>Pternistis Wagler 1832</dc:title>|
12
- end
13
- end
14
-
15
- end
@@ -1,36 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- describe ScientificNameCanonical do
4
- before(:all) do
5
- set_parser(ScientificNameCanonicalParser.new)
6
- end
7
-
8
- it "parses names with valid name part and unparseable rest" do
9
- [
10
- ["Morea ssjjlajajaj324$33 234243242","Morea",
11
- [{ uninomial: { string: "Morea" }}], { 0 => ["uninomial", 5]}],
12
- ["Morea (Morea) Burt 2342343242 23424322342 23424234",
13
- "Morea (Morea)", [{ genus: { string: "Morea" },
14
- infragenus: { string: "Morea" }}],
15
- { 0 => ["genus", 5], 7 => ["infragenus", 12] }],
16
- ["Morea (Morea) burtius 2342343242 23424322342 23424234",
17
- "Morea (Morea) burtius", [{ genus: { string: "Morea" },
18
- infragenus: { string: "Morea" },
19
- species: { string: "burtius" }}],
20
- { 0 => ["genus", 5], 7 => ["infragenus", 12], 14 => ["species", 21] }],
21
- ["Moraea spathulata ( (L. f. Klatt","Moraea spathulata",
22
- [{ genus: { string: "Moraea" }, species: { string: "spathulata"}}],
23
- { 0 => ["genus", 6], 7 => ["species", 17] } ],
24
- ["Verpericola megasoma \"Dall\" Pils.","Verpericola megasoma",
25
- [{ genus: { string: "Verpericola" },
26
- species: { string: "megasoma"}}],
27
- { 0 => ["genus", 11], 12 => ["species", 20] }]
28
- ].each do |n|
29
- expect(parse(n[0])).not_to be_nil
30
- expect(value(n[0])).to eq n[1]
31
- expect(details(n[0])).to eq n[2]
32
- expect(pos(n[0])).to eq n[3]
33
- expect(parse(n[0]).hybrid).to be false
34
- end
35
- end
36
- end
@@ -1,1137 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- describe ScientificNameClean do
4
- before(:all) do
5
- set_parser(ScientificNameCleanParser.new)
6
- end
7
-
8
- it "parses uninomial" do
9
- sn = "Pseudocercospora"
10
- expect(parse(sn)).to_not be_nil
11
- expect(value(sn)).to eq "Pseudocercospora"
12
- expect(canonical(sn)).to eq "Pseudocercospora"
13
- expect(details(sn)).to eq [{ uninomial: { string: "Pseudocercospora" } }]
14
- expect(pos(sn)).to eq({ 0 => ["uninomial", 16] })
15
- end
16
-
17
- it "parses uninomial with author and year" do
18
- sn = "Pseudocercospora Speg."
19
- expect(parse(sn)).to_not be_nil
20
- expect(details(sn)).to eq [{ uninomial:
21
- { string: "Pseudocercospora",
22
- authorship: "Speg.",
23
- basionymAuthorTeam:
24
- { authorTeam: "Speg.", author: ["Speg."] } } }]
25
- expect(pos(sn)).to eq({ 0 => ["uninomial", 16], 17 => ["author_word", 22] })
26
- sn = "Pseudocercospora Spegazzini, 1910"
27
- expect(parse(sn)).to_not be_nil
28
- expect(value(sn)).to eq "Pseudocercospora Spegazzini 1910"
29
- expect(details(sn)).to eq [{ uninomial:
30
- { string: "Pseudocercospora",
31
- authorship: "Spegazzini, 1910",
32
- basionymAuthorTeam:
33
- { authorTeam: "Spegazzini",
34
- author: ["Spegazzini"], year: "1910" } } }]
35
- expect(pos(sn)).to eq({ 0 => ["uninomial", 16],
36
- 17 => ["author_word", 27], 29 => ["year", 33] })
37
- end
38
-
39
- it "parses uninomials with uninomial ranks" do
40
- sn = "Epacridaceae trib. Archerieae Crayn & Quinn"
41
- expect(parse(sn)).to_not be_nil
42
- expect(details(sn)).to eq [{ uninomial:
43
- { string: "Epacridaceae" },
44
- rank_uninomials: "trib.",
45
- :uninomial2 => { string: "Archerieae",
46
- authorship: "Crayn & Quinn",
47
- basionymAuthorTeam:
48
- { authorTeam: "Crayn & Quinn",
49
- author: ["Crayn", "Quinn"] } } }]
50
- end
51
-
52
- it "parses names with a valid 2 letter genus" do
53
- ["Ca Dyar 1914",
54
- "Ea Distant 1911",
55
- "Ge Nicéville 1895",
56
- "Ia Thomas 1902",
57
- "Io Lea 1831",
58
- "Io Blanchard 1852",
59
- "Ix Bergroth 1916",
60
- "Lo Seale 1906",
61
- "Oa Girault 1929",
62
- "Ra Whitley 1931",
63
- "Ty Bory de St. Vincent 1827",
64
- "Ua Girault 1929",
65
- "Aa Baker 1940",
66
- "Ja Uéno 1955",
67
- "Zu Walters & Fitch 1960",
68
- "La Bleszynski 1966",
69
- "Qu Durkoop",
70
- "As Slipinski 1982",
71
- "Ba Solem 1983"].each do |name|
72
- expect(parse(name)).to_not be_nil
73
- end
74
- expect(canonical("Quoyula")).to eq "Quoyula"
75
- end
76
-
77
- it "parses canonical" do
78
- sn = "Pseudocercospora dendrobii"
79
- expect(parse(sn)).to_not be_nil
80
- expect(value(sn)).to eq "Pseudocercospora dendrobii"
81
- expect(canonical(sn)).to eq "Pseudocercospora dendrobii"
82
- expect(details(sn)).to eq [{ genus:
83
- { string: "Pseudocercospora" },
84
- species: { string: "dendrobii" } }]
85
- expect(pos(sn)).to eq({ 0 => ["genus", 16], 21 => ["species", 30] })
86
- end
87
-
88
- it "parses abbreviated canonical" do
89
- sn = "P. dendrobii"
90
- expect(parse(sn)).to_not be_nil
91
- expect(value(sn)).to eq "P. dendrobii"
92
- sn = "Ps. dendrobii"
93
- expect(parse(sn)).to_not be_nil
94
- expect(value(sn)).to eq "Ps. dendrobii"
95
- expect(details(sn)).to eq [{ genus:
96
- { string: "Ps." },
97
- species: { string: "dendrobii" } }]
98
- end
99
-
100
-
101
- it "parses species name with author and year" do
102
- sn = "Platypus bicaudatulus Schedl 1935"
103
- expect(parse(sn)).to_not be_nil
104
- expect(value(sn)).to eq "Platypus bicaudatulus Schedl 1935"
105
- sn = "Platypus bicaudatulus Schedl, 1935h"
106
- expect(parse(sn)).to_not be_nil
107
- expect(value(sn)).to eq "Platypus bicaudatulus Schedl 1935"
108
- expect(details(sn)).to eq [{ genus:
109
- { string: "Platypus" },
110
- species: { string: "bicaudatulus",
111
- authorship: "Schedl, 1935h",
112
- basionymAuthorTeam:
113
- { authorTeam: "Schedl", author: ["Schedl"],
114
- year: "1935" } } }]
115
- expect(pos(sn)).to eq({ 0 => ["genus", 8],
116
- 9 => ["species", 21], 22 => ["author_word", 28],
117
- 30 => ["year", 35] })
118
- expect(parse("Platypus bicaudatulus Schedl, 1935B")).to_not be_nil
119
- sn = "Platypus bicaudatulus Schedl (1935h)"
120
- expect(parse(sn)).to_not be_nil
121
- expect(details(sn)).to eq [{ genus: { string: "Platypus" },
122
- species: { string: "bicaudatulus", authorship: "Schedl (1935h)",
123
- basionymAuthorTeam: { authorTeam: "Schedl", author: ["Schedl"],
124
- year: "1935" } } }]
125
- expect(parse("Platypus bicaudatulus Schedl 1935")).to_not be_nil
126
- end
127
-
128
- it "parses species name with abbreviated genus, author and year" do
129
- sn = "P. bicaudatulus Schedl 1935"
130
- expect(parse(sn)).to_not be_nil
131
- expect(value(sn)).to eq "P. bicaudatulus Schedl 1935"
132
- sn = "Pl. bicaudatulus Schedl, 1935h"
133
- expect(parse(sn)).not_to be_nil
134
- expect(value(sn)).to eq "Pl. bicaudatulus Schedl 1935"
135
- expect(details(sn)).to eq [{ genus: { string: "Pl." },
136
- species: { string: "bicaudatulus", authorship: "Schedl, 1935h",
137
- basionymAuthorTeam: { authorTeam: "Schedl",
138
- author: ["Schedl"], year: "1935" } } }]
139
- sn = "Pla. bicaudatulus Schedl, 1935h"
140
- expect(parse(sn)).to_not be_nil
141
- expect(value(sn)).to eq "Pla. bicaudatulus Schedl 1935"
142
- end
143
-
144
- it "parses species name with author\'s postfix f., filius (son of)" do
145
- names = [
146
- ["Platypus bicaudatulus Schedl f. 1935", [{ genus: { string: "Platypus" },
147
- species: { string: "bicaudatulus", authorship: "Schedl f. 1935",
148
- basionymAuthorTeam: { authorTeam: "Schedl f.",
149
- author: ["Schedl f."], year: "1935" } } }],
150
- "Platypus bicaudatulus Schedl f. 1935"],
151
- ["Platypus bicaudatulus Schedl filius 1935",
152
- [{ genus: { string: "Platypus" },
153
- species: { string: "bicaudatulus",
154
- authorship: "Schedl filius 1935",
155
- basionymAuthorTeam: { authorTeam: "Schedl filius",
156
- author: ["Schedl filius"], year: "1935" } } }],
157
- "Platypus bicaudatulus Schedl filius 1935"],
158
- ["Fimbristylis ovata (Burm. f.) J. Kern",
159
- [{ genus: { string: "Fimbristylis" }, species: { string: "ovata",
160
- authorship: "(Burm. f.) J. Kern",
161
- combinationAuthorTeam: { authorTeam: "J. Kern",
162
- author: ["J. Kern"] },
163
- basionymAuthorTeam: { authorTeam: "Burm. f.",
164
- author: ["Burm. f."] } } }], "Fimbristylis ovata (Burm. f.) J. Kern"],
165
- ["Carex chordorrhiza Ehrh. ex L. f.",
166
- [{ genus: { string: "Carex" }, species: { string: "chordorrhiza",
167
- authorship: "Ehrh. ex L. f.",
168
- basionymAuthorTeam: { authorTeam: "Ehrh.",
169
- author: ["Ehrh."], exAuthorTeam: { authorTeam: "L. f.",
170
- author: ["L. f."] } } } }], "Carex chordorrhiza Ehrh. ex L. f."],
171
- ["Amelanchier arborea var. arborea (Michx. f.) Fernald",
172
- [{ genus: { string: "Amelanchier" }, species: { string: "arborea"},
173
- infraspecies: [{ string: "arborea", rank: "var.",
174
- authorship: "(Michx. f.) Fernald", combinationAuthorTeam: {
175
- authorTeam: "Fernald", author: ["Fernald"] },
176
- basionymAuthorTeam: { authorTeam: "Michx. f.",
177
- author: ["Michx. f."] } }]}],
178
- "Amelanchier arborea var. arborea (Michx. f.) Fernald"],
179
- ["Cerastium arvense var. fuegianum Hook. f.",
180
- [{ genus: { string: "Cerastium" }, species: { string: "arvense"},
181
- infraspecies: [{ string: "fuegianum", rank: "var.",
182
- authorship: "Hook. f.",
183
- basionymAuthorTeam: { authorTeam: "Hook. f.",
184
- author: ["Hook. f."] } }]}],
185
- "Cerastium arvense var. fuegianum Hook. f."],
186
- ["Cerastium arvense var. fuegianum Hook.f.",
187
- [{ genus: { string: "Cerastium" }, species: { string: "arvense"},
188
- infraspecies: [{ string: "fuegianum", rank: "var.",
189
- authorship: "Hook.f.", basionymAuthorTeam: {
190
- authorTeam: "Hook.f.", author: ["Hook.f."] } }]}],
191
- "Cerastium arvense var. fuegianum Hook.f."],
192
- ["Cerastium arvense ssp. velutinum var. velutinum (Raf.) Britton f.",
193
- [{ genus: { string: "Cerastium" }, species: { string: "arvense"},
194
- infraspecies: [{ string: "velutinum", rank: "ssp." },
195
- { string: "velutinum", rank: "var.",
196
- authorship: "(Raf.) Britton f.",
197
- combinationAuthorTeam: { authorTeam: "Britton f.",
198
- author: ["Britton f."] }, basionymAuthorTeam: { authorTeam: "Raf.",
199
- author: ["Raf."] } }]}],
200
- "Cerastium arvense ssp. velutinum var. velutinum (Raf.) Britton f."],
201
- ["Amelanchier arborea f. hirsuta (Michx. f.) Fernald",
202
- [{ infraspecies: [{ basionymAuthorTeam: { author: ["Michx. f."],
203
- authorTeam: "Michx. f." }, string: "hirsuta", rank: "f.",
204
- combinationAuthorTeam: { author: ["Fernald"], authorTeam: "Fernald" },
205
- authorship: "(Michx. f.) Fernald" }], genus: { string: "Amelanchier"},
206
- species: { string: "arborea" } }],
207
- "Amelanchier arborea f. hirsuta (Michx. f.) Fernald"],
208
- ["Betula pendula fo. dalecarlica (L. f.) C.K. Schneid.",
209
- [{ infraspecies: [{ basionymAuthorTeam: { author: ["L. f."],
210
- authorTeam: "L. f." }, string: "dalecarlica", rank: "fo.",
211
- combinationAuthorTeam: { author: ["C.K. Schneid."],
212
- authorTeam: "C.K. Schneid." }, authorship: "(L. f.) C.K. Schneid."}],
213
- genus: { string: "Betula" }, species: { string: "pendula"} }],
214
- "Betula pendula fo. dalecarlica (L. f.) C.K. Schneid."],
215
- ["Racomitrium canescens f. ericoides (F. Weber ex Brid.) Mönk.",
216
- [{ genus: { string: "Racomitrium" }, species: { string: "canescens"},
217
- infraspecies: [{ string: "ericoides", rank: "f.",
218
- authorship: "(F. Weber ex Brid.) Mönk.",
219
- combinationAuthorTeam: { authorTeam: "Mönk.", author: ["Mönk."] },
220
- basionymAuthorTeam: { authorTeam: "F. Weber",
221
- author: ["F. Weber"], exAuthorTeam: { authorTeam: "Brid.",
222
- author: ["Brid."] } } }]}],
223
- "Racomitrium canescens f. ericoides (F. Weber ex Brid.) Mönk."],
224
- ["Racomitrium canescens forma ericoides (F. Weber ex Brid.) Mönk.",
225
- [{ genus: { string: "Racomitrium" }, species: { string: "canescens"},
226
- infraspecies: [{ string: "ericoides", rank: "forma",
227
- authorship: "(F. Weber ex Brid.) Mönk.",
228
- combinationAuthorTeam: { authorTeam: "Mönk.", author: ["Mönk."] },
229
- basionymAuthorTeam: { authorTeam: "F. Weber", author: ["F. Weber"],
230
- exAuthorTeam: { authorTeam: "Brid.", author: ["Brid."] } } }]}],
231
- "Racomitrium canescens forma ericoides (F. Weber ex Brid.) Mönk."],
232
- ["Peristernia nassatula forskali Tapparone-Canefri 1875",
233
- [{ genus: { string: "Peristernia" }, species: { string: "nassatula"},
234
- infraspecies: [{ string: "forskali", rank: "n/a",
235
- authorship: "Tapparone-Canefri 1875", basionymAuthorTeam: {
236
- authorTeam: "Tapparone-Canefri", author: ["Tapparone-Canefri"],
237
- year: "1875" } }]}],
238
- "Peristernia nassatula forskali Tapparone-Canefri 1875"],
239
- ]
240
- names.each do |sn, sn_details, sn_value|
241
- expect(parse(sn)).to_not be_nil
242
- expect(details(sn)).to eq sn_details
243
- expect(value(sn)).to eq sn_value
244
- end
245
- end
246
-
247
- it "parses genus with '?'" do
248
- sn = "Ferganoconcha? oblonga"
249
- expect(parse(sn)).to_not be_nil
250
- expect(value(sn)).to eq "Ferganoconcha oblonga"
251
- expect(details(sn)).to eq [{ genus: { string: "Ferganoconcha" },
252
- species: { string: "oblonga" } }]
253
- expect(pos(sn)).to eq({ 0 => ["genus", 14], 15 => ["species", 22] })
254
- end
255
-
256
- it "parses æ in the name" do
257
- names = [
258
- ["Læptura laetifica Dow, 1913", "Laeptura laetifica Dow 1913"],
259
- ["Leptura lætifica Dow, 1913", "Leptura laetifica Dow 1913"],
260
- ["Leptura leætifica Dow, 1913", "Leptura leaetifica Dow 1913"],
261
- ["Leæptura laetifica Dow, 1913", "Leaeptura laetifica Dow 1913"],
262
- ["Leœptura laetifica Dow, 1913", "Leoeptura laetifica Dow 1913"],
263
- ["Ærenea cognata Lacordaire, 1872", "Aerenea cognata Lacordaire 1872"],
264
- ["Œdicnemus capensis", "Oedicnemus capensis"],
265
- ["Œnanthæ œnanthe","Oenanthae oenanthe"],
266
- ["Œnanthe œnanthe","Oenanthe oenanthe"],
267
- ["Cerambyx thomæ Gmelin J. F., 1790", "Cerambyx thomae Gmelin J. F. 1790"]
268
- ]
269
- names.each do |name_pair|
270
- expect(parse(name_pair[0])).to_not be_nil
271
- expect(value(name_pair[0])).to eq name_pair[1]
272
- end
273
- end
274
-
275
- it "parses names with e-umlaut" do
276
- sn = "Kalanchoë tuberosa"
277
- expect(canonical(sn)).to eq "Kalanchoe tuberosa"
278
- sn = "Isoëtes asplundii H. P. Fuchs"
279
- expect(canonical(sn)).to eq "Isoetes asplundii"
280
- end
281
-
282
- it "parses infragenus (ICZN code)" do
283
- sn = "Hegeter (Hegeter) intercedens Lindberg H 1950"
284
- expect(parse(sn)).to_not be_nil
285
- expect(value(sn)).to eq "Hegeter (Hegeter) intercedens Lindberg H 1950"
286
- expect(canonical(sn)).to eq "Hegeter intercedens"
287
- expect(details(sn)).to eq [{ genus: { string: "Hegeter" },
288
- infragenus: { string: "Hegeter" }, species: { string: "intercedens",
289
- authorship: "Lindberg H 1950",
290
- basionymAuthorTeam: { authorTeam: "Lindberg H",
291
- author: ["Lindberg H"], year: "1950" } } }]
292
- expect(pos(sn)).to eq({ 0 => ["genus", 7], 9 => ["infragenus", 16],
293
- 18 => ["species", 29], 30 => ["author_word", 38],
294
- 39 => ["author_word", 40], 41 => ["year", 45] })
295
- sn = "Ixodes (Ixodes) hexagonus hexagonus Neumann, 1911"
296
- expect(canonical(sn)).to eq "Ixodes hexagonus hexagonus"
297
- sn = "Brachytrypus (B.) grandidieri"
298
- expect(canonical(sn)).to eq "Brachytrypus grandidieri"
299
- expect(details(sn)).to eq [{ genus: { string: "Brachytrypus" },
300
- infragenus: { string: "B." }, species: { string: "grandidieri"} }]
301
- sn = "Empis (Argyrandrus) Bezzi 1909"
302
- expect(details(sn)).to eq [{ uninomial: { string: "Empis",
303
- infragenus: { string: "Argyrandrus" }, authorship: "Bezzi 1909",
304
- basionymAuthorTeam: { authorTeam: "Bezzi",
305
- author: ["Bezzi"], year: "1909" } } }]
306
- sn = "Platydoris (Bergh )"
307
- expect(details(sn)).to eq [{ uninomial: { string: "Platydoris",
308
- infragenus: { string: "Bergh" } } }]
309
- expect(value(sn)).to eq "Platydoris (Bergh)"
310
- sn = "Platydoris (B.)"
311
- expect(details(sn)).to eq [{ uninomial: { string: "Platydoris",
312
- infragenus: { string: "B." } } }]
313
- end
314
-
315
- it "parses several authors without a year" do
316
- sn = "Pseudocercospora dendrobii U. Braun & Crous"
317
- expect(parse(sn)).to_not be be_nil
318
- expect(value(sn)).to eq "Pseudocercospora dendrobii U. Braun & Crous"
319
- expect(canonical(sn)).to eq "Pseudocercospora dendrobii"
320
- expect(details(sn)).to eq [{ genus: { string: "Pseudocercospora" },
321
- species: { string: "dendrobii", authorship: "U. Braun & Crous",
322
- basionymAuthorTeam: { authorTeam: "U. Braun & Crous",
323
- author: ["U. Braun", "Crous"] } } }]
324
- expect(pos(sn)).to eq({ 0 => ["genus", 16], 17 => ["species", 26],
325
- 27 => ["author_word", 29], 30 => ["author_word", 35],
326
- 38 => ["author_word", 43] })
327
- sn = "Pseudocercospora dendrobii U. Braun and Crous"
328
- expect(parse(sn)).to_not be_nil
329
- expect(value(sn)).to eq "Pseudocercospora dendrobii U. Braun & Crous"
330
- expect(pos(sn)).to eq({ 0 => ["genus", 16], 17 => ["species", 26],
331
- 27 => ["author_word", 29], 30 => ["author_word", 35],
332
- 40 => ["author_word", 45] })
333
- sn = "Pseudocercospora dendrobii U. Braun et Crous"
334
- expect(parse(sn)).to_not be_nil
335
- expect(value(sn)).to eq "Pseudocercospora dendrobii U. Braun & Crous"
336
- sn = "Arthopyrenia hyalospora(Nyl.)R.C. Harris"
337
- expect(parse(sn)).to_not be_nil
338
- expect(value(sn)).to eq "Arthopyrenia hyalospora (Nyl.) R.C. Harris"
339
- expect(canonical(sn)).to eq "Arthopyrenia hyalospora"
340
- expect(details(sn)).to eq [{ genus: { string: "Arthopyrenia" },
341
- species: { string: "hyalospora", authorship: "(Nyl.)R.C. Harris",
342
- combinationAuthorTeam: { authorTeam: "R.C. Harris",
343
- author: ["R.C. Harris"] },
344
- basionymAuthorTeam: { authorTeam: "Nyl.", author: ["Nyl."] } } }]
345
- end
346
-
347
- it "parses several authors with a year" do
348
- sn = "Pseudocercospora dendrobii U. Braun & Crous 2003"
349
- expect(parse(sn)).to_not be_nil
350
- expect(value(sn)).to eq "Pseudocercospora dendrobii U. Braun & Crous 2003"
351
- expect(canonical(sn)).to eq "Pseudocercospora dendrobii"
352
- expect(details(sn)).to eq [{ genus: { string: "Pseudocercospora" },
353
- species: { string: "dendrobii", authorship: "U. Braun & Crous 2003",
354
- basionymAuthorTeam: { authorTeam: "U. Braun & Crous",
355
- author: ["U. Braun", "Crous"], year: "2003" } } }]
356
- expect(pos(sn)).to eq({ 0 => ["genus", 16], 17 => ["species", 26],
357
- 27 => ["author_word", 29], 30 => ["author_word", 35],
358
- 38 => ["author_word", 43], 44 => ["year", 48] })
359
- sn = "Pseudocercospora dendrobii Crous, 2003"
360
- expect(parse(sn)).to_not be_nil
361
- end
362
-
363
- it "parses basionym authors in parenthesis" do
364
- sn = "Zophosis persis (Chatanay, 1914)"
365
- expect(parse(sn)).to_not be_nil
366
- expect(details(sn)).to eq [{ genus: { string: "Zophosis" },
367
- species: { string: "persis", authorship: "(Chatanay, 1914)",
368
- basionymAuthorTeam: { authorTeam: "Chatanay",
369
- author: ["Chatanay"], year: "1914" } } }]
370
- sn = "Zophosis persis (Chatanay 1914)"
371
- expect(parse(sn)).to_not be_nil
372
- expect(details(sn)).to eq [{ genus: { string: "Zophosis" },
373
- species: { string: "persis", authorship: "(Chatanay 1914)",
374
- basionymAuthorTeam: { authorTeam: "Chatanay",
375
- author: ["Chatanay"], year: "1914" } } }]
376
- sn = "Zophosis persis (Chatanay), 1914"
377
- expect(parse(sn)).to_not be_nil
378
- expect(value(sn)).to eq "Zophosis persis (Chatanay 1914)"
379
- expect(details(sn)).to eq [{ genus: { string: "Zophosis" },
380
- species: { string: "persis", authorship: "(Chatanay), 1914",
381
- basionymAuthorTeam: { author_team: "(Chatanay), 1914",
382
- author: ["Chatanay"], year: "1914" } } }]
383
- expect(pos(sn)).to eq({ 0 => ["genus", 8], 9 => ["species", 15],
384
- 17 => ["author_word", 25], 28 => ["year", 32] })
385
- expect(parse("Zophosis persis (Chatanay) 1914")).to_not be_nil
386
- #parse("Zophosis persis Chatanay (1914)")).to_not be_nil
387
- end
388
-
389
- it "parses name with identificaation annotation -- aff cf sp spp" do
390
- sn = "Diplocephalus aff. procerus Thaler, 1972"
391
- expect(details(sn)).to eq [{ genus: { string: "Diplocephalus" },
392
- annotation_identification: "aff.",
393
- ignored: { species: { string: "procerus", authorship: "Thaler, 1972",
394
- basionymAuthorTeam: { authorTeam: "Thaler",
395
- author: ["Thaler"], year: "1972" } } } }]
396
- sn = "Diplocephalus aff procerus Thaler, 1972"
397
- expect(details(sn)).to eq [{ genus: { string: "Diplocephalus" },
398
- annotation_identification: "aff", ignored: { species:
399
- { string: "procerus", authorship: "Thaler, 1972",
400
- basionymAuthorTeam: { authorTeam: "Thaler",
401
- author: ["Thaler"], year: "1972" } } } }]
402
- sn = "Diplocephalus affprocerus Thaler, 1972"
403
- expect(details(sn)).to eq [{ genus: { string: "Diplocephalus" },
404
- species: { string: "affprocerus", authorship: "Thaler, 1972",
405
- basionymAuthorTeam: { authorTeam: "Thaler",
406
- author: ["Thaler"], year: "1972" } } }]
407
- sn = "Diplocephalus cf. procerus Thaler, 1972"
408
- expect(details(sn)).to eq [{ genus: { string: "Diplocephalus" },
409
- annotation_identification: "cf.", species: { species:
410
- { string: "procerus", authorship: "Thaler, 1972",
411
- basionymAuthorTeam: { authorTeam: "Thaler",
412
- author: ["Thaler"], year: "1972" } } } }]
413
- sn = "Diplocephalus cf procerus Thaler, 1972"
414
- expect(details(sn)).to eq [{ genus: { string: "Diplocephalus" },
415
- annotation_identification: "cf", species:
416
- { species: { string: "procerus", authorship: "Thaler, 1972",
417
- basionymAuthorTeam: { authorTeam: "Thaler",
418
- author: ["Thaler"], year: "1972" } } } }]
419
- sn = "Sphingomonas sp. 37"
420
- expect(details(sn)).to eq [{ genus: { string: "Sphingomonas" },
421
- annotation_identification: "sp.", ignored: { unparsed: "37" } }]
422
- sn = "Thryothorus leucotis spp. bogotensis"
423
- expect(details(sn)).to eq [{ genus: { string: "Thryothorus" },
424
- species: { string: "leucotis" }, infraspecies:
425
- [{ annotation_identification: "spp.",
426
- ignored: { infraspecies: { string: "bogotensis", rank: "n/a" } } }]}]
427
- end
428
-
429
- it "parses scientific name" do
430
- sn = "Pseudocercospora dendrobii(H.C. Burnett)U. Braun & Crous 2003"
431
- expect(parse(sn)).to_not be_nil
432
- expect(value(sn)).to eq "Pseudocercospora dendrobii (H.C. Burnett) "\
433
- "U. Braun & Crous 2003"
434
- expect(canonical(sn)).to eq "Pseudocercospora dendrobii"
435
- expect(details(sn)).to eq [{ genus: { string: "Pseudocercospora" },
436
- species: { string: "dendrobii",
437
- authorship: "(H.C. Burnett)U. Braun & Crous 2003",
438
- combinationAuthorTeam: { authorTeam: "U. Braun & Crous",
439
- author: ["U. Braun", "Crous"], year: "2003" },
440
- basionymAuthorTeam: { authorTeam: "H.C. Burnett",
441
- author: ["H.C. Burnett"] } } }]
442
- sn = "Pseudocercospora dendrobii(H.C. Burnett,1873)"\
443
- "U. Braun & Crous 2003"
444
- expect(parse(sn)).to_not be_nil
445
- expect(value(sn)).to eq "Pseudocercospora dendrobii (H.C. Burnett 1873) "\
446
- "U. Braun & Crous 2003"
447
- expect(details(sn)).to eq [{ genus: { string: "Pseudocercospora" },
448
- species: { string: "dendrobii",
449
- authorship: "(H.C. Burnett,1873)U. Braun & Crous 2003",
450
- combinationAuthorTeam: { authorTeam: "U. Braun & Crous",
451
- author: ["U. Braun", "Crous"], year: "2003" },
452
- basionymAuthorTeam: { authorTeam: "H.C. Burnett",
453
- author: ["H.C. Burnett"], year: "1873" } } }]
454
- end
455
-
456
- it "parses several authors with several years" do
457
- sn = "Pseudocercospora dendrobii (H.C. Burnett 1883) U. Braun & Crous 2003"
458
- expect(parse(sn)).to_not be_nil
459
- expect(value(sn)).to eq "Pseudocercospora dendrobii (H.C. Burnett 1883) "\
460
- "U. Braun & Crous 2003"
461
- expect(canonical(sn)).to eq "Pseudocercospora dendrobii"
462
- expect(details(sn)).to eq [{ genus: { string: "Pseudocercospora" },
463
- species: { string: "dendrobii",
464
- authorship: "(H.C. Burnett 1883) U. Braun & Crous 2003",
465
- combinationAuthorTeam: { authorTeam: "U. Braun & Crous",
466
- author: ["U. Braun", "Crous"], year: "2003" },
467
- basionymAuthorTeam: { authorTeam: "H.C. Burnett",
468
- author: ["H.C. Burnett"], year: "1883" } } }]
469
- expect(pos(sn)).to eq({ 0 => ["genus", 16], 17 => ["species", 26],
470
- 28 => ["author_word", 32], 33 => ["author_word", 40],
471
- 41 => ["year", 45], 47 => ["author_word", 49],
472
- 50 => ["author_word", 55], 58 => ["author_word", 63],
473
- 64 => ["year", 68] })
474
- end
475
-
476
- it "parses name with subspecies without rank Zoological Code" do
477
- sn = "Hydnellum scrobiculatum zonatum (Banker) D. Hall & D.E. Stuntz 1972"
478
- expect(parse(sn)).to_not be_nil
479
- expect(value(sn)).to eq "Hydnellum scrobiculatum zonatum (Banker) "\
480
- "D. Hall & D.E. Stuntz 1972"
481
- expect(canonical(sn)).to eq "Hydnellum scrobiculatum zonatum"
482
- expect(details(sn)).to eq [{ genus: { string: "Hydnellum" },
483
- species: { string: "scrobiculatum" },
484
- infraspecies: [{ string: "zonatum", rank: "n/a",
485
- authorship: "(Banker) D. Hall & D.E. Stuntz 1972",
486
- combinationAuthorTeam: { authorTeam: "D. Hall & D.E. Stuntz",
487
- author: ["D. Hall", "D.E. Stuntz"], year: "1972" },
488
- basionymAuthorTeam: { authorTeam: "Banker", author: ["Banker"] } }]}]
489
- expect(pos(sn)).to eq({ 0 => ["genus", 9], 10 => ["species", 23],
490
- 24 => ["infraspecies", 31], 33 => ["author_word", 39],
491
- 41 => ["author_word", 43], 44 => ["author_word", 48],
492
- 51 => ["author_word", 55], 56 => ["author_word", 62],
493
- 63 => ["year", 67] })
494
- sn = "Begonia pingbienensis angustior"
495
- expect(parse(sn)).to_not be_nil
496
- expect(details(sn)).to eq [{ genus: { string: "Begonia" },
497
- species: { string: "pingbienensis" },
498
- infraspecies: [{ string: "angustior", rank: "n/a" }]}]
499
- expect(pos(sn)).to eq({ 0 => ["genus", 7],
500
- 8 => ["species", 21], 22 => ["infraspecies", 31] })
501
- end
502
-
503
- it "parses infraspecies with rank" do
504
- sn = "Aus bus Linn. var. bus"
505
- expect(parse(sn)).to_not be_nil
506
- expect(details(sn)).to eq [{ genus: { string: "Aus" },
507
- species: { string: "bus", authorship: "Linn.",
508
- basionymAuthorTeam: { authorTeam: "Linn.",
509
- author: ["Linn."] } }, infraspecies: [{ string: "bus", rank: "var."}]}]
510
- sn = "Agalinis purpurea (L.) Briton var. borealis (Berg.) Peterson 1987"
511
- expect(parse(sn)).to_not be_nil
512
- expect(details(sn)).to eq [{ genus: { string: "Agalinis" },
513
- species: { string: "purpurea", authorship: "(L.) Briton",
514
- combinationAuthorTeam: { authorTeam: "Briton", author: ["Briton"] },
515
- basionymAuthorTeam: { authorTeam: "L.",
516
- author: ["L."] } }, infraspecies: [{ string: "borealis",
517
- rank: "var.", authorship: "(Berg.) Peterson 1987",
518
- combinationAuthorTeam: { authorTeam: "Peterson",
519
- author: ["Peterson"], year: "1987" },
520
- basionymAuthorTeam: { authorTeam: "Berg.", author: ["Berg."] } }]}]
521
- expect(pos(sn)).to eq({ 0 => ["genus", 8], 9 => ["species", 17],
522
- 19 => ["author_word", 21], 23 => ["author_word", 29],
523
- 30 => ["infraspecific_type", 34], 35 => ["infraspecies", 43],
524
- 45 => ["author_word", 50], 52 => ["author_word", 60],
525
- 61 => ["year", 65] })
526
- sn = "Phaeographis inusta var. macularis(Leight.) A.L. Sm. 1861"
527
- expect(parse(sn)).to_not be_nil
528
- expect(value(sn)).to eq "Phaeographis inusta var. macularis (Leight.) "\
529
- "A.L. Sm. 1861"
530
- expect(canonical(sn)).to eq "Phaeographis inusta macularis"
531
- expect(pos(sn)).to eq({ 0 => ["genus", 12], 13 => ["species", 19],
532
- 20 => ["infraspecific_type", 24], 25 => ["infraspecies", 34],
533
- 35 => ["author_word", 42], 44 => ["author_word", 48],
534
- 49 => ["author_word", 52], 53 => ["year", 57] })
535
- sn = "Cassytha peninsularis J. Z. Weber var. flindersii"
536
- expect(canonical(sn)).to eq "Cassytha peninsularis flindersii"
537
- sn = "Prunus armeniaca convar. budae (Pénzes) Soó"
538
-
539
- expect(canonical(sn)).to eq "Prunus armeniaca budae"
540
- sn = "Polypodium pectinatum L. f. typica Rosenst."
541
- expect(canonical(sn)).to eq "Polypodium pectinatum typica"
542
- # might get confused with forma vs filius
543
- sn = "Polypodium pectinatum L.f. typica Rosenst."
544
- expect(canonical(sn)).to eq "Polypodium pectinatum typica"
545
- sn = "Polypodium pectinatum (L.) f. typica Rosenst."
546
- expect(canonical(sn)).to eq "Polypodium pectinatum typica"
547
- sn = "Polypodium pectinatum L. f., Rosenst."
548
- expect(canonical(sn)).to eq "Polypodium pectinatum"
549
- sn = "Polypodium pectinatum L. f."
550
- expect(canonical(sn)).to eq "Polypodium pectinatum"
551
- sn = "Polypodium pectinatum (L. f.) typica Rosent."
552
- expect(canonical(sn)).to eq "Polypodium pectinatum typica"
553
- sn = "Polypodium pectinatum L. f. thisisjunk Rosent."
554
- expect(canonical(sn)).to eq "Polypodium pectinatum thisisjunk"
555
- end
556
-
557
- it "parsex unknown original authors (auct.)/(hort.)/(?)" do
558
- sn = "Tragacantha leporina (?) Kuntze"
559
- expect(parse(sn)).to_not be_nil
560
- expect(value(sn)).to eq "Tragacantha leporina (?) Kuntze"
561
- expect(details(sn)).to eq [{ genus: { string: "Tragacantha" },
562
- species: { string: "leporina", authorship: "(?) Kuntze",
563
- combinationAuthorTeam: { authorTeam: "Kuntze", author: ["Kuntze"] },
564
- basionymAuthorTeam: { authorTeam: "(?)", author: ["?"] } } }]
565
- sn = "Lachenalia tricolor var. nelsonii (auct.) Baker"
566
- expect(parse(sn)).to_not be_nil
567
- expect(value(sn)).to eq "Lachenalia tricolor var. nelsonii (auct.) Baker"
568
- expect(details(sn)).to eq [{ genus: { string: "Lachenalia" },
569
- species: { string: "tricolor" }, infraspecies: [{ string: "nelsonii",
570
- rank: "var.", authorship: "(auct.) Baker",
571
- combinationAuthorTeam: { authorTeam: "Baker",
572
- author: ["Baker"] }, basionymAuthorTeam:
573
- { authorTeam: "auct.", author: ["unknown"] } }]}]
574
- expect(pos(sn)).to eq({ 0 => ["genus", 10], 11 => ["species", 19],
575
- 20 => ["infraspecific_type", 24], 25 => ["infraspecies", 33],
576
- 35 => ["unknown_author", 40], 42 => ["author_word", 47] })
577
- end
578
-
579
- it "parses unknown authors auct./anon./hort./ht." do
580
- sn = "Puya acris ht."
581
- expect(parse(sn)).to_not be_nil
582
- expect(pos(sn)).to eq({ 0 => ["genus", 4], 5 => ["species", 10],
583
- 11 => ["unknown_author", 14] })
584
- end
585
-
586
- it "parses normal names with hort or anon in them" do
587
- sn = "Mus musculus hortulanus"
588
- expect(parse(sn)).to_not be_nil
589
- expect(pos(sn)).to eq({ 0 => ["genus", 3], 4 => ["species", 12],
590
- 13 => ["infraspecies", 23] })
591
- end
592
-
593
- it "parses real world examples" do
594
- sn = "Stagonospora polyspora M.T. Lucas & Sousa da Câmara 1934"
595
- expect(parse(sn)).to_not be_nil
596
- expect(value(sn)).
597
- to eq "Stagonospora polyspora M.T. Lucas & Sousa da Câmara 1934"
598
- expect(details(sn)).to eq [{ genus: { string: "Stagonospora" },
599
- species: { string: "polyspora",
600
- authorship: "M.T. Lucas & Sousa da Câmara 1934", basionymAuthorTeam:
601
- { authorTeam: "M.T. Lucas & Sousa da Câmara",
602
- author: ["M.T. Lucas", "Sousa da Câmara"], year: "1934"} } }]
603
- expect(pos(sn)).to eq({ 0 => ["genus", 12], 13 => ["species", 22],
604
- 23 => ["author_word", 27], 28 => ["author_word", 33],
605
- 36 => ["author_word", 41], 42 => ["author_word", 44],
606
- 45 => ["author_word", 51], 52 => ["year", 56] })
607
- expect(parse("Cladoniicola staurospora Diederich, "\
608
- "van den Boom & Aptroot 2001")).to_not be_nil
609
- sn = "Yarrowia lipolytica var. lipolytica (Wick., Kurtzman & E.A. Herrm.) "\
610
- "Van der Walt & Arx 1981"
611
- expect(parse(sn)).to_not be_nil
612
- expect(value(sn)).to eq "Yarrowia lipolytica var. lipolytica "\
613
- "(Wick., Kurtzman & E.A. Herrm.) Van der Walt & Arx 1981"
614
- expect(pos(sn)).to eq({ 0 => ["genus", 8], 9 => ["species", 19],
615
- 20 => ["infraspecific_type", 24], 25 => ["infraspecies", 35],
616
- 37 => ["author_word", 42], 44 => ["author_word", 52],
617
- 55 => ["author_word", 59], 60 => ["author_word", 66],
618
- 68 => ["author_word", 71], 72 => ["author_word", 75],
619
- 76 => ["author_word", 80], 83 => ["author_word", 86],
620
- 87 => ["year", 91] })
621
- expect(parse("Physalospora rubiginosa (Fr.) anon.")).to_not be_nil
622
- expect(parse("Pleurotus ëous (Berk.) Sacc. 1887")).to_not be_nil
623
- expect(parse("Lecanora wetmorei Śliwa 2004")).to_not be_nil
624
- # valid
625
- # infraspecific
626
- expect(parse("Calicium furfuraceum * furfuraceum (L.) Pers. 1797")).
627
- to_not be_nil
628
- expect(parse("Exobasidium vaccinii ** andromedae (P. Karst.) "\
629
- "P. Karst. 1882")).to_not be_nil
630
- expect(parse("Urceolaria scruposa **** clausa Flot. 1849")).to_not be_nil
631
- expect(parse("Cortinarius angulatus B gracilescens Fr. 1838")).to_not be_nil
632
- expect(parse("Cyathicula scelobelonium")).to_not be_nil
633
- # single quote that did not show
634
- # parse("Phytophthora hedraiandra De Cock & Man in ?t Veld 2004"
635
- # Phthora vastatrix d?Hérelle 1909
636
- # author is exception
637
- sn = "Tuber liui A S. Xu 1999"
638
- expect(parse(sn)).to_not be_nil
639
- expect(details(sn)).to eq [{ genus: { string: "Tuber" },
640
- species: { string: "liui", authorship: "A S. Xu 1999",
641
- basionymAuthorTeam: { authorTeam: "A S. Xu",
642
- author: ["A S. Xu"], year: "1999"} } }]
643
- expect(parse("Xylaria potentillae A S. Xu")).to_not be_nil
644
- expect(parse("Agaricus squamula Berk. & M.A. Curtis 1860")).to_not be_nil
645
- expect(parse("Peltula coriacea Büdel, Henssen & Wessels 1986")).
646
- to_not be_nil
647
- #had to add no dot rule for trinomials without a rank to make it to work
648
- sn = "Saccharomyces drosophilae anon."
649
- expect(parse(sn)).to_not be_nil
650
- expect(details(sn)).to eq [{ genus: { string: "Saccharomyces" },
651
- species: { string: "drosophilae", authorship: "anon.",
652
- basionymAuthorTeam: { authorTeam: "anon.", author: ["unknown"]} } }]
653
- expect(pos(sn)).to eq({ 0 => ["genus", 13],
654
- 14 => ["species", 25],
655
- 26 => ["unknown_author", 31] })
656
- sn = "Abacetus laevicollis de Chaudoir, 1869"
657
- expect(parse(sn)).to_not be_nil
658
- expect(canonical(sn)).to eq "Abacetus laevicollis"
659
- sn = "Gastrosericus eremorum van Beaumont 1955"
660
- expect(canonical(sn)).to eq "Gastrosericus eremorum"
661
- sn = "Gastrosericus eremorum von Beaumont 1955"
662
- expect(canonical(sn)).to eq "Gastrosericus eremorum"
663
- sn = "Cypraeovula (Luponia) amphithales perdentata"
664
- expect(canonical(sn)).to eq "Cypraeovula amphithales perdentata"
665
- expect(details(sn)).to eq [{ genus: { string: "Cypraeovula" },
666
- infragenus: { string: "Luponia"}, species: { string: "amphithales"},
667
- infraspecies: [{ string: "perdentata", rank: "n/a"}]}]
668
- sn = "Polyrhachis orsyllus nat musculus Forel 1901"
669
- expect(canonical(sn)).to eq "Polyrhachis orsyllus musculus"
670
- sn = "Latrodectus 13-guttatus Thorell, 1875"
671
- expect(canonical(sn)).to eq "Latrodectus tredecguttatus"
672
- expect(value(sn)).to eq "Latrodectus tredecguttatus Thorell 1875"
673
- sn = "Latrodectus 3-guttatus Thorell, 1875"
674
- expect(canonical(sn)).to eq "Latrodectus triguttatus"
675
- expect(value(sn)).to eq "Latrodectus triguttatus Thorell 1875"
676
- sn = "Balaninus c-album Schönherr, CJ., 1836"
677
- expect(canonical(sn)).to eq "Balaninus c-album"
678
- end
679
-
680
- it "parses name with morph." do
681
- sn = "Callideriphus flavicollis morph. reductus Fuchs 1961"
682
- expect(parse(sn)).to_not be_nil
683
- expect(value(sn)).
684
- to eq "Callideriphus flavicollis morph. reductus Fuchs 1961"
685
- expect(canonical(sn)).to eq "Callideriphus flavicollis reductus"
686
- expect(details(sn)).to eq [{ genus: { string: "Callideriphus" },
687
- species: { string: "flavicollis"}, infraspecies: [{ string: "reductus",
688
- rank: "morph.", authorship: "Fuchs 1961", basionymAuthorTeam:
689
- { authorTeam: "Fuchs", author: ["Fuchs"], year: "1961"} }]}]
690
- expect(pos(sn)).to eq({ 0 => ["genus", 13], 14 => ["species", 25],
691
- 26 => ["infraspecific_type", 32],
692
- 33 => ["infraspecies", 41],
693
- 42 => ["author_word", 47], 48 => ["year", 52] })
694
- end
695
-
696
-
697
- it "parses name with forma/fo./form./f." do
698
- sn = "Caulerpa cupressoides forma nuda"
699
- expect(parse(sn)).to_not be_nil
700
- expect(value(sn)).to eq "Caulerpa cupressoides forma nuda"
701
- expect(canonical(sn)).to eq "Caulerpa cupressoides nuda"
702
- expect(details(sn)).to eq [{ genus: { string: "Caulerpa" },
703
- species: { string: "cupressoides"},
704
- infraspecies: [{ string: "nuda", rank: "forma"}]}]
705
- expect(pos(sn)).to eq({ 0 => ["genus", 8], 9 => ["species", 21],
706
- 22 => ["infraspecific_type", 27],
707
- 28 => ["infraspecies", 32] })
708
- sn = "Chlorocyperus glaber form. fasciculariforme (Lojac.) Soó"
709
- expect(parse(sn)).to_not be_nil
710
- expect(value("Chlorocyperus glaber form. fasciculariforme (Lojac.) Soó")).
711
- to eq "Chlorocyperus glaber form. fasciculariforme (Lojac.) Soó"
712
- expect(canonical(sn)).to eq "Chlorocyperus glaber fasciculariforme"
713
- expect(details(sn)).to eq [{ genus: { string: "Chlorocyperus" },
714
- species: { string: "glaber"}, infraspecies:
715
- [{ string: "fasciculariforme", rank: "form.",
716
- authorship: "(Lojac.) Soó", combinationAuthorTeam: { authorTeam: "Soó",
717
- author: ["Soó"]}, basionymAuthorTeam: { authorTeam: "Lojac.",
718
- author: ["Lojac."]} }]}]
719
- expect(pos(sn)).to eq({ 0 => ["genus", 13], 14 => ["species", 20],
720
- 21 => ["infraspecific_type", 26],
721
- 27 => ["infraspecies", 43],
722
- 45 => ["author_word", 51],
723
- 53 => ["author_word", 56] })
724
- sn = "Bambusa nana Roxb. fo. alphonse-karri (Mitford ex Satow) "\
725
- "Makino ex Shiros."
726
- expect(parse(sn)).to_not be_nil
727
- expect(value(sn)).to eq "Bambusa nana Roxb. fo. alphonse-karri "\
728
- "(Mitford ex Satow) Makino ex Shiros."
729
- expect(canonical(sn)).to eq "Bambusa nana alphonse-karri"
730
- expect(details(sn)).to eq [{ genus: { string: "Bambusa" },
731
- species: { string: "nana", authorship: "Roxb.", basionymAuthorTeam:
732
- { authorTeam: "Roxb.", author: ["Roxb."]} },
733
- infraspecies: [{ string: "alphonse-karri",
734
- rank: "fo.", authorship: "(Mitford ex Satow) Makino ex Shiros.",
735
- combinationAuthorTeam: { authorTeam: "Makino",
736
- author: ["Makino"], exAuthorTeam: { authorTeam: "Shiros.",
737
- author: ["Shiros."]} }, basionymAuthorTeam: { authorTeam: "Mitford",
738
- author: ["Mitford"], exAuthorTeam: { authorTeam: "Satow",
739
- author: ["Satow"]} } }]}]
740
- expect(pos(sn)).to eq({ 0 => ["genus", 7], 8 => ["species", 12],
741
- 13 => ["author_word", 18], 19 => ["infraspecific_type", 22],
742
- 23 => ["infraspecies", 37], 39 => ["author_word", 46],
743
- 50 => ["author_word", 55], 57 => ["author_word", 63],
744
- 67 => ["author_word", 74] })
745
- sn = " Sphaerotheca fuliginea f. dahliae Movss. 1967 "
746
- sn = "Sphaerotheca fuliginea f. dahliae Movss. 1967"
747
- expect(parse(sn)).to_not be_nil
748
- expect(value(sn)).to eq "Sphaerotheca fuliginea f. dahliae Movss. 1967"
749
- expect(canonical(sn)).to eq "Sphaerotheca fuliginea dahliae"
750
- expect(details(sn)).to eq [{ genus: { string: "Sphaerotheca" },
751
- species: { string: "fuliginea"}, infraspecies:
752
- [{ string: "dahliae", rank: "f.", authorship: "Movss. 1967",
753
- basionymAuthorTeam: { authorTeam: "Movss.",
754
- author: ["Movss."], year: "1967"} }]}]
755
- expect(pos(sn)).to eq({ 0 => ["genus", 12], 16 => ["species", 25],
756
- 29 => ["infraspecific_type", 31], 36 => ["infraspecies", 43],
757
- 47 => ["author_word", 53], 58 => ["year", 62] })
758
- expect(parse("Polypodium vulgare nothosubsp. mantoniae (Rothm.) Schidlay")).
759
- to_not be_nil
760
- end
761
-
762
- it "parses name with several subspecies names" do
763
- # NOT BOTANICAL CODE BUT NOT INFREQUENT"
764
- sn = "Hydnellum scrobiculatum var. zonatum f. "\
765
- "parvum (Banker) D. Hall & D.E. Stuntz 1972"
766
- expect(parse(sn)).to_not be_nil
767
- expect(value(sn)).to eq "Hydnellum scrobiculatum var. zonatum f. "\
768
- "parvum (Banker) D. Hall & D.E. Stuntz 1972"
769
- expect(details(sn)).to eq [{ genus: { string: "Hydnellum" }, species:
770
- { string: "scrobiculatum"}, infraspecies: [{ string: "zonatum",
771
- rank: "var."}, { string: "parvum", rank: "f.",
772
- authorship: "(Banker) D. Hall & D.E. Stuntz 1972",
773
- combinationAuthorTeam: { authorTeam: "D. Hall & D.E. Stuntz",
774
- author: ["D. Hall", "D.E. Stuntz"], year: "1972"},
775
- basionymAuthorTeam: { authorTeam: "Banker", author: ["Banker"]} }]}]
776
- expect(pos(sn)).to eq({ 0 => ["genus", 9], 10 => ["species", 23],
777
- 24 => ["infraspecific_type", 28], 29 => ["infraspecies", 36],
778
- 37 => ["infraspecific_type", 39], 40 => ["infraspecies", 46],
779
- 48 => ["author_word", 54], 56 => ["author_word", 58],
780
- 59 => ["author_word", 63], 66 => ["author_word", 70],
781
- 71 => ["author_word", 77], 78 => ["year", 82] })
782
- expect(parse("Senecio fuchsii C.C.Gmel. subsp. fuchsii var. "\
783
- "expansus (Boiss. & Heldr.) Hayek")).to_not be_nil
784
- expect(parse("Senecio fuchsii C.C.Gmel. subsp. fuchsii var. fuchsii")).
785
- to_not be_nil
786
- end
787
-
788
-
789
- it "parses status BOTANICAL RARE" do
790
- #it is always latin abbrev often 2 words
791
- sn = "Arthopyrenia hyalospora (Nyl.) R.C. Harris comb. nov."
792
- expect(parse(sn)).to_not be_nil
793
- expect(value(sn)).to eq "Arthopyrenia hyalospora (Nyl.) "\
794
- "R.C. Harris comb. nov."
795
- expect(canonical(sn)).to eq "Arthopyrenia hyalospora"
796
- expect(details(sn)).to eq [{ genus: { string: "Arthopyrenia" },
797
- species: { string: "hyalospora", authorship: "(Nyl.) R.C. Harris",
798
- combinationAuthorTeam: { authorTeam: "R.C. Harris",
799
- author: ["R.C. Harris"]}, basionymAuthorTeam: { authorTeam: "Nyl.",
800
- author: ["Nyl."]} }, status: "comb. nov."}]
801
- expect(pos(sn)).to eq({ 0 => ["genus", 12], 13 => ["species", 23],
802
- 25 => ["author_word", 29], 31 => ["author_word", 35],
803
- 36 => ["author_word", 42] })
804
- end
805
-
806
- it "parses revised (ex) names" do
807
- #invalidly published
808
- sn = "Arthopyrenia hyalospora (Nyl. ex Banker) R.C. Harris"
809
- expect(parse(sn)).to_not be_nil
810
- expect(value(sn)).
811
- to eq "Arthopyrenia hyalospora (Nyl. ex Banker) R.C. Harris"
812
- expect(canonical(sn)).to eq "Arthopyrenia hyalospora"
813
- expect(details(sn)).to eq [{ genus: { string: "Arthopyrenia" },
814
- species: { string: "hyalospora",
815
- authorship: "(Nyl. ex Banker) R.C. Harris", combinationAuthorTeam:
816
- { authorTeam: "R.C. Harris", author: ["R.C. Harris"]},
817
- basionymAuthorTeam: { authorTeam: "Nyl.", author: ["Nyl."],
818
- exAuthorTeam: { authorTeam: "Banker", author: ["Banker"]} } } }]
819
- expect(pos(sn)).to eq({ 0 => ["genus", 12], 13 => ["species", 23],
820
- 25 => ["author_word", 29], 33 => ["author_word", 39],
821
- 41 => ["author_word", 45], 46 => ["author_word", 52] })
822
- sn = "Arthopyrenia hyalospora Nyl. ex Banker"
823
- expect(parse(sn)).to_not be_nil
824
- expect(details(sn)).to eq [{ genus: { string: "Arthopyrenia" },
825
- species: { string: "hyalospora", authorship: "Nyl. ex Banker",
826
- basionymAuthorTeam: { authorTeam: "Nyl.", author: ["Nyl."],
827
- exAuthorTeam: { authorTeam: "Banker", author: ["Banker"]} } } }]
828
- sn = "Glomopsis lonicerae Peck ex C.J. Gould 1945"
829
- expect(parse(sn)).to_not be_nil
830
- expect(details(sn)).to eq [{ genus: { string: "Glomopsis" },
831
- species: { string: "lonicerae", authorship: "Peck ex C.J. Gould 1945",
832
- basionymAuthorTeam: { authorTeam: "Peck", author: ["Peck"],
833
- exAuthorTeam: { authorTeam: "C.J. Gould", author: ["C.J. Gould"],
834
- year: "1945"} } } }]
835
- expect(pos(sn)).to eq({ 0 => ["genus", 9], 10 => ["species", 19],
836
- 20 => ["author_word", 24], 28 => ["author_word", 32],
837
- 33 => ["author_word", 38], 39 => ["year", 43] })
838
- expect(parse("Acanthobasidium delicatum (Wakef.) Oberw. ex Jülich 1979")).
839
- to_not be_nil
840
- sn = "Mycosphaerella eryngii (Fr. ex Duby) Johanson ex Oudem. 1897"
841
- expect(parse(sn)).to_not be_nil
842
- expect(details(sn)).to eq [{ genus: { string: "Mycosphaerella" },
843
- species: { string: "eryngii",
844
- authorship: "(Fr. ex Duby) Johanson ex Oudem. 1897",
845
- combinationAuthorTeam: { authorTeam: "Johanson", author: ["Johanson"],
846
- exAuthorTeam: { authorTeam: "Oudem.", author: ["Oudem."], year: "1897"} },
847
- basionymAuthorTeam: { authorTeam: "Fr.", author: ["Fr."],
848
- exAuthorTeam: { authorTeam: "Duby", author: ["Duby"]} } } }]
849
- expect(pos(sn)).to eq({ 0 => ["genus", 14], 15 => ["species", 22],
850
- 24 => ["author_word", 27], 31 => ["author_word", 35],
851
- 37 => ["author_word", 45], 49 => ["author_word", 55],
852
- 56 => ["year", 60] })
853
- #invalid but happens
854
- expect(parse("Mycosphaerella eryngii (Fr. Duby) ex Oudem. 1897")).
855
- to_not be_nil
856
- expect(parse("Mycosphaerella eryngii (Fr.ex Duby) ex Oudem. 1897")).
857
- to_not be_nil
858
- sn = "Salmonella werahensis (Castellani) Hauduroy and Ehringer "\
859
- "in Hauduroy 1937"
860
- expect(parse(sn)).to_not be_nil
861
- expect(details(sn)).to eq [{ genus: { string: "Salmonella" },
862
- species: { string: "werahensis",
863
- authorship: "(Castellani) Hauduroy and Ehringer in Hauduroy 1937",
864
- combinationAuthorTeam: { authorTeam: "Hauduroy and Ehringer",
865
- author: ["Hauduroy", "Ehringer"], exAuthorTeam: {
866
- authorTeam: "Hauduroy", author: ["Hauduroy"], year: "1937"} },
867
- basionymAuthorTeam: { authorTeam: "Castellani",
868
- author: ["Castellani"]} } }]
869
- expect(pos(sn)).to eq({ 0 => ["genus", 10], 11 => ["species", 21],
870
- 23 => ["author_word", 33], 35 => ["author_word", 43],
871
- 48 => ["author_word", 56], 60 => ["author_word", 68],
872
- 69 => ["year", 73] })
873
- end
874
-
875
- it "parses named hybrids" do
876
- [
877
- ["×Agropogon P. Fourn. 1934", [{ uninomial: { string: "Agropogon",
878
- authorship: "P. Fourn. 1934", basionymAuthorTeam:
879
- { authorTeam: "P. Fourn.", author: ["P. Fourn."], year: "1934" } } }]],
880
- ["xAgropogon P. Fourn.", [{ uninomial: { string: "Agropogon",
881
- authorship: "P. Fourn.", basionymAuthorTeam: { authorTeam: "P. Fourn.",
882
- author: ["P. Fourn."] } } }]],
883
- ["XAgropogon P.Fourn.", [{ uninomial: { string: "Agropogon",
884
- authorship: "P.Fourn.", basionymAuthorTeam: { authorTeam: "P.Fourn.",
885
- author: ["P.Fourn."] } } }]],
886
- ["× Agropogon", [{ uninomial: { string: "Agropogon" } }]],
887
- ["x Agropogon", [{ uninomial: { string: "Agropogon" } }]],
888
- ["X Agropogon", [{ uninomial: { string: "Agropogon" } }]],
889
- ["X Cupressocyparis leylandii", [{ genus: { string: "Cupressocyparis" },
890
- species: { string: "leylandii"} }]],
891
- ["×Heucherella tiarelloides", [{ genus: { string: "Heucherella" },
892
- species: { string: "tiarelloides"} }]],
893
- ["xHeucherella tiarelloides", [{ genus: { string: "Heucherella" },
894
- species: { string: "tiarelloides"} }]],
895
- ["x Heucherella tiarelloides", [{ genus: { string: "Heucherella" },
896
- species: { string: "tiarelloides"} }]],
897
- ["×Agropogon littoralis (Sm.) C. E. Hubb. 1946", [{ genus:
898
- { string: "Agropogon" }, species: { string: "littoralis",
899
- authorship: "(Sm.) C. E. Hubb. 1946", combinationAuthorTeam:
900
- { authorTeam: "C. E. Hubb.", author: ["C. E. Hubb."], year: "1946"},
901
- basionymAuthorTeam: { authorTeam: "Sm.", author: ["Sm."]} } }]]
902
- ].each do |res|
903
- expect(parse(res[0])).to_not be_nil
904
- expect(parse(res[0]).hybrid).to eq true
905
- expect(details(res[0])).to eq res[1]
906
- end
907
- [
908
- ["Asplenium X inexpectatum (E.L. Braun 1940) Morton (1956)",
909
- [{ genus: { string: "Asplenium" }, species: { string: "inexpectatum",
910
- authorship: "(E.L. Braun 1940) Morton (1956)", combinationAuthorTeam:
911
- { authorTeam: "Morton", author: ["Morton"], year: "1956"},
912
- basionymAuthorTeam: { authorTeam: "E.L. Braun", author: ["E.L. Braun"],
913
- year: "1940"} } }]],
914
- ["Mentha ×smithiana R. A. Graham 1949",[{ genus: { string: "Mentha" },
915
- species: { string: "smithiana", authorship: "R. A. Graham 1949",
916
- basionymAuthorTeam: { authorTeam: "R. A. Graham",
917
- author: ["R. A. Graham"], year: "1949"} } }]],
918
- ["Salix ×capreola Andersson (1867)",[{ genus: { string: "Salix" },
919
- species: { string: "capreola", authorship: "Andersson (1867)",
920
- basionymAuthorTeam: { authorTeam: "Andersson", author: ["Andersson"],
921
- year: "1867"} } }]],
922
- ["Salix x capreola Andersson",[{ genus: { string: "Salix" },
923
- species: { string: "capreola", authorship: "Andersson",
924
- basionymAuthorTeam: { authorTeam: "Andersson",
925
- author: ["Andersson"]} } }]]
926
- ].each do |res|
927
- expect(parse(res[0])).to_not be_nil
928
- expect(parse(res[0]).hybrid).to eq true
929
- expect(details(res[0])).to eq res[1]
930
- end
931
- sn = "Rosa alpina x pomifera"
932
- expect(canonical(sn)).to eq "Rosa alpina × pomifera"
933
- expect(parse(sn).details).to eq [{ genus: { string: "Rosa" },
934
- species: { string: "alpina"} }, { species: { string: "pomifera"},
935
- genus: { string: "Rosa"} }]
936
- end
937
-
938
- it "parses hybrid combination" do
939
- sn = "Arthopyrenia hyalospora X Hydnellum scrobiculatum"
940
- expect(parse(sn)).to_not be_nil
941
- expect(parse(sn).hybrid).to eq true
942
- expect(value(sn)).
943
- to eq "Arthopyrenia hyalospora \303\227 Hydnellum scrobiculatum"
944
- expect(canonical(sn)).
945
- to eq "Arthopyrenia hyalospora × Hydnellum scrobiculatum"
946
- expect(details(sn)).to eq [{ genus: { string: "Arthopyrenia" },
947
- species: { string: "hyalospora"} }, { genus: { string: "Hydnellum"},
948
- species: { string: "scrobiculatum"} }]
949
- expect(pos(sn)).to eq({ 0 => ["genus", 12], 13 => ["species", 23],
950
- 26 => ["genus", 35], 36 => ["species", 49] })
951
- sn = "Arthopyrenia hyalospora (Banker) D. Hall X Hydnellum "\
952
- "scrobiculatum D.E. Stuntz"
953
- expect(parse(sn)).to_not be_nil
954
- expect(parse(sn).hybrid).to eq true
955
- expect(value(sn)).to eq "Arthopyrenia hyalospora (Banker) "\
956
- "D. Hall \303\227 Hydnellum scrobiculatum D.E. Stuntz"
957
- expect(canonical(sn)).
958
- to eq "Arthopyrenia hyalospora × Hydnellum scrobiculatum"
959
- expect(pos(sn)).to eq({ 0 => ["genus", 12], 13 => ["species", 23],
960
- 25 => ["author_word", 31], 33 => ["author_word", 35],
961
- 36 => ["author_word", 40], 43 => ["genus", 52],
962
- 53 => ["species", 66], 67 => ["author_word", 71],
963
- 72 => ["author_word", 78] })
964
- expect(value("Arthopyrenia hyalospora X")).
965
- to eq "Arthopyrenia hyalospora \303\227 ?"
966
- sn = "Arthopyrenia hyalospora x"
967
- expect(parse(sn)).to_not be_nil
968
- expect(parse(sn).hybrid).to eq true
969
- expect(canonical(sn)).to eq "Arthopyrenia hyalospora"
970
- expect(details(sn)).to eq [{ genus: { string: "Arthopyrenia" },
971
- species: { string: "hyalospora"} }, "?"]
972
- expect(pos(sn)).to eq({ 0 => ["genus", 12], 13 => ["species", 23] })
973
- sn = "Arthopyrenia hyalospora × ?"
974
- expect(parse(sn)).to_not be_nil
975
- expect(parse(sn).hybrid).to eq true
976
- expect(details(sn)).to eq [{ genus: { string: "Arthopyrenia" },
977
- species: { string: "hyalospora"} }, "?"]
978
- expect(pos(sn)).to eq({ 0 => ["genus", 12], 13 => ["species", 23] })
979
- end
980
-
981
- it "parses names with taxon concept" do
982
- sn = "Stenometope laevissimus sec. Eschmeyer 2004"
983
- expect(details(sn)).to eq [{ genus: { string: "Stenometope" },
984
- species: { string: "laevissimus"}, taxon_concept:
985
- { authorship: "Eschmeyer 2004",
986
- basionymAuthorTeam: { authorTeam: "Eschmeyer",
987
- author: ["Eschmeyer"], year: "2004"} } }]
988
- expect(pos(sn)).to eq({ 0 => ["genus", 11], 12 => ["species", 23],
989
- 29 => ["author_word", 38], 39 => ["year", 43] })
990
- sn = "Stenometope laevissimus Bibron 1855 sec. Eschmeyer 2004"
991
- expect(parse(sn)).to_not be_nil
992
- expect(details(sn)).to eq [{ genus: { string: "Stenometope" },
993
- species: { string: "laevissimus", authorship: "Bibron 1855",
994
- basionymAuthorTeam: { authorTeam: "Bibron", author: ["Bibron"],
995
- year: "1855"} }, taxon_concept: { authorship: "Eschmeyer 2004",
996
- basionymAuthorTeam: { authorTeam: "Eschmeyer",
997
- author: ["Eschmeyer"], year: "2004"} } }]
998
- expect(pos(sn)).to eq({ 0 => ["genus", 11], 12 => ["species", 23],
999
- 24 => ["author_word", 30], 31 => ["year", 35],
1000
- 41 => ["author_word", 50], 51 => ["year", 55] })
1001
- end
1002
-
1003
- it "parses names with spaces inconsistencies" do
1004
- expect(parse(" Asplenium X inexpectatum (E.L. Braun 1940) "\
1005
- "Morton (1956) ")).to_not be_nil
1006
- end
1007
-
1008
- it "parses names with any number of spaces" do
1009
- sn = "Trematosphaeria phaeospora (E. Müll.)"\
1010
- " L. Holm 1957"
1011
- expect(parse(sn)).to_not be_nil
1012
- expect(value(sn)).to eq "Trematosphaeria phaeospora (E. Müll.) L. Holm 1957"
1013
- expect(canonical(sn)).to eq "Trematosphaeria phaeospora"
1014
- expect(details(sn)).to eq [{ genus: { string: "Trematosphaeria" },
1015
- species: { string: "phaeospora", authorship: "(E. Müll.) "\
1016
- "L. Holm 1957",
1017
- combinationAuthorTeam: { authorTeam: "L. Holm",
1018
- author: ["L. Holm"], year: "1957"},
1019
- basionymAuthorTeam: { authorTeam: "E. Müll.", author: ["E. Müll."]} } }]
1020
- expect(pos(sn)).to eq({ 0 => ["genus", 15], 16 => ["species", 26],
1021
- 28 => ["author_word", 30], 31 => ["author_word", 36],
1022
- 46 => ["author_word", 48], 61 => ["author_word", 65],
1023
- 66 => ["year", 70] })
1024
- end
1025
-
1026
- it "does not parse serveral authors groups with several years NOT CORRECT" do
1027
- expect(parse("Pseudocercospora dendrobii (H.C. Burnett 1883) "\
1028
- "(Leight.) (Movss. 1967) U. Braun & Crous 2003")).to be_nil
1029
- end
1030
-
1031
- it "does not parse unallowed utf-8 chars in name part" do
1032
- expect(parse("Érematosphaeria phaespora")).to be_nil
1033
- expect(parse("Trematosphaeria phaeáapora")).to be_nil
1034
- expect(parse("Trematоsphaeria phaeaapora")).to be_nil #cyrillic o
1035
- end
1036
-
1037
- it "parses new stuff" do
1038
- sn = "Nesticus quelpartensis Paik & Namkung, in Paik, "\
1039
- "Yaginuma & Namkung, 1969"
1040
- expect(details(sn)).to eq [{ genus: { string: "Nesticus" },
1041
- species: { string: "quelpartensis",
1042
- authorship: "Paik & Namkung, in Paik, Yaginuma & Namkung, 1969",
1043
- basionymAuthorTeam: { authorTeam: "Paik & Namkung",
1044
- author: ["Paik", "Namkung"], exAuthorTeam:
1045
- { authorTeam: "Paik, Yaginuma & Namkung",
1046
- author: ["Paik", "Yaginuma", "Namkung"], year: "1969"} } } }]
1047
- expect(parse("Dipoena yoshidai Ono, in Ono et al., 1991")).to_not be_nil
1048
- sn = "Latrodectus mactans bishopi Kaston, 1938"
1049
- expect(details(sn)).to eq [{ genus: { string: "Latrodectus" },
1050
- species: { string: "mactans"}, infraspecies: [{ string: "bishopi",
1051
- rank: "n/a", authorship: "Kaston, 1938",
1052
- basionymAuthorTeam: { authorTeam: "Kaston",
1053
- author: ["Kaston"], year: "1938"} }]}]
1054
- #have to figure out black lists for this one
1055
- sn = "Thiobacillus x Parker and Prisk 1953"
1056
- sn = "Bacille de Plaut, Kritchevsky and Séguin 1921"
1057
- expect(details(sn)).to eq [{ uninomial: { string: "Bacille",
1058
- authorship: "de Plaut, Kritchevsky and Séguin 1921",
1059
- basionymAuthorTeam: { authorTeam: "de Plaut, Kritchevsky and Séguin",
1060
- author: ["de Plaut", "Kritchevsky", "Séguin"], year: "1921" } } }]
1061
- sn = "Araneus van bruysseli Petrunkevitch, 1911"
1062
- expect(details(sn)).to eq [{ genus: { string: "Araneus" },
1063
- species: { string: "van"}, infraspecies: [{ string: "bruysseli",
1064
- rank: "n/a", authorship: "Petrunkevitch, 1911",
1065
- basionymAuthorTeam: { authorTeam: "Petrunkevitch",
1066
- author: ["Petrunkevitch"], year: "1911"} }]}]
1067
- sn = "Sapromyces laidlawi ab Sabin 1941"
1068
- expect(details(sn)).to eq [{ genus: { string: "Sapromyces" },
1069
- species: { string: "laidlawi", authorship: "ab Sabin 1941",
1070
- basionymAuthorTeam: { authorTeam: "ab Sabin", author: ["ab Sabin"],
1071
- year: "1941"} } }]
1072
- sn = "Nocardia rugosa di Marco and Spalla 1957"
1073
- expect(details(sn)).to eq [{ genus: { string: "Nocardia" },
1074
- species: { string: "rugosa", authorship: "di Marco and Spalla 1957",
1075
- basionymAuthorTeam: { authorTeam: "di Marco and Spalla",
1076
- author: ["di Marco", "Spalla"], year: "1957"} } }]
1077
- sn = "Flexibacter elegans Lewin 1969 non Soriano 1945"
1078
- expect(details(sn)).to eq [{ genus: { string: "Flexibacter" },
1079
- species: { string: "elegans", authorship: "Lewin 1969 non Soriano 1945",
1080
- basionymAuthorTeam: { authorTeam: "Lewin", author: ["Lewin"],
1081
- year: "1969"} } }]
1082
- sn = "Flexibacter elegans Soriano 1945, non Lewin 1969"
1083
- expect(details(sn)).to eq [{ genus: { string: "Flexibacter" },
1084
- species: { string: "elegans", authorship: "Soriano 1945, non Lewin 1969",
1085
- basionymAuthorTeam: { authorTeam: "Soriano", author: ["Soriano"],
1086
- year: "1945"} } }]
1087
- sn = "Schottera nicaeënsis (J.V. Lamouroux ex Duby) Guiry & Hollenberg"
1088
- expect(details(sn)).to eq [{ genus: { string: "Schottera" },
1089
- species: { string: "nicaeensis",
1090
- authorship: "(J.V. Lamouroux ex Duby) Guiry & Hollenberg",
1091
- combinationAuthorTeam: { authorTeam: "Guiry & Hollenberg",
1092
- author: ["Guiry", "Hollenberg"]}, basionymAuthorTeam:
1093
- { authorTeam: "J.V. Lamouroux", author: ["J.V. Lamouroux"],
1094
- exAuthorTeam: { authorTeam: "Duby", author: ["Duby"]} } } }]
1095
- sn = "Deschampsia cespitosa ssp pumila"
1096
- expect(details(sn)).to eq [{ genus: { string: "Deschampsia" },
1097
- species: { string: "cespitosa"},
1098
- infraspecies: [{ string: "pumila", rank: "ssp"}]}]
1099
- end
1100
-
1101
- # Combination genus names merges without dash or capital letter
1102
- it "parses hybrid names with capitalized second name in genus" do
1103
- # (botanical code error)
1104
- sn = "Anacampti-Platanthera P. Fourn."
1105
- expect(parse(sn)).to_not be_nil
1106
- expect(canonical(sn)).to eq "Anacamptiplatanthera"
1107
- sn = "Anacampti-Platanthera vulgaris P. Fourn."
1108
- expect(parse(sn)).to_not be_nil
1109
- expect(canonical(sn)).to eq "Anacamptiplatanthera vulgaris"
1110
- end
1111
-
1112
- it "parses genus names starting with uppercase letters AE OE" do
1113
- sn = "AEmona separata Broun 1921"
1114
- expect(canonical(sn)).to eq "Aemona separata"
1115
- sn = "OEmona simplex White, 1855"
1116
- expect(canonical(sn)).to eq "Oemona simplex"
1117
- end
1118
-
1119
-
1120
- #"Arthrosamanea eriorhachis (Harms & sine ref. ) Aubrév."
1121
- # -- ignore & sine ref. (means without reference)
1122
-
1123
- =begin
1124
- new stuff
1125
-
1126
- sn = "Orchidaceae × Asconopsis hort."
1127
- expect(canonical(sn)).to eq "Orchidaceae x Asconopsis"
1128
- sn
1129
- Tamiops swinhoei near hainanus|Tamiops swinhoei near hainanus
1130
- Conus textile form archiepiscopus|Conus textile form archiepiscopus|
1131
- Crypticus pseudosericeus ssp. olivieri Desbrochers des \
1132
- Loges,1881|Crypticus pseudosericeus olivieri des
1133
- Solanum nigrum subsp nigrum|Solanum nigrum subsp nigrum
1134
- Protoglossus taeniatum author unknown|Protoglossus taeniatum author unknown
1135
- Dupontiella (S. ?) bicolor|Dupontiella|
1136
- =end
1137
- end