view release on metacpan or search on metacpan
lib/Lingua/ENG/Inflect.pm view on Meta::CPAN
my $PL_sb_U_a_ae = enclose join "|",
(
"alumna", "alga", "vertebra", "persona"
);
# CLASSICAL "..a" -> "..ae"
my $PL_sb_C_a_ae = enclose join "|",
(
"amoeba", "antenna", "formula", "hyperbola",
"medusa", "nebula", "parabola", "abscissa",
"hydra", "nova", "lacuna", "aurora", ".*umbra",
"flora", "fauna",
);
# CLASSICAL "..en" -> "..ina"
my $PL_sb_C_en_ina = enclose join "|", map { substr($_,0,-2) }
(
"stamen", "foramen", "lumen", "carmen"
lib/Lingua/ENG/Inflect.pm view on Meta::CPAN
classical zero=>0; # "no errors" INSTEAD OF "no error"
classical 'herd'; # "2 buffalo" INSTEAD OF "2 buffalos"
classical herd=>1; # "2 buffalo" INSTEAD OF "2 buffalos"
classical herd=>0; # "2 buffalos" INSTEAD OF "2 buffalo"
classical 'persons'; # "2 chairpersons" INSTEAD OF "2 chairpeople"
classical persons=>1; # "2 chairpersons" INSTEAD OF "2 chairpeople"
classical persons=>0; # "2 chairpeople" INSTEAD OF "2 chairpersons"
classical 'ancient'; # "2 formulae" INSTEAD OF "2 formulas"
classical ancient=>1; # "2 formulae" INSTEAD OF "2 formulas"
classical ancient=>0; # "2 formulas" INSTEAD OF "2 formulae"
# INTERPOLATE "PL()", "PL_N()", "PL_V()", "PL_ADJ()", A()", "AN()"
# "NUM()" AND "ORD()" WITHIN STRINGS:
print inflect("The plural of $word is PL($word)\n");
print inflect("I saw $cat_count PL("cat",$cat_count)\n");
print inflect("PL(I,$N1) PL_V(saw,$N1) PL(a,$N2) PL_N(saw,$N2)");
print inflect("NUM($N1,)PL(I) PL_V(saw) NUM($N2,)PL(a) PL_N(saw)");
lib/Lingua/ENG/Inflect.pm view on Meta::CPAN
The exportable subroutine C<classical()> controls this feature.
If C<classical()> is called with no arguments, it unconditionally
invokes classical mode. If it is called with a single argument, it
turns all classical inflects on or off (depending on whether the argument is
true or false). If called with two or more arguments, those arguments
specify which aspects of classical behaviour are to be used.
Thus:
classical; # SWITCH ON CLASSICAL MODE
print PL("formula"); # -> "formulae"
classical 0; # SWITCH OFF CLASSICAL MODE
print PL("formula"); # -> "formulas"
classical $cmode; # CLASSICAL MODE IFF $cmode
print PL("formula"); # -> "formulae" (IF $cmode)
# -> "formulas" (OTHERWISE)
classical herd=>1; # SWITCH ON CLASSICAL MODE FOR "HERD" NOUNS
print PL("wilderbeest"); # -> "wilderbeest"
classical names=>1; # SWITCH ON CLASSICAL MODE FOR NAMES
print PL("sally"); # -> "sallies"
print PL("Sally"); # -> "Sallys"
Note however that C<classical()> has no effect on the inflection of words which
are now fully assimilated. Hence:
t/classical_all.t view on Meta::CPAN
use Lingua::ENG::Inflect qw(PL_N classical);
use Test::More 'no_plan';
# DEFAULT...
is PL_N('error', 0) => 'errors'; # classical 'zero' not active
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('brother') => 'brothers'; # classical others not active
is PL_N('person') => 'people'; # classical 'persons' not active
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
# CLASSICAL PLURALS ACTIVATED...
classical 'all';
is PL_N('error', 0) => 'error'; # classical 'zero' active
is PL_N('wildebeest') => 'wildebeest'; # classical 'herd' active
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('brother') => 'brethren'; # classical others active
is PL_N('person') => 'persons'; # classical 'persons' active
is PL_N('formula') => 'formulae'; # classical 'ancient' active
# CLASSICAL PLURALS DEACTIVATED...
classical all => 0;
is PL_N('error', 0) => 'errors'; # classical 'zero' not active
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
is PL_N('Sally') => 'Sallies'; # classical 'names' not active
is PL_N('brother') => 'brothers'; # classical others not active
is PL_N('person') => 'people'; # classical 'persons' not active
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
# CLASSICAL PLURALS REACTIVATED...
classical all => 1;
is PL_N('error', 0) => 'error'; # classical 'zero' active
is PL_N('wildebeest') => 'wildebeest'; # classical 'herd' active
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('brother') => 'brethren'; # classical others active
is PL_N('person') => 'persons'; # classical 'persons' active
is PL_N('formula') => 'formulae'; # classical 'ancient' active
# CLASSICAL PLURALS REDEACTIVATED...
classical 0;
is PL_N('error', 0) => 'errors'; # classical 'zero' not active
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
is PL_N('Sally') => 'Sallies'; # classical 'names' not active
is PL_N('brother') => 'brothers'; # classical others not active
is PL_N('person') => 'people'; # classical 'persons' not active
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
# CLASSICAL PLURALS REREACTIVATED...
classical 1;
is PL_N('error', 0) => 'error'; # classical 'zero' active
is PL_N('wildebeest') => 'wildebeest'; # classical 'herd' active
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('brother') => 'brethren'; # classical others active
is PL_N('person') => 'persons'; # classical 'persons' active
is PL_N('formula') => 'formulae'; # classical 'ancient' active
# CLASSICAL PLURALS REREDEACTIVATED...
classical 0;
is PL_N('error', 0) => 'errors'; # classical 'zero' not active
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
is PL_N('Sally') => 'Sallies'; # classical 'names' not active
is PL_N('brother') => 'brothers'; # classical others not active
is PL_N('person') => 'people'; # classical 'persons' not active
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
# CLASSICAL PLURALS REREREACTIVATED...
classical;
is PL_N('error', 0) => 'error'; # classical 'zero' active
is PL_N('wildebeest') => 'wildebeest'; # classical 'herd' active
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('brother') => 'brethren'; # classical others active
is PL_N('person') => 'persons'; # classical 'persons' active
is PL_N('formula') => 'formulae'; # classical 'ancient' active
t/classical_ancient.t view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use Lingua::ENG::Inflect qw(PL_N classical);
use Test::More 'no_plan';
# DEFAULT...
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
# "person" PLURALS ACTIVATED...
classical 'ancient';
is PL_N('formula') => 'formulae'; # classical 'ancient' active
# OTHER CLASSICALS NOT ACTIVATED...
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
is PL_N('error', 0) => 'errors'; # classical 'zero' not active
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('brother') => 'brothers'; # classical 'all' not active
is PL_N('person') => 'people'; # classical 'persons' not active
t/classical_ancient_1.t view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use Lingua::ENG::Inflect qw(PL_N classical);
use Test::More 'no_plan';
# DEFAULT...
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
# "person" PLURALS ACTIVATED...
classical ancient => 1;
is PL_N('formula') => 'formulae'; # classical 'ancient' active
# OTHER CLASSICALS NOT ACTIVATED...
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
is PL_N('error', 0) => 'errors'; # classical 'zero' not active
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('brother') => 'brothers'; # classical 'all' not active
is PL_N('person') => 'people'; # classical 'persons' not active
t/classical_herd.t view on Meta::CPAN
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
# HERD PLURALS ACTIVATED...
classical 'herd';
is PL_N('wildebeest') => 'wildebeest'; # classical 'herd' active
# OTHER CLASSICALS NOT ACTIVATED...
is PL_N('person') => 'people'; # classical 'persons' not active
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
is PL_N('error', 0) => 'errors'; # classical 'zero' not active
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('brother') => 'brothers'; # classical 'all' not active
t/classical_herd_1.t view on Meta::CPAN
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
# HERD PLURALS ACTIVATED...
classical herd => 1;
is PL_N('wildebeest') => 'wildebeest'; # classical 'herd' active
# OTHER CLASSICALS NOT ACTIVATED...
is PL_N('person') => 'people'; # classical 'persons' not active
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
is PL_N('error', 0) => 'errors'; # classical 'zero' not active
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('brother') => 'brothers'; # classical 'all' not active
t/classical_names.t view on Meta::CPAN
classical 'names';
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('Jones', 0) => 'Joneses'; # always inflects that way
# OTHER CLASSICALS NOT ACTIVATED...
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
is PL_N('error', 0) => 'errors'; # classical 'zero' not active
is PL_N('brother') => 'brothers'; # classical 'all' not active
is PL_N('person') => 'people'; # classical 'persons' not active
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
# "person" PLURALS DEACTIVATED...
classical names=>0;
is PL_N('Sally') => 'Sallies'; # classical 'names' not active
is PL_N('Jones', 0) => 'Joneses'; # always inflects that way
t/classical_names_1.t view on Meta::CPAN
classical names=>1;
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('Jones') => 'Joneses'; # always inflects that way
# OTHER CLASSICALS NOT ACTIVATED...
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
is PL_N('error', 0) => 'errors'; # classical 'zero' not active
is PL_N('brother') => 'brothers'; # classical 'all' not active
is PL_N('person') => 'people'; # classical 'persons' not active
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
t/classical_person.t view on Meta::CPAN
is PL_N('person') => 'people'; # classical 'persons' not active
# "person" PLURALS ACTIVATED...
classical 'persons';
is PL_N('person') => 'persons'; # classical 'persons' active
# OTHER CLASSICALS NOT ACTIVATED...
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
is PL_N('error', 0) => 'errors'; # classical 'zero' not active
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('brother') => 'brothers'; # classical 'all' not active
t/classical_person_1.t view on Meta::CPAN
is PL_N('person') => 'people'; # classical 'persons' not active
# "person" PLURALS ACTIVATED...
classical persons=>1;
is PL_N('person') => 'persons'; # classical 'persons' active
# OTHER CLASSICALS NOT ACTIVATED...
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
is PL_N('error', 0) => 'errors'; # classical 'zero' not active
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('brother') => 'brothers'; # classical 'all' not active
t/classical_zero.t view on Meta::CPAN
classical 'zero';
is PL_N('error', 0) => 'error'; # classical 'zero' active
# OTHER CLASSICALS NOT ACTIVATED...
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('brother') => 'brothers'; # classical 'all' not active
is PL_N('person') => 'people'; # classical 'persons' not active
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
t/classical_zero_1.t view on Meta::CPAN
classical zero => 1;
is PL_N('error', 0) => 'error'; # classical 'zero' active
# OTHER CLASSICALS NOT ACTIVATED...
is PL_N('wildebeest') => 'wildebeests'; # classical 'herd' not active
is PL_N('Sally') => 'Sallys'; # classical 'names' active
is PL_N('brother') => 'brothers'; # classical 'all' not active
is PL_N('person') => 'people'; # classical 'persons' not active
is PL_N('formula') => 'formulas'; # classical 'ancient' not active
t/inflections.t view on Meta::CPAN
flora -> floras|florae
flounder -> flounder
focus -> focuses|foci
foetus -> foetuses
folio -> folios
Foochowese -> Foochowese
foot -> feet
foot's -> feet's # POSSESSIVE FORM
foramen -> foramens|foramina
foreshoes -> foreshoe
formula -> formulas|formulae
forum -> forums
fought -> fought
fox -> foxes
from him -> from them
from it -> from them # ACCUSATIVE
fungus -> funguses|fungi
Gabunese -> Gabunese
gallows -> gallows
ganglion -> ganglions|ganglia
gas -> gases