anystyle-parser 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/anystyle/parser/normalizer.rb +3 -2
- data/lib/anystyle/parser/version.rb +1 -1
- data/spec/anystyle/parser/normalizer_spec.rb +12 -1
- 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: 631f1662988a92106ea88a98bca0069978917f61
|
4
|
+
data.tar.gz: dcc843a4d6da021d6bf09724353824f78e126d3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0450da79bb01fdc1817c3f28315e0837630c4d0a751201dfe40f62254f0f6ab936a6f06be596b6786fa1d6b331e9c85e68d671c16b377829a3c080317db5c401
|
7
|
+
data.tar.gz: 0b56e7522faaa010334148ebc8a3fc5300f097137ec9a156cec738b23c2fb8e76474b22877165c00a42ceccd5f54d5349b1f13322526b435ebd123d7200ca33f
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
Anystyle-Parser
|
2
2
|
===============
|
3
|
-
[![Build Status](https://travis-ci.org/inukshuk/anystyle-parser.
|
4
|
-
[![Coverage Status](https://coveralls.io/repos/inukshuk/anystyle-parser/badge.
|
3
|
+
[![Build Status](https://travis-ci.org/inukshuk/anystyle-parser.svg?branch=master)](https://travis-ci.org/inukshuk/anystyle-parser)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/github/inukshuk/anystyle-parser/badge.svg?branch=master)](https://coveralls.io/github/inukshuk/anystyle-parser?branch=master)
|
5
|
+
[![Flattr us](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=inukshuk&url=https://anystyle.io&title=AnyStyle&description=Parses%20scholarly%20references%20in%20no%20time!&tags=programming,bibliography,parser,machine%20learning,api&language=en_GB&category=software)
|
5
6
|
|
6
7
|
Anystyle-Parser is a very fast and smart parser for academic references. It
|
7
8
|
is inspired by [ParsCit](http://aye.comp.nus.edu.sg/parsCit/) and
|
@@ -138,7 +138,7 @@ module Anystyle
|
|
138
138
|
end
|
139
139
|
|
140
140
|
def strip_et_al(names)
|
141
|
-
!!names.sub!(/(\bet\s+al\b|\bu\.\s*a\.|(\band|\&)\s+others).*$/, '')
|
141
|
+
!!names.sub!(/(\bet\s+(al|coll)\b|\bu\.\s*a\.|(\band|\&)\s+others).*$/, '')
|
142
142
|
end
|
143
143
|
|
144
144
|
def normalize_translator(hash)
|
@@ -148,6 +148,7 @@ module Anystyle
|
|
148
148
|
translators.gsub!(/^\W+|\W+$/, '')
|
149
149
|
translators.gsub!(/[^[:alpha:]]*\btrans(l(ated)?)?\b[^[:alpha:]]*/i, '')
|
150
150
|
translators.gsub!(/\bby\b/i, '')
|
151
|
+
translators.gsub!(/\btrad\./i, '')
|
151
152
|
|
152
153
|
hash[:translator] = normalize_names(translators)
|
153
154
|
hash
|
@@ -312,7 +313,7 @@ module Anystyle
|
|
312
313
|
hash = normalize_pages(hash)
|
313
314
|
else
|
314
315
|
case volume
|
315
|
-
when /\D*(\d+)\D+(\d+[\s
|
316
|
+
when /\D*(\d+)\D+(\d+[\s\/&—–-]+\d+)/
|
316
317
|
hash[:volume], hash[:number] = $1.to_i, $2
|
317
318
|
when /(\d+)?\D+no\.\s*(\d+\D+\d+)/
|
318
319
|
hash[:volume] = $1.to_i unless $1.nil?
|
@@ -62,7 +62,8 @@ module Anystyle
|
|
62
62
|
['Edgar A. Poe, Herman Melville', 'Poe, Edgar A. and Melville, Herman'],
|
63
63
|
['Edgar A. Poe; Herman Melville', 'Poe, Edgar A. and Melville, Herman'],
|
64
64
|
['Poe, Edgar A., Melville, Herman', 'Poe, Edgar A. and Melville, Herman'],
|
65
|
-
['Aeschlimann Magnin, E.', 'Aeschlimann Magnin, E.']
|
65
|
+
['Aeschlimann Magnin, E.', 'Aeschlimann Magnin, E.'],
|
66
|
+
['Yang, Q., Mudambi, R., & Meyer, K. E.', 'Yang, Q. and Mudambi, R. and Meyer, K.E.']
|
66
67
|
].each do |name, normalized|
|
67
68
|
it "tokenizes #{name.inspect}" do
|
68
69
|
expect(Normalizer.instance.normalize_names(name)).to eq(normalized)
|
@@ -124,6 +125,7 @@ module Anystyle
|
|
124
125
|
expect(n.normalize_editor(:editor => 'Edward Wood u. a.')[:editor]).to eq('Wood, Edward')
|
125
126
|
expect(n.normalize_editor(:editor => 'Edward Wood and others')[:editor]).to eq('Wood, Edward')
|
126
127
|
expect(n.normalize_editor(:editor => 'Edward Wood & others')[:editor]).to eq('Wood, Edward')
|
128
|
+
expect(n.normalize_editor(:editor => 'Edward Wood et coll.')[:editor]).to eq('Wood, Edward')
|
127
129
|
end
|
128
130
|
end
|
129
131
|
|
@@ -137,6 +139,8 @@ module Anystyle
|
|
137
139
|
expect(n.normalize_translator(:translator => 'übers. v. J Doe')).to eq({ :translator => 'Doe, J.' })
|
138
140
|
expect(n.normalize_translator(:translator => 'Übersetzung v. J Doe')).to eq({ :translator => 'Doe, J.' })
|
139
141
|
expect(n.normalize_translator(:translator => 'In der Übersetzung von J Doe')).to eq({ :translator => 'Doe, J.' })
|
142
|
+
expect(n.normalize_translator(:translator => 'Trad. J Doe')).to eq({ :translator => 'Doe, J.' })
|
143
|
+
expect(n.normalize_translator(:translator => 'trad. J Doe')).to eq({ :translator => 'Doe, J.' })
|
140
144
|
end
|
141
145
|
end
|
142
146
|
|
@@ -185,6 +189,13 @@ module Anystyle
|
|
185
189
|
end
|
186
190
|
end
|
187
191
|
|
192
|
+
describe '#normalize_volume' do
|
193
|
+
it "strips in from beginning" do
|
194
|
+
expect(n.normalize_volume(:volume => '11(2/3)'))
|
195
|
+
.to eq({ :volume => 11, :number => '2/3' })
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
188
199
|
end
|
189
200
|
|
190
201
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anystyle-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bibtex-ruby
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.6.3
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Smart and fast academic bibliography parser.
|