File size: 181 Bytes
5c5b473
 
 
 
 
 
 
1
2
3
4
5
6
7
import re

def clean_text(text):
    text = text.lower()
    text = re.sub(r"http\S+", "", text)   # remove links
    text = re.sub(r"[^a-zA-Z\s]", "", text)
    return text.strip()