Skip to content

Commit d2929a1

Browse files
committed
Add WordList.stem
1 parent b9fc62a commit d2929a1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

textblob/blob.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ def lemmatize(self):
285285
"""Return the lemma of each word in this WordList."""
286286
return self.__class__([word.lemmatize() for word in self])
287287

288+
def stem(self, *args, **kwargs):
289+
"""Return the stem for each word in this WordList."""
290+
return self.__class__([word.stem(*args, **kwargs) for word in self])
291+
288292

289293
def _validated_param(obj, name, base_class, default, base_class_name=None):
290294
"""Validates a parameter passed to __init__. Makes sure that obj is
@@ -487,7 +491,7 @@ def ngrams(self, n=3):
487491
"""
488492
if n <= 0:
489493
return []
490-
grams = [WordList(self.words[i:i+n])
494+
grams = [WordList(self.words[i:i + n])
491495
for i in range(len(self.words) - n + 1)]
492496
return grams
493497

0 commit comments

Comments
 (0)