def _clean_text(self, text: str) -> list[str]:
        """Clean and split the extracted text into paragraphs."""
        # Remove binary artifacts and control characters
        text = re.sub(r"[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\xFF]", "", text)

        # Remove multiple spaces and newlines
        text = re.sub(r"\s+", " ", text)

        # Split into paragraphs on double newlines or other common separators
        paragraphs = re.split(r"\n\n|\r\n\r\n|\f", text)

        # Remove empty or whitespace-only paragraphs
        paragraphs = [p.strip() for p in paragraphs if p.strip()]

        return paragraphs
Clean and split the extracted text into paragraphs.
py/core/parsers/media/doc_parser.py