biblicit 2.0.8 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/biblicit/citeseer.rb +2 -1
- data/lib/biblicit/parscit.rb +19 -1
- data/lib/biblicit/version.rb +1 -1
- metadata +1 -1
data/lib/biblicit/citeseer.rb
CHANGED
@@ -30,7 +30,8 @@ module CiteSeer
|
|
30
30
|
def parse(xml)
|
31
31
|
{
|
32
32
|
title: xml.css('title').text,
|
33
|
-
authors: xml.css('author > name').map { |n| n.text },
|
33
|
+
authors: xml.css('author > name').map { |n| n.text.strip }.reject(&:blank?).uniq,
|
34
|
+
author_emails: xml.css('author > email').map { |n| n.text.strip }.reject(&:blank?).uniq,
|
34
35
|
abstract: xml.css('abstract').text,
|
35
36
|
valid: xml.css('validHeader').first.text == '1',
|
36
37
|
}
|
data/lib/biblicit/parscit.rb
CHANGED
@@ -26,11 +26,29 @@ module ParsCit
|
|
26
26
|
|
27
27
|
def parse(xml)
|
28
28
|
parsed = xml.css("algorithm[name=ParsHed]")
|
29
|
-
|
29
|
+
|
30
|
+
result = {
|
30
31
|
title: parsed.css('title').text.gsub(/\s+/,' ').strip,
|
31
32
|
authors: parsed.css('author').map { |a| a.text.gsub(/\s+/,' ').strip },
|
32
33
|
abstract: parsed.css('abstract').text
|
33
34
|
}
|
35
|
+
|
36
|
+
citations = xml.css('algorithm[name=ParsCit] > citationList > citation').map do |node|
|
37
|
+
cite = {
|
38
|
+
authors: node.css('author').map(&:text).map(&:strip).reject(&:blank?).uniq
|
39
|
+
}
|
40
|
+
|
41
|
+
node.children.each do |child|
|
42
|
+
unless ['contexts','authors','marker','rawString'].include?(child.name) || (text = child.text.strip).blank?
|
43
|
+
cite[child.name.to_sym] = text
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
cite
|
48
|
+
end
|
49
|
+
|
50
|
+
result[:citations] = citations
|
51
|
+
result
|
34
52
|
end
|
35
53
|
|
36
54
|
end
|
data/lib/biblicit/version.rb
CHANGED