@@ -1423,6 +1423,7 @@ def _next_token():
14231423 # map lemmas and parts of speech to synsets
14241424 self ._lemma_pos_offset_map [lemma ][pos ] = synset_offsets
14251425 if pos == ADJ :
1426+ # Duplicate all adjectives indiscriminately?:
14261427 self ._lemma_pos_offset_map [lemma ][ADJ_SAT ] = synset_offsets
14271428
14281429 def _load_exception_map (self ):
@@ -2018,7 +2019,8 @@ def morphy(self, form, pos=None, check_exceptions=True):
20182019 """
20192020 Find a possible base form for the given form, with the given
20202021 part of speech, by checking WordNet's list of exceptional
2021- forms, or by substituting affixes for this part of speech.
2022+ forms, or by substituting suffixes for this part of speech.
2023+ If pos=None, try every part of speech until finding lemmas.
20222024 Return the first form found in WordNet, or eventually None.
20232025
20242026 >>> from nltk.corpus import wordnet as wn
@@ -2035,19 +2037,11 @@ def morphy(self, form, pos=None, check_exceptions=True):
20352037 book
20362038 >>> wn.morphy('book', wn.ADJ)
20372039 """
2038-
2039- if pos is None :
2040- posl = POS_LIST
2041- else :
2042- posl = [pos ]
2043- analyses = []
2044- for pos in posl :
2040+ for pos in [pos ] if pos else POS_LIST :
20452041 analyses = self ._morphy (form , pos , check_exceptions )
20462042 if analyses :
2043+ # Stop (don't try more parts of speech):
20472044 return analyses [0 ]
2048- else :
2049- continue
2050- return None
20512045
20522046 MORPHOLOGICAL_SUBSTITUTIONS = {
20532047 NOUN : [
0 commit comments