Lingua:...ingular(3)
π Lingua::EN::PluralToSingular π
okay bestie, welcome to the manual page for Lingua::EN::PluralToSingular β a Perl module from the User Contributed Perl Documentation collection. it does exactly one thing and it does it slayfully: it takes an English plural noun and hands you back the singular. no cap. π
β¨ NAME β¨
Lingua::EN::PluralToSingular β change an English plural to a singular π¦
πΈ SYNOPSIS πΈ
here's the vibe, code and all:
use Lingua::EN::PluralToSingular qw/to_singular is_plural/;
my @words = qw/knives sheep dog dogs cannabis/;
for my $word (@words) {
if (is_plural ($word)) {
my $sing = to_singular ($word);
print "The singular of '$word' is '$sing'.\n";
}
else {
print "'", ucfirst ($word), "' is not plural.\n";
}
}
which produces output:
The singular of 'knives' is 'knife'.
The singular of 'sheep' is 'sheep'.
'Dog' is not plural.
The singular of 'dogs' is 'dog'.
'Cannabis' is not plural.
(This example is included as synopsis.pl <https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.21/examples/synopsis.pl> in the distribution.) <star>β</star>
π VERSION π
this documents Lingua::EN::PluralToSingular version 0.21, corresponding to git commit 2d53254eeaec8d2006655f63f61b4f6868e81153 <https://github.com/benkasminbullock/Lingua-EN-PluralToSingular/commit/2d53254eeaec8d2006655f63f61b4f6868e81153> released on Thu Jun 21 17:48:56 2018 +0900. <butterfly>π¦</butterfly>
π DESCRIPTION π
this module converts words denoting a plural in the English language into words denoting a singular noun. it's giving "singularizer" and honestly? obsessed. π
π FUNCTIONS π
to_singular
my $singular = to_singular ($word);
convert $word into its singular form. for example,
to_singular ('cats')
returns 'cat'. if the word is unknown or does not seem to be plural, "to_singular" returns the word itself, so
to_singular ('battlehorn');
returns 'battlehorn'. it said "not my problem bestie" and handed it right back. iconic behaviour honestly. π
is_plural
if (is_plural ($word)) {
print "There are too many $word here.\n";
}
else {
print "There is a $word here.\n";
}
returns 1 if the word is a valid plural, 0 if not. it also returns 1 for ambiguous words like "sheep". yes, sheep is both. sheep said "i contain multitudes" and honestly, same. πβ¨
π LIMITATIONS AND CAVEATS π
okay bestie, sit down, we gotta talk about the fine print. none of this is a vibe check failure, it's just how the module works. π
Assumes the input is a noun
"to_singular" assumes its input is a noun. for example, "lives" may be the plural of "life", or the verb "live", as in "he lives". the routine assumes a noun and converts to "life". so if you hand it a verb, that's on you, not on the module. π
Distinguishes lower and upper case
it does not deal with capitalized words. if the input word may be capitalized, or if its initial letter may be capitalized, the user must preprocess it to put it into the normal case. so, for example,
to_singular ('FLIES');
returns 'FLIES' and
to_singular ('Wolves');
returns 'Wolve'. similarly,
to_singular ('Charles');
returns 'Charles', but
to_singular ('charles');
returns 'charle', since the exception only applies if the word is capitalized. the caps lock version ate and the lowercase version... did not. π
Does not handle pronouns
the module does not attempt to handle pronoun forms like "ourselves" or "themselves". these words are left unaltered. they're just standing there, untouched, minding their own business. π§
False plurals also accepted
for the sake of user convenience, false plurals like "octopi" are also accepted by the module. (the plural of "octopus" is "octopuses".) yes it's technically wrong and yes we're letting it slide, it's called being nice. π
Not all exceptional plurals are included
there are many exceptions which have not been included, notably words with Latin or Greek plurals. the module is not a classics scholar, okay? it's doing its best. π
π STANDALONE SCRIPT π
the script scripts/singular provides a quick way to get singular versions of nouns:
singular cats dogs geese
# Prints "cat dog goose".
one command, three glow-ups. chef's kiss. π
π¦ SEE ALSO π¦
Lingua::EN::InflectβLingua::EN::Inflectby Damian Conway converts English singular nouns to plurals, but not vice-versa. one-way street, unfortunately.Lingua::EN::Inflect::NumberβLingua::EN::Inflect::Numberis supposed to do the same thing as this module. however, as of the time of writing (version 1.12) it's actually based on the third-person verb handling ofLingua::EN::Inflect, in other words it takes a verb in the"he says"form and converts it into"say". thus you get bugs like <https://rt.cpan.org/Public/Bug/Display.html?id=64564> where the reporter demonstrates that'to_Sincorrectly renders the singular of"statuses"as"statuse."'not the flex they thought it was. π
π«Ά ACKNOWLEDGEMENTS π«Ά
thanks to Xan Charbonnet and H2CHANG for various additions and fixes. Lisa Hare contributed support for plurals ending in i as part of the 2016 Pull Request Challenge. we love a collaboration era. π
πΈ AUTHOR πΈ
Ben Bullock, <bkb@cpan.org>
π COPYRIGHT & LICENCE π
this package and associated files are copyright (C) 2011-2018 Ben Bullock.
you can use, copy, modify and redistribute this package and associated files under the Perl Artistic Licence or the GNU General Public Licence. go forth and redistribute, bestie. π
and that's the whole page, fr fr. this was perl v5.42.0, dated 2025-07-25 β mwah, bye bestie! π πβ¨
π¦ where this page comes from
- fedora 43: perl-Lingua-EN-PluralToSingular 0.21-24.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms