inflect icon indicating copy to clipboard operation
inflect copied to clipboard

singular_noun on word ending in "s" removes s.

Open eykamp opened this issue 3 years ago • 5 comments


import inflect as Inflect
inflect = Inflect.engine()
inflect.singular_noun("car")           # get False, as expected
inflect.singular_noun("mass")          # get "mas", expected False

Is this behavior a bug? singular_noun() is supposed to return False when the word is already singular, and I can find no reference to suggest "mass" is the plural of "mas", which is itself the plural of "ma".

eykamp avatar May 18 '22 14:05 eykamp

This issue is related to #161. It seems inflect is naïve when it comes to many words and simply adds or subtracts a trailing s for plural/singular transforms. Probably there are many such edge cases.

I'd be open to a special-case fix for "mass" or a more general solution to words ending in "s".

jaraco avatar Jul 09 '22 15:07 jaraco

I got the same error with two other words: loss (gave los) and analysis (gave analysi). For the first word its easy (and the same case as mass), don't remove the last s when word ends with double s, but the other one is more tricky.

george-gca avatar Jul 12 '22 22:07 george-gca

@jaraco I can only think of a solution that involves a dictionary (like a list of valid words). That would be cumbersome, but I can't think of it in another way. One solution would be creating another repo with only a list of words (maybe only singulars?) like this one and then offer a version of the functions that loads this list (for people that don't mind loading a set of words in memory for the sake of correctness).

This would be helpful also when using specific terms, so it could have for example a set of words for specific scenarios, like machine learning, biology, etc.

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

@jaraco I'm pretty sure all words that end with ss are singular. If you think this is the right solution, can I correct this issue and submit a pull request?

KnisSukparangsee avatar Nov 01 '23 03:11 KnisSukparangsee

I'm not opposed to the solution, but will point out that plural acronyms can end in "ss". For example, GISs, plural of GIS.

But this problem seems addressable via other means, and might be a better problem to have than the current one.

On Tue, Oct 31, 2023, at 20:29, KnisSukparangsee wrote:

@jaraco https://github.com/jaraco I'm pretty sure all words that end with ss are singular. If you think this is the right solution, can I correct this issue and submit a pull request?

— Reply to this email directly, view it on GitHub https://github.com/jaraco/inflect/issues/159#issuecomment-1788351123, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIUWC6VY34EELQJ3IDK2BTYCG6ZTAVCNFSM5WIXX3XKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZYHAZTKMJRGIZQ. You are receiving this because you authored the thread.Message ID: @.***>

eykamp avatar Nov 01 '23 17:11 eykamp