Undocumented `False` for `singular_noun` if word is already singular
>>> word = 'woman'
>>> word = p.plural_noun(word)
>>> word
'women'
>>> word = p.plural_noun(word)
>>> word
'womens'
I think this is intended behaviour, as this module is garbage, in garbage out.
The method
plural_noun()takes a singular English noun or pronoun and returns its plural.
https://github.com/jazzband/inflect#forming-plurals-and-singulars
Only the first case provides a singular noun.
Hi, @hakubo
Is it possible to check that work is plural?
As I understand it's different logic with singular_noun which returns False for singular nouns....
Yes:
The method
singular_noun()takes a plural English noun or pronoun and returns its singular.
Or otherwise False:
>>> import inflect
>>> p = inflect.engine()
>>> p.singular_noun('women')
'woman'
>>> p.singular_noun('woman')
False
But into documentation is nothing about this difference.
And as I understand correct way of plural_noun usage is (because we do not have is_plural function:
import inflect
p = inflect.engine()
word = 'women'
p.plural_noun(word) if not p.singular_noun(word) else word
That's a good point about it not being documented, because now you mention it, GIGO also applies to singular_noun.
For example (https://github.com/jazzband/inflect/issues/4#issuecomment-1083243):
>>> import inflect
>>> p = inflect.engine()
>>> p.singular_noun('woman')
False
>>> p.singular_noun('dress')
'dres'
Inflecting Plurals and Singulars
All of the
plural...plural inflection methods take the word to be inflected as their first argument and return the corresponding inflection. Note that all such methods expect the singular form of the word. The results of passing a plural form are undefined (and unlikely to be correct). Similarly, thesi...singular inflection method expects the plural form of the word.
https://github.com/jazzband/inflect#inflecting-plurals-and-singulars
So you need to know what sort of input you give and use the correct method. You can throw anything in and hope for the best but it's not the intended use and you might well get something undefined out.
I changed title of issue. Thank You, @hugovk !
I think False should remain undocumented because it can't be relied upon to determine singular/plural.