Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aMiss-aWry opened this issue Jun 26, 2022 · 5 comments · Fixed by #168
Open

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

aMiss-aWry opened this issue Jun 26, 2022 · 5 comments · Fixed by #168

Comments

@aMiss-aWry
Copy link

aMiss-aWry commented Jun 26, 2022

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]
@jaraco
Copy link
Owner

jaraco commented Jul 9, 2022

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 jaraco changed the title Words ending in 's' should never be pluralized by adding another 's' - 'defnoun' doesn't seem to work when the word is a part of a string passed. Words ending in 's' should never be pluralized by adding another 's' Jul 9, 2022
@jaraco
Copy link
Owner

jaraco commented Jul 9, 2022

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 jaraco added the feature label Jul 9, 2022
@george-gca
Copy link
Contributor

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
Copy link
Contributor

Already added some tests like jeans -> jeans

@jaraco jaraco reopened this Jan 19, 2023
@jaraco
Copy link
Owner

jaraco commented Jan 19, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants