From 668de758a0ec8f6f9f0c146cd86c7262d32aaa5f Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Tue, 9 Jun 2020 18:29:59 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20dinglehopper:=20Support=20disabling?= =?UTF-8?q?=20metrics=20in=20the=20OCR-D=20interface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 +++++++ qurator/dinglehopper/ocrd-tool.json | 9 ++++++++- qurator/dinglehopper/ocrd_cli.py | 8 +++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5f5fa08..b088f70 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,13 @@ This generates HTML and JSON reports in the `OCR-D-OCR-TESS-EVAL` filegroup. ![dinglehopper displaying metrics and character differences](.screenshots/dinglehopper.png?raw=true) +You may also want to disable metrics and the green-red color scheme by +parameter: + +~~~ +ocrd-dinglehopper -I ABBYY-FULLTEXT,OCR-D-OCR-CALAMARI -O OCR-D-OCR-COMPARE-ABBYY-CALAMARI -p '{"metrics": false}' +~~~ + Testing ------- Use `pytest` to run the tests in [the tests directory](qurator/dinglehopper/tests): diff --git a/qurator/dinglehopper/ocrd-tool.json b/qurator/dinglehopper/ocrd-tool.json index 4710f35..1f009ae 100644 --- a/qurator/dinglehopper/ocrd-tool.json +++ b/qurator/dinglehopper/ocrd-tool.json @@ -16,7 +16,14 @@ ], "steps": [ "recognition/text-recognition" - ] + ], + "parameters": { + "metrics": { + "type": "boolean", + "default": true, + "description": "Enable/disable metrics and green/red" + } + } } } } diff --git a/qurator/dinglehopper/ocrd_cli.py b/qurator/dinglehopper/ocrd_cli.py index a23dffd..d98c21c 100644 --- a/qurator/dinglehopper/ocrd_cli.py +++ b/qurator/dinglehopper/ocrd_cli.py @@ -34,6 +34,7 @@ class OcrdDinglehopperEvaluate(Processor): return file_id def process(self): + metrics = self.parameter['metrics'] gt_grp, ocr_grp = self.input_file_grp.split(',') for n, page_id in enumerate(self.workspace.mets.physical_pages): gt_file = self.workspace.mets.find_files(fileGrp=gt_grp, pageId=page_id)[0] @@ -50,7 +51,12 @@ class OcrdDinglehopperEvaluate(Processor): os.mkdir(self.output_file_grp) except FileExistsError: pass - cli_process(gt_file.local_filename, ocr_file.local_filename, report_prefix) + cli_process( + gt_file.local_filename, + ocr_file.local_filename, + report_prefix, + metrics=metrics + ) # Add reports to the workspace for report_suffix, mimetype in \