Newer
Older
from typing import List, Optional, Tuple

Michał Pogoda
committed
from src.detections.detection import Detection

Michał Pogoda
committed
class DateDetection(Detection):
TWO_DIGITS_DAY = "DD"
ONE_DIGIT_DAY = "D"
TWO_DIGIT_MONTH = "MM"
ONE_DIGIT_MONTH = "M"
FOUR_DIGIT_YEAR = "YYYY"
TWO_DIGIT_YEAR = "YY"
TEXT_MONTH = "MMM"
OTHER = "OTHER"
def __init__(
self, format: Optional[List[Tuple[AnnotationPart, str]]] = None
) -> None:
Args:
format (Optional[List[Tuple[AnnotationPart, str]]], optional): Format of
detected date. Defaults to None.
"""
"""Compare two date detections.
Args:
other (DateDetection): date detection to compare with
Returns:
bool: true if both detections are equal, false otherwise
"""
return self.format == other.format and super().__eq__(other)