biodiversity19 3.1.5 → 3.1.6

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.
@@ -1,16 +1,16 @@
1
1
  # encoding: UTF-8
2
- require 'unicode_utils'
2
+ require "unicode_utils"
3
3
 
4
4
  grammar ScientificNameClean
5
5
 
6
6
  rule root
7
7
  space a:scientific_name_5 space {
8
8
  def value
9
- a.value.gsub(/\s{2,}/, ' ').strip
9
+ a.value.gsub(/\s{2,}/, " ").strip
10
10
  end
11
11
 
12
12
  def canonical
13
- a.canonical.gsub(/\s{2,}/, ' ').strip
13
+ a.canonical.gsub(/\s{2,}/, " ").strip
14
14
  end
15
15
 
16
16
  def pos
@@ -218,7 +218,7 @@ grammar ScientificNameClean
218
218
  .+ space {
219
219
 
220
220
  def value
221
- ''
221
+ ""
222
222
  end
223
223
 
224
224
  def hybrid
@@ -226,11 +226,11 @@ grammar ScientificNameClean
226
226
  end
227
227
 
228
228
  def canonical
229
- ''
229
+ ""
230
230
  end
231
231
 
232
232
  def pos
233
- {interval.begin => ['unparsed', interval.end]}
233
+ {interval.begin => ["unparsed", interval.end]}
234
234
  end
235
235
 
236
236
  def details
@@ -513,14 +513,14 @@ grammar ScientificNameClean
513
513
 
514
514
  def pos
515
515
  def a.pos
516
- {interval.begin => ['infraspecies', a.interval.end]}
516
+ {interval.begin => ["infraspecies", a.interval.end]}
517
517
  end
518
518
  aid.pos(a)
519
519
  end
520
520
 
521
521
  def details
522
522
  def a.details
523
- {:infraspecies => {:string => value, :rank => 'n/a'}}
523
+ {:infraspecies => {:string => value, :rank => "n/a"}}
524
524
  end
525
525
  aid.details(a)
526
526
  end
@@ -536,11 +536,11 @@ grammar ScientificNameClean
536
536
  end
537
537
 
538
538
  def pos
539
- {interval.begin => ['infraspecies', interval.end]}
539
+ {interval.begin => ["infraspecies", interval.end]}
540
540
  end
541
541
 
542
542
  def details
543
- {:infraspecies => {:string => value, :rank => 'n/a'}}
543
+ {:infraspecies => {:string => value, :rank => "n/a"}}
544
544
  end
545
545
  }
546
546
  end
@@ -560,7 +560,7 @@ grammar ScientificNameClean
560
560
  end
561
561
 
562
562
  rule rank
563
- ("morph."/"f.sp."/"B "/"ssp."/"ssp "/"mut."/"nat "/"nothosubsp."/"convar."/"pseudovar."/"sect."/"ser."/"var."/"subvar."/ "[var.]" /"var "/"subsp."/"subsp "/"subf."/"race "/"forma "/"fma."/"fma "/"form."/"form "/"fo."/"fo "/"f."/"α"/"ββ"/"β"/"γ"/"δ"/"ε"/"φ"/"θ"/"μ"/"a."/"b."/"c."/"d."/"e."/"g."/"k."/"****"/"**"/"*")
563
+ ("morph."/"f.sp."/"B "/"ssp."/"ssp "/"mut."/"nat "/"nothosubsp."/"convar."/"pseudovar."/"sect."/"ser."/"var."/"subvar."/ "[var.]" /"var "/"subsp."/"subsp "/"subf."/"race "/"forma."/"forma "/"fma."/"fma "/"form."/"form "/"fo."/"fo "/"f."/"α"/"ββ"/"β"/"γ"/"δ"/"ε"/"φ"/"θ"/"μ"/"a."/"b."/"c."/"d."/"e."/"g."/"k."/"****"/"**"/"*")
564
564
  {
565
565
  def value
566
566
  text_value.strip
@@ -575,8 +575,8 @@ grammar ScientificNameClean
575
575
  end
576
576
 
577
577
  def pos(a)
578
- interval_end = text_value[-1] == ' ' ? interval.end - 1 : interval.end
579
- {interval.begin => ['infraspecific_type', interval_end], a.interval.begin => ['infraspecies', a.interval.end]}
578
+ interval_end = text_value[-1] == " " ? interval.end - 1 : interval.end
579
+ {interval.begin => ["infraspecific_type", interval_end], a.interval.begin => ["infraspecies", a.interval.end]}
580
580
  end
581
581
 
582
582
  def details(a = nil)
@@ -592,7 +592,7 @@ grammar ScientificNameClean
592
592
  end
593
593
 
594
594
  def pos(uni)
595
- {interval.begin => ['rank_uninomial', interval.end], uni.interval.begin => ['uninomial', uni.interval.end]}
595
+ {interval.begin => ["rank_uninomial", interval.end], uni.interval.begin => ["uninomial", uni.interval.end]}
596
596
  end
597
597
 
598
598
  def details(uni)
@@ -634,7 +634,7 @@ grammar ScientificNameClean
634
634
  end
635
635
 
636
636
  def pos
637
- {interval.begin => ['species', interval.end]}
637
+ {interval.begin => ["species", interval.end]}
638
638
  end
639
639
 
640
640
  def hybrid
@@ -660,7 +660,7 @@ grammar ScientificNameClean
660
660
  end
661
661
 
662
662
  def pos
663
- {a.interval.begin => ['infragenus', a.interval.end]}
663
+ {a.interval.begin => ["infragenus", a.interval.end]}
664
664
  end
665
665
 
666
666
  def details
@@ -676,7 +676,7 @@ grammar ScientificNameClean
676
676
  end
677
677
 
678
678
  def pos
679
- {a.interval.begin => ['genus', a.interval.end]}
679
+ {a.interval.begin => ["genus", a.interval.end]}
680
680
  end
681
681
 
682
682
  def canonical
@@ -786,7 +786,7 @@ grammar ScientificNameClean
786
786
  end
787
787
 
788
788
  def pos
789
- {interval.begin => ['uninomial', interval.end]}
789
+ {interval.begin => ["uninomial", interval.end]}
790
790
  end
791
791
 
792
792
  def hybrid
@@ -909,11 +909,11 @@ grammar ScientificNameClean
909
909
  end
910
910
 
911
911
  def pos
912
- {a.interval.begin => ['unknown_author', a.interval.end]}
912
+ {a.interval.begin => ["unknown_author", a.interval.end]}
913
913
  end
914
914
 
915
915
  def details
916
- {:authorship => text_value, :basionymAuthorTeam => {:authorTeam => text_value, :author => ['?']}}
916
+ {:authorship => text_value, :basionymAuthorTeam => {:authorTeam => text_value, :author => ["?"]}}
917
917
  end
918
918
  }
919
919
  end
@@ -949,7 +949,7 @@ grammar ScientificNameClean
949
949
  details_with_arg(:basionymAuthorTeam)
950
950
  end
951
951
 
952
- def details_with_arg(authorTeamType = 'basionymAuthorTeam')
952
+ def details_with_arg(authorTeamType = "basionymAuthorTeam")
953
953
  { :authorship => text_value,
954
954
  authorTeamType.to_sym => {
955
955
  :authorTeam => a.text_value.strip
@@ -971,7 +971,7 @@ grammar ScientificNameClean
971
971
  details_with_arg(:basionymAuthorTeam)
972
972
  end
973
973
 
974
- def details_with_arg(authorTeamType = 'basionymAuthorTeam')
974
+ def details_with_arg(authorTeamType = "basionymAuthorTeam")
975
975
  { :authorship => text_value,
976
976
  authorTeamType.to_sym => {
977
977
  :authorTeam => a.text_value.strip
@@ -987,7 +987,7 @@ grammar ScientificNameClean
987
987
  details
988
988
  end
989
989
 
990
- def details_with_arg(authorTeamType = 'basionymAuthorTeam')
990
+ def details_with_arg(authorTeamType = "basionymAuthorTeam")
991
991
  { :authorship => text_value,
992
992
  authorTeamType.to_sym => {
993
993
  :authorTeam => text_value,
@@ -1025,7 +1025,7 @@ grammar ScientificNameClean
1025
1025
  end
1026
1026
 
1027
1027
  def pos
1028
- {interval.begin => ['unknown_author', interval.end]}
1028
+ {interval.begin => ["unknown_author", interval.end]}
1029
1029
  end
1030
1030
 
1031
1031
  def details
@@ -1059,7 +1059,7 @@ grammar ScientificNameClean
1059
1059
  rule author_name
1060
1060
  space a:author_name_without_postfix space b:author_postfix_word space !latin_word {
1061
1061
  def value
1062
- a.value + ' ' + b.value
1062
+ a.value + " " + b.value
1063
1063
  end
1064
1064
 
1065
1065
  def pos
@@ -1113,7 +1113,7 @@ grammar ScientificNameClean
1113
1113
  end
1114
1114
 
1115
1115
  def pos
1116
- {interval.begin => ['author_word', 1], (interval.begin + 2) => ['author_word', 2], (interval.begin + 5) => ['author_word', 2]}
1116
+ {interval.begin => ["author_word", 1], (interval.begin + 2) => ["author_word", 2], (interval.begin + 5) => ["author_word", 2]}
1117
1117
  end
1118
1118
 
1119
1119
  def details
@@ -1128,7 +1128,7 @@ grammar ScientificNameClean
1128
1128
 
1129
1129
  def pos
1130
1130
  #cheating because there are several words in some of them
1131
- {interval.begin => ['author_word', interval.end]}
1131
+ {interval.begin => ["author_word", interval.end]}
1132
1132
  end
1133
1133
 
1134
1134
  def details
@@ -1144,7 +1144,7 @@ grammar ScientificNameClean
1144
1144
  end
1145
1145
 
1146
1146
  def pos
1147
- {interval.begin => ['author_word', interval.end]}
1147
+ {interval.begin => ["author_word", interval.end]}
1148
1148
  end
1149
1149
 
1150
1150
  def details
@@ -1158,7 +1158,7 @@ grammar ScientificNameClean
1158
1158
  end
1159
1159
 
1160
1160
  def pos
1161
- {interval.begin => ['author_word', interval.end]}
1161
+ {interval.begin => ["author_word", interval.end]}
1162
1162
  end
1163
1163
 
1164
1164
  def details
@@ -1177,7 +1177,7 @@ grammar ScientificNameClean
1177
1177
 
1178
1178
  def pos
1179
1179
  #cheating because there are several words in some of them
1180
- {interval.begin => ['author_word', interval.end]}
1180
+ {interval.begin => ["author_word", interval.end]}
1181
1181
  end
1182
1182
  }
1183
1183
  end
@@ -1189,7 +1189,7 @@ grammar ScientificNameClean
1189
1189
  end
1190
1190
 
1191
1191
  def pos
1192
- {interval.begin => ['author_word', interval.end]}
1192
+ {interval.begin => ["author_word", interval.end]}
1193
1193
  end
1194
1194
  }
1195
1195
  end
@@ -1217,7 +1217,7 @@ grammar ScientificNameClean
1217
1217
  /
1218
1218
  a:("AE"/"OE") b:latin_word {
1219
1219
  def value
1220
- a.text_value[0..0] + 'e' + b.value
1220
+ a.text_value[0..0] + "e" + b.value
1221
1221
  end
1222
1222
  }
1223
1223
  /
@@ -1251,7 +1251,7 @@ grammar ScientificNameClean
1251
1251
  end
1252
1252
 
1253
1253
  def pos
1254
- {b.interval.begin => ['species', b.interval.end]}
1254
+ {b.interval.begin => ["species", b.interval.end]}
1255
1255
  end
1256
1256
 
1257
1257
  def details
@@ -1273,7 +1273,7 @@ grammar ScientificNameClean
1273
1273
  end
1274
1274
 
1275
1275
  def pos
1276
- {b.interval.begin => ['species', b.interval.end]}
1276
+ {b.interval.begin => ["species", b.interval.end]}
1277
1277
  end
1278
1278
 
1279
1279
  def details
@@ -1295,7 +1295,7 @@ grammar ScientificNameClean
1295
1295
  end
1296
1296
 
1297
1297
  def pos
1298
- {b.interval.begin => ['species', b.interval.end]}
1298
+ {b.interval.begin => ["species", b.interval.end]}
1299
1299
  end
1300
1300
 
1301
1301
  def details
@@ -1312,16 +1312,16 @@ grammar ScientificNameClean
1312
1312
  end
1313
1313
 
1314
1314
  def apply(sp)
1315
- ''
1315
+ ""
1316
1316
  end
1317
1317
 
1318
1318
  def canonical(sp)
1319
- ''
1319
+ ""
1320
1320
  end
1321
1321
 
1322
1322
  def pos(sp)
1323
- interval_end = text_value[-1] == ' ' ? interval.end - 1 : interval.end
1324
- {interval.begin => ['annotation_identification', interval.end]}
1323
+ interval_end = text_value[-1] == " " ? interval.end - 1 : interval.end
1324
+ {interval.begin => ["annotation_identification", interval.end]}
1325
1325
  end
1326
1326
 
1327
1327
  def details(sp)
@@ -1335,16 +1335,16 @@ grammar ScientificNameClean
1335
1335
  end
1336
1336
 
1337
1337
  def apply(sp)
1338
- ' ' + value + ' ' + sp.value
1338
+ " " + value + " " + sp.value
1339
1339
  end
1340
1340
 
1341
1341
  def canonical(sp)
1342
- ' ' + sp.canonical
1342
+ " " + sp.canonical
1343
1343
  end
1344
1344
 
1345
1345
  def pos(sp)
1346
- interval_end = text_value[-1] == ' ' ? interval.end - 1 : interval.end
1347
- {interval.begin => ['annotation_identification', interval.end]}.merge(sp.pos)
1346
+ interval_end = text_value[-1] == " " ? interval.end - 1 : interval.end
1347
+ {interval.begin => ["annotation_identification", interval.end]}.merge(sp.pos)
1348
1348
  end
1349
1349
 
1350
1350
  def details(sp)
@@ -1372,12 +1372,18 @@ grammar ScientificNameClean
1372
1372
  end
1373
1373
  }
1374
1374
  /
1375
- "o\'donelli" {
1375
+ "o'donelli" {
1376
1376
  def value
1377
1377
  "odonelli"
1378
1378
  end
1379
1379
  }
1380
1380
  /
1381
+ "o'neili" {
1382
+ def value
1383
+ "oneili"
1384
+ end
1385
+ }
1386
+ /
1381
1387
  a:valid_name_letter b:valid_name_letters {
1382
1388
  def value
1383
1389
  a.value + b.value
@@ -1388,13 +1394,13 @@ grammar ScientificNameClean
1388
1394
  rule valid_name_letters
1389
1395
  [a-zëæœ]+ {
1390
1396
  def value
1391
- res = ''
1392
- text_value.split('').each do |l|
1393
- l = 'ae' if l == 'æ'
1394
- l = 'oe' if l == 'œ'
1397
+ res = ""
1398
+ text_value.split("").each do |l|
1399
+ l = "ae" if l == "æ"
1400
+ l = "oe" if l == "œ"
1395
1401
  # We normalize ë as well. It is legal in botanical code, but it
1396
1402
  # is beneficial to normalize it for the reconsiliation purposes
1397
- l = 'e' if l == 'ë'
1403
+ l = "e" if l == "ë"
1398
1404
  res << l
1399
1405
  end
1400
1406
  res
@@ -1406,9 +1412,9 @@ grammar ScientificNameClean
1406
1412
  [a-zëæœ] {
1407
1413
  def value
1408
1414
  res = text_value
1409
- res = 'ae' if res == 'æ'
1410
- res = 'oe' if res == 'œ'
1411
- res = 'e' if res == 'ë'
1415
+ res = "ae" if res == "æ"
1416
+ res = "oe" if res == "œ"
1417
+ res = "e" if res == "ë"
1412
1418
  res
1413
1419
  end
1414
1420
  }
@@ -1418,13 +1424,13 @@ grammar ScientificNameClean
1418
1424
  rule cap_digraph
1419
1425
  "Æ" {
1420
1426
  def value
1421
- 'Ae'
1427
+ "Ae"
1422
1428
  end
1423
1429
  }
1424
1430
  /
1425
1431
  "Œ" {
1426
1432
  def value
1427
- 'Oe'
1433
+ "Oe"
1428
1434
  end
1429
1435
  }
1430
1436
  end
@@ -1456,7 +1462,7 @@ grammar ScientificNameClean
1456
1462
  end
1457
1463
 
1458
1464
  def pos
1459
- {interval.begin => ['year', interval.end]}
1465
+ {interval.begin => ["year", interval.end]}
1460
1466
  end
1461
1467
 
1462
1468
  def details
@@ -1472,7 +1478,7 @@ grammar ScientificNameClean
1472
1478
  end
1473
1479
 
1474
1480
  def pos
1475
- {interval.begin => ['year', interval.end]}
1481
+ {interval.begin => ["year", interval.end]}
1476
1482
  end
1477
1483
 
1478
1484
  def details
@@ -27,21 +27,21 @@ module ScientificNameDirty
27
27
 
28
28
  module Root1
29
29
  def value
30
- a.value.gsub(/\s{2,}/, ' ').strip
30
+ a.value.gsub(/\s{2,}/, " ").strip
31
31
  end
32
-
32
+
33
33
  def canonical
34
- a.canonical.gsub(/\s{2,}/, ' ').strip
34
+ a.canonical.gsub(/\s{2,}/, " ").strip
35
35
  end
36
-
36
+
37
37
  def pos
38
38
  a.pos
39
39
  end
40
-
40
+
41
41
  def hybrid
42
42
  a.hybrid
43
43
  end
44
-
44
+
45
45
  def details
46
46
  a.details.class == Array ? a.details : [a.details]
47
47
  end
@@ -101,15 +101,15 @@ module ScientificNameDirty
101
101
  def value
102
102
  a.value
103
103
  end
104
-
104
+
105
105
  def canonical
106
106
  a.canonical
107
107
  end
108
-
108
+
109
109
  def pos
110
110
  a.pos
111
111
  end
112
-
112
+
113
113
  def details
114
114
  a.details
115
115
  end
@@ -333,15 +333,15 @@ module ScientificNameDirty
333
333
  def value
334
334
  a.value + " " + b.value
335
335
  end
336
-
336
+
337
337
  def canonical
338
338
  a.canonical
339
339
  end
340
-
340
+
341
341
  def pos
342
342
  a.pos.merge(b.pos)
343
343
  end
344
-
344
+
345
345
  def details
346
346
  {:species => a.details[:species].merge(b.details)}
347
347
  end
@@ -409,14 +409,14 @@ module ScientificNameDirty
409
409
 
410
410
  module LatinWord1
411
411
  def value
412
- res = ''
413
- text_value.split('').each do |l|
414
- l = 'ae' if l == 'æ'
415
- l = 'oe' if l == 'œ'
412
+ res = ""
413
+ text_value.split("").each do |l|
414
+ l = "ae" if l == "æ"
415
+ l = "oe" if l == "œ"
416
416
  res << l
417
417
  end
418
- res.tr('àâåãäáçčëéèíìïňññóòôøõöúùüŕřŗššşž',
419
- 'aaaaaacceeeiiinnnoooooouuurrrsssz')
418
+ res.tr("àâåãäáçčëéèíìïňññóòôøõöúùüŕřŗššşž",
419
+ "aaaaaacceeeiiinnnoooooouuurrrsssz")
420
420
  end
421
421
  end
422
422
 
@@ -460,14 +460,14 @@ module ScientificNameDirty
460
460
 
461
461
  module ValidNameLetters0
462
462
  def value
463
- res = ''
464
- text_value.split('').each do |l|
465
- l = 'ae' if l == 'æ'
466
- l = 'oe' if l == 'œ'
463
+ res = ""
464
+ text_value.split("").each do |l|
465
+ l = "ae" if l == "æ"
466
+ l = "oe" if l == "œ"
467
467
  res << l
468
468
  end
469
- res.tr('àâåãäáçčëéèíìïňññóòôøõöúùüŕřŗššşž',
470
- 'aaaaaacceeeiiinnnoooooouuurrrsssz')
469
+ res.tr("àâåãäáçčëéèíìïňññóòôøõöúùüŕřŗššşž",
470
+ "aaaaaacceeeiiinnnoooooouuurrrsssz")
471
471
 
472
472
  end
473
473
  end
@@ -665,11 +665,11 @@ module ScientificNameDirty
665
665
  def value
666
666
  a.value + " " + b.value
667
667
  end
668
-
668
+
669
669
  def pos
670
670
  a.pos.merge(b.pos)
671
671
  end
672
-
672
+
673
673
  def details
674
674
  {:year => a.value, :approximate_year => b.value}
675
675
  end
@@ -693,11 +693,11 @@ module ScientificNameDirty
693
693
  def value
694
694
  a.text_value
695
695
  end
696
-
696
+
697
697
  def pos
698
- {a.interval.begin => ['year', a.interval.end]}
698
+ {a.interval.begin => ["year", a.interval.end]}
699
699
  end
700
-
700
+
701
701
  def details
702
702
  {:year => value}
703
703
  end
@@ -814,11 +814,11 @@ module ScientificNameDirty
814
814
  def value
815
815
  "(" + a.text_value + ")"
816
816
  end
817
-
817
+
818
818
  def pos
819
- {a.interval.begin => ['year', a.interval.end]}
819
+ {a.interval.begin => ["year", a.interval.end]}
820
820
  end
821
-
821
+
822
822
  def details
823
823
  {:approximate_year => value}
824
824
  end
@@ -905,11 +905,11 @@ module ScientificNameDirty
905
905
  def value
906
906
  text_value
907
907
  end
908
-
908
+
909
909
  def pos
910
- {interval.begin => ['year', interval.end]}
910
+ {interval.begin => ["year", interval.end]}
911
911
  end
912
-
912
+
913
913
  def details
914
914
  {:year => value}
915
915
  end
@@ -1020,7 +1020,7 @@ module ScientificNameDirty
1020
1020
  end
1021
1021
 
1022
1022
  def pos
1023
- {interval.begin => ['year', interval.end]}
1023
+ {interval.begin => ["year", interval.end]}
1024
1024
  end
1025
1025
 
1026
1026
  def details