This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from operator import itemgetter | |
from collections import Counter | |
def clean_data(txt): | |
txt = txt.lower() | |
txt = txt.replace('mr.','mr').replace('mrs.','mrs').replace('ms.','ms') | |
sentences = re.findall(r"[^!\.\?]+[!\.\?]",txt.lower()) | |
sentences = [s.replace('\n',' ').replace('\r',' ') for s in sentences] | |
sentences = [re.sub(r'[^a-z ]','',x) for x in sentences] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bin | |
.Python | |
lib | |
include | |
pip-selfcheck.json |
OlderNewer