dwc_agent 1.5.1.0 → 1.5.1.5
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.
- checksums.yaml +4 -4
- data/lib/dwc_agent/constants.rb +11 -6
- data/lib/dwc_agent/parser.rb +2 -6
- data/lib/dwc_agent/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60fb91c31b1d74e63657e5c8ba4e7993d521524303689b74110d17e61e3cadf9
|
4
|
+
data.tar.gz: 8e38c2448aa5c059a0437fd14a47c0c6d9fa77e4a00b5a4a3269b0a10b2d0e18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1a7fe93b0dbffd440cd68f4e1ffd330bf5cc66deae97e4414bf17d25784662b94e545c24203a7c184b122f96e30dc022bdeb906456c3a17ad3830739acab16d
|
7
|
+
data.tar.gz: 15d764c70cc733f1534ce552322f994d224d5e702b8e0cdccb085fd53a5f12320d4dacb862b7a9413b3144980f4856d5e32451516c0f22beff51935295a3c581
|
data/lib/dwc_agent/constants.rb
CHANGED
@@ -12,6 +12,7 @@ module DwcAgent
|
|
12
12
|
\bu\.\s*a\.|
|
13
13
|
\b[,;]?\s*(?i:and|&)?\s*(?i:others|party)\s*\b|
|
14
14
|
\b[,;]?\s*(?i:etc)\.?|
|
15
|
+
\b[,;]?\s*(?i:exp)\.?\s*(\b|\z)|
|
15
16
|
\b[,;]?\s*(?i:on)\b|
|
16
17
|
\b[,;]?\s*(?i:unkn?own)\b|
|
17
18
|
\b[,;]?\s*(?i:n/a)\b|
|
@@ -51,7 +52,7 @@ module DwcAgent
|
|
51
52
|
\d+\s+(?i:Nov|Novemb(er|re))\.?\b|
|
52
53
|
\d+\s+(?i:Dec|D(e|é)cemb(er|re))\.?\b|
|
53
54
|
\b[.-–,;:/]?\s*(?i:Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|Evergreen|Florida|Hawaii|Idaho|Illinois|Indiana|Iowa|Kansas|Kentucky|Louisiana|Maine|Maryland|Massachusetts|Michigan|Minnesota|Mississippi|Missouri|Montana|Nebraska|Nevada|New\s+Hampshire|New\s+Jersey|New\s+Mexico|New\s+York|North\s+Carolina|North\s+Dakota|Ohio|Oklahoma|Oregon|Pennsylvania|Portland|Rhode\s+Island|South\s+Carolina|South\s+Dakota|St\s+Petersburg|Tennessee|Texas|Utah|Vermont|Washington|West\s+Virginia|Wisconsin|Wyoming)\s+(?i:State)\s*\b|
|
54
|
-
\b[.,;:/]?\s*?(?i:Afghanistan|Åland Islands|Albania|Algeria|American Samoa|Andorra|Angola|Anguilla|Antarctica|Antigua and Barbuda|Argentina|Armenia|Aruba|Australia|Austria|Azerbaijan|Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bermuda|Bhutan|Bolivia \(Plurinational State of\)|Bonaire, Sint Eustatius and Saba|Bosnia and Herzegovina|Botswana|Bouvet Island|Brazil|British Indian Ocean Territory|Brunei Darussalam|Bulgaria|Burkina Faso|Burundi|Cabo Verde|Cambodia|Cameroon|Canada|Cayman Islands|Central African Republic|Chad|Chile|China|Christmas Island|Cocos \(Keeling\) Islands|Colombia|Comoros|Congo|Congo \(Democratic Republic of the\)|Cook Islands|Costa Rica|Côte d'Ivoire|Croatia|Cuba|Curaçao|Cyprus|Czechia|Denmark|Djibouti|Dominica|Dominican Republic|Ecuador|Egypt|El Salvador|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Falkland Islands \(Malvinas\)|Faroe Islands|Fiji|Finland|France|French Guiana|French Polynesia|French Southern Territories|Gabon|Gambia|Germany|Ghana|Gibraltar|Greece|Greenland|Grenada|Guadeloupe|Guam|Guatemala|Guernsey|Guinea|Guinea-Bissau|Guyana|Haiti|Heard Island and McDonald Islands|Holy See|Honduras|Hong Kong|Hungary|Iceland|India|Indonesia|Iran \(Islamic Republic of\)|Iraq|Ireland|Isle of Man|Israel|Italy|Jamaica|Japan|Jersey|Kazakhstan|Kenya|Kiribati|Korea \(Democratic People\'s Republic of\)|Korea \(Republic of\)|Kuwait|Kyrgyzstan|Lao People\'s Democratic Republic|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|Macao|Macedonia (the former Yugoslav Republic of)|Madagascar|Malawi|Malaysia|Maldives|
|
55
|
+
\b[.,;:/]?\s*?(?i:Afghanistan|Åland Islands|Albania|Algeria|American Samoa|Andorra|Angola|Anguilla|Antarctica|Antigua and Barbuda|Argentina|Armenia|Aruba|Australia|Austria|Azerbaijan|Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bermuda|Bhutan|Bolivia \(Plurinational State of\)|Bonaire, Sint Eustatius and Saba|Bosnia and Herzegovina|Botswana|Bouvet Island|Brazil|British Indian Ocean Territory|Brunei Darussalam|Bulgaria|Burkina Faso|Burundi|Cabo Verde|Cambodia|Cameroon|Canada|Cayman Islands|Central African Republic|Chad|Chile|China|Christmas Island|Cocos \(Keeling\) Islands|Colombia|Comoros|Congo|Congo \(Democratic Republic of the\)|Cook Islands|Costa Rica|Côte d'Ivoire|Croatia|Cuba|Curaçao|Cyprus|Czechia|Denmark|Djibouti|Dominica|Dominican Republic|Ecuador|Egypt|El Salvador|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Falkland Islands \(Malvinas\)|Faroe Islands|Fiji|Finland|France|French Guiana|French Polynesia|French Southern Territories|Gabon|Gambia|Germany|Ghana|Gibraltar|Greece|Greenland|Grenada|Guadeloupe|Guam|Guatemala|Guernsey|Guinea|Guinea-Bissau|Guyana|Haiti|Heard Island and McDonald Islands|Holy See|Honduras|Hong Kong|Hungary|Iceland|India|Indonesia|Iran \(Islamic Republic of\)|Iraq|Ireland|Isle of Man|Israel|Italy|Jamaica|Japan|Jersey|Kazakhstan|Kenya|Kiribati|Korea \(Democratic People\'s Republic of\)|Korea \(Republic of\)|Kuwait|Kyrgyzstan|Lao People\'s Democratic Republic|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|Macao|Macedonia (the former Yugoslav Republic of)|Madagascar|Malawi|Malaysia|Maldives|Malta|Marshall Islands|Martinique|Mauritania|Mauritius|Mayotte|Mexico|Micronesia \(Federated States of\)|Moldova \(Republic of\)|Monaco|Mongolia|Montenegro|Montserrat|Morocco|Mozambique|Myanmar|Namibia|Nauru|Nepal|Netherlands|New Caledonia|New Zealand|Nicaragua|Niger|Nigeria|Niue|Norfolk Island|Northern Mariana Islands|Norway|Oman|Pakistan|Palau|Palestine, State of|Panama|Papua New Guinea|Paraguay|Peru|Philippines|Pitcairn|Poland|Portugal|Puerto Rico|Qatar|Réunion|Romania|Russian Federation|Rwanda|Saint Barthélemy|Saint Helena, Ascension and Tristan da Cunha|Saint Kitts and Nevis|Saint Lucia|Saint Martin \(French part\)|Saint Pierre and Miquelon|Saint Vincent and the Grenadines|Samoa|San Marino|Sao Tome and Principe|Saudi Arabia|Senegal|Serbia|Seychelles|Sierra Leone|Singapore|Sint Maarten \(Dutch part\)|Slovakia|Slovenia|Solomon Islands|Somalia|South Africa|South Georgia and the South Sandwich Islands|South Sudan|Spain|Sri Lanka|Sudan|Suriname|Svalbard and Jan Mayen|Swaziland|Sweden|Switzerland|Syrian Arab Republic|Taiwan|Tajikistan|Tanzania, United Republic of|Thailand|Timor-Leste|Togo|Tokelau|Tonga|Trinidad and Tobago|Tunisia|Turkey|Turkmenistan|Turks and Caicos Islands|Tuvalu|Uganda|Ukraine|United Arab Emirates|United Kingdom of Great Britain and Northern Ireland|United States of America|United States Minor Outlying Islands|Uruguay|Uzbekistan|Vanuatu|Venezuela \(Bolivarian Republic of\)|Viet Nam|Virgin Islands \(British\)|Virgin Islands \(U\.S\.\)|Wallis and Futuna|Western Sahara|Yemen|Zambia|Zimbabwe)\b|
|
55
56
|
(?i:autres?\s+de|probab|likely|possibl(e|y)|doubtful)|
|
56
57
|
\b\s*(?i:maybe)\s*\b|
|
57
58
|
\b\s*(?i:prob)\.\s*\b|
|
@@ -89,7 +90,7 @@ module DwcAgent
|
|
89
90
|
\b(?i:to\s+(sub)?spp?)\.?|
|
90
91
|
(?i:nom\.?\s+rev\.?)|
|
91
92
|
FNA|DAO|HUH|FDNMB|MNHN|PNI|USNM|ZMUC|CSIRO|ACAD|USGS|NAWQA|
|
92
|
-
|
93
|
+
(?i:para|topo|syn|holo|allo|choro|eco|iso|isoepi|isopara|karyo|morpho|neo|mero|pala|paralecto|paraneo|photo|schizo)?(?i:types?\:?)|
|
93
94
|
AFSC\/POLISH\s+SORTING\s+CTR\.?|
|
94
95
|
(?i:university|museum|exhibits?)|
|
95
96
|
(?i:uqam)|
|
@@ -190,9 +191,12 @@ module DwcAgent
|
|
190
191
|
'-Jr' => ' Jr.'
|
191
192
|
}
|
192
193
|
|
193
|
-
|
194
|
-
^(
|
195
|
-
|
194
|
+
SEPARATORS = {
|
195
|
+
"^(\\S{4,},\\s+(?:\\S\\.\\s*){1,})\\s+(\\S{4,},\\s+(?:\\S\.\\s*){1,})$" => "\\1 | \\2",
|
196
|
+
"(\\S{1}\\.)([[:alpha:]]{2,})" => "\\1 \\2",
|
197
|
+
"(\\w*),?\\s+(.*)\\s+(van|von)$" => "\\3 \\1, \\2",
|
198
|
+
"^([A-Z.]+)\\s+(?:and|&)\\s+([A-Z.]+)\\s+(.*)$" => "\\1 \\3 | \\2 \\3"
|
199
|
+
}
|
196
200
|
|
197
201
|
BLACKLIST = %r{
|
198
202
|
(?i:abundant)|
|
@@ -216,6 +220,7 @@ module DwcAgent
|
|
216
220
|
(?i:exc?s?icc?at(a|i))|
|
217
221
|
(?i:evidence)|
|
218
222
|
(?i:exporter)|
|
223
|
+
(?i:foundation)|
|
219
224
|
(?i:ichthyology)|
|
220
225
|
(?i:inconn?u)|
|
221
226
|
(?i:internation|gou?vern|ministry|extension|unit|district|provincial|na(c|t)ional|military|region|environ|natur(e|al)|naturelles|division|program|direction|national)|
|
@@ -244,7 +249,7 @@ module DwcAgent
|
|
244
249
|
(?i:skeleton)|
|
245
250
|
(?i:survey|assessment|station|monitor|stn\.|index|project|bureau|engine|(e|é)x?chang(e|é)s?|ex(c|k)ursi(e|o|ó)n?|exped\.?|exp(e|i)di(c|t)i(e|o|ó)n?|experiment|explora(d|t)|festival|generation|inventory|marine|service)|
|
246
251
|
(?i:submersible)|
|
247
|
-
(?i:synonymy?)|
|
252
|
+
(?i:synonymy?)|
|
248
253
|
(?i:systematic|perspective)|
|
249
254
|
\s+(?i:off)\s+|
|
250
255
|
\s*(?i:too)\s+|\s*(?i:the)\s+|
|
data/lib/dwc_agent/parser.rb
CHANGED
@@ -16,13 +16,10 @@ module DwcAgent
|
|
16
16
|
suffix: SUFFIX
|
17
17
|
}
|
18
18
|
@namae = Namae::Parser.new(options)
|
19
|
-
|
20
19
|
@strip_out_regex = Regexp.new STRIP_OUT.to_s
|
21
|
-
@residual_terminators_regex = Regexp.new SPLIT_BY.to_s + %r{\s*\z}.to_s
|
22
20
|
@char_subs_regex = Regexp.new [CHAR_SUBS.keys.join].to_s
|
23
21
|
@phrase_subs_regex = Regexp.new PHRASE_SUBS.keys.map{|a| Regexp.escape a }.join('|').to_s
|
24
|
-
@
|
25
|
-
@add_separators_regex = Regexp.new %r{(\S{1}\.)([[:alpha:]]{2,})}.to_s
|
22
|
+
@residual_terminators_regex = Regexp.new SPLIT_BY.to_s + %r{\s*\z}.to_s
|
26
23
|
end
|
27
24
|
|
28
25
|
# Parses the passed-in string and returns a list of names.
|
@@ -35,8 +32,7 @@ module DwcAgent
|
|
35
32
|
name.gsub!(/\[|\]/, '')
|
36
33
|
name.gsub!(@char_subs_regex, CHAR_SUBS)
|
37
34
|
name.gsub!(@phrase_subs_regex, PHRASE_SUBS)
|
38
|
-
name.gsub!(
|
39
|
-
name.gsub!(@complex_separators_regex, '\1 | \2')
|
35
|
+
SEPARATORS.each{|key, value| name.gsub!(Regexp.new(key), value)}
|
40
36
|
name.gsub!(@residual_terminators_regex, '')
|
41
37
|
name.squeeze!(' ')
|
42
38
|
name.strip!
|
data/lib/dwc_agent/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dwc_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.1.
|
4
|
+
version: 1.5.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David P. Shorthouse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: namae
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
122
|
+
rubygems_version: 3.2.4
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Parse Darwin Core agent terms such as recordedBy and identifiedBy
|