I am trying to remove stop words (from nltk) from my data set but not sure why the one line query is not working:
filtered_words = [word if word not in stop_words for word in words]
This is what I need to do:
filtered_words = []
for word in words:
if word not in stop_words:
filtered_words.append(word)