File size: 161 Bytes
d660b02
 
 
 
 
 
 
 
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()