diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-05-24 20:32:42 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-05-24 20:32:42 +0200 |
commit | 8b18e4311aceae98f730dc655c24ba72494dc9ae (patch) | |
tree | e65cb2d63ed1be69720cc0a1332e04f4e6941fd1 /python | |
parent | 08bc9a7cace627ae730f765739ce71913ce376b3 (diff) | |
download | refcat-8b18e4311aceae98f730dc655c24ba72494dc9ae.tar.gz refcat-8b18e4311aceae98f730dc655c24ba72494dc9ae.zip |
tasks: add UnmatchedMapped, for OL
Diffstat (limited to 'python')
-rw-r--r-- | python/refcat/tasks.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py index 54a5890..fa72062 100644 --- a/python/refcat/tasks.py +++ b/python/refcat/tasks.py @@ -747,3 +747,24 @@ class OpenLibraryWorksSorted(Refcat): def output(self): return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd) + +class UnmatchedMapped(Refcat): + """ + Map unmatched refs (in release schema) to titles to do approximate title matches with OL. + """ + + def requires(self): + return UnmatchedRefs() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + skate-map -m ts | + LC_ALL=C sort -T {tmpdir} -S25% -k1,1 --parallel 4 | + zstd -T0 -c > {output} + """, + tmpdir=self.tmpdir, + input=self.input().path) + + def output(self): + return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd) |