diff --git a/python/stringalign/evaluation.py b/python/stringalign/evaluation.py index 06834d8..3581432 100644 --- a/python/stringalign/evaluation.py +++ b/python/stringalign/evaluation.py @@ -196,9 +196,11 @@ def from_strings( tokenizer=tokenizer, ) - def __str__(self) -> str: + def __repr__(self) -> str: return f"LineError('{self.reference}', '{self.predicted}', metadata={self.metadata})" + __str__ = __repr__ + @dataclass(frozen=True, slots=True) class TranscriptionEvaluator: @@ -278,3 +280,11 @@ def from_strings( predictions=predictions, line_errors=line_errors, ) + + def __len__(self) -> int: + return len(self.line_errors) + + def __repr__(self) -> str: + return f"TranscriptionEvaluator(len={len(self)})" + + __str__ = __repr__