Created
October 25, 2019 04:01
-
-
Save StrikingLoo/d4b09557c9d94876ca785c9ff4dd0c05 to your computer and use it in GitHub Desktop.
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
corpus = "" | |
for file_name in file_names: | |
with open(file_name, 'r') as f: | |
corpus+=f.read() | |
corpus = corpus.replace('\n',' ') | |
corpus = corpus.replace('\t',' ') | |
corpus = corpus.replace('“', ' " ') | |
corpus = corpus.replace('”', ' " ') | |
for spaced in ['.','-',',','!','?','(','—',')']: | |
corpus = corpus.replace(spaced, ' {0} '.format(spaced)) | |
len(corpus) #10510355 characters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment