Sign in to PrePAN

Lingua::EN::PluralToSingular Convert an English plural to singular



use Lingua::EN::PluralToSingular qw/plural2singular/;

my $s = plural2singular ('menus');
# $s = 'menu' (removed final s)
my $s = plural2singular ('citrus');
# $s = 'citrus' (no change)
my $s = plural2singular ('fries');
# $s = 'fry' (ies->y)
my $s = plural2singular ('species');
# $s = 'species' (no change)
my $s = plural2singular ('children');
# $s = 'child' (irregular plurals, also mice, women, etc.)


A module which deals with all the exasperating edge cases of converting English plural nouns to English singular nouns.

It needs to know the irregular plurals of English such as "mice" and "children" as well as being able to distinguish words like "Charles" and "citrus" from words like "miles" and "menus", and also to be able to deal with plurals like "fries" and "sandwiches".

The module probably needs to have some dictionary of words built in or to depend on another module which has some knowledge of English vocabulary.

knives -> knife, also wolves -> wolf, roofs -> roof.


these existing modules seem to already serve the same purpose: ,

I had a look at Lingua::EN::Inflect::Number, and this is a seriously defective module. It uses the method of using Lingua::EN::Inflect's function to turn verbs with an s on the end (third person singular) into plain verbs. It worked for some things but because the method it uses is so stupid, it fails for obvious things like mouse/mice and so on.
@Anonymous again:

Please refer to this:

I wrote some more information about that module there.

Also, I already looked at Lingua::EN::Inflect, but it doesn't deal with things like "citrus" and "menus" so I don't think that module is a basis for building upon.
(With apologies for a vague comment) There is something similar, and which works quite well, in the Rails framework.

Yes it's Ruby... but maybe you can share some data? Have a similar approach? It seems wasteful to duplicate the effort required to put in the special cases.

@mca-wtsi: thanks for the link. I am trying to find where the actual data or approach is defined in that Ruby, it's not really clear on that page.

Sorry, I don't have the answer... I just used the class a little.

I was cheerfully assuming the link I gave would be enough for you to decide whether it might be worth sharing/piggybacking and find the start of the trail. Presumably the class lives in version control, and you can get the history for it, and find changesets with related files.

I assume other languages also have something similar. Maybe there is a python one, which is easier to cooperate with?
This is now on cpan. I'll do more work on it when I get some bug reports or something.

Please sign up to post a review.