diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/refcat/tasks.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py index d17a1f9..aaa0551 100644 --- a/python/refcat/tasks.py +++ b/python/refcat/tasks.py @@ -711,7 +711,7 @@ class OpenLibraryWorks(Refcat): class OpenLibraryMapped(Refcat): """ - Map OL data with e.g. a title normalizing mapper. + Map OL data with e.g. a title normalizing mapper. 4m8.341s. """ mapper = luigi.Parameter(default="ts", description="mapper short name") @@ -734,3 +734,27 @@ class OpenLibraryMapped(Refcat): def output(self): return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd) + +class BrefZipFuzzyOpenLibrary(Refcat): + """ + Fuzzy matching from refs to open library (both converted to release schema). + """ + mapper = luigi.Parameter(default="ts", description="mapper short name") + + def requires(self): + return { + "refs": RefsMapped(mapper=self.mapper), + "ol": OpenLibraryMapped(mapper=self.mapper), + } + + def run(self): + output = shellout(r""" + skate-reduce -m ol -F <(zstdcat -T0 {refs}) -O <(zstdcat -T0 {ol}) | + zstd -c -T0 > {output} + """, + refs=self.input().get("refs").path, + ol=self.input().get("ol").path) + luigi.LocalTarget(output).move(self.output().path) + + def output(self): + return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd) |