Newer
Older
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