I am trying to remove stopwords from my text.
I have tried using the code below.
from nltk.corpus import stopwords
sw = stopwords.words("english")
my_text='I love coding'
my_text=re.sub("|".join(sw),"",my_text)
print(my_text)
Expected result: love coding
.
Actual result: I l cng
(since 'o' and 've' are both found in the stopwords list "sw").
How can I get the expected result?