Community_Collections_App / src /preprocess_text.py
lynn-twinkl
Changed function name
fca167e
raw
history blame contribute delete
305 Bytes
import string
def normalise_text(text):
"""
This function normalises text for later use in
a machine learning pipeline
"""
if isinstance(text, str):
text = text.lower()
text = text.translate(str.maketrans('','', string.punctuation))
return ' '.join(text.split())