1 # Performance note: I benchmarked this code using a set instead of
2 # a list for the stopwords and was surprised to find that the list
3 # performed /better/ than the set - maybe because it's only a small
34 def strip_stopwords(sentence
):
35 "Removes stopwords - also normalizes whitespace"
36 words
= sentence
.split()
39 if word
.lower() not in stopwords
:
41 return u
' '.join(sentence
)