From 9f5112f8f674069c1795fba9dc441e7c2786c484 Mon Sep 17 00:00:00 2001 From: Benjamin Rosemann Date: Fri, 11 Jun 2021 10:23:26 +0200 Subject: [PATCH] Remove support for ExtractedText for bag metrics. --- qurator/dinglehopper/metrics/bag_of_words_accuracy.py | 10 +--------- .../dinglehopper/tests/metrics/test_bag_accuracy.py | 1 - 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/qurator/dinglehopper/metrics/bag_of_words_accuracy.py b/qurator/dinglehopper/metrics/bag_of_words_accuracy.py index 1b0e763..bef86c1 100644 --- a/qurator/dinglehopper/metrics/bag_of_words_accuracy.py +++ b/qurator/dinglehopper/metrics/bag_of_words_accuracy.py @@ -1,20 +1,12 @@ from collections import Counter -from typing import Union from .utils import bag_accuracy, MetricResult, Weights -from .. import ExtractedText from ..normalize import words_normalized def bag_of_words_accuracy( - reference: Union[str, ExtractedText], - compared: Union[str, ExtractedText], - weights: Weights, + reference: str, compared: str, weights: Weights ) -> MetricResult: - if isinstance(reference, ExtractedText): - reference = reference.text - if isinstance(compared, ExtractedText): - compared = compared.text reference_words = Counter(words_normalized(reference)) compared_words = Counter(words_normalized(compared)) result = bag_accuracy(reference_words, compared_words, weights) diff --git a/qurator/dinglehopper/tests/metrics/test_bag_accuracy.py b/qurator/dinglehopper/tests/metrics/test_bag_accuracy.py index daa8721..2ef6377 100644 --- a/qurator/dinglehopper/tests/metrics/test_bag_accuracy.py +++ b/qurator/dinglehopper/tests/metrics/test_bag_accuracy.py @@ -1,4 +1,3 @@ -import math import unicodedata from collections import Counter