Lingua::EN::Number::IsOrdinal - detect if English number is ordinal or cardinal
use Lingua::EN::Number::IsOrdinal 'is_ordinal'; ok is_ordinal('first'); ok !is_ordinal('one'); ok is_ordinal('2nd'); ok !is_ordinal('2');
This module will tell you if a number, either in words or as digits, is a cardinal or ordinal number.
This is useful if you e.g. want to distinguish these types of numbers found with Lingua::EN::FindNumber and take different actions.
Takes a number as English words or digits (with or without ordinal suffix) and returns 1 for ordinal numbers and undef for cardinal numbers.
1
undef
Checks that the whole parameter is a number using Lingua::EN::FindNumber or a regex in the case of digits, and if it isn't will throw a not a number exception.
not a number
This function can be optionally imported.
Lingua::EN::FindNumber
Lingua::EN::Words2Nums
Lingua::EN::Inflect::Phrase
Rafael Kitover <rkitover@cpan.org>
To install Lingua::EN::Number::IsOrdinal, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::EN::Number::IsOrdinal
CPAN shell
perl -MCPAN -e shell install Lingua::EN::Number::IsOrdinal
For more information on module installation, please visit the detailed CPAN module installation guide.