Exemple #1
0
 def clean_text(self, s):
     s = UnicodeDammit(s).unicode_markup
     punctuation = '\!"#$%&()*+,-./:;<=>?@[]^_`{|}~' + "\n\t\r"
     translator = str.maketrans(punctuation, ' ' * len(punctuation))
     s = s.translate(translator)
     return self.remove_redundant_spaces(s)