Skip to content

Commit 557dda3

Browse files
committed
Avoid recursively stripping suffixes in _morphy
1 parent 00de04b commit 557dda3

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

nltk/corpus/reader/wordnet.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,8 +2082,7 @@ def _morphy(self, form, pos, check_exceptions=True):
20822082
# Given an original string x
20832083
# 1. Apply rules once to the input to get y1, y2, y3, etc.
20842084
# 2. Return all that are in the database
2085-
# 3. If there are no matches, keep applying rules until you either
2086-
# find a match or you can't go any further
2085+
# 3. If there are no matches: (edited by ekaf) don't recurse, return an empty list.
20872086

20882087
exceptions = self._exception_map[pos]
20892088
substitutions = self.MORPHOLOGICAL_SUBSTITUTIONS[pos]
@@ -2120,13 +2119,6 @@ def filter_forms(forms):
21202119
if results:
21212120
return results
21222121

2123-
# 3. If there are no matches, keep applying rules until we find a match
2124-
while forms:
2125-
forms = apply_rules(forms)
2126-
results = filter_forms(forms)
2127-
if results:
2128-
return results
2129-
21302122
# Return an empty list if we can't find anything
21312123
return []
21322124

0 commit comments

Comments
 (0)