aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-05-10 23:53:17 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-05-10 23:53:17 +0200
commit4fda7f72a87a863641138126c0b0e117a9b93d7b (patch)
tree22f763b3b0a7d188b3475e4f17ae5c45697a2b9e
parentb64fabdcb19d7f5c0368df21e297bbe7826fc3e8 (diff)
downloadrefcat-4fda7f72a87a863641138126c0b0e117a9b93d7b.tar.gz
refcat-4fda7f72a87a863641138126c0b0e117a9b93d7b.zip
add RefsDOI
-rw-r--r--python/refcat/tasks.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py
index 5b54b51..fbe7b1a 100644
--- a/python/refcat/tasks.py
+++ b/python/refcat/tasks.py
@@ -275,7 +275,7 @@ class UnmatchedRefs(Refcat):
class URLTabs(Refcat):
"""
- Extract (work ident, release ident, url, doc).
+ Extract (work ident, release ident, url, doc). 519m45.710s (about 55k docs/s).
"""
def requires(self):
return RefsWithUnstructured()
@@ -295,4 +295,24 @@ class URLTabs(Refcat):
def output(self):
return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd)
+class RefsDOI(Refcat):
+ """
+ Sorted (doi, doc) tuplics from refs.
+ """
+ def requires(self):
+ return RefsWithUnstructured()
+
+ def run(self):
+ output = shellout("""
+ zstdcat -T0 {input} |
+ skate-map -m ff -x biblio.doi |
+ LC_ALL=C sort -T {tmpdir} -k2,2 -S25% --parallel 4 |
+ zstd -T0 -c > {output}
+ """,
+ n=self.n,
+ tmpdir=self.tmpdir,
+ input=self.input().path)
+ luigi.LocalTarget(output).move(self.output().path)
+ def output(self):
+ return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd)