Skip to content

Instantly share code, notes, and snippets.

@washcycle
Created February 25, 2020 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save washcycle/4881a8d520174d9259b887186fa47307 to your computer and use it in GitHub Desktop.
Save washcycle/4881a8d520174d9259b887186fa47307 to your computer and use it in GitHub Desktop.
Remove Stop Words From Text Python
sentences = []
labels = []
with open("/text.csv", 'r') as csvfile:
csvfile.readline()
for line in csvfile.readlines():
row = line.split(',')
labels.append(row[0])
sentence = row[1].split()
sentences.append(' '.join([w for w in sentence if not w in stop_words]))
print(len(sentences))
print(sentences[0])
print(labels[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment