Skip to content
Snippets Groups Projects
interface.py 754 B
Newer Older
Michał Pogoda's avatar
Michał Pogoda committed
from abc import ABC, abstractmethod
from typing import List, Tuple
from src.annotations import Annotation


class ReplacerInterface(ABC):
    @abstractmethod
    def replace(
        self, text: str, detections: List[Tuple[int, int, Annotation]]
    ) -> Tuple[str, List[Tuple[int, int, Annotation]]]:
        """Replace detected entities in text with anonimized version.

        Args:
            text (str): Text to be processed.
            detections (List[Tuple[int, int, str]]): List of detections.

        Returns:
            Tuple[str, List[Tuple[int, int, str]]]: Text with supported entities 
            replaced with anonimized version and list of detections that were 
            not processed by this replacer.
        """
        pass