(base)
return base.strip().lower()
Tokenization/string cleaning.
    Original from https://github.com/yoonkim/CNN_sentence/blob/master/process_data.py
Tokenization/string cleaning.
    Original from https://github.com/yoonkim/CNN_sentence/blob/master/process_data.py
Tokenization / string cleaning . Original from https : // github . com / yoonkim / CNN_sentence / blob / master / process_data . py
def clean_string(base):
    """
    Tokenization/string cleaning.
    Original from https://github.com/yoonkim/CNN_sentence/blob/master/process_data.py
    """
    base = re.sub(r"[^A-Za-z0-9(),!?\'\`]", " ", base)
    base = re.sub(r"\'re", " \'re", base)
    base = re.sub(r"\'d", " \'d", base)
    base = re.sub(r"\'ll", " \'ll", base)
    base = re.sub(r"\'s", " \'s", base)
    base = re.sub(r"\'ve", " \'ve", base)
    base = re.sub(r"n\'t", " n\'t", base)
    base = re.sub(r"!", " ! ", base)
    base = re.sub(r",", " , ", base)
    base = re.sub(r"\)", " \) ", base)
    base = re.sub(r"\(", " \( ", base)
    base = re.sub(r"\?", " \? ", base)
    base = re.sub(r"\s{2,}", " ", base)
    return base.strip().lower()
def clean_string ( base ) : base = re . sub ( r"[^A-Za-z0-9(),!?\'\`]" , " " , base ) base = re . sub ( r"\'re" , " \'re" , base ) base = re . sub ( r"\'d" , " \'d" , base ) base = re . sub ( r"\'ll" , " \'ll" , base ) base = re . sub ( r"\'s" , " \'s" , base ) base = re . sub ( r"\'ve" , " \'ve" , base ) base = re . sub ( r"n\'t" , " n\'t" , base ) base = re . sub ( r"!" , " ! " , base ) base = re . sub ( r"," , " , " , base ) base = re . sub ( r"\)" , " \) " , base ) base = re . sub ( r"\(" , " \( " , base ) base = re . sub ( r"\?" , " \? " , base ) base = re . sub ( r"\s{2,}" , " " , base ) return base . strip ( ) . lower ( )