Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions pattern/text/en/inflect.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,17 +602,25 @@ def singularize(word, pos=NOUN, custom={}):
return singularize(word[:-1]) + "'s"
w = word.lower()
for x in singular_uninflected:
if x.endswith(w):
return word
if x==w:
return word
# Changed from endswith to ==
#if x.endswith(w):
for x in singular_uncountable:
if x.endswith(w):
if x==w:
return word
# Changed from endswith to ==
#if x.endswith(w):
for x in singular_ie:
if w.endswith(x+"s"):
return w
return x
# Changed. We need to return the singular word
#return w
for x in singular_irregular:
if w.endswith(x):
return re.sub('(?i)'+x+'$', singular_irregular[x], word)
if x==w:
return word
#if w.endswith(x):
# return re.sub('(?i)'+x+'$', singular_irregular[x], word)
for suffix, inflection in singular_rules:
m = suffix.search(word)
g = m and m.groups() or []
Expand Down