Created
February 25, 2020 21:42
-
-
Save washcycle/4881a8d520174d9259b887186fa47307 to your computer and use it in GitHub Desktop.
Remove Stop Words From Text Python
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
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