biodiversity 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.2
1
+ 0.7.3
@@ -779,7 +779,6 @@ grammar ScientificNameClean
779
779
  end
780
780
  }
781
781
  end
782
-
783
782
 
784
783
  rule simple_authorship
785
784
  a:authors_names space [,]? space b:year? [,]? space "non" space authors_names space [,]? space year {
@@ -901,8 +900,26 @@ grammar ScientificNameClean
901
900
  end
902
901
  }
903
902
  end
904
-
903
+
905
904
  rule author_name
905
+ space a:author_name_without_postfix space b:author_postix_word {
906
+ def value
907
+ a.value + ' ' + b.value
908
+ end
909
+
910
+ def pos
911
+ a.pos.merge(b.pos)
912
+ end
913
+
914
+ def details
915
+ {:author => [value]}
916
+ end
917
+ }
918
+ /
919
+ author_name_without_postfix
920
+ end
921
+
922
+ rule author_name_without_postfix
906
923
  space a:author_prefix_word space b:author_name {
907
924
  def value
908
925
  a.value + " " + b.value
@@ -1007,6 +1024,18 @@ grammar ScientificNameClean
1007
1024
  end
1008
1025
  }
1009
1026
  end
1027
+
1028
+ rule author_postix_word
1029
+ space ("f."/"filius") space {
1030
+ def value
1031
+ text_value.strip
1032
+ end
1033
+
1034
+ def pos
1035
+ {interval.begin => ['author_word', interval.end]}
1036
+ end
1037
+ }
1038
+ end
1010
1039
 
1011
1040
  rule cap_latin_word_pair
1012
1041
  a:cap_latin_word "-" b:cap_latin_word {
data/pkg/.gitignore ADDED
File without changes
@@ -80,6 +80,28 @@ describe ScientificNameClean do
80
80
  parse("Platypus bicaudatulus Schedl 1935").should_not be_nil
81
81
  end
82
82
 
83
+ it "should parse species name with author's postfix f., filius (son of)" do
84
+ names = [
85
+ [ "Platypus bicaudatulus Schedl f. 1935", [{:genus=>{:string=>"Platypus"}, :species=>{:string=>"bicaudatulus", :authorship=>"Schedl f. 1935", :basionymAuthorTeam=>{:authorTeam=>"Schedl f.", :author=>["Schedl f."], :year=>"1935"}}}], 'Platypus bicaudatulus Schedl f. 1935'],
86
+ [ "Platypus bicaudatulus Schedl filius 1935", [{:genus=>{:string=>"Platypus"}, :species=>{:string=>"bicaudatulus", :authorship=>"Schedl filius 1935", :basionymAuthorTeam=>{:authorTeam=>"Schedl filius", :author=>["Schedl filius"], :year=>"1935"}}}], 'Platypus bicaudatulus Schedl filius 1935'],
87
+ [ "Fimbristylis ovata (Burm. f.) J. Kern", [{:genus=>{:string=>"Fimbristylis"}, :species=>{:string=>"ovata", :authorship=>"(Burm. f.) J. Kern", :combinationAuthorTeam=>{:authorTeam=>"J. Kern", :author=>["J. Kern"]}, :basionymAuthorTeam=>{:authorTeam=>"Burm. f.", :author=>["Burm. f."]}}}], 'Fimbristylis ovata (Burm. f.) J. Kern'],
88
+ [ "Carex chordorrhiza Ehrh. ex L. f.", [{:genus=>{:string=>"Carex"}, :species=>{:string=>"chordorrhiza", :authorship=>"Ehrh. ex L. f.", :basionymAuthorTeam=>{:authorTeam=>"Ehrh.", :author=>["Ehrh."], :exAuthorTeam=>{:authorTeam=>"L. f.", :author=>["L. f."]}}}}], 'Carex chordorrhiza Ehrh. ex L. f.'],
89
+ [ "Amelanchier arborea var. arborea (Michx. f.) Fernald", [{:genus=>{:string=>"Amelanchier"}, :species=>{:string=>"arborea"}, :infraspecies=>[{:string=>"arborea", :rank=>"var.", :authorship=>"(Michx. f.) Fernald", :combinationAuthorTeam=>{:authorTeam=>"Fernald", :author=>["Fernald"]}, :basionymAuthorTeam=>{:authorTeam=>"Michx. f.", :author=>["Michx. f."]}}]}], 'Amelanchier arborea var. arborea (Michx. f.) Fernald'],
90
+ [ "Cerastium arvense var. fuegianum Hook. f.", [{:genus=>{:string=>"Cerastium"}, :species=>{:string=>"arvense"}, :infraspecies=>[{:string=>"fuegianum", :rank=>"var.", :authorship=>"Hook. f.", :basionymAuthorTeam=>{:authorTeam=>"Hook. f.", :author=>["Hook. f."]}}]}], 'Cerastium arvense var. fuegianum Hook. f.'],
91
+ [ "Cerastium arvense var. fuegianum Hook.f.", [{:genus=>{:string=>"Cerastium"}, :species=>{:string=>"arvense"}, :infraspecies=>[{:string=>"fuegianum", :rank=>"var.", :authorship=>"Hook.f.", :basionymAuthorTeam=>{:authorTeam=>"Hook.f.", :author=>["Hook.f."]}}]}], 'Cerastium arvense var. fuegianum Hook.f.'],
92
+ [ "Cerastium arvense ssp. velutinum var. velutinum (Raf.) Britton f.", [{:genus=>{:string=>"Cerastium"}, :species=>{:string=>"arvense"}, :infraspecies=>[{:string=>"velutinum", :rank=>"ssp."}, {:string=>"velutinum", :rank=>"var.", :authorship=>"(Raf.) Britton f.", :combinationAuthorTeam=>{:authorTeam=>"Britton f.", :author=>["Britton f."]}, :basionymAuthorTeam=>{:authorTeam=>"Raf.", :author=>["Raf."]}}]}], "Cerastium arvense ssp. velutinum var. velutinum (Raf.) Britton f."],
93
+ ["Amelanchier arborea f. hirsuta (Michx. f.) Fernald", [{:infraspecies=>[{:basionymAuthorTeam=>{:author=>["Michx. f."], :authorTeam=>"Michx. f."}, :string=>"hirsuta", :rank=>"f.", :combinationAuthorTeam=>{:author=>["Fernald"], :authorTeam=>"Fernald"}, :authorship=>"(Michx. f.) Fernald"}], :genus=>{:string=>"Amelanchier"}, :species=>{:string=>"arborea"}}], "Amelanchier arborea f. hirsuta (Michx. f.) Fernald"],
94
+ ["Betula pendula fo. dalecarlica (L. f.) C.K. Schneid.", [{:infraspecies=>[{:basionymAuthorTeam=>{:author=>["L. f."], :authorTeam=>"L. f."}, :string=>"dalecarlica", :rank=>"f.", :combinationAuthorTeam=>{:author=>["C.K. Schneid."], :authorTeam=>"C.K. Schneid."}, :authorship=>"(L. f.) C.K. Schneid."}], :genus=>{:string=>"Betula"}, :species=>{:string=>"pendula"}}], "Betula pendula f. dalecarlica (L. f.) C.K. Schneid."],
95
+ ["Racomitrium canescens f. ericoides (F. Weber ex Brid.) Mönk.", [{:genus=>{:string=>"Racomitrium"}, :species=>{:string=>"canescens"}, :infraspecies=>[{:string=>"ericoides", :rank=>"f.", :authorship=>"(F. Weber ex Brid.) Mönk.", :combinationAuthorTeam=>{:authorTeam=>"Mönk.", :author=>["Mönk."]}, :basionymAuthorTeam=>{:authorTeam=>"F. Weber", :author=>["F. Weber"], :exAuthorTeam=>{:authorTeam=>"Brid.", :author=>["Brid."]}}}]}], "Racomitrium canescens f. ericoides (F. Weber ex Brid.) Mönk."],
96
+ ["Racomitrium canescens forma ericoides (F. Weber ex Brid.) Mönk.", [{:genus=>{:string=>"Racomitrium"}, :species=>{:string=>"canescens"}, :infraspecies=>[{:string=>"ericoides", :rank=>"f.", :authorship=>"(F. Weber ex Brid.) Mönk.", :combinationAuthorTeam=>{:authorTeam=>"Mönk.", :author=>["Mönk."]}, :basionymAuthorTeam=>{:authorTeam=>"F. Weber", :author=>["F. Weber"], :exAuthorTeam=>{:authorTeam=>"Brid.", :author=>["Brid."]}}}]}], "Racomitrium canescens f. ericoides (F. Weber ex Brid.) Mönk."],
97
+ ]
98
+ names.each do |sn, sn_details, sn_value|
99
+ parse(sn).should_not be_nil
100
+ details(sn).should == sn_details
101
+ value(sn).should == sn_value
102
+ end
103
+ end
104
+
83
105
  it 'should parse genus with "?"' do
84
106
  sn = "Ferganoconcha? oblonga"
85
107
  parse(sn).should_not be_nil
@@ -156,8 +178,6 @@ describe ScientificNameClean do
156
178
  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."]}}}]
157
179
  end
158
180
 
159
-
160
-
161
181
  it 'should parse several authors with a year' do
162
182
  sn = "Pseudocercospora dendrobii U. Braun & Crous 2003"
163
183
  parse(sn).should_not be_nil
@@ -272,6 +272,19 @@ Eichornia crassipes ( (Martius) ) Solms-Laub.|{"scientificName":{"parsed":true,
272
272
  #year without authorship
273
273
  Acarospora cratericola 1929|{"scientificName":{"parsed":true, "parser_version":"test_version", "parser_run":2,"verbatim":"Acarospora cratericola 1929","normalized":"Acarospora cratericola 1929","canonical":"Acarospora cratericola","hybrid":false,"details":[{"genus":{"string":"Acarospora"},"species":{"string":"cratericola","year":"1929"}}],"positions":{"0":["genus",10],"11":["species",22],"23":["year",27]}}}
274
274
 
275
+ #authorship with filius (son of)
276
+ Platypus bicaudatulus Schedl f. 1935|{"scientificName":{"parsed":true, "parser_version":"test_version", "verbatim":"Platypus bicaudatulus Schedl f. 1935", "normalized":"Platypus bicaudatulus Schedl f. 1935", "canonical":"Platypus bicaudatulus", "hybrid":false, "details":[{"genus":{"string":"Platypus"}, "species":{"string":"bicaudatulus", "authorship":"Schedl f. 1935", "basionymAuthorTeam":{"authorTeam":"Schedl f.", "author":["Schedl f."], "year":"1935"}}}], "parser_run":1, "positions":{"0":["genus", 8], "9":["species", 21], "22":["author_word", 28], "29":["author_word", 32], "32":["year", 36]}}}
277
+ Platypus bicaudatulus Schedl filius 1935|{"scientificName":{"parsed":true, "parser_version":"test_version", "verbatim":"Platypus bicaudatulus Schedl filius 1935", "normalized":"Platypus bicaudatulus Schedl filius 1935", "canonical":"Platypus bicaudatulus", "hybrid":false, "details":[{"genus":{"string":"Platypus"}, "species":{"string":"bicaudatulus", "authorship":"Schedl filius 1935", "basionymAuthorTeam":{"authorTeam":"Schedl filius", "author":["Schedl filius"], "year":"1935"}}}], "parser_run":1, "positions":{"0":["genus", 8], "9":["species", 21], "22":["author_word", 28], "29":["author_word", 36], "36":["year", 40]}}}
278
+ Fimbristylis ovata (Burm. f.) J. Kern|{"scientificName":{"parsed":true, "parser_version":"test_version", "verbatim":"Fimbristylis ovata (Burm. f.) J. Kern", "normalized":"Fimbristylis ovata (Burm. f.) J. Kern", "canonical":"Fimbristylis ovata", "hybrid":false, "details":[{"genus":{"string":"Fimbristylis"}, "species":{"string":"ovata", "authorship":"(Burm. f.) J. Kern", "combinationAuthorTeam":{"authorTeam":"J. Kern", "author":["J. Kern"]}, "basionymAuthorTeam":{"authorTeam":"Burm. f.", "author":["Burm. f."]}}}], "parser_run":1, "positions":{"0":["genus", 12], "13":["species", 18], "20":["author_word", 25], "26":["author_word", 28], "30":["author_word", 32], "33":["author_word", 37]}}}
279
+ Carex chordorrhiza Ehrh. ex L. f.|{"scientificName":{"parsed":true, "parser_version":"test_version", "verbatim":"Carex chordorrhiza Ehrh. ex L. f.", "normalized":"Carex chordorrhiza Ehrh. ex L. f.", "canonical":"Carex chordorrhiza", "hybrid":false, "details":[{"genus":{"string":"Carex"}, "species":{"string":"chordorrhiza", "authorship":"Ehrh. ex L. f.", "basionymAuthorTeam":{"authorTeam":"Ehrh.", "author":["Ehrh."], "exAuthorTeam":{"authorTeam":"L. f.", "author":["L. f."]}}}}], "parser_run":1, "positions":{"0":["genus", 5], "6":["species", 18], "19":["author_word", 24], "28":["author_word", 30], "31":["author_word", 33]}}}
280
+ Amelanchier arborea var. arborea (Michx. f.) Fernald|{"scientificName":{"parsed":true, "parser_version":"test_version", "verbatim":"Amelanchier arborea var. arborea (Michx. f.) Fernald", "normalized":"Amelanchier arborea var. arborea (Michx. f.) Fernald", "canonical":"Amelanchier arborea arborea", "hybrid":false, "details":[{"genus":{"string":"Amelanchier"}, "species":{"string":"arborea"}, "infraspecies":[{"string":"arborea", "rank":"var.", "authorship":"(Michx. f.) Fernald", "combinationAuthorTeam":{"authorTeam":"Fernald", "author":["Fernald"]}, "basionymAuthorTeam":{"authorTeam":"Michx. f.", "author":["Michx. f."]}}]}], "parser_run":1, "positions":{"0":["genus", 11], "12":["species", 19], "25":["infraspecies", 32], "34":["author_word", 40], "41":["author_word", 43], "45":["author_word", 52]}}}
281
+ Cerastium arvense var. fuegianum Hook. f.|{"scientificName":{"parsed":true, "parser_version":"test_version", "verbatim":"Cerastium arvense var. fuegianum Hook. f.", "normalized":"Cerastium arvense var. fuegianum Hook. f.", "canonical":"Cerastium arvense fuegianum", "hybrid":false, "details":[{"genus":{"string":"Cerastium"}, "species":{"string":"arvense"}, "infraspecies":[{"string":"fuegianum", "rank":"var.", "authorship":"Hook. f.", "basionymAuthorTeam":{"authorTeam":"Hook. f.", "author":["Hook. f."]}}]}], "parser_run":1, "positions":{"0":["genus", 9], "10":["species", 17], "23":["infraspecies", 32], "33":["author_word", 38], "39":["author_word", 41]}}}
282
+ Cerastium arvense var. fuegianum Hook.f.|{"scientificName":{"parsed":true, "parser_version":"test_version", "verbatim":"Cerastium arvense var. fuegianum Hook.f.", "normalized":"Cerastium arvense var. fuegianum Hook.f.", "canonical":"Cerastium arvense fuegianum", "hybrid":false, "details":[{"genus":{"string":"Cerastium"}, "species":{"string":"arvense"}, "infraspecies":[{"string":"fuegianum", "rank":"var.", "authorship":"Hook.f.", "basionymAuthorTeam":{"authorTeam":"Hook.f.", "author":["Hook.f."]}}]}], "parser_run":1, "positions":{"0":["genus", 9], "10":["species", 17], "23":["infraspecies", 32], "33":["author_word", 40]}}}
283
+ Cerastium arvense ssp. velutinum var. velutinum (Raf.) Britton f.|{"scientificName":{"parsed":true, "parser_version":"test_version", "verbatim":"Cerastium arvense ssp. velutinum var. velutinum (Raf.) Britton f.", "normalized":"Cerastium arvense ssp. velutinum var. velutinum (Raf.) Britton f.", "canonical":"Cerastium arvense velutinum velutinum", "hybrid":false, "details":[{"genus":{"string":"Cerastium"}, "species":{"string":"arvense"}, "infraspecies":[{"string":"velutinum", "rank":"ssp."}, {"string":"velutinum", "rank":"var.", "authorship":"(Raf.) Britton f.", "combinationAuthorTeam":{"authorTeam":"Britton f.", "author":["Britton f."]}, "basionymAuthorTeam":{"authorTeam":"Raf.", "author":["Raf."]}}]}], "parser_run":1, "positions":{"0":["genus", 9], "10":["species", 17], "23":["infraspecies", 32], "38":["infraspecies", 47], "49":["author_word", 53], "55":["author_word", 62], "63":["author_word", 65]}}}
284
+ Amelanchier arborea f. hirsuta (Michx. f.) Fernald|{"scientificName":{"parsed":true, "parser_version":"test_version", "verbatim":"Amelanchier arborea f. hirsuta (Michx. f.) Fernald", "normalized":"Amelanchier arborea f. hirsuta (Michx. f.) Fernald", "canonical":"Amelanchier arborea hirsuta", "hybrid":false, "details":[{"genus":{"string":"Amelanchier"}, "species":{"string":"arborea"}, "infraspecies":[{"string":"hirsuta", "rank":"f.", "authorship":"(Michx. f.) Fernald", "combinationAuthorTeam":{"authorTeam":"Fernald", "author":["Fernald"]}, "basionymAuthorTeam":{"authorTeam":"Michx. f.", "author":["Michx. f."]}}]}], "parser_run":1, "positions":{"0":["genus", 11], "12":["species", 19], "23":["infraspecies", 30], "32":["author_word", 38], "39":["author_word", 41], "43":["author_word", 50]}}}
285
+ Betula pendula fo. dalecarlica (L. f.) C.K. Schneid.|{"scientificName":{"parsed":true, "parser_version":"test_version", "verbatim":"Betula pendula fo. dalecarlica (L. f.) C.K. Schneid.", "normalized":"Betula pendula f. dalecarlica (L. f.) C.K. Schneid.", "canonical":"Betula pendula dalecarlica", "hybrid":false, "details":[{"genus":{"string":"Betula"}, "species":{"string":"pendula"}, "infraspecies":[{"string":"dalecarlica", "rank":"f.", "authorship":"(L. f.) C.K. Schneid.", "combinationAuthorTeam":{"authorTeam":"C.K. Schneid.", "author":["C.K. Schneid."]}, "basionymAuthorTeam":{"authorTeam":"L. f.", "author":["L. f."]}}]}], "parser_run":1, "positions":{"0":["genus", 6], "7":["species", 14], "19":["infraspecies", 30], "32":["author_word", 34], "35":["author_word", 37], "39":["author_word", 43], "44":["author_word", 52]}}}
286
+ Racomitrium canescens f. ericoides (F. Weber ex Brid.) Mönk.|{"scientificName":{"parsed":true, "parser_version":"test_version", "verbatim":"Racomitrium canescens f. ericoides (F. Weber ex Brid.) Mönk.", "normalized":"Racomitrium canescens f. ericoides (F. Weber ex Brid.) Mönk.", "canonical":"Racomitrium canescens ericoides", "hybrid":false, "details":[{"genus":{"string":"Racomitrium"}, "species":{"string":"canescens"}, "infraspecies":[{"string":"ericoides", "rank":"f.", "authorship":"(F. Weber ex Brid.) Mönk.", "combinationAuthorTeam":{"authorTeam":"Mönk.", "author":["Mönk."]}, "basionymAuthorTeam":{"authorTeam":"F. Weber", "author":["F. Weber"], "exAuthorTeam":{"authorTeam":"Brid.", "author":["Brid."]}}}]}], "parser_run":1, "positions":{"0":["genus", 11], "12":["species", 21], "25":["infraspecies", 34], "36":["author_word", 38], "39":["author_word", 44], "48":["author_word", 53], "55":["author_word", 60]}}}
287
+ Racomitrium canescens forma ericoides (F. Weber ex Brid.) Mönk.|{"scientificName":{"parsed":true, "parser_version":"test_version", "verbatim":"Racomitrium canescens forma ericoides (F. Weber ex Brid.) Mönk.", "normalized":"Racomitrium canescens f. ericoides (F. Weber ex Brid.) Mönk.", "canonical":"Racomitrium canescens ericoides", "hybrid":false, "details":[{"genus":{"string":"Racomitrium"}, "species":{"string":"canescens"}, "infraspecies":[{"string":"ericoides", "rank":"f.", "authorship":"(F. Weber ex Brid.) Mönk.", "combinationAuthorTeam":{"authorTeam":"Mönk.", "author":["Mönk."]}, "basionymAuthorTeam":{"authorTeam":"F. Weber", "author":["F. Weber"], "exAuthorTeam":{"authorTeam":"Brid.", "author":["Brid."]}}}]}], "parser_run":1, "positions":{"0":["genus", 11], "12":["species", 21], "28":["infraspecies", 37], "39":["author_word", 41], "42":["author_word", 47], "51":["author_word", 56], "58":["author_word", 63]}}}
275
288
 
276
289
  #year range
277
290
  Tridentella tangeroae Bruce, 1987-92|{"scientificName":{"parsed":true, "parser_version":"test_version", "parser_run":2,"verbatim":"Tridentella tangeroae Bruce, 1987-92","normalized":"Tridentella tangeroae Bruce 1987-92","canonical":"Tridentella tangeroae","hybrid":false,"details":[{"genus":{"string":"Tridentella"},"species":{"string":"tangeroae","authorship":"Bruce, 1987-92","basionymAuthorTeam":{"authorTeam":"Bruce","author":["Bruce"],"year":"1987-92"}}}],"positions":{"0":["genus",11],"12":["species",21],"22":["author_word",27],"29":["year",36]}}}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biodiversity
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 2
10
- version: 0.7.2
9
+ - 3
10
+ version: 0.7.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dmitry Mozzherin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-07 00:00:00 -04:00
18
+ date: 2011-02-07 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -72,7 +72,6 @@ extra_rdoc_files:
72
72
  - README.rdoc
73
73
  files:
74
74
  - .document
75
- - .gitignore
76
75
  - LICENSE
77
76
  - README.rdoc
78
77
  - Rakefile
@@ -102,8 +101,8 @@ homepage: http://github.com/GlobalNamesArchitecture/biodiversity
102
101
  licenses: []
103
102
 
104
103
  post_install_message:
105
- rdoc_options:
106
- - --charset=UTF-8
104
+ rdoc_options: []
105
+
107
106
  require_paths:
108
107
  - lib
109
108
  required_ruby_version: !ruby/object:Gem::Requirement
data/.gitignore DELETED
@@ -1,16 +0,0 @@
1
- lib/biodiversity/parser/*rb
2
- *.gemspec
3
- *.sw?
4
- .DS_Store
5
- coverage
6
- rdoc
7
- pkg
8
- *.swp
9
- *.swo
10
- biodiversity*.gem
11
- *json
12
- *xml
13
- tmp
14
- .DS_Store
15
- spec/parser/test_data_new.txt
16
- t