(text)
return result
Clean the text - remove unwanted chars, fold punctuation etc.
Clean the text - remove unwanted chars, fold punctuation etc.
Clean the text - remove unwanted chars fold punctuation etc .
def clean_text(text):
    """Clean the text - remove unwanted chars, fold punctuation etc."""
    result = NORMALIZE_WHITESPACE_REGEX.sub(' ', text.strip())
    result = RE_DASH_FILTER.sub('-', result)
    result = RE_APOSTROPHE_FILTER.sub("'", result)
    result = RE_LEFT_PARENTH_FILTER.sub("(", result)
    result = RE_RIGHT_PARENTH_FILTER.sub(")", result)
    result = RE_BASIC_CLEANER.sub('', result)
    return result
def clean_text ( text ) : result = NORMALIZE_WHITESPACE_REGEX . sub ( ' ' , text . strip ( ) ) result = RE_DASH_FILTER . sub ( '-' , result ) result = RE_APOSTROPHE_FILTER . sub ( "'" , result ) result = RE_LEFT_PARENTH_FILTER . sub ( "(" , result ) result = RE_RIGHT_PARENTH_FILTER . sub ( ")" , result ) result = RE_BASIC_CLEANER . sub ( '' , result ) return result