From e189ec24a8d3ab06201f427ffa755eb3fe386f35 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 23 Jan 2004 13:23:20 +0000 Subject: [PATCH] Added some handling for 'try' in the pluralization stuff. --- src/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils.py b/src/utils.py index 31e1bc7b4..cf3f936dc 100755 --- a/src/utils.py +++ b/src/utils.py @@ -331,6 +331,8 @@ def pluralize(s, i=2): return matchCase(s, plurals[lowered]) elif any(lowered.endswith, ['ch', 'ss']): return matchCase(s, s+'es') + elif lowered.endswith('y'): + return matchCase(s, s[:-1]+'ies') else: return matchCase(s, s+'s') @@ -341,8 +343,10 @@ def depluralize(s): return matchCase(s, plurals[lowered]) elif any(lowered.endswith, ['ches', 'sses']): return s[:-2] + elif lowered.endswith('ies'): + return matchCase(s, s[:-3]+'y') else: - if s.endswith('s') or s.endswith('S'): + if lowered.endswith('s'): return s[:-1] # Chop off 's'. else: return s # Don't know what to do.