Last active
September 4, 2019 14:50
-
-
Save yfwu/5b15f64c5a69c14f490d63182f316143 to your computer and use it in GitHub Desktop.
modified read_data for generating word array
This file contains 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
def read_data_modified(fname): | |
data = [] | |
with open(fname) as f: | |
for line in f.readlines(): | |
line = re.sub('[!@#%^&:;,`\.\']', '', line) | |
data.extend(line.replace('\n', '').strip().lower().split(' ')) | |
return data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment