anystyle-parser 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +2 -1
- data/lib/anystyle/parser/features.rb +8 -0
- data/lib/anystyle/parser/normalizer.rb +18 -0
- data/lib/anystyle/parser/parser.rb +1 -1
- data/lib/anystyle/parser/support/anystyle.mod +6821 -4922
- data/lib/anystyle/parser/version.rb +1 -1
- metadata +15 -15
data/HISTORY.md
CHANGED
@@ -136,6 +136,14 @@ module Anystyle
|
|
136
136
|
:'internal-braces'
|
137
137
|
when /^[\(\[\{<].*[>\}\]\)]$/
|
138
138
|
:braces
|
139
|
+
when /^[\(\[\{<]/
|
140
|
+
:'opening-braces'
|
141
|
+
when /[>\}\]\)][\.]$/
|
142
|
+
:'terminal-closing-braces'
|
143
|
+
when /[>\}\]\)][,;:-]$/
|
144
|
+
:'internal-closing-braces'
|
145
|
+
when /^[>\}\]\)]$/
|
146
|
+
:'closing-braces'
|
139
147
|
when /[,;:-]$/
|
140
148
|
:internal
|
141
149
|
when /[!\?\."']$/
|
@@ -311,6 +311,24 @@ module Anystyle
|
|
311
311
|
warn e.message
|
312
312
|
hash
|
313
313
|
end
|
314
|
+
|
315
|
+
def normalize_location(hash)
|
316
|
+
location, *dangling = hash[:location]
|
317
|
+
unmatched(:pages, hash, dangling) unless dangling.empty?
|
318
|
+
|
319
|
+
location.gsub!(/^\W+|\W+$/, '')
|
320
|
+
|
321
|
+
if !hash.has_key?(:publisher) && location =~ /:/
|
322
|
+
location, publisher = location.split(/\s*:\s*/)
|
323
|
+
hash[:publisher] = publisher
|
324
|
+
end
|
325
|
+
|
326
|
+
hash[:location] = location
|
327
|
+
hash
|
328
|
+
rescue => e
|
329
|
+
warn e.message
|
330
|
+
hash
|
331
|
+
end
|
314
332
|
|
315
333
|
private
|
316
334
|
|
@@ -169,7 +169,7 @@ module Anystyle
|
|
169
169
|
hash[:type] = :book
|
170
170
|
when keys.include?(:institution)
|
171
171
|
hash[:type] = :techreport
|
172
|
-
when keys.include?(:school)
|
172
|
+
when keys.include?(:school) || text =~ /master('s)?\s+thesis/i
|
173
173
|
hash[:type] = :mastersthesis
|
174
174
|
when text =~ /unpublished/i
|
175
175
|
hash[:type] = :unpublished
|