From c514abfb9f8fbb8de96ffc789e39c3d1e85843dd Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Thu, 8 Oct 2020 13:33:19 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20dinglehopper:=20Sanitize=20impor?= =?UTF-8?q?ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qurator/dinglehopper/character_error_rate.py | 4 ++-- qurator/dinglehopper/cli.py | 9 ++++++--- qurator/dinglehopper/edit_distance.py | 2 +- qurator/dinglehopper/ocrd_cli.py | 4 ++-- qurator/dinglehopper/tests/extracted_text_test.py | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/qurator/dinglehopper/character_error_rate.py b/qurator/dinglehopper/character_error_rate.py index 055d6de..2b13f55 100644 --- a/qurator/dinglehopper/character_error_rate.py +++ b/qurator/dinglehopper/character_error_rate.py @@ -6,8 +6,8 @@ from typing import Tuple from multimethod import multimethod from uniseg.graphemecluster import grapheme_clusters -from qurator.dinglehopper.edit_distance import distance -from qurator.dinglehopper.extracted_text import ExtractedText +from .edit_distance import distance +from .extracted_text import ExtractedText @multimethod diff --git a/qurator/dinglehopper/cli.py b/qurator/dinglehopper/cli.py index f568399..87485bc 100644 --- a/qurator/dinglehopper/cli.py +++ b/qurator/dinglehopper/cli.py @@ -3,10 +3,13 @@ import os import click from jinja2 import Environment, FileSystemLoader from markupsafe import escape +from uniseg.graphemecluster import grapheme_clusters - -from qurator.dinglehopper import * -from qurator.dinglehopper import ExtractedText +from .character_error_rate import character_error_rate_n +from .word_error_rate import word_error_rate_n, words_normalized +from .align import seq_align +from .extracted_text import ExtractedText +from .ocr_files import extract def gen_diff_report(gt_in, ocr_in, css_prefix, joiner, none): diff --git a/qurator/dinglehopper/edit_distance.py b/qurator/dinglehopper/edit_distance.py index e91d063..ec49338 100644 --- a/qurator/dinglehopper/edit_distance.py +++ b/qurator/dinglehopper/edit_distance.py @@ -8,7 +8,7 @@ import numpy as np from multimethod import multimethod from uniseg.graphemecluster import grapheme_clusters -from . import ExtractedText +from .extracted_text import ExtractedText def levenshtein_matrix(seq1: Sequence, seq2: Sequence): diff --git a/qurator/dinglehopper/ocrd_cli.py b/qurator/dinglehopper/ocrd_cli.py index d98c21c..ed5ecd3 100644 --- a/qurator/dinglehopper/ocrd_cli.py +++ b/qurator/dinglehopper/ocrd_cli.py @@ -7,8 +7,8 @@ from ocrd.decorators import ocrd_cli_options, ocrd_cli_wrap_processor from ocrd_utils import concat_padded, getLogger from pkg_resources import resource_string -from qurator.dinglehopper.cli import process as cli_process -from qurator.dinglehopper.edit_distance import levenshtein_matrix_cache_clear +from .cli import process as cli_process +from .edit_distance import levenshtein_matrix_cache_clear log = getLogger('processor.OcrdDinglehopperEvaluate') diff --git a/qurator/dinglehopper/tests/extracted_text_test.py b/qurator/dinglehopper/tests/extracted_text_test.py index ef2776c..98788f6 100644 --- a/qurator/dinglehopper/tests/extracted_text_test.py +++ b/qurator/dinglehopper/tests/extracted_text_test.py @@ -1,10 +1,10 @@ import unicodedata import pytest -from qurator.dinglehopper import ExtractedText from uniseg.graphemecluster import grapheme_clusters -from qurator.dinglehopper import seq_align from collections import namedtuple +from .. import seq_align, ExtractedText + def test_text(): test1 = ExtractedText(None, [