mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-06-08 11:20:26 +02:00
Remove support for ExtractedText for bag metrics.
This commit is contained in:
parent
381fe7cb6b
commit
9f5112f8f6
2 changed files with 1 additions and 10 deletions
|
@ -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)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import math
|
||||
import unicodedata
|
||||
from collections import Counter
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue