ModelSmith-AI / backend /nlp /preprocess.py
ACA050's picture
Upload 79 files
a309487 verified
import re
class NLPPreprocessor:
def clean(self, text: str):
text = text.lower()
text = re.sub(r"[^a-zA-Z0-9\s]", "", text)
text = re.sub(r"\s+", " ", text)
return text.strip()