biodiversity 0.5.14 → 0.5.15
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/biodiversity.gemspec +2 -5
- data/lib/biodiversity/parser/scientific_name_canonical.rb +3 -3
- data/lib/biodiversity/parser/scientific_name_canonical.treetop +4 -4
- data/lib/biodiversity/parser/scientific_name_clean.rb +58 -58
- data/lib/biodiversity/parser/scientific_name_clean.treetop +25 -25
- data/lib/biodiversity/parser/scientific_name_dirty.rb +9 -9
- data/lib/biodiversity/parser/scientific_name_dirty.treetop +5 -5
- data/spec/parser/scientific_name_canonical.spec.rb +6 -6
- data/spec/parser/scientific_name_clean.spec.rb +75 -75
- data/spec/parser/scientific_name_dirty.spec.rb +14 -14
- data/spec/parser/test_data.txt +148 -148
- metadata +5 -17
@@ -186,7 +186,7 @@ grammar ScientificNameClean
|
|
186
186
|
|
187
187
|
|
188
188
|
rule multinomial_name
|
189
|
-
a:genus space b:
|
189
|
+
a:genus space b:infragenus space species_prefix? space c:species space_hard d:infraspecies_mult {
|
190
190
|
def value
|
191
191
|
a.value + " " + b.value + " " + c.value + " " + d.value
|
192
192
|
end
|
@@ -208,7 +208,7 @@ grammar ScientificNameClean
|
|
208
208
|
end
|
209
209
|
}
|
210
210
|
/
|
211
|
-
a:genus space b:
|
211
|
+
a:genus space b:infragenus space species_prefix? space c:species {
|
212
212
|
def value
|
213
213
|
a.value + " " + b.value + " " + c.value
|
214
214
|
end
|
@@ -304,7 +304,7 @@ grammar ScientificNameClean
|
|
304
304
|
end
|
305
305
|
|
306
306
|
rule infraspecies
|
307
|
-
a:
|
307
|
+
a:infraspecies_string space b:authorship {
|
308
308
|
def value
|
309
309
|
a.value + " " + b.value
|
310
310
|
end
|
@@ -322,10 +322,10 @@ grammar ScientificNameClean
|
|
322
322
|
end
|
323
323
|
}
|
324
324
|
/
|
325
|
-
|
325
|
+
infraspecies_string
|
326
326
|
end
|
327
327
|
|
328
|
-
rule
|
328
|
+
rule infraspecies_string
|
329
329
|
sel:rank space_hard a:species_word {
|
330
330
|
def value
|
331
331
|
sel.apply(a)
|
@@ -357,7 +357,7 @@ grammar ScientificNameClean
|
|
357
357
|
end
|
358
358
|
|
359
359
|
def details
|
360
|
-
{:infraspecies => {:
|
360
|
+
{:infraspecies => {:string => value, :rank => 'n/a'}}
|
361
361
|
end
|
362
362
|
}
|
363
363
|
end
|
@@ -393,7 +393,7 @@ grammar ScientificNameClean
|
|
393
393
|
end
|
394
394
|
|
395
395
|
def details(a = nil)
|
396
|
-
{:infraspecies => {:
|
396
|
+
{:infraspecies => {:string => (a.value rescue nil), :rank => text_value}}
|
397
397
|
end
|
398
398
|
}
|
399
399
|
/
|
@@ -413,13 +413,13 @@ grammar ScientificNameClean
|
|
413
413
|
" " + a.value
|
414
414
|
end
|
415
415
|
def details(a = nil)
|
416
|
-
{:infraspecies => {:
|
416
|
+
{:infraspecies => {:string => (a.value rescue nil), :rank => value}}
|
417
417
|
end
|
418
418
|
}
|
419
419
|
end
|
420
420
|
|
421
421
|
rule species
|
422
|
-
a:
|
422
|
+
a:species_string space b:authorship {
|
423
423
|
def value
|
424
424
|
a.value + " " + b.value
|
425
425
|
end
|
@@ -441,10 +441,10 @@ grammar ScientificNameClean
|
|
441
441
|
end
|
442
442
|
}
|
443
443
|
/
|
444
|
-
|
444
|
+
species_string
|
445
445
|
end
|
446
446
|
|
447
|
-
rule
|
447
|
+
rule species_string
|
448
448
|
a:species_word &(space_hard author_prefix_word space_hard) {
|
449
449
|
def value
|
450
450
|
a.value
|
@@ -463,7 +463,7 @@ grammar ScientificNameClean
|
|
463
463
|
end
|
464
464
|
|
465
465
|
def details
|
466
|
-
{:species => {:
|
466
|
+
{:species => {:string => a.value}}
|
467
467
|
end
|
468
468
|
}
|
469
469
|
/
|
@@ -481,14 +481,14 @@ grammar ScientificNameClean
|
|
481
481
|
end
|
482
482
|
|
483
483
|
def details
|
484
|
-
{:species => {:
|
484
|
+
{:species => {:string => value}}
|
485
485
|
end
|
486
486
|
}
|
487
487
|
/
|
488
488
|
species_word_hybrid
|
489
489
|
end
|
490
490
|
|
491
|
-
rule
|
491
|
+
rule infragenus
|
492
492
|
left_paren space a:cap_latin_word space right_paren {
|
493
493
|
def value
|
494
494
|
"(" + a.value + ")"
|
@@ -499,11 +499,11 @@ grammar ScientificNameClean
|
|
499
499
|
end
|
500
500
|
|
501
501
|
def pos
|
502
|
-
{a.interval.begin => ['
|
502
|
+
{a.interval.begin => ['infragenus', a.interval.end]}
|
503
503
|
end
|
504
504
|
|
505
505
|
def details
|
506
|
-
{:
|
506
|
+
{:infragenus => {:string => a.value}}
|
507
507
|
end
|
508
508
|
}
|
509
509
|
end
|
@@ -523,13 +523,13 @@ grammar ScientificNameClean
|
|
523
523
|
end
|
524
524
|
|
525
525
|
def details
|
526
|
-
{:genus => {:
|
526
|
+
{:genus => {:string => a.value}}
|
527
527
|
end
|
528
528
|
}
|
529
529
|
end
|
530
530
|
|
531
531
|
rule uninomial_name
|
532
|
-
a:
|
532
|
+
a:uninomial_string space_hard b:authorship {
|
533
533
|
def value
|
534
534
|
a.value + " " + b.value
|
535
535
|
end
|
@@ -551,10 +551,10 @@ grammar ScientificNameClean
|
|
551
551
|
end
|
552
552
|
}
|
553
553
|
/
|
554
|
-
|
554
|
+
uninomial_string
|
555
555
|
end
|
556
556
|
|
557
|
-
rule
|
557
|
+
rule uninomial_string
|
558
558
|
cap_latin_word {
|
559
559
|
def canonical
|
560
560
|
value
|
@@ -569,7 +569,7 @@ grammar ScientificNameClean
|
|
569
569
|
end
|
570
570
|
|
571
571
|
def details
|
572
|
-
{:uninomial => {:
|
572
|
+
{:uninomial => {:string => value}}
|
573
573
|
end
|
574
574
|
}
|
575
575
|
end
|
@@ -977,7 +977,7 @@ grammar ScientificNameClean
|
|
977
977
|
end
|
978
978
|
|
979
979
|
def details
|
980
|
-
{:species => {:
|
980
|
+
{:species => {:string => b.value}}
|
981
981
|
end
|
982
982
|
}
|
983
983
|
/
|
@@ -999,7 +999,7 @@ grammar ScientificNameClean
|
|
999
999
|
end
|
1000
1000
|
|
1001
1001
|
def details
|
1002
|
-
{:species => {:
|
1002
|
+
{:species => {:string => b.value}}
|
1003
1003
|
end
|
1004
1004
|
}
|
1005
1005
|
/
|
@@ -1021,7 +1021,7 @@ grammar ScientificNameClean
|
|
1021
1021
|
end
|
1022
1022
|
|
1023
1023
|
def details
|
1024
|
-
{:species => {:
|
1024
|
+
{:species => {:string => b.value}}
|
1025
1025
|
end
|
1026
1026
|
}
|
1027
1027
|
end
|
@@ -1192,4 +1192,4 @@ grammar ScientificNameClean
|
|
1192
1192
|
[\s]+
|
1193
1193
|
end
|
1194
1194
|
|
1195
|
-
end
|
1195
|
+
end
|
@@ -133,7 +133,7 @@ module ScientificNameDirty
|
|
133
133
|
elements[1]
|
134
134
|
end
|
135
135
|
|
136
|
-
def
|
136
|
+
def string_authorship_inconsistencies
|
137
137
|
elements[2]
|
138
138
|
end
|
139
139
|
|
@@ -174,7 +174,7 @@ module ScientificNameDirty
|
|
174
174
|
|
175
175
|
i0 = index
|
176
176
|
i1, s1 = index, []
|
177
|
-
r2 =
|
177
|
+
r2 = _nt_infraspecies_string
|
178
178
|
s1 << r2
|
179
179
|
if r2
|
180
180
|
r3 = _nt_space
|
@@ -196,13 +196,13 @@ module ScientificNameDirty
|
|
196
196
|
r0 = r1
|
197
197
|
else
|
198
198
|
i5, s5 = index, []
|
199
|
-
r6 =
|
199
|
+
r6 = _nt_infraspecies_string
|
200
200
|
s5 << r6
|
201
201
|
if r6
|
202
202
|
r7 = _nt_space
|
203
203
|
s5 << r7
|
204
204
|
if r7
|
205
|
-
r8 =
|
205
|
+
r8 = _nt_string_authorship_inconsistencies
|
206
206
|
s5 << r8
|
207
207
|
if r8
|
208
208
|
r9 = _nt_space
|
@@ -282,7 +282,7 @@ module ScientificNameDirty
|
|
282
282
|
|
283
283
|
i0 = index
|
284
284
|
i1, s1 = index, []
|
285
|
-
r2 =
|
285
|
+
r2 = _nt_species_string
|
286
286
|
s1 << r2
|
287
287
|
if r2
|
288
288
|
r3 = _nt_space
|
@@ -911,10 +911,10 @@ module ScientificNameDirty
|
|
911
911
|
r0
|
912
912
|
end
|
913
913
|
|
914
|
-
def
|
914
|
+
def _nt_string_authorship_inconsistencies
|
915
915
|
start_index = index
|
916
|
-
if node_cache[:
|
917
|
-
cached = node_cache[:
|
916
|
+
if node_cache[:string_authorship_inconsistencies].has_key?(index)
|
917
|
+
cached = node_cache[:string_authorship_inconsistencies][index]
|
918
918
|
@index = cached.interval.end if cached
|
919
919
|
return cached
|
920
920
|
end
|
@@ -927,7 +927,7 @@ module ScientificNameDirty
|
|
927
927
|
r0 = nil
|
928
928
|
end
|
929
929
|
|
930
|
-
node_cache[:
|
930
|
+
node_cache[:string_authorship_inconsistencies][start_index] = r0
|
931
931
|
|
932
932
|
r0
|
933
933
|
end
|
@@ -29,7 +29,7 @@ grammar ScientificNameDirty
|
|
29
29
|
end
|
30
30
|
|
31
31
|
rule infraspecies
|
32
|
-
a:
|
32
|
+
a:infraspecies_string space b:year {
|
33
33
|
def value
|
34
34
|
a.value + " " + b.value
|
35
35
|
end
|
@@ -47,7 +47,7 @@ grammar ScientificNameDirty
|
|
47
47
|
end
|
48
48
|
}
|
49
49
|
/
|
50
|
-
a:
|
50
|
+
a:infraspecies_string space string_authorship_inconsistencies space b:authorship {
|
51
51
|
def value
|
52
52
|
a.value + " " + b.value
|
53
53
|
end
|
@@ -69,7 +69,7 @@ grammar ScientificNameDirty
|
|
69
69
|
end
|
70
70
|
|
71
71
|
rule species
|
72
|
-
a:
|
72
|
+
a:species_string space b:year {
|
73
73
|
def value
|
74
74
|
a.value + " " + b.value
|
75
75
|
end
|
@@ -198,7 +198,7 @@ grammar ScientificNameDirty
|
|
198
198
|
}
|
199
199
|
end
|
200
200
|
|
201
|
-
rule
|
201
|
+
rule string_authorship_inconsistencies
|
202
202
|
("corrig.")
|
203
203
|
end
|
204
204
|
|
@@ -208,4 +208,4 @@ grammar ScientificNameDirty
|
|
208
208
|
space_hard [^ш]+
|
209
209
|
end
|
210
210
|
|
211
|
-
end
|
211
|
+
end
|
@@ -10,11 +10,11 @@ describe ScientificNameCanonical do
|
|
10
10
|
|
11
11
|
it 'should parse names with valid name part and unparseable rest' do
|
12
12
|
[
|
13
|
-
['Morea ssjjlajajaj324$33 234243242','Morea', [{:uninomial=>{:
|
14
|
-
['Morea (Morea) Burt 2342343242 23424322342 23424234', 'Morea (Morea)', [{:genus=>{:
|
15
|
-
['Morea (Morea) burtius 2342343242 23424322342 23424234', 'Morea (Morea) burtius', [{:genus=>{:
|
16
|
-
['Moraea spathulata ( (L. f. Klatt','Moraea spathulata',[{:genus=>{:
|
17
|
-
['Verpericola megasoma ""Dall" Pils.','Verpericola megasoma',[{:genus=>{:
|
13
|
+
['Morea ssjjlajajaj324$33 234243242','Morea', [{:uninomial=>{:string=>"Morea"}}], {0=>["uninomial", 5]}],
|
14
|
+
['Morea (Morea) Burt 2342343242 23424322342 23424234', 'Morea (Morea)', [{:genus=>{:string=>"Morea"}, :infragenus=>{:string=>"Morea"}}], {0=>["genus", 5], 7=>["infragenus", 12]}],
|
15
|
+
['Morea (Morea) burtius 2342343242 23424322342 23424234', 'Morea (Morea) burtius', [{:genus=>{:string=>"Morea"}, :infragenus=>{:string=>"Morea"}, :species=>{:string=>"burtius"}}], {0=>["genus", 5], 7=>["infragenus", 12], 14=>["species", 21]}],
|
16
|
+
['Moraea spathulata ( (L. f. Klatt','Moraea spathulata',[{:genus=>{:string=>"Moraea"}, :species=>{:string=>"spathulata"}}], {0=>["genus", 6], 7=>["species", 17]} ],
|
17
|
+
['Verpericola megasoma ""Dall" Pils.','Verpericola megasoma',[{:genus=>{:string=>"Verpericola"}, :species=>{:string=>"megasoma"}}], {0=>["genus", 11], 12=>["species", 20]}]
|
18
18
|
].each do |n|
|
19
19
|
parse(n[0]).should_not be_nil
|
20
20
|
value(n[0]).should == n[1]
|
@@ -24,4 +24,4 @@ describe ScientificNameCanonical do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
end
|
27
|
+
end
|
@@ -13,19 +13,19 @@ describe ScientificNameClean do
|
|
13
13
|
parse(sn).should_not be_nil
|
14
14
|
value(sn).should == 'Pseudocercospora'
|
15
15
|
canonical(sn).should == 'Pseudocercospora'
|
16
|
-
details(sn).should == [{:uninomial=>{:
|
16
|
+
details(sn).should == [{:uninomial=>{:string=>"Pseudocercospora"}}]
|
17
17
|
pos(sn).should == {0=>["uninomial", 16]}
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should parse uninomial with author and year' do
|
21
21
|
sn = 'Pseudocercospora Speg.'
|
22
22
|
parse(sn).should_not be_nil
|
23
|
-
details(sn).should == [{:uninomial=>{:
|
23
|
+
details(sn).should == [{:uninomial=>{:string=>"Pseudocercospora", :authorship=>"Speg.", :basionymAuthorTeam=>{:authorTeam=>"Speg.", :author=>["Speg."]}}}]
|
24
24
|
pos(sn).should == {0=>["uninomial", 16], 17=>["author_word", 22]}
|
25
25
|
sn = 'Pseudocercospora Spegazzini, 1910'
|
26
26
|
parse(sn).should_not be_nil
|
27
27
|
value(sn).should == 'Pseudocercospora Spegazzini 1910'
|
28
|
-
details(sn).should == [{:uninomial=>{:
|
28
|
+
details(sn).should == [{:uninomial=>{:string=>"Pseudocercospora", :authorship=>"Spegazzini, 1910", :basionymAuthorTeam=>{:authorTeam=>"Spegazzini", :author=>["Spegazzini"], :year=>"1910"}}}]
|
29
29
|
pos(sn).should == {0=>["uninomial", 16], 17=>["author_word", 27], 29=>["year", 33]}
|
30
30
|
end
|
31
31
|
|
@@ -59,7 +59,7 @@ describe ScientificNameClean do
|
|
59
59
|
parse(sn).should_not be_nil
|
60
60
|
value(sn).should == 'Pseudocercospora dendrobii'
|
61
61
|
canonical(sn).should == 'Pseudocercospora dendrobii'
|
62
|
-
details(sn).should == [{:genus=>{:
|
62
|
+
details(sn).should == [{:genus=>{:string=>"Pseudocercospora"}, :species=>{:string=>"dendrobii"}}]
|
63
63
|
pos(sn).should == {0=>["genus", 16], 21=>["species", 30]}
|
64
64
|
end
|
65
65
|
|
@@ -71,12 +71,12 @@ describe ScientificNameClean do
|
|
71
71
|
sn = "Platypus bicaudatulus Schedl, 1935h"
|
72
72
|
parse(sn).should_not be_nil
|
73
73
|
value(sn).should == "Platypus bicaudatulus Schedl 1935"
|
74
|
-
details(sn).should == [{:genus=>{:
|
74
|
+
details(sn).should == [{:genus=>{:string=>"Platypus"}, :species=>{:string=>"bicaudatulus", :authorship=>"Schedl, 1935h", :basionymAuthorTeam=>{:authorTeam=>"Schedl", :author=>["Schedl"], :year=>"1935"}}}]
|
75
75
|
pos(sn).should == {0=>["genus", 8], 9=>["species", 21], 22=>["author_word", 28], 30=>["year", 35]}
|
76
76
|
parse("Platypus bicaudatulus Schedl, 1935B").should_not be_nil
|
77
77
|
sn = "Platypus bicaudatulus Schedl (1935h)"
|
78
78
|
parse(sn).should_not be_nil
|
79
|
-
details(sn).should == [{:genus=>{:
|
79
|
+
details(sn).should == [{:genus=>{:string=>"Platypus"}, :species=>{:string=>"bicaudatulus", :authorship=>"Schedl (1935h)", :basionymAuthorTeam=>{:authorTeam=>"Schedl", :author=>["Schedl"], :year=>"1935"}}}]
|
80
80
|
parse("Platypus bicaudatulus Schedl 1935").should_not be_nil
|
81
81
|
end
|
82
82
|
|
@@ -84,7 +84,7 @@ describe ScientificNameClean do
|
|
84
84
|
sn = "Ferganoconcha? oblonga"
|
85
85
|
parse(sn).should_not be_nil
|
86
86
|
value(sn).should == "Ferganoconcha oblonga"
|
87
|
-
details(sn).should == [{:genus=>{:
|
87
|
+
details(sn).should == [{:genus=>{:string=>"Ferganoconcha"}, :species=>{:string=>"oblonga"}}]
|
88
88
|
pos(sn).should == {0=>["genus", 14], 15=>["species", 22]}
|
89
89
|
end
|
90
90
|
|
@@ -113,18 +113,18 @@ describe ScientificNameClean do
|
|
113
113
|
parse(sn).should_not be_nil
|
114
114
|
value(sn).should == "Trematosphaeria phaeospora (E. Müll.) L. Holm 1957"
|
115
115
|
canonical(sn).should == "Trematosphaeria phaeospora"
|
116
|
-
details(sn).should == [{:genus=>{:
|
116
|
+
details(sn).should == [{:genus=>{:string=>"Trematosphaeria"}, :species=>{:string=>"phaeospora", :authorship=>"(E. Müll.) L. Holm 1957", :combinationAuthorTeam=>{:authorTeam=>"L. Holm", :author=>["L. Holm"], :year=>"1957"}, :basionymAuthorTeam=>{:authorTeam=>"E. Müll.", :author=>["E. Müll."]}}}]
|
117
117
|
pos(sn).should == {0=>["genus", 15], 16=>["species", 26], 28=>["author_word", 30], 31=>["author_word", 36], 46=>["author_word", 48], 61=>["author_word", 65], 66=>["year", 70]}
|
118
118
|
|
119
119
|
end
|
120
120
|
|
121
|
-
it 'should parse
|
121
|
+
it 'should parse infragenus (ICZN code)' do
|
122
122
|
sn = "Hegeter (Hegeter) intercedens Lindberg H 1950"
|
123
123
|
parse(sn).should_not be_nil
|
124
124
|
value(sn).should == "Hegeter (Hegeter) intercedens Lindberg H 1950"
|
125
125
|
canonical(sn).should == "Hegeter intercedens"
|
126
|
-
details(sn).should == [{:genus=>{:
|
127
|
-
pos(sn).should == {0=>["genus", 7], 9=>["
|
126
|
+
details(sn).should == [{:genus=>{:string=>"Hegeter"}, :infragenus=>{:string=>"Hegeter"}, :species=>{:string=>"intercedens", :authorship=>"Lindberg H 1950", :basionymAuthorTeam=>{:authorTeam=>"Lindberg H", :author=>["Lindberg H"], :year=>"1950"}}}]
|
127
|
+
pos(sn).should == {0=>["genus", 7], 9=>["infragenus", 16], 18=>["species", 29], 30=>["author_word", 38], 39=>["author_word", 40], 41=>["year", 45]}
|
128
128
|
end
|
129
129
|
|
130
130
|
it 'should parse several authors without a year' do
|
@@ -132,7 +132,7 @@ describe ScientificNameClean do
|
|
132
132
|
parse(sn).should_not be_nil
|
133
133
|
value(sn).should == "Pseudocercospora dendrobii U. Braun et Crous"
|
134
134
|
canonical(sn).should == "Pseudocercospora dendrobii"
|
135
|
-
details(sn).should == [{:genus=>{:
|
135
|
+
details(sn).should == [{:genus=>{:string=>"Pseudocercospora"}, :species=>{:string=>"dendrobii", :authorship=>"U. Braun & Crous", :basionymAuthorTeam=>{:authorTeam=>"U. Braun & Crous", :author=>["U. Braun", "Crous"]}}}]
|
136
136
|
pos(sn).should == {0=>["genus", 16], 17=>["species", 26], 27=>["author_word", 29], 30=>["author_word", 35], 38=>["author_word", 43]}
|
137
137
|
sn = "Pseudocercospora dendrobii U. Braun and Crous"
|
138
138
|
parse(sn).should_not be_nil
|
@@ -145,7 +145,7 @@ describe ScientificNameClean do
|
|
145
145
|
parse(sn).should_not be_nil
|
146
146
|
value(sn).should == "Arthopyrenia hyalospora (Nyl.) R.C. Harris"
|
147
147
|
canonical(sn).should == "Arthopyrenia hyalospora"
|
148
|
-
details(sn).should == [{:genus=>{:
|
148
|
+
details(sn).should == [{:genus=>{:string=>"Arthopyrenia"}, :species=>{:string=>"hyalospora", :authorship=>"(Nyl.)R.C. Harris", :combinationAuthorTeam=>{:authorTeam=>"R.C. Harris", :author=>["R.C. Harris"]}, :basionymAuthorTeam=>{:authorTeam=>"Nyl.", :author=>["Nyl."]}}}]
|
149
149
|
end
|
150
150
|
|
151
151
|
|
@@ -155,7 +155,7 @@ describe ScientificNameClean do
|
|
155
155
|
parse(sn).should_not be_nil
|
156
156
|
value(sn).should == "Pseudocercospora dendrobii U. Braun et Crous 2003"
|
157
157
|
canonical(sn).should == "Pseudocercospora dendrobii"
|
158
|
-
details(sn).should == [{:genus=>{:
|
158
|
+
details(sn).should == [{:genus=>{:string=>"Pseudocercospora"}, :species=>{:string=>"dendrobii", :authorship=>"U. Braun & Crous 2003", :basionymAuthorTeam=>{:authorTeam=>"U. Braun & Crous", :author=>["U. Braun", "Crous"], :year=>"2003"}}}]
|
159
159
|
pos(sn).should == {0=>["genus", 16], 17=>["species", 26], 27=>["author_word", 29], 30=>["author_word", 35], 38=>["author_word", 43], 44=>["year", 48]}
|
160
160
|
sn = "Pseudocercospora dendrobii Crous, 2003"
|
161
161
|
parse(sn).should_not be_nil
|
@@ -164,14 +164,14 @@ describe ScientificNameClean do
|
|
164
164
|
it 'should parse basionym authors in parenthesis' do
|
165
165
|
sn = "Zophosis persis (Chatanay, 1914)"
|
166
166
|
parse(sn).should_not be_nil
|
167
|
-
details(sn).should == [{:genus=>{:
|
167
|
+
details(sn).should == [{:genus=>{:string=>"Zophosis"}, :species=>{:string=>"persis", :authorship=>"(Chatanay, 1914)", :basionymAuthorTeam=>{:authorTeam=>"Chatanay", :author=>["Chatanay"], :year=>"1914"}}}]
|
168
168
|
sn = "Zophosis persis (Chatanay 1914)"
|
169
169
|
parse(sn).should_not be_nil
|
170
|
-
details(sn).should == [{:genus=>{:
|
170
|
+
details(sn).should == [{:genus=>{:string=>"Zophosis"}, :species=>{:string=>"persis", :authorship=>"(Chatanay 1914)", :basionymAuthorTeam=>{:authorTeam=>"Chatanay", :author=>["Chatanay"], :year=>"1914"}}}]
|
171
171
|
sn = "Zophosis persis (Chatanay), 1914"
|
172
172
|
parse(sn).should_not be_nil
|
173
173
|
value(sn).should == "Zophosis persis (Chatanay 1914)"
|
174
|
-
details(sn).should == [{:genus=>{:
|
174
|
+
details(sn).should == [{:genus=>{:string=>"Zophosis"}, :species=>{:string=>"persis", :authorship=>"(Chatanay), 1914", :basionymAuthorTeam=>{:author_team=>"(Chatanay), 1914", :author=>["Chatanay"], :year=>"1914"}}}]
|
175
175
|
pos(sn).should == {0=>["genus", 8], 9=>["species", 15], 17=>["author_word", 25], 28=>["year", 32]}
|
176
176
|
parse("Zophosis persis (Chatanay) 1914").should_not be_nil
|
177
177
|
#parse("Zophosis persis Chatanay (1914)").should_not be_nil
|
@@ -182,11 +182,11 @@ describe ScientificNameClean do
|
|
182
182
|
parse(sn).should_not be_nil
|
183
183
|
value(sn).should == "Pseudocercospora dendrobii (H.C. Burnett) U. Braun et Crous 2003"
|
184
184
|
canonical(sn).should == "Pseudocercospora dendrobii"
|
185
|
-
details(sn).should == [{:genus=>{:
|
185
|
+
details(sn).should == [{:genus=>{:string=>"Pseudocercospora"}, :species=>{:string=>"dendrobii", :authorship=>"(H.C. Burnett)U. Braun & Crous 2003", :combinationAuthorTeam=>{:authorTeam=>"U. Braun & Crous", :author=>["U. Braun", "Crous"], :year=>"2003"}, :basionymAuthorTeam=>{:authorTeam=>"H.C. Burnett", :author=>["H.C. Burnett"]}}}]
|
186
186
|
sn = "Pseudocercospora dendrobii(H.C. Burnett,1873)U. Braun & Crous 2003"
|
187
187
|
parse(sn).should_not be_nil
|
188
188
|
value(sn).should == "Pseudocercospora dendrobii (H.C. Burnett 1873) U. Braun et Crous 2003"
|
189
|
-
details(sn).should == [{:genus=>{:
|
189
|
+
details(sn).should == [{:genus=>{:string=>"Pseudocercospora"}, :species=>{:string=>"dendrobii", :authorship=>"(H.C. Burnett,1873)U. Braun & Crous 2003", :combinationAuthorTeam=>{:authorTeam=>"U. Braun & Crous", :author=>["U. Braun", "Crous"], :year=>"2003"}, :basionymAuthorTeam=>{:authorTeam=>"H.C. Burnett", :author=>["H.C. Burnett"], :year=>"1873"}}}]
|
190
190
|
end
|
191
191
|
|
192
192
|
it 'should parse several authors with several years' do
|
@@ -194,7 +194,7 @@ describe ScientificNameClean do
|
|
194
194
|
parse(sn).should_not be_nil
|
195
195
|
value(sn).should == "Pseudocercospora dendrobii (H.C. Burnett 1883) U. Braun et Crous 2003"
|
196
196
|
canonical(sn).should == "Pseudocercospora dendrobii"
|
197
|
-
details(sn).should == [{:genus=>{:
|
197
|
+
details(sn).should == [{:genus=>{:string=>"Pseudocercospora"}, :species=>{:string=>"dendrobii", :authorship=>"(H.C. Burnett 1883) U. Braun & Crous 2003", :combinationAuthorTeam=>{:authorTeam=>"U. Braun & Crous", :author=>["U. Braun", "Crous"], :year=>"2003"}, :basionymAuthorTeam=>{:authorTeam=>"H.C. Burnett", :author=>["H.C. Burnett"], :year=>"1883"}}}]
|
198
198
|
pos(sn).should == {0=>["genus", 16], 17=>["species", 26], 28=>["author_word", 32], 33=>["author_word", 40], 41=>["year", 45], 47=>["author_word", 49], 50=>["author_word", 55], 58=>["author_word", 63], 64=>["year", 68]}
|
199
199
|
end
|
200
200
|
|
@@ -203,21 +203,21 @@ describe ScientificNameClean do
|
|
203
203
|
parse(sn).should_not be_nil
|
204
204
|
value(sn).should == "Hydnellum scrobiculatum zonatum (Banker) D. Hall et D.E. Stuntz 1972"
|
205
205
|
canonical(sn).should == "Hydnellum scrobiculatum zonatum"
|
206
|
-
details(sn).should == [{:genus=>{:
|
206
|
+
details(sn).should == [{:genus=>{:string=>"Hydnellum"}, :species=>{:string=>"scrobiculatum"}, :infraspecies=>[{:string=>"zonatum", :rank=>"n/a", :authorship=>"(Banker) D. Hall & D.E. Stuntz 1972", :combinationAuthorTeam=>{:authorTeam=>"D. Hall & D.E. Stuntz", :author=>["D. Hall", "D.E. Stuntz"], :year=>"1972"}, :basionymAuthorTeam=>{:authorTeam=>"Banker", :author=>["Banker"]}}]}]
|
207
207
|
pos(sn).should == {0=>["genus", 9], 10=>["species", 23], 24=>["infraspecies", 31], 33=>["author_word", 39], 41=>["author_word", 43], 44=>["author_word", 48], 51=>["author_word", 55], 56=>["author_word", 62], 63=>["year", 67]}
|
208
208
|
sn = "Begonia pingbienensis angustior"
|
209
209
|
parse(sn).should_not be_nil
|
210
|
-
details(sn).should == [{:genus=>{:
|
210
|
+
details(sn).should == [{:genus=>{:string=>"Begonia"}, :species=>{:string=>"pingbienensis"}, :infraspecies=>[{:string=>"angustior", :rank=>"n/a"}]}]
|
211
211
|
pos(sn).should == {0=>["genus", 7], 8=>["species", 21], 22=>["infraspecies", 31]}
|
212
212
|
end
|
213
213
|
|
214
214
|
it 'should parse infraspecies with rank' do
|
215
215
|
sn = "Aus bus Linn. var. bus"
|
216
216
|
parse(sn).should_not be_nil
|
217
|
-
details(sn).should == [{:genus=>{:
|
217
|
+
details(sn).should == [{:genus=>{:string=>"Aus"}, :species=>{:string=>"bus", :authorship=>"Linn.", :basionymAuthorTeam=>{:authorTeam=>"Linn.", :author=>["Linn."]}}, :infraspecies=>[{:string=>"bus", :rank=>"var."}]}]
|
218
218
|
sn = "Agalinis purpurea (L.) Briton var. borealis (Berg.) Peterson 1987"
|
219
219
|
parse(sn).should_not be_nil
|
220
|
-
details(sn).should == [{:genus=>{:
|
220
|
+
details(sn).should == [{:genus=>{:string=>"Agalinis"}, :species=>{:string=>"purpurea", :authorship=>"(L.) Briton", :combinationAuthorTeam=>{:authorTeam=>"Briton", :author=>["Briton"]}, :basionymAuthorTeam=>{:authorTeam=>"L.", :author=>["L."]}}, :infraspecies=>[{:string=>"borealis", :rank=>"var.", :authorship=>"(Berg.) Peterson 1987", :combinationAuthorTeam=>{:authorTeam=>"Peterson", :author=>["Peterson"], :year=>"1987"}, :basionymAuthorTeam=>{:authorTeam=>"Berg.", :author=>["Berg."]}}]}]
|
221
221
|
pos(sn).should == {0=>["genus", 8], 9=>["species", 17], 19=>["author_word", 21], 23=>["author_word", 29], 35=>["infraspecies", 43], 45=>["author_word", 50], 52=>["author_word", 60], 61=>["year", 65]}
|
222
222
|
sn = "Phaeographis inusta var. macularis(Leight.) A.L. Sm. 1861"
|
223
223
|
parse(sn).should_not be_nil
|
@@ -230,11 +230,11 @@ describe ScientificNameClean do
|
|
230
230
|
sn = "Tragacantha leporina (?) Kuntze"
|
231
231
|
parse(sn).should_not be_nil
|
232
232
|
value(sn).should == "Tragacantha leporina (?) Kuntze"
|
233
|
-
details(sn).should == [{:genus=>{:
|
233
|
+
details(sn).should == [{:genus=>{:string=>"Tragacantha"}, :species=>{:string=>"leporina", :authorship=>"(?) Kuntze", :combinationAuthorTeam=>{:authorTeam=>"Kuntze", :author=>["Kuntze"]}, :basionymAuthorTeam=>{:authorTeam=>"(?)", :author=>["?"]}}}]
|
234
234
|
sn = "Lachenalia tricolor var. nelsonii (auct.) Baker"
|
235
235
|
parse(sn).should_not be_nil
|
236
236
|
value(sn).should == "Lachenalia tricolor var. nelsonii (auct.) Baker"
|
237
|
-
details(sn).should == [{:genus=>{:
|
237
|
+
details(sn).should == [{:genus=>{:string=>"Lachenalia"}, :species=>{:string=>"tricolor"}, :infraspecies=>[{:string=>"nelsonii", :rank=>"var.", :authorship=>"(auct.) Baker", :combinationAuthorTeam=>{:authorTeam=>"Baker", :author=>["Baker"]}, :basionymAuthorTeam=>{:authorTeam=>"auct.", :author=>["unknown"]}}]}]
|
238
238
|
pos(sn).should == {0=>["genus", 10], 11=>["species", 19], 25=>["infraspecies", 33], 35=>["unknown_author", 40], 42=>["author_word", 47]}
|
239
239
|
end
|
240
240
|
|
@@ -248,7 +248,7 @@ describe ScientificNameClean do
|
|
248
248
|
sn = "Stagonospora polyspora M.T. Lucas & Sousa da Câmara 1934"
|
249
249
|
parse(sn).should_not be_nil
|
250
250
|
value(sn).should == "Stagonospora polyspora M.T. Lucas et Sousa da Câmara 1934"
|
251
|
-
details(sn).should == [{:genus=>{:
|
251
|
+
details(sn).should == [{:genus=>{:string=>"Stagonospora"}, :species=>{:string=>"polyspora", :authorship=>"M.T. Lucas & Sousa da Câmara 1934", :basionymAuthorTeam=>{:authorTeam=>"M.T. Lucas & Sousa da Câmara", :author=>["M.T. Lucas", "Sousa da Câmara"], :year=>"1934"}}}]
|
252
252
|
pos(sn).should == {0=>["genus", 12], 13=>["species", 22], 23=>["author_word", 27], 28=>["author_word", 33], 36=>["author_word", 41], 42=>["author_word", 44], 45=>["author_word", 51], 52=>["year", 56]}
|
253
253
|
parse("Cladoniicola staurospora Diederich, van den Boom & Aptroot 2001").should_not be_nil
|
254
254
|
sn = "Yarrowia lipolytica var. lipolytica (Wick., Kurtzman & E.A. Herrm.) Van der Walt & Arx 1981"
|
@@ -271,14 +271,14 @@ describe ScientificNameClean do
|
|
271
271
|
# author is exception
|
272
272
|
sn = "Tuber liui A S. Xu 1999"
|
273
273
|
parse(sn).should_not be_nil
|
274
|
-
details(sn).should == [{:genus=>{:
|
274
|
+
details(sn).should == [{:genus=>{:string=>"Tuber"}, :species=>{:string=>"liui", :authorship=>"A S. Xu 1999", :basionymAuthorTeam=>{:authorTeam=>"A S. Xu", :author=>["A S. Xu"], :year=>"1999"}}}]
|
275
275
|
parse('Xylaria potentillae A S. Xu').should_not be_nil
|
276
276
|
parse("Agaricus squamula Berk. & M.A. Curtis 1860").should_not be_nil
|
277
277
|
parse("Peltula coriacea Büdel, Henssen & Wessels 1986").should_not be_nil
|
278
278
|
#had to add no dot rule for trinomials without a rank to make it to work
|
279
279
|
sn = "Saccharomyces drosophilae anon."
|
280
280
|
parse(sn).should_not be_nil
|
281
|
-
details(sn).should == [{:genus=>{:
|
281
|
+
details(sn).should == [{:genus=>{:string=>"Saccharomyces"}, :species=>{:string=>"drosophilae", :authorship=>"anon.", :basionymAuthorTeam=>{:authorTeam=>"anon.", :author=>["unknown"]}}}]
|
282
282
|
pos(sn).should == {0=>["genus", 13], 14=>["species", 25], 26=>["unknown_author", 31]}
|
283
283
|
sn = "Abacetus laevicollis de Chaudoir, 1869"
|
284
284
|
parse(sn).should_not be_nil
|
@@ -289,7 +289,7 @@ describe ScientificNameClean do
|
|
289
289
|
canonical(sn).should == 'Gastrosericus eremorum'
|
290
290
|
sn = "Cypraeovula (Luponia) amphithales perdentata"
|
291
291
|
canonical(sn).should == 'Cypraeovula Luponia amphithales perdentata'
|
292
|
-
details(sn).should == [{:genus=>{:
|
292
|
+
details(sn).should == [{:genus=>{:string=>"Cypraeovula"}, :infragenus=>{:string=>"Luponia"}, :species=>{:string=>"amphithales"}, :infraspecies=>[{:string=>"perdentata", :rank=>"n/a"}]}]
|
293
293
|
sn = "Polyrhachis orsyllus nat musculus Forel 1901"
|
294
294
|
canonical(sn).should == "Polyrhachis orsyllus musculus"
|
295
295
|
sn = 'Latrodectus 13-guttatus Thorell, 1875'
|
@@ -305,7 +305,7 @@ describe ScientificNameClean do
|
|
305
305
|
parse(sn).should_not be_nil
|
306
306
|
value(sn).should == "Callideriphus flavicollis morph. reductus Fuchs 1961"
|
307
307
|
canonical(sn).should == "Callideriphus flavicollis reductus"
|
308
|
-
details(sn).should == [{:genus=>{:
|
308
|
+
details(sn).should == [{:genus=>{:string=>"Callideriphus"}, :species=>{:string=>"flavicollis"}, :infraspecies=>[{:string=>"reductus", :rank=>"morph.", :authorship=>"Fuchs 1961", :basionymAuthorTeam=>{:authorTeam=>"Fuchs", :author=>["Fuchs"], :year=>"1961"}}]}]
|
309
309
|
pos(sn).should == {0=>["genus", 13], 14=>["species", 25], 33=>["infraspecies", 41], 42=>["author_word", 47], 48=>["year", 52]}
|
310
310
|
end
|
311
311
|
|
@@ -315,26 +315,26 @@ describe ScientificNameClean do
|
|
315
315
|
parse(sn).should_not be_nil
|
316
316
|
value(sn).should == "Caulerpa cupressoides f. nuda"
|
317
317
|
canonical(sn).should == "Caulerpa cupressoides nuda"
|
318
|
-
details(sn).should == [{:genus=>{:
|
318
|
+
details(sn).should == [{:genus=>{:string=>"Caulerpa"}, :species=>{:string=>"cupressoides"}, :infraspecies=>[{:string=>"nuda", :rank=>"f."}]}]
|
319
319
|
pos(sn).should == {0=>["genus", 8], 9=>["species", 21], 28=>["infraspecies", 32]}
|
320
320
|
sn = "Chlorocyperus glaber form. fasciculariforme (Lojac.) Soó"
|
321
321
|
parse(sn).should_not be_nil
|
322
322
|
value("Chlorocyperus glaber form. fasciculariforme (Lojac.) Soó").should == "Chlorocyperus glaber f. fasciculariforme (Lojac.) Soó"
|
323
323
|
canonical(sn).should == "Chlorocyperus glaber fasciculariforme"
|
324
|
-
details(sn).should == [{:genus=>{:
|
324
|
+
details(sn).should == [{:genus=>{:string=>"Chlorocyperus"}, :species=>{:string=>"glaber"}, :infraspecies=>[{:string=>"fasciculariforme", :rank=>"f.", :authorship=>"(Lojac.) Soó", :combinationAuthorTeam=>{:authorTeam=>"Soó", :author=>["Soó"]}, :basionymAuthorTeam=>{:authorTeam=>"Lojac.", :author=>["Lojac."]}}]}]
|
325
325
|
pos(sn).should == {0=>["genus", 13], 14=>["species", 20], 27=>["infraspecies", 43], 45=>["author_word", 51], 53=>["author_word", 56]}
|
326
326
|
sn = "Bambusa nana Roxb. fo. alphonse-karri (Mitford ex Satow) Makino ex Shiros."
|
327
327
|
parse(sn).should_not be_nil
|
328
328
|
value(sn).should == "Bambusa nana Roxb. f. alphonse-karri (Mitford ex Satow) Makino ex Shiros."
|
329
329
|
canonical(sn).should == "Bambusa nana alphonse-karri"
|
330
|
-
details(sn).should == [{:genus=>{:
|
330
|
+
details(sn).should == [{:genus=>{:string=>"Bambusa"}, :species=>{:string=>"nana", :authorship=>"Roxb.", :basionymAuthorTeam=>{:authorTeam=>"Roxb.", :author=>["Roxb."]}}, :infraspecies=>[{:string=>"alphonse-karri", :rank=>"f.", :authorship=>"(Mitford ex Satow) Makino ex Shiros.", :combinationAuthorTeam=>{:authorTeam=>"Makino", :author=>["Makino"], :exAuthorTeam=>{:authorTeam=>"Shiros.", :author=>["Shiros."]}}, :basionymAuthorTeam=>{:authorTeam=>"Mitford", :author=>["Mitford"], :exAuthorTeam=>{:authorTeam=>"Satow", :author=>["Satow"]}}}]}]
|
331
331
|
pos(sn).should == {0=>["genus", 7], 8=>["species", 12], 13=>["author_word", 18], 23=>["infraspecies", 37], 39=>["author_word", 46], 50=>["author_word", 55], 57=>["author_word", 63], 67=>["author_word", 74]}
|
332
332
|
sn = " Sphaerotheca fuliginea f. dahliae Movss. 1967 "
|
333
333
|
sn = "Sphaerotheca fuliginea f. dahliae Movss. 1967"
|
334
334
|
parse(sn).should_not be_nil
|
335
335
|
value(sn).should == "Sphaerotheca fuliginea f. dahliae Movss. 1967"
|
336
336
|
canonical(sn).should == "Sphaerotheca fuliginea dahliae"
|
337
|
-
details(sn).should == [{:genus=>{:
|
337
|
+
details(sn).should == [{:genus=>{:string=>"Sphaerotheca"}, :species=>{:string=>"fuliginea"}, :infraspecies=>[{:string=>"dahliae", :rank=>"f.", :authorship=>"Movss. 1967", :basionymAuthorTeam=>{:authorTeam=>"Movss.", :author=>["Movss."], :year=>"1967"}}]}]
|
338
338
|
pos(sn).should == {0=>["genus", 12], 16=>["species", 25], 36=>["infraspecies", 43], 47=>["author_word", 53], 58=>["year", 62]}
|
339
339
|
parse('Polypodium vulgare nothosubsp. mantoniae (Rothm.) Schidlay').should_not be_nil
|
340
340
|
end
|
@@ -343,7 +343,7 @@ describe ScientificNameClean do
|
|
343
343
|
sn = "Hydnellum scrobiculatum var. zonatum f. parvum (Banker) D. Hall & D.E. Stuntz 1972"
|
344
344
|
parse(sn).should_not be_nil
|
345
345
|
value(sn).should == "Hydnellum scrobiculatum var. zonatum f. parvum (Banker) D. Hall et D.E. Stuntz 1972"
|
346
|
-
details(sn).should == [{:genus=>{:
|
346
|
+
details(sn).should == [{:genus=>{:string=>"Hydnellum"}, :species=>{:string=>"scrobiculatum"}, :infraspecies=>[{:string=>"zonatum", :rank=>"var."}, {:string=>"parvum", :rank=>"f.", :authorship=>"(Banker) D. Hall & D.E. Stuntz 1972", :combinationAuthorTeam=>{:authorTeam=>"D. Hall & D.E. Stuntz", :author=>["D. Hall", "D.E. Stuntz"], :year=>"1972"}, :basionymAuthorTeam=>{:authorTeam=>"Banker", :author=>["Banker"]}}]}]
|
347
347
|
pos(sn).should == {0=>["genus", 9], 10=>["species", 23], 29=>["infraspecies", 36], 40=>["infraspecies", 46], 48=>["author_word", 54], 56=>["author_word", 58], 59=>["author_word", 63], 66=>["author_word", 70], 71=>["author_word", 77], 78=>["year", 82]}
|
348
348
|
parse('Senecio fuchsii C.C.Gmel. subsp. fuchsii var. expansus (Boiss. & Heldr.) Hayek').should_not be_nil
|
349
349
|
parse('Senecio fuchsii C.C.Gmel. subsp. fuchsii var. fuchsii').should_not be_nil
|
@@ -356,7 +356,7 @@ describe ScientificNameClean do
|
|
356
356
|
parse(sn).should_not be_nil
|
357
357
|
value(sn).should == "Arthopyrenia hyalospora (Nyl.) R.C. Harris comb. nov."
|
358
358
|
canonical(sn).should == "Arthopyrenia hyalospora"
|
359
|
-
details(sn).should == [{:genus=>{:
|
359
|
+
details(sn).should == [{:genus=>{:string=>"Arthopyrenia"}, :species=>{:string=>"hyalospora", :authorship=>"(Nyl.) R.C. Harris", :combinationAuthorTeam=>{:authorTeam=>"R.C. Harris ", :author=>["R.C. Harris"]}, :basionymAuthorTeam=>{:authorTeam=>"Nyl.", :author=>["Nyl."]}}, :status=>"comb. nov."}]
|
360
360
|
pos(sn).should == {0=>["genus", 12], 13=>["species", 23], 25=>["author_word", 29], 31=>["author_word", 35], 36=>["author_word", 42]}
|
361
361
|
end
|
362
362
|
|
@@ -366,52 +366,52 @@ describe ScientificNameClean do
|
|
366
366
|
parse(sn).should_not be_nil
|
367
367
|
value(sn).should == "Arthopyrenia hyalospora (Nyl. ex Banker) R.C. Harris"
|
368
368
|
canonical(sn).should == "Arthopyrenia hyalospora"
|
369
|
-
details(sn).should == [{:genus=>{:
|
369
|
+
details(sn).should == [{:genus=>{:string=>"Arthopyrenia"}, :species=>{:string=>"hyalospora", :authorship=>"(Nyl. ex Banker) R.C. Harris", :combinationAuthorTeam=>{:authorTeam=>"R.C. Harris", :author=>["R.C. Harris"]}, :basionymAuthorTeam=>{:authorTeam=>"Nyl.", :author=>["Nyl."], :exAuthorTeam=>{:authorTeam=>"Banker", :author=>["Banker"]}}}}]
|
370
370
|
pos(sn).should == {0=>["genus", 12], 13=>["species", 23], 25=>["author_word", 29], 33=>["author_word", 39], 41=>["author_word", 45], 46=>["author_word", 52]}
|
371
371
|
sn = "Arthopyrenia hyalospora Nyl. ex Banker"
|
372
372
|
parse(sn).should_not be_nil
|
373
|
-
details(sn).should == [{:genus=>{:
|
373
|
+
details(sn).should == [{:genus=>{:string=>"Arthopyrenia"}, :species=>{:string=>"hyalospora", :authorship=>"Nyl. ex Banker", :basionymAuthorTeam=>{:authorTeam=>"Nyl.", :author=>["Nyl."], :exAuthorTeam=>{:authorTeam=>"Banker", :author=>["Banker"]}}}}]
|
374
374
|
sn = "Glomopsis lonicerae Peck ex C.J. Gould 1945"
|
375
375
|
parse(sn).should_not be_nil
|
376
|
-
details(sn).should == [{:genus=>{:
|
376
|
+
details(sn).should == [{:genus=>{:string=>"Glomopsis"}, :species=>{:string=>"lonicerae", :authorship=>"Peck ex C.J. Gould 1945", :basionymAuthorTeam=>{:authorTeam=>"Peck", :author=>["Peck"], :exAuthorTeam=>{:authorTeam=>"C.J. Gould", :author=>["C.J. Gould"], :year=>"1945"}}}}]
|
377
377
|
pos(sn).should == {0=>["genus", 9], 10=>["species", 19], 20=>["author_word", 24], 28=>["author_word", 32], 33=>["author_word", 38], 39=>["year", 43]}
|
378
378
|
parse("Acanthobasidium delicatum (Wakef.) Oberw. ex Jülich 1979").should_not be_nil
|
379
379
|
sn = "Mycosphaerella eryngii (Fr. ex Duby) Johanson ex Oudem. 1897"
|
380
380
|
parse(sn).should_not be_nil
|
381
|
-
details(sn).should == [{:genus=>{:
|
381
|
+
details(sn).should == [{:genus=>{:string=>"Mycosphaerella"}, :species=>{:string=>"eryngii", :authorship=>"(Fr. ex Duby) Johanson ex Oudem. 1897", :combinationAuthorTeam=>{:authorTeam=>"Johanson", :author=>["Johanson"], :exAuthorTeam=>{:authorTeam=>"Oudem.", :author=>["Oudem."], :year=>"1897"}}, :basionymAuthorTeam=>{:authorTeam=>"Fr.", :author=>["Fr."], :exAuthorTeam=>{:authorTeam=>"Duby", :author=>["Duby"]}}}}]
|
382
382
|
pos(sn).should == {0=>["genus", 14], 15=>["species", 22], 24=>["author_word", 27], 31=>["author_word", 35], 37=>["author_word", 45], 49=>["author_word", 55], 56=>["year", 60]}
|
383
383
|
#invalid but happens
|
384
384
|
parse("Mycosphaerella eryngii (Fr. Duby) ex Oudem. 1897").should_not be_nil
|
385
385
|
parse("Mycosphaerella eryngii (Fr.ex Duby) ex Oudem. 1897").should_not be_nil
|
386
386
|
sn = "Salmonella werahensis (Castellani) Hauduroy and Ehringer in Hauduroy 1937"
|
387
387
|
parse(sn).should_not be_nil
|
388
|
-
details(sn).should == [{:genus=>{:
|
388
|
+
details(sn).should == [{:genus=>{:string=>"Salmonella"}, :species=>{:string=>"werahensis", :authorship=>"(Castellani) Hauduroy and Ehringer in Hauduroy 1937", :combinationAuthorTeam=>{:authorTeam=>"Hauduroy and Ehringer", :author=>["Hauduroy", "Ehringer"], :exAuthorTeam=>{:authorTeam=>"Hauduroy", :author=>["Hauduroy"], :year=>"1937"}}, :basionymAuthorTeam=>{:authorTeam=>"Castellani", :author=>["Castellani"]}}}]
|
389
389
|
pos(sn).should == {0=>["genus", 10], 11=>["species", 21], 23=>["author_word", 33], 35=>["author_word", 43], 48=>["author_word", 56], 60=>["author_word", 68], 69=>["year", 73]}
|
390
390
|
end
|
391
391
|
|
392
392
|
it 'should parse named hybrids' do
|
393
393
|
[
|
394
|
-
["×Agropogon P. Fourn. 1934", [{:uninomial=>{:
|
395
|
-
["xAgropogon P. Fourn.", [{:uninomial=>{:
|
396
|
-
["XAgropogon P.Fourn.", [{:uninomial=>{:
|
397
|
-
["× Agropogon", [{:uninomial=>{:
|
398
|
-
["x Agropogon", [{:uninomial=>{:
|
399
|
-
["X Agropogon", [{:uninomial=>{:
|
400
|
-
["X Cupressocyparis leylandii", [{:genus=>{:
|
401
|
-
["×Heucherella tiarelloides", [{:genus=>{:
|
402
|
-
["xHeucherella tiarelloides", [{:genus=>{:
|
403
|
-
["x Heucherella tiarelloides", [{:genus=>{:
|
404
|
-
["×Agropogon littoralis (Sm.) C. E. Hubb. 1946", [{:genus=>{:
|
394
|
+
["×Agropogon P. Fourn. 1934", [{:uninomial=>{:string=>"Agropogon", :authorship=>"P. Fourn. 1934", :basionymAuthorTeam=>{:authorTeam=>"P. Fourn.", :author=>["P. Fourn."], :year=>"1934"}}}]],
|
395
|
+
["xAgropogon P. Fourn.", [{:uninomial=>{:string=>"Agropogon", :authorship=>"P. Fourn.", :basionymAuthorTeam=>{:authorTeam=>"P. Fourn.", :author=>["P. Fourn."]}}}]],
|
396
|
+
["XAgropogon P.Fourn.", [{:uninomial=>{:string=>"Agropogon", :authorship=>"P.Fourn.", :basionymAuthorTeam=>{:authorTeam=>"P.Fourn.", :author=>["P.Fourn."]}}}]],
|
397
|
+
["× Agropogon", [{:uninomial=>{:string=>"Agropogon"}}]],
|
398
|
+
["x Agropogon", [{:uninomial=>{:string=>"Agropogon"}}]],
|
399
|
+
["X Agropogon", [{:uninomial=>{:string=>"Agropogon"}}]],
|
400
|
+
["X Cupressocyparis leylandii", [{:genus=>{:string=>"Cupressocyparis"}, :species=>{:string=>"leylandii"}}]],
|
401
|
+
["×Heucherella tiarelloides", [{:genus=>{:string=>"Heucherella"}, :species=>{:string=>"tiarelloides"}}]],
|
402
|
+
["xHeucherella tiarelloides", [{:genus=>{:string=>"Heucherella"}, :species=>{:string=>"tiarelloides"}}]],
|
403
|
+
["x Heucherella tiarelloides", [{:genus=>{:string=>"Heucherella"}, :species=>{:string=>"tiarelloides"}}]],
|
404
|
+
["×Agropogon littoralis (Sm.) C. E. Hubb. 1946", [{:genus=>{:string=>"Agropogon"}, :species=>{:string=>"littoralis", :authorship=>"(Sm.) C. E. Hubb. 1946", :combinationAuthorTeam=>{:authorTeam=>"C. E. Hubb.", :author=>["C. E. Hubb."], :year=>"1946"}, :basionymAuthorTeam=>{:authorTeam=>"Sm.", :author=>["Sm."]}}}]]
|
405
405
|
].each do |res|
|
406
406
|
parse(res[0]).should_not be_nil
|
407
407
|
parse(res[0]).hybrid.should be_true
|
408
408
|
details(res[0]).should == res[1]
|
409
409
|
end
|
410
410
|
[
|
411
|
-
['Asplenium X inexpectatum (E.L. Braun 1940) Morton (1956)',[{:genus=>{:
|
412
|
-
['Mentha ×smithiana R. A. Graham 1949',[{:genus=>{:
|
413
|
-
['Salix ×capreola Andersson (1867)',[{:genus=>{:
|
414
|
-
['Salix x capreola Andersson',[{:genus=>{:
|
411
|
+
['Asplenium X inexpectatum (E.L. Braun 1940) Morton (1956)',[{:genus=>{:string=>"Asplenium"}, :species=>{:string=>"inexpectatum", :authorship=>"(E.L. Braun 1940) Morton (1956)", :combinationAuthorTeam=>{:authorTeam=>"Morton", :author=>["Morton"], :year=>"1956"}, :basionymAuthorTeam=>{:authorTeam=>"E.L. Braun", :author=>["E.L. Braun"], :year=>"1940"}}}]],
|
412
|
+
['Mentha ×smithiana R. A. Graham 1949',[{:genus=>{:string=>"Mentha"}, :species=>{:string=>"smithiana", :authorship=>"R. A. Graham 1949", :basionymAuthorTeam=>{:authorTeam=>"R. A. Graham", :author=>["R. A. Graham"], :year=>"1949"}}}]],
|
413
|
+
['Salix ×capreola Andersson (1867)',[{:genus=>{:string=>"Salix"}, :species=>{:string=>"capreola", :authorship=>"Andersson (1867)", :basionymAuthorTeam=>{:authorTeam=>"Andersson", :author=>["Andersson"], :year=>"1867"}}}]],
|
414
|
+
['Salix x capreola Andersson',[{:genus=>{:string=>"Salix"}, :species=>{:string=>"capreola", :authorship=>"Andersson", :basionymAuthorTeam=>{:authorTeam=>"Andersson", :author=>["Andersson"]}}}]]
|
415
415
|
].each do |res|
|
416
416
|
parse(res[0]).should_not be_nil
|
417
417
|
parse(res[0]).hybrid.should be_true
|
@@ -425,7 +425,7 @@ describe ScientificNameClean do
|
|
425
425
|
parse(sn).hybrid.should be_true
|
426
426
|
value(sn).should == "Arthopyrenia hyalospora \303\227 Hydnellum scrobiculatum"
|
427
427
|
canonical(sn).should == "Arthopyrenia hyalospora Hydnellum scrobiculatum"
|
428
|
-
details(sn).should == [{:genus=>{:
|
428
|
+
details(sn).should == [{:genus=>{:string=>"Arthopyrenia"}, :species=>{:string=>"hyalospora"}}, {:genus=>{:string=>"Hydnellum"}, :species=>{:string=>"scrobiculatum"}}]
|
429
429
|
pos(sn).should == {0=>["genus", 12], 13=>["species", 23], 26=>["genus", 35], 36=>["species", 49]}
|
430
430
|
sn = "Arthopyrenia hyalospora (Banker) D. Hall X Hydnellum scrobiculatum D.E. Stuntz"
|
431
431
|
parse(sn).should_not be_nil
|
@@ -438,23 +438,23 @@ describe ScientificNameClean do
|
|
438
438
|
parse(sn).should_not be_nil
|
439
439
|
parse(sn).hybrid.should be_true
|
440
440
|
canonical(sn).should == "Arthopyrenia hyalospora"
|
441
|
-
details(sn).should == [{:genus=>{:
|
441
|
+
details(sn).should == [{:genus=>{:string=>"Arthopyrenia"}, :species=>{:string=>"hyalospora"}}, "?"]
|
442
442
|
pos(sn).should == {0=>["genus", 12], 13=>["species", 23]}
|
443
443
|
sn = "Arthopyrenia hyalospora × ?"
|
444
444
|
parse(sn).should_not be_nil
|
445
445
|
parse(sn).hybrid.should be_true
|
446
|
-
details(sn).should == [{:genus=>{:
|
446
|
+
details(sn).should == [{:genus=>{:string=>"Arthopyrenia"}, :species=>{:string=>"hyalospora"}}, "?"]
|
447
447
|
pos(sn).should == {0=>["genus", 12], 13=>["species", 23]}
|
448
448
|
end
|
449
449
|
|
450
450
|
it 'should parse names with taxon concept' do
|
451
451
|
sn = "Sténométope laevissimus sec. Eschmeyer 2004"
|
452
452
|
val = @parser.failure_reason.to_s.match(/column [0-9]*/).to_s().gsub(/column /,'')
|
453
|
-
details(sn).should == [{:genus=>{:
|
453
|
+
details(sn).should == [{:genus=>{:string=>"Sténométope"}, :species=>{:string=>"laevissimus"}, :taxon_concept=>{:authorship=>"Eschmeyer 2004", :basionymAuthorTeam=>{:authorTeam=>"Eschmeyer", :author=>["Eschmeyer"], :year=>"2004"}}}]
|
454
454
|
pos(sn).should == {0=>["genus", 11], 12=>["species", 23], 29=>["author_word", 38], 39=>["year", 43]}
|
455
455
|
sn = "Sténométope laevissimus Bibron 1855 sec. Eschmeyer 2004"
|
456
456
|
parse(sn).should_not be_nil
|
457
|
-
details(sn).should == [{:genus=>{:
|
457
|
+
details(sn).should == [{:genus=>{:string=>"Sténométope"}, :species=>{:string=>"laevissimus", :authorship=>"Bibron 1855", :basionymAuthorTeam=>{:authorTeam=>"Bibron", :author=>["Bibron"], :year=>"1855"}}, :taxon_concept=>{:authorship=>"Eschmeyer 2004", :basionymAuthorTeam=>{:authorTeam=>"Eschmeyer", :author=>["Eschmeyer"], :year=>"2004"}}}]
|
458
458
|
pos(sn).should == {0=>["genus", 11], 12=>["species", 23], 24=>["author_word", 30], 31=>["year", 35], 41=>["author_word", 50], 51=>["year", 55]}
|
459
459
|
end
|
460
460
|
|
@@ -474,31 +474,31 @@ describe ScientificNameClean do
|
|
474
474
|
|
475
475
|
it "should parse new stuff" do
|
476
476
|
sn = 'Nesticus quelpartensis Paik & Namkung, in Paik, Yaginuma & Namkung, 1969'
|
477
|
-
details(sn).should == [{:genus=>{:
|
477
|
+
details(sn).should == [{:genus=>{:string=>"Nesticus"}, :species=>{:string=>"quelpartensis", :authorship=>"Paik & Namkung, in Paik, Yaginuma & Namkung, 1969", :basionymAuthorTeam=>{:authorTeam=>"Paik & Namkung", :author=>["Paik", "Namkung"], :exAuthorTeam=>{:authorTeam=>"Paik, Yaginuma & Namkung", :author=>["Paik", "Yaginuma", "Namkung"], :year=>"1969"}}}}]
|
478
478
|
parse('Dipoena yoshidai Ono, in Ono et al., 1991').should_not be_nil
|
479
479
|
sn = 'Choriozopella trägårdhi Lawrence, 1947'
|
480
|
-
details(sn).should == [{:genus=>{:
|
480
|
+
details(sn).should == [{:genus=>{:string=>"Choriozopella"}, :species=>{:string=>"trägårdhi", :authorship=>"Lawrence, 1947", :basionymAuthorTeam=>{:authorTeam=>"Lawrence", :author=>["Lawrence"], :year=>"1947"}}}]
|
481
481
|
sn = 'Latrodectus mactans bishopi Kaston, 1938'
|
482
|
-
details(sn).should == [{:genus=>{:
|
482
|
+
details(sn).should == [{:genus=>{:string=>"Latrodectus"}, :species=>{:string=>"mactans"}, :infraspecies=>[{:string=>"bishopi", :rank=>"n/a", :authorship=>"Kaston, 1938", :basionymAuthorTeam=>{:authorTeam=>"Kaston", :author=>["Kaston"], :year=>"1938"}}]}]
|
483
483
|
sn = 'Diplocephalus aff. procerus Thaler, 1972'
|
484
|
-
details(sn).should == [{:genus=>{:
|
484
|
+
details(sn).should == [{:genus=>{:string=>"Diplocephalus"}, :species=>{:string=>"procerus", :authorship=>"Thaler, 1972", :basionymAuthorTeam=>{:authorTeam=>"Thaler", :author=>["Thaler"], :year=>"1972"}}}]
|
485
485
|
sn = 'Dyarcyops birói Kulczynski, 1908'
|
486
|
-
details(sn).should == [{:genus=>{:
|
486
|
+
details(sn).should == [{:genus=>{:string=>"Dyarcyops"}, :species=>{:string=>"birói", :authorship=>"Kulczynski, 1908", :basionymAuthorTeam=>{:authorTeam=>"Kulczynski", :author=>["Kulczynski"], :year=>"1908"}}}]
|
487
487
|
sn = 'Sparassus françoisi Simon, 1898'
|
488
|
-
details(sn).should == [{:genus=>{:
|
488
|
+
details(sn).should == [{:genus=>{:string=>"Sparassus"}, :species=>{:string=>"françoisi", :authorship=>"Simon, 1898", :basionymAuthorTeam=>{:authorTeam=>"Simon", :author=>["Simon"], :year=>"1898"}}}]
|
489
489
|
sn = 'Thiobacillus x Parker and Prisk 1953' #have to figure out black lists for this one
|
490
490
|
sn = 'Bacille de Plaut, Kritchevsky and Séguin 1921'
|
491
|
-
details(sn).should == [{:uninomial=>{:
|
491
|
+
details(sn).should == [{:uninomial=>{:string=>"Bacille", :authorship=>"de Plaut, Kritchevsky and Séguin 1921", :basionymAuthorTeam=>{:authorTeam=>"de Plaut, Kritchevsky and Séguin", :author=>["de Plaut", "Kritchevsky", "Séguin"], :year=>"1921"}}}]
|
492
492
|
sn = 'Araneus van bruysseli Petrunkevitch, 1911'
|
493
|
-
details(sn).should == [{:genus=>{:
|
493
|
+
details(sn).should == [{:genus=>{:string=>"Araneus"}, :species=>{:string=>"van"}, :infraspecies=>[{:string=>"bruysseli", :rank=>"n/a", :authorship=>"Petrunkevitch, 1911", :basionymAuthorTeam=>{:authorTeam=>"Petrunkevitch", :author=>["Petrunkevitch"], :year=>"1911"}}]}]
|
494
494
|
sn = 'Sapromyces laidlawi ab Sabin 1941'
|
495
|
-
details(sn).should == [{:genus=>{:
|
495
|
+
details(sn).should == [{:genus=>{:string=>"Sapromyces"}, :species=>{:string=>"laidlawi", :authorship=>"ab Sabin 1941", :basionymAuthorTeam=>{:authorTeam=>"ab Sabin", :author=>["ab Sabin"], :year=>"1941"}}}]
|
496
496
|
sn = 'Nocardia rugosa di Marco and Spalla 1957'
|
497
|
-
details(sn).should == [{:genus=>{:
|
497
|
+
details(sn).should == [{:genus=>{:string=>"Nocardia"}, :species=>{:string=>"rugosa", :authorship=>"di Marco and Spalla 1957", :basionymAuthorTeam=>{:authorTeam=>"di Marco and Spalla", :author=>["di Marco", "Spalla"], :year=>"1957"}}}]
|
498
498
|
sn = 'Flexibacter elegans Lewin 1969 non Soriano 1945'
|
499
|
-
details(sn).should == [{:genus=>{:
|
499
|
+
details(sn).should == [{:genus=>{:string=>"Flexibacter"}, :species=>{:string=>"elegans", :authorship=>"Lewin 1969 non Soriano 1945", :basionymAuthorTeam=>{:authorTeam=>"Lewin", :author=>["Lewin"], :year=>"1969"}}}]
|
500
500
|
sn = 'Flexibacter elegans Soriano 1945, non Lewin 1969'
|
501
|
-
details(sn).should == [{:genus=>{:
|
501
|
+
details(sn).should == [{:genus=>{:string=>"Flexibacter"}, :species=>{:string=>"elegans", :authorship=>"Soriano 1945, non Lewin 1969", :basionymAuthorTeam=>{:authorTeam=>"Soriano", :author=>["Soriano"], :year=>"1945"}}}]
|
502
502
|
end
|
503
503
|
|
504
|
-
end
|
504
|
+
end
|