dimus-biodiversity 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/biodiversity.rb +0 -2
- data/lib/biodiversity/parser.rb +4 -7
- data/lib/biodiversity/parser/scientific_name_canonical.rb +22 -0
- data/lib/biodiversity/parser/scientific_name_canonical.treetop +18 -2
- data/lib/biodiversity/parser/scientific_name_clean.rb +139 -60
- data/lib/biodiversity/parser/scientific_name_clean.treetop +85 -9
- data/spec/parser/scientific_name.spec.rb +15 -5
- data/spec/parser/scientific_name_canonical.spec.rb +6 -5
- data/spec/parser/scientific_name_clean.spec.rb +79 -73
- data/spec/parser/scientific_name_dirty.spec.rb +13 -13
- metadata +1 -1
@@ -16,7 +16,7 @@ describe ScientificNameDirty do
|
|
16
16
|
sn = "Eichornia crassipes ( (Martius) ) Solms-Laub."
|
17
17
|
parse(sn).should_not be_nil
|
18
18
|
value(sn).should == "Eichornia crassipes (Martius) Solms-Laub."
|
19
|
-
details(sn).should == {:genus=>{:epitheton=>"Eichornia"}, :species=>{:epitheton=>"crassipes", :authorship=>"( (Martius) ) Solms-Laub.", :combinationAuthorTeam=>{:authorTeam=>"Solms-Laub.", :author=>["Solms-Laub."]}, :basionymAuthorTeam=>{:authorTeam=>"Martius", :author=>["Martius"]}}}
|
19
|
+
details(sn).should == [{:genus=>{:epitheton=>"Eichornia"}, :species=>{:epitheton=>"crassipes", :authorship=>"( (Martius) ) Solms-Laub.", :combinationAuthorTeam=>{:authorTeam=>"Solms-Laub.", :author=>["Solms-Laub."]}, :basionymAuthorTeam=>{:authorTeam=>"Martius", :author=>["Martius"]}}}]
|
20
20
|
pos(sn).should == {0=>["genus", 9], 10=>["species", 19], 23=>["author_word", 30], 34=>["author_word", 45]}
|
21
21
|
end
|
22
22
|
|
@@ -24,14 +24,14 @@ describe ScientificNameDirty do
|
|
24
24
|
sn = "Acarospora cratericola 1929"
|
25
25
|
parse(sn).should_not be_nil
|
26
26
|
pos(sn).should == {0=>["genus", 10], 11=>["species", 22], 23=>["year", 27]}
|
27
|
-
details(sn).should == {:genus=>{:epitheton=>"Acarospora"}, :species=>{:epitheton=>"cratericola", :year=>"1929"}}
|
27
|
+
details(sn).should == [{:genus=>{:epitheton=>"Acarospora"}, :species=>{:epitheton=>"cratericola", :year=>"1929"}}]
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'should parse double years' do
|
31
31
|
sn = "Tridentella tangeroae Bruce, 1987-92"
|
32
32
|
parse(sn).should_not be_nil
|
33
33
|
pos(sn).should == {0=>["genus", 11], 12=>["species", 21], 22=>["author_word", 27], 29=>["year", 36]}
|
34
|
-
details(sn).should == {:genus=>{:epitheton=>"Tridentella"}, :species=>{:epitheton=>"tangeroae", :authorship=>"Bruce, 1987-92", :basionymAuthorTeam=>{:authorTeam=>"Bruce", :author=>["Bruce"], :year=>"1987-92"}}}
|
34
|
+
details(sn).should == [{:genus=>{:epitheton=>"Tridentella"}, :species=>{:epitheton=>"tangeroae", :authorship=>"Bruce, 1987-92", :basionymAuthorTeam=>{:authorTeam=>"Bruce", :author=>["Bruce"], :year=>"1987-92"}}}]
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should parse dirty years' do
|
@@ -47,7 +47,7 @@ describe ScientificNameDirty do
|
|
47
47
|
sn = "Gymnodactylus irregularis WERMUTH 1965: 54"
|
48
48
|
parse(sn).should_not be_nil
|
49
49
|
value(sn).should == "Gymnodactylus irregularis WERMUTH 1965"
|
50
|
-
details(sn).should == {:genus=>{:epitheton=>"Gymnodactylus"}, :species=>{:epitheton=>"irregularis", :authorship=>"WERMUTH 1965: 54", :basionymAuthorTeam=>{:authorTeam=>"WERMUTH", :author=>["WERMUTH"], :year=>"1965"}}}
|
50
|
+
details(sn).should == [{:genus=>{:epitheton=>"Gymnodactylus"}, :species=>{:epitheton=>"irregularis", :authorship=>"WERMUTH 1965: 54", :basionymAuthorTeam=>{:authorTeam=>"WERMUTH", :author=>["WERMUTH"], :year=>"1965"}}}]
|
51
51
|
pos(sn).should == {0=>["genus", 13], 14=>["species", 25], 26=>["author_word", 33], 34=>["year", 38]}
|
52
52
|
end
|
53
53
|
|
@@ -58,12 +58,12 @@ describe ScientificNameDirty do
|
|
58
58
|
value("Anthoscopus Cabanis [1851]").should == "Anthoscopus Cabanis (1851)"
|
59
59
|
sn = "Anthoscopus Cabanis [1851?]"
|
60
60
|
value(sn).should == "Anthoscopus Cabanis (1851?)"
|
61
|
-
details(sn).should == {:uninomial=>{:epitheton=>"Anthoscopus", :authorship=>"Cabanis [1851?]", :basionymAuthorTeam=>{:authorTeam=>"Cabanis", :author=>["Cabanis"], :approximate_year=>"(1851?)"}}}
|
61
|
+
details(sn).should == [{:uninomial=>{:epitheton=>"Anthoscopus", :authorship=>"Cabanis [1851?]", :basionymAuthorTeam=>{:authorTeam=>"Cabanis", :author=>["Cabanis"], :approximate_year=>"(1851?)"}}}]
|
62
62
|
pos(sn).should == {0=>["uninomial", 11], 12=>["author_word", 19], 21=>["year", 26]}
|
63
63
|
sn = "Trismegistia monodii Ando, 1973 [1974]"
|
64
64
|
parse(sn).should_not be_nil
|
65
65
|
value(sn).should == 'Trismegistia monodii Ando 1973 (1974)' #should it be 'Trismegistia monodii Ando 1973 (1974)' instead?
|
66
|
-
details(sn).should == {:genus=>{:epitheton=>"Trismegistia"}, :species=>{:epitheton=>"monodii", :authorship=>"Ando, 1973 [1974]", :basionymAuthorTeam=>{:authorTeam=>"Ando", :author=>["Ando"], :year=>"1973", :approximate_year=>"(1974)"}}}
|
66
|
+
details(sn).should == [{:genus=>{:epitheton=>"Trismegistia"}, :species=>{:epitheton=>"monodii", :authorship=>"Ando, 1973 [1974]", :basionymAuthorTeam=>{:authorTeam=>"Ando", :author=>["Ando"], :year=>"1973", :approximate_year=>"(1974)"}}}]
|
67
67
|
pos(sn).should == {0=>["genus", 12], 13=>["species", 20], 21=>["author_word", 25], 27=>["year", 31], 33=>["year", 37]}
|
68
68
|
parse("Zygaena witti Wiegel [1973]").should_not be_nil
|
69
69
|
sn = "Deyeuxia coarctata Kunth, 1815 [1816]"
|
@@ -74,17 +74,17 @@ describe ScientificNameDirty do
|
|
74
74
|
it "should parse new stuff" do
|
75
75
|
sn = 'Zoropsis (TaKeoa) nishimurai Yaginuma, 1971' #skipping for now
|
76
76
|
sn = 'Campylobacter pyloridis Marshall et al.1985.'
|
77
|
-
details(sn).should == {:genus=>{:epitheton=>"Campylobacter"}, :species=>{:epitheton=>"pyloridis", :authorship=>"Marshall et al.1985.", :basionymAuthorTeam=>{:authorTeam=>"Marshall et al.", :author=>["Marshall et al."], :year=>"1985"}}}
|
77
|
+
details(sn).should == [{:genus=>{:epitheton=>"Campylobacter"}, :species=>{:epitheton=>"pyloridis", :authorship=>"Marshall et al.1985.", :basionymAuthorTeam=>{:authorTeam=>"Marshall et al.", :author=>["Marshall et al."], :year=>"1985"}}}]
|
78
78
|
sn = 'Staphylococcus hyicus chromogenes Devriese et al. 1978 (Approved Lists 1980).'
|
79
|
-
details(sn).should == {:genus=>{:epitheton=>"Staphylococcus"}, :species=>{:epitheton=>"hyicus"}, :infraspecies=>{:epitheton=>"chromogenes", :rank=>"n/a", :authorship=>"Devriese et al. 1978", :basionymAuthorTeam=>{:authorTeam=>"Devriese et al.", :author=>["Devriese et al."], :year=>"1978"}}}
|
79
|
+
details(sn).should == [{:genus=>{:epitheton=>"Staphylococcus"}, :species=>{:epitheton=>"hyicus"}, :infraspecies=>[{:epitheton=>"chromogenes", :rank=>"n/a", :authorship=>"Devriese et al. 1978", :basionymAuthorTeam=>{:authorTeam=>"Devriese et al.", :author=>["Devriese et al."], :year=>"1978"}}]}]
|
80
80
|
sn = 'Kitasatospora corrig. griseola Takahashi et al. 1985.'
|
81
|
-
details(sn).should == {:genus=>{:epitheton=>"Kitasatospora"}, :species=>{:epitheton=>"griseola", :authorship=>"Takahashi et al. 1985.", :basionymAuthorTeam=>{:authorTeam=>"Takahashi et al.", :author=>["Takahashi et al."], :year=>"1985"}}}
|
81
|
+
details(sn).should == [{:genus=>{:epitheton=>"Kitasatospora"}, :species=>{:epitheton=>"griseola", :authorship=>"Takahashi et al. 1985.", :basionymAuthorTeam=>{:authorTeam=>"Takahashi et al.", :author=>["Takahashi et al."], :year=>"1985"}}}]
|
82
82
|
sn = 'Beijerinckia derxii venezuelae corrig. Thompson and Skerman, 1981'
|
83
|
-
details(sn).should == {:genus=>{:epitheton=>"Beijerinckia"}, :species=>{:epitheton=>"derxii"}, :infraspecies=>{:epitheton=>"venezuelae", :rank=>"n/a", :authorship=>"Thompson and Skerman, 1981", :basionymAuthorTeam=>{:authorTeam=>"Thompson and Skerman", :author=>["Thompson", "Skerman"], :year=>"1981"}}}
|
84
|
-
details('Streptomyces parvisporogenes ignotus 1960').should == {:genus=>{:epitheton=>"Streptomyces"}, :species=>{:epitheton=>"parvisporogenes"}, :infraspecies=>{:epitheton=>"ignotus", :rank=>"n/a", :year=>"1960"}}
|
85
|
-
details('Oscillaria caviae Simons 1920, according to Simons 1922').should == {:genus=>{:epitheton=>"Oscillaria"}, :species=>{:epitheton=>"caviae", :authorship=>"Simons 1920", :basionymAuthorTeam=>{:authorTeam=>"Simons", :author=>["Simons"], :year=>"1920"}}}
|
83
|
+
details(sn).should == [{:genus=>{:epitheton=>"Beijerinckia"}, :species=>{:epitheton=>"derxii"}, :infraspecies=>[{:epitheton=>"venezuelae", :rank=>"n/a", :authorship=>"Thompson and Skerman, 1981", :basionymAuthorTeam=>{:authorTeam=>"Thompson and Skerman", :author=>["Thompson", "Skerman"], :year=>"1981"}}]}]
|
84
|
+
details('Streptomyces parvisporogenes ignotus 1960').should == [{:genus=>{:epitheton=>"Streptomyces"}, :species=>{:epitheton=>"parvisporogenes"}, :infraspecies=>[{:epitheton=>"ignotus", :rank=>"n/a", :year=>"1960"}]}]
|
85
|
+
details('Oscillaria caviae Simons 1920, according to Simons 1922').should == [{:genus=>{:epitheton=>"Oscillaria"}, :species=>{:epitheton=>"caviae", :authorship=>"Simons 1920", :basionymAuthorTeam=>{:authorTeam=>"Simons", :author=>["Simons"], :year=>"1920"}}}]
|
86
86
|
sn = 'Bacterium monocytogenes hominis"" Nyfeldt 1932'
|
87
|
-
details(sn).should == {:genus=>{:epitheton=>"Bacterium"}, :species=>{:epitheton=>"monocytogenes"}, :infraspecies=>{:epitheton=>"hominis", :rank=>"n/a"}}
|
87
|
+
details(sn).should == [{:genus=>{:epitheton=>"Bacterium"}, :species=>{:epitheton=>"monocytogenes"}, :infraspecies=>[{:epitheton=>"hominis", :rank=>"n/a"}]}]
|
88
88
|
end
|
89
89
|
|
90
90
|
end
|