Words ending in 's' should never be pluralized by adding another 's'
aMiss-aWry opened this issue · 5 comments
stockings -> stockingss
jeans -> jeanss
sandals -> sandalss
How do I avoid this? I can fix the specific words with defnoun('jeans', 'jeans'), which corrects the result for an isolated string 'jeans' -> 'jeans'.
However, if I try to run plural_noun on 'blue jeans' instead of 'jeans' it then breaks again, returning 'blue jeanss'. I understand this is because 'blue jeans' appears to be a different string from 'jeans', but perhaps it should check the rules for the part of the string it is altering?
I've gotten around this so far by this incredibly hacky 'solution', so any improvement would obviously be immensely appreciated:
plural = _INFLECT.plural_noun(key, count)
if plural.endswith('ss'):
plural = plural[0:-1]
Thanks for the report. It seems you've reported two different issues, so let's focus on one at a time. Let's keep this one for double-s, and create a new one for defnoun and multi-word subjects.
On further consideration, I'm not sure the reported issue is a bug. This project doesn't always detect invalid inputs. In the examples above, one is passing plural nouns into plural_noun
, whose input is meant to be a singular noun. It would probably be a new feature to recognize already-plural words and handle them. I welcome investigation and contribution.
One question, why the plural functions always return str
while singular ones return str
or False
? Shouldn't all return the same type, either only str or both?
Already added some tests like jeans -> jeans
One question, why the plural functions always return
str
while singular ones returnstr
orFalse
? Shouldn't all return the same type, either only str or both?
I don't have a good answer. It may be for a good reason or it could be an implementation artifact. If it's not documented or protected by tests that explain it, it's fair game to consider changing it.