inflect
inflect copied to clipboard
Fix singular_noun for words ending in -ss
singular_noun returns wrong results for words ending in -ss:
>>> p.singular_noun("grass")
'gras'
>>> p.singular_noun("glass")
'glas'
>>> p.singular_noun("boss")
'bos'
The problem is the catch-all rule at the end of _sinoun that strips a trailing s from any word. Words ending in -ss (like "grass", "glass", "boss", "moss", "cross", "dress") are already singular, so they shouldn't reach this rule.
The fix adds a check for -ss endings right before the catch-all, returning False since these words are already singular. Their plural forms (grasses, glasses, etc.) are still handled correctly by the earlier -sses rules.
All 223 existing tests continue to pass plus 16 new ones covering the fix.
Fixes #235