bpl_enrich 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bpl_enrich/dates.rb +1 -0
- data/lib/bpl_enrich/version.rb +1 -1
- data/test/dates_test.rb +21 -0
- data/test/dummy/log/test.log +30 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69ccce9a084733f7f9fb63c6a26dba0c74818829
|
4
|
+
data.tar.gz: e33886a42dcf60f031932f22181cfd82fcb0fa78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be415afcc29ca30c9fa7dab438b5a7949dccc22586ae82ad14783c637063e59a14f4da59470454facfcfc3d000cf9c5117ae8e001da9c139a5d598a64e538e5e
|
7
|
+
data.tar.gz: ae47de03455d706e6578967f9bb79564911c550e8fc7aa3b77079f28d0b99d62397e94b86d9beb63e11320328760cc7fb05c90803f17755382d29df8f23ac641
|
data/lib/bpl_enrich/dates.rb
CHANGED
@@ -72,6 +72,7 @@ module BplEnrich
|
|
72
72
|
# remove unnecessary chars and words
|
73
73
|
value = value.gsub(/[\[\]\(\)\.,']/,'')
|
74
74
|
value = value.gsub(/(\b[Bb]etween\b|\b[Cc]irca\b|\bca\b|\Aca|\Ac)/,'').strip
|
75
|
+
value = value.gsub(/-00/,'') # 1995-00 || 1995-01-00
|
75
76
|
|
76
77
|
# differentiate between ranges and single dates
|
77
78
|
if (value.scan(/\d\d\d\d/).length == 2) ||
|
data/lib/bpl_enrich/version.rb
CHANGED
data/test/dates_test.rb
CHANGED
@@ -59,6 +59,27 @@ class DatesTest < ActiveSupport::TestCase
|
|
59
59
|
assert_equal nil, result[:date_note]
|
60
60
|
assert_equal 'approximate', result[:date_qualifier]
|
61
61
|
assert_equal nil, result[:date_note]
|
62
|
+
|
63
|
+
result = BplEnrich::Dates.standardize('1995-01-00')
|
64
|
+
assert_equal '1995-01', result[:single_date]
|
65
|
+
assert_equal nil, result[:date_range]
|
66
|
+
assert_equal nil, result[:date_note]
|
67
|
+
assert_equal nil, result[:date_qualifier]
|
68
|
+
assert_equal nil, result[:date_note]
|
69
|
+
|
70
|
+
result = BplEnrich::Dates.standardize('1996-00-00')
|
71
|
+
assert_equal '1996', result[:single_date]
|
72
|
+
assert_equal nil, result[:date_range]
|
73
|
+
assert_equal nil, result[:date_note]
|
74
|
+
assert_equal nil, result[:date_qualifier]
|
75
|
+
assert_equal nil, result[:date_note]
|
76
|
+
|
77
|
+
result = BplEnrich::Dates.standardize('1997-00')
|
78
|
+
assert_equal '1997', result[:single_date]
|
79
|
+
assert_equal nil, result[:date_range]
|
80
|
+
assert_equal nil, result[:date_note]
|
81
|
+
assert_equal nil, result[:date_qualifier]
|
82
|
+
assert_equal nil, result[:date_note]
|
62
83
|
end
|
63
84
|
|
64
85
|
|
data/test/dummy/log/test.log
CHANGED
@@ -208,3 +208,33 @@ BplEnrichTest: test_strip_value
|
|
208
208
|
DatesTest: test_date_standardizer
|
209
209
|
---------------------------------
|
210
210
|
[1m[35m (0.0ms)[0m rollback transaction
|
211
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
212
|
+
--------------------------------
|
213
|
+
LCSHTest: test_lcsh_standardizer
|
214
|
+
--------------------------------
|
215
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
216
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
217
|
+
---------------------------------
|
218
|
+
DatesTest: test_date_standardizer
|
219
|
+
---------------------------------
|
220
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
221
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
222
|
+
-------------------------------
|
223
|
+
BplEnrichTest: test_strip_value
|
224
|
+
-------------------------------
|
225
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
226
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
227
|
+
------------------------------------
|
228
|
+
AuthoritiesTest: test_parse_language
|
229
|
+
------------------------------------
|
230
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
231
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
232
|
+
-----------------------------------------
|
233
|
+
AuthoritiesTest: test_parse_name_for_role
|
234
|
+
-----------------------------------------
|
235
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
236
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
237
|
+
--------------------------------
|
238
|
+
AuthoritiesTest: test_parse_role
|
239
|
+
--------------------------------
|
240
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bpl_enrich
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boston Public Library
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
170
|
rubyforge_project:
|
171
|
-
rubygems_version: 2.
|
171
|
+
rubygems_version: 2.5.2
|
172
172
|
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Methods for enriching and standardizing metadata.
|