dwc_agent 1.5.1.2 → 1.5.1.7
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 -5
- 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: afc5ec36b9305134423bbce68ae89477184b5eb290f103bed37c5a2e6281fd9a
|
4
|
+
data.tar.gz: c1e3d831330c261ff56e13fd011068de611e445e43f396cb993c6bd0740eb2ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73b6a8fbe5f77240bfd295352ef187f305877d01464906def2742c38bade4d142c0d20dd253854b92a8e14f92f9302b9a4bd0d79c6adc2fe151dc65d590cb09a
|
7
|
+
data.tar.gz: 38028bd6113ee128ee2353bfbb4a580f188684e9b722739661cc2f221dbbcdc7c1f105bda0be80f900026e9c2fd44fd1b7637f3afb46e8192034a62ddcf449ac
|
data/lib/dwc_agent/constants.rb
CHANGED
@@ -52,7 +52,7 @@ module DwcAgent
|
|
52
52
|
\d+\s+(?i:Nov|Novemb(er|re))\.?\b|
|
53
53
|
\d+\s+(?i:Dec|D(e|é)cemb(er|re))\.?\b|
|
54
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|
|
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|
|
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|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|
|
56
56
|
(?i:autres?\s+de|probab|likely|possibl(e|y)|doubtful)|
|
57
57
|
\b\s*(?i:maybe)\s*\b|
|
58
58
|
\b\s*(?i:prob)\.\s*\b|
|
@@ -111,7 +111,7 @@ module DwcAgent
|
|
111
111
|
(\(|\{|\[).{1,}(\)|\]|\})|
|
112
112
|
(\(|\[|\{).{1,}\z|
|
113
113
|
\b(?i:leg)[\.:]?\s*\b|
|
114
|
-
(
|
114
|
+
(?:[Dd](ed|on))[\.:]|
|
115
115
|
\d*[A-Za-z]*\d*-\d*\z|
|
116
116
|
\s+[A-Z]*\d+\z|
|
117
117
|
\s+\d+[A-Za-z]+\z|
|
@@ -191,9 +191,14 @@ module DwcAgent
|
|
191
191
|
'-Jr' => ' Jr.'
|
192
192
|
}
|
193
193
|
|
194
|
-
|
195
|
-
^(
|
196
|
-
|
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]+)\\s+(?:and|&|et|e)\\s+([A-Z.\\s]+)\\s+(\\w{2,})(.*)" => "\\1 \\3 | \\2 \\3 | \\4",
|
199
|
+
"^([A-Z]\\w{2,}),\\s*?([A-Z]\\w{2,})\\s*?[,&]\\s*?([A-Z]\\w{2,})$" => "\\1 | \\2 | \\3",
|
200
|
+
"^([A-Z]\\w{2,}),\\s*?([A-Z]\\w{2,}),\\s*?([A-Z]\\w{2,})\\s*?[,&]\\s*?([A-Z]\\w{3,})$" => "\\1 | \\2 | \\3 | \\4"
|
201
|
+
}
|
197
202
|
|
198
203
|
BLACKLIST = %r{
|
199
204
|
(?i:abundant)|
|
@@ -225,6 +230,7 @@ module DwcAgent
|
|
225
230
|
(?i:o?\.?m\.?n\.?r\.?)|
|
226
231
|
(?i:measurement)|
|
227
232
|
(?i:ent(o|y)mology)|
|
233
|
+
(?i:malacology)|
|
228
234
|
(?i:geographic)|
|
229
235
|
(?i:mus(eum|ée)|universit(y|é|e|at)|college|institute?|acad(e|é)m|school|écol(e|iers?)|laboratoi?r|projec?t|polytech|dep(t|art?ment)|research|clinic|hospital|cientifica|sanctuary|safari)|
|
230
236
|
(?i:univ\.)|
|
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.7
|
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-26 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
|