diff --git a/qurator/eynollah/ocrd-tool.json b/qurator/eynollah/ocrd-tool.json index 28dd772..ef6230c 100644 --- a/qurator/eynollah/ocrd-tool.json +++ b/qurator/eynollah/ocrd-tool.json @@ -49,11 +49,16 @@ "default": false, "description": "if this parameter set to true, this tool would check that input image need resizing and enhancement or not." }, - "light mode": { + "light_mode": { "type": "boolean", "default": false, "description": "lighter and faster but simpler method for main region detection and deskewing" }, + "textline_light": { + "type": "boolean", + "default": false, + "description": "if this parameter set to true, this tool will try to return contoure of textlines instead of rectangle bounding box of textline with a faster method." + }, "headers_off": { "type": "boolean", "default": false, diff --git a/qurator/eynollah/processor.py b/qurator/eynollah/processor.py index 65122dd..c4d3cb2 100644 --- a/qurator/eynollah/processor.py +++ b/qurator/eynollah/processor.py @@ -11,6 +11,10 @@ class EynollahProcessor(Processor): def metadata_filename(self) -> str: return 'eynollah/ocrd-tool.json' + def setup(self) -> None: + if self.parameter['textline_light'] and not self.parameter['light_mode']: + raise ValueError("Error: You set parameter 'textline_light' to enable light textline detection but parameter 'light_mode' is not enabled") + def process_page_pcgts(self, *input_pcgts: Optional[OcrdPage], page_id: Optional[str] = None) -> OcrdPageResult: assert input_pcgts assert input_pcgts[0] @@ -26,6 +30,7 @@ class EynollahProcessor(Processor): allow_enhancement=self.parameter['allow_enhancement'], curved_line=self.parameter['curved_line'], light_version=self.parameter['light_mode'], + textline_light=self.parameter['textline_light'], full_layout=self.parameter['full_layout'], allow_scaling=self.parameter['allow_scaling'], headers_off=self.parameter['headers_off'],