File size: 153 Bytes
a22e84b
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
import re


def clean_text(text: str) -> str:
    text = re.sub(r"[^\w\s.,!?]", " ", text)
    text = re.sub(r"\s+", " ", text)

    return text.strip()