1Lingua::EN::Number::IsOUrsdeirnaClo(n3t)ributed Perl DocLuimnegnutaa:t:iEoNn::Number::IsOrdinal(3)
2
3
4

NAME

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

SYNOPSIS

10           use Lingua::EN::Number::IsOrdinal 'is_ordinal';
11
12           ok is_ordinal('first');
13
14           ok !is_ordinal('one');
15
16           ok is_ordinal('2nd');
17
18           ok !is_ordinal('2');
19

DESCRIPTION

21       This module will tell you if a number, either in words or as digits, is
22       a cardinal or ordinal number <http://www.ego4u.com/en/cram-
23       up/vocabulary/numbers/ordinal>.
24
25       This is useful if you e.g. want to distinguish these types of numbers
26       found with Lingua::EN::FindNumber and take different actions.
27

FUNCTIONS

29   is_ordinal
30       Takes a number as English words or digits (with or without ordinal
31       suffix) and returns 1 for ordinal numbers and "undef" for cardinal
32       numbers.
33
34       Checks that the whole parameter is a number using
35       Lingua::EN::FindNumber or a regex in the case of digits, and if it
36       isn't will throw a "not a number" exception.
37
38       This function can be optionally imported.
39

METHODS

41   _is_ordinal
42       Method version of "is_ordinal", this is where the function is actually
43       implemented. Can be overloaded in a subclass.
44
45   _is_number
46       Returns 1 if the passed in string is a word-number as detected by
47       Lingua::EN::FindNumber or is a cardinal or ordinal number made of
48       digits and (for ordinal numbers) a suffix. Otherwise returns "undef".
49       Can be overloaded in a subclass.
50

SEE ALSO

52       •   Lingua::EN::FindNumber
53
54       •   Lingua::EN::Words2Nums
55
56       •   Lingua::EN::Inflect::Phrase
57

AUTHOR

59       Rafael Kitover <rkitover@cpan.org>
60

LICENSE

62       Copyright 2013-2015 by Rafael Kitover
63
64       This library is free software; you can redistribute it and/or modify it
65       under the same terms as Perl itself.
66
67
68
69perl v5.36.0                      2023-01-20  Lingua::EN::Number::IsOrdinal(3)
Impressum