From 2a6cc5823ef32e8f952b5b2c14e5972f27111222 Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Thu, 20 May 2021 09:39:09 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20dinglehopper:=20Call=20initLoggi?= =?UTF-8?q?ng=20before=20logging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using ocrd_utils' getLogger(), we need to call initLogging() before doing any logging. Fixes #55. --- qurator/dinglehopper/cli.py | 2 ++ qurator/dinglehopper/cli_extract.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/qurator/dinglehopper/cli.py b/qurator/dinglehopper/cli.py index 09c26f0..32e159f 100644 --- a/qurator/dinglehopper/cli.py +++ b/qurator/dinglehopper/cli.py @@ -4,6 +4,7 @@ import click from jinja2 import Environment, FileSystemLoader from markupsafe import escape from uniseg.graphemecluster import grapheme_clusters +from ocrd_utils import initLogging from .character_error_rate import character_error_rate_n from .word_error_rate import word_error_rate_n, words_normalized @@ -176,6 +177,7 @@ def main(gt, ocr, report_prefix, metrics, textequiv_level, progress): By default, the text of PAGE files is extracted on 'region' level. You may use "--textequiv-level line" to extract from the level of TextLine tags. """ + initLogging() Config.progress = progress process(gt, ocr, report_prefix, metrics=metrics, textequiv_level=textequiv_level) diff --git a/qurator/dinglehopper/cli_extract.py b/qurator/dinglehopper/cli_extract.py index ce49db4..0d4f713 100644 --- a/qurator/dinglehopper/cli_extract.py +++ b/qurator/dinglehopper/cli_extract.py @@ -1,6 +1,7 @@ import os import click +from ocrd_utils import initLogging from .extracted_text import ExtractedText from .ocr_files import extract @@ -24,6 +25,7 @@ def main(input_file, textequiv_level): By default, the text of PAGE files is extracted on 'region' level. You may use "--textequiv-level line" to extract from the level of TextLine tags. """ + initLogging() input_text = extract(input_file, textequiv_level=textequiv_level).text print(input_text)