SnowballStemmer("english") is not working for a list of words

179 views Asked by At

I am trying to learn Stemming in NLTK and while I try to stem words with SnowballStemmer it has stuck with PorterStemmer.

Although when I try to stem one single word it works properly but when I try to stem a list of words, it stems with PorterStemmer.

I have created a new list named "singles" to add all the stem words into that list but the result is not what I am looking for.

As you can see, when I used "generously", everything looks just fine, but when I try to print "singles" which is supposed to include all the stem words of "plurals" list, I get the stem words with PorterStemmer.

from nltk.stem.snowball import SnowballStemmer

plurals = ['caresses', 'flies', 'dies', 'mules', 'denied','died', 'agreed', 'owned', 'humbled', 'sized','meeting', 'stating', 'siezing', 'itemization','sensational', 'traditional', 'reference', 'colonizer','plotted']
stemmer = SnowballStemmer("english")
singles = [stemmer.stem(plural) for plural in plurals]

print(SnowballStemmer("english").stem("generously"))
print(" ".join(singles))

The issue is that I don't what to stem "generously", I want to stem the list named "plurals". I just added "generously" to show that it works fine for one word but not for a list.

I would really appreciate it if you help me understand what I am missing.

0

There are 0 answers