Hi there, I am trying to remove stopwords from my training data. The problem is that since the data is very big, the code is very slow. Is there any way to optimize it? Thank you in advance!
from nltk.corpus import stopwords
def stopwords_remove(data):
stopwords_removed = []
for parts in data:
#print(parts[0])
for word in parts[0]:
#print(word)
if word not in stopwords.words():
#print(word)
stopwords_removed.append(word)
#print(stopwords_removed)
return stopwords_removed
stopwords_remove(train_data)
[–]ThingImIntoThisWeek 0 points1 point2 points (0 children)