diff --git a/src/annotations/annotations.py b/src/annotations/annotations.py index 4ba6feb7e5b9c50452679f7d91745ea53c6a2c98..584f33fb208cd8112936e77f76f7854828903cca 100644 --- a/src/annotations/annotations.py +++ b/src/annotations/annotations.py @@ -1,3 +1,5 @@ +from dataclasses import dataclass +@dataclass class Annotation: def __hash__(self) -> int: return (type(self), *(self.__dict__.values())).__hash__() @@ -6,8 +8,6 @@ class Annotation: class MorphosyntacticAnnotation(Annotation): def __init__(self, morphosyntactic_tag) -> None: self.morphosyntactic_tag = morphosyntactic_tag - - +@dataclass class NerAnnotation(Annotation): - def __init__(self, ner_type: str) -> None: - self.ner_type = ner_type + ner_type: str \ No newline at end of file diff --git a/src/detections/detection.py b/src/detections/detection.py index fad8a6db4fc91a0b02ad553bbfc023be3fba69cf..96e60c711be109f5fe892c38b239d3007a993b8c 100644 --- a/src/detections/detection.py +++ b/src/detections/detection.py @@ -1,12 +1,10 @@ from typing import Optional +from dataclasses import dataclass - +@dataclass class Detection: TYPE_NAME = "detection" - def __init__(self) -> None: - pass - def __hash__(self) -> int: return (type(self), *(self.__dict__.values())).__hash__()