Skip to content

Commit 27ef06a

Browse files
committed
Make clear that WordNetLemmatizer picks the shortest possible lemma
1 parent 557dda3 commit 27ef06a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nltk/stem/wordnet.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ class WordNetLemmatizer:
3131
"""
3232

3333
def lemmatize(self, word: str, pos: str = "n") -> str:
34-
"""Lemmatize `word` using WordNet's built-in morphy function.
34+
"""Lemmatize `word` by picking the shortest of the possible lemmas,
35+
using the wordnet corpus reader's built-in _morphy function.
3536
Returns the input word unchanged if it cannot be found in WordNet.
3637
3738
:param word: The input word to lemmatize.
@@ -40,7 +41,7 @@ def lemmatize(self, word: str, pos: str = "n") -> str:
4041
`"v"` for verbs, `"a"` for adjectives, `"r"` for adverbs and `"s"`
4142
for satellite adjectives.
4243
:type pos: str
43-
:return: The lemma of `word`, for the given `pos`.
44+
:return: The shortest lemma of `word`, for the given `pos`.
4445
"""
4546
lemmas = wn._morphy(word, pos)
4647
return min(lemmas, key=len) if lemmas else word

0 commit comments

Comments
 (0)