Skip to content

Instantly share code, notes, and snippets.

@darcwader
Last active October 29, 2017 12:56
Show Gist options
  • Select an option

  • Save darcwader/cee68318e3607a88ffc4fc6c4068b723 to your computer and use it in GitHub Desktop.

Select an option

Save darcwader/cee68318e3607a88ffc4fc6c4068b723 to your computer and use it in GitHub Desktop.
spam
file_name = 'SMSSpamCollection'
with open(file_name) as f:
corpus = f.readlines()
print("there are {} messages".format(len(corpus)))
corpus = [x.strip() for x in corpus] #remove trailing \n from lines
for i,message in enumerate(corpus[:10]):
print(i, message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment