File size: 245 Bytes
f3287af
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import re
import string

def clean_text(text: str) -> str:
    """Lowercase, remove punctuation, and clean text"""
    text = text.lower()
    text = re.sub(f"[{re.escape(string.punctuation)}]", "", text)
    text = text.strip()
    return text