File size: 305 Bytes
82e0bc6
 
fca167e
82e0bc6
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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())