NAME

Lingua::EN::Number::IsOrdinal - detect if English number is ordinal or cardinal

SYNOPSIS

use Lingua::EN::Number::IsOrdinal 'is_ordinal';

ok is_ordinal('first');

ok !is_ordinal('one');

ok is_ordinal('2nd');

ok !is_ordinal('2');

DESCRIPTION

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.

FUNCTIONS

is_ordinal

Takes a number as English words or digits (with or without ordinal suffix) and returns 1 for ordinal numbers and undef for cardinal numbers.

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.

This function can be optionally imported.

SEE ALSO

AUTHOR

Rafael Kitover <rkitover@cpan.org>