Skip to content
Snippets Groups Projects
delete_replacer.py 545 B
Newer Older
Michał Pogoda's avatar
Michał Pogoda committed
from typing import List, Tuple
from src.annotations import Annotation
from src.string_replacements import replace
from src.replacers.interface import ReplacerInterface


class DeleteReplacer(ReplacerInterface):
    def __init__(self):
        pass

    def replace(
        self, text: str, detections: List[Tuple[int, int, Annotation]]
    ) -> Tuple[str, List[Tuple[int, int, Annotation]]]:
        
        result = [
            (start, end, "")
            for start, end, _ in detections
        ]

        return replace(text, result), []