relaton-ieee 1.12.0 → 1.12.3
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/README.adoc +1 -1
- data/lib/relaton_ieee/data_fetcher.rb +2 -2
- data/lib/relaton_ieee/hit_collection.rb +9 -13
- data/lib/relaton_ieee/pub_id.rb +3 -3
- data/lib/relaton_ieee/rawbib_id_parser.rb +1 -1
- data/lib/relaton_ieee/scrapper.rb +3 -1
- data/lib/relaton_ieee/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae6ce7435bdf251b1180ba075e3585f7075c289ab5ad58bbf7e26706d3fe10fe
|
4
|
+
data.tar.gz: b6475b2c93336560e490fea100879389d4323a7854180114d724443af0332e52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a630fdfff66077109cbbbad786783488c79a687de9d60b75b1ed42b03a46ab98c11542abbdbb7497dbe3220183d1512f7457339edfad3b459591fe2a3c06676
|
7
|
+
data.tar.gz: f2027e366b04f6cc59c0e219526082d9f171d22fdbbf91c42077b07e0c37a8508a715f8fb9eb7ae55c50eaf8974970fff15b7f6ade8389438061aaceace766fc
|
data/README.adoc
CHANGED
@@ -170,7 +170,7 @@ hash = YAML.load_file 'spec/fixtures/ieee_528_2019.yaml'
|
|
170
170
|
|
171
171
|
=== Fetch data
|
172
172
|
|
173
|
-
There is an IEEE dataset https://github.com/
|
173
|
+
There is an IEEE dataset https://github.com/relaton/ieee-rawbib which can be converted into BibXML/BibYAML formats. The dataset needs to be placed into local directiory.
|
174
174
|
|
175
175
|
The method `RelatonIeee::DataFetcher.fetch(output: "data", format: "yaml")` converts all the documents from the local `ieee-rawbib` directory and save them to the `./data` folder in YAML format.
|
176
176
|
Arguments:
|
@@ -44,7 +44,7 @@ module RelatonIeee
|
|
44
44
|
def self.fetch(output: "data", format: "yaml")
|
45
45
|
t1 = Time.now
|
46
46
|
puts "Started at: #{t1}"
|
47
|
-
FileUtils.mkdir_p output unless Dir.exist? output
|
47
|
+
FileUtils.mkdir_p output # unless Dir.exist? output
|
48
48
|
new(output, format).fetch
|
49
49
|
t2 = Time.now
|
50
50
|
puts "Stopped at: #{t2}"
|
@@ -113,7 +113,7 @@ module RelatonIeee
|
|
113
113
|
amsid = doc.at("./publicationinfo/amsid").text
|
114
114
|
if backrefs.value?(bib.docidentifier[0].id) && /updates\.\d+/ !~ filename
|
115
115
|
oamsid = backrefs.key bib.docidentifier[0].id
|
116
|
-
warn "Document exists ID: \"#{bib.docidentifier[0].id}\" AMSID: "\
|
116
|
+
warn "Document exists ID: \"#{bib.docidentifier[0].id}\" AMSID: " \
|
117
117
|
"\"#{amsid}\" source: \"#{filename}\". Other AMSID: \"#{oamsid}\""
|
118
118
|
if bib.docidentifier[0].id.include?(doc.at("./publicationinfo/stdnumber").text)
|
119
119
|
save_doc bib # rewrite file if the PubID matches to the stdnumber
|
@@ -5,40 +5,36 @@ require "fileutils"
|
|
5
5
|
module RelatonIeee
|
6
6
|
class HitCollection < RelatonBib::HitCollection
|
7
7
|
DOMAIN = "https://standards.ieee.org".freeze
|
8
|
-
DATADIR = File.expand_path ".relaton/ogc/", Dir.home
|
9
|
-
DATAFILE = File.expand_path "bibliography.json", DATADIR
|
10
|
-
ETAGFILE = File.expand_path "etag.txt", DATADIR
|
11
|
-
|
12
|
-
# rubocop:disable Metrics/AbcSize
|
8
|
+
# DATADIR = File.expand_path ".relaton/ogc/", Dir.home
|
9
|
+
# DATAFILE = File.expand_path "bibliography.json", DATADIR
|
10
|
+
# ETAGFILE = File.expand_path "etag.txt", DATADIR
|
13
11
|
|
14
12
|
# @param reference [Strig]
|
15
13
|
# @param opts [Hash]
|
16
|
-
def initialize(reference) # rubocop:disable Metrics/MethodLength
|
14
|
+
def initialize(reference) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
17
15
|
super
|
18
16
|
code1 = reference.sub(/^IEEE\s(Std\s)?/, "")
|
19
17
|
url = "#{DOMAIN}/wp-admin/admin-ajax.php"
|
20
18
|
query = reference.gsub("/", " ")
|
21
19
|
resp = Faraday.post url, { action: "ieee_cloudsearch", q: query }
|
22
20
|
json = JSON.parse resp.body
|
23
|
-
|
24
|
-
|
21
|
+
unless json["results"]
|
22
|
+
@array = []
|
23
|
+
return
|
24
|
+
end
|
25
|
+
|
25
26
|
@array = json["results"]["hits"]["hit"].reduce([]) do |s, hit|
|
26
27
|
flds = hit["fields"]
|
27
|
-
# ref = hit.text.strip
|
28
|
-
# /^(?:\w+\s)?(?<code2>[A-Z\d.]+)(?:-(?<year>\d{4}))?/ =~ ref
|
29
28
|
/^(?:\w+\s)?(?<code2>[A-Z\d.]+)(?:-(?<year>\d{4}))?/ =~ flds["meta_designation_l"]
|
30
29
|
next s unless code2 && code1 =~ %r{^#{code2}}
|
31
30
|
|
32
31
|
hit_data = {
|
33
32
|
ref: flds["meta_designation_l"],
|
34
|
-
# title: flds["meta_title_t"],
|
35
|
-
# abstract: flds["meta_description_l"],
|
36
33
|
year: year.to_i,
|
37
34
|
url: flds["doc_id_l"],
|
38
35
|
}
|
39
36
|
s << Hit.new(hit_data, self)
|
40
37
|
end.sort_by { |h| h.hit[:year].to_s + h.hit[:url] }.reverse
|
41
38
|
end
|
42
|
-
# rubocop:enable Metrics/AbcSize
|
43
39
|
end
|
44
40
|
end
|
data/lib/relaton_ieee/pub_id.rb
CHANGED
@@ -28,7 +28,7 @@ module RelatonIeee
|
|
28
28
|
# @option args [String] :year
|
29
29
|
# @option args [String] :month
|
30
30
|
#
|
31
|
-
def initialize(number:, **args) # rubocop:disable Metrics/MethodLength
|
31
|
+
def initialize(number:, **args) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
32
32
|
@publisher = args[:publisher]
|
33
33
|
@stage = args[:stage]
|
34
34
|
@number = number
|
@@ -56,7 +56,7 @@ module RelatonIeee
|
|
56
56
|
out = "#{approval} #{out}" if approval
|
57
57
|
out = "#{status} #{out}" if status
|
58
58
|
out = "#{publisher} #{out}" if publisher
|
59
|
-
out += "
|
59
|
+
out += ".#{part}" if part
|
60
60
|
out += edition_to_s + draft_to_s + rev_to_s + corr_to_s + amd_to_s
|
61
61
|
out + year_to_s + month_to_s + redline_to_s
|
62
62
|
end
|
@@ -82,7 +82,7 @@ module RelatonIeee
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def year_to_s
|
85
|
-
year ? "
|
85
|
+
year ? "-#{year}" : ""
|
86
86
|
end
|
87
87
|
|
88
88
|
def month_to_s
|
@@ -39,7 +39,9 @@ module RelatonIeee
|
|
39
39
|
# @param ref [String]
|
40
40
|
# @return [Array<RelatonBib::DocumentIdentifier>]
|
41
41
|
def fetch_docid(ref)
|
42
|
-
|
42
|
+
args = { id: ref, type: "IEEE", primary: true }
|
43
|
+
args[:scope] = "trademark" if ref.match?(/^IEEE\s(?:Std\s)?(?:802|2030)/)
|
44
|
+
[RelatonBib::DocumentIdentifier.new(**args)]
|
43
45
|
end
|
44
46
|
|
45
47
|
# @param url [String]
|
data/lib/relaton_ieee/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-ieee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06
|
11
|
+
date: 2022-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|