Have a list "l" with distinct words like this:
'gone',
'done',
'crawled',
'laughed',
'cried'
I try to apply stemming on this list just that way:
from stemming.porter2 import stem
l = [[stem(word) for word in sentence.split(' ')] for sentence in l]
But nothing seems to happen and nothing changes. What am I doing wrong with the stemming procedure?
Your code has one mistake. l
is a list of words, not sentences. You have to do this:
l = [stem(word) for word in l]
For example:
>>> l = ['gone', 'done', 'crawled', 'laughed', 'cried']
>>> [stem(word) for word in l]
['gone', 'done', 'crawl', 'laugh', 'cri']