inflect icon indicating copy to clipboard operation
inflect copied to clipboard

Words ending in 's' should never be pluralized by adding another 's'

Open aMiss-aWry opened this issue 2 years ago • 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]

aMiss-aWry avatar Jun 26 '22 21:06 aMiss-aWry

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.

jaraco avatar Jul 09 '22 15:07 jaraco

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.

jaraco avatar Jul 09 '22 15:07 jaraco

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?

george-gca avatar Aug 07 '22 20:08 george-gca

Already added some tests like jeans -> jeans

george-gca avatar Nov 01 '22 19:11 george-gca

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?

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.

jaraco avatar Jan 19 '23 04:01 jaraco