def clean_text(text):
    """Clean text for TFIDF."""
    new_text = re.sub(ur'\p{P}+', ' ', text)

    new_text = [stem(i) for i in new_text.lower().split() if not
                re.findall(r'[0-9]', i)]

    new_text = ' '.join(new_text)

    return new_text
def clean_text ( text ) : new_text = re . sub ( ur '\p{P}+' , ' ' , text ) new_text = [ stem ( i ) for i in new_text . lower ( ) . split ( ) if not re . findall ( r'[0-9]' , i ) ] new_text = ' ' . join ( new_text ) return new_text
Clean text for TFIDF.