Lingua:...sOrdinal(3)
okay so bestie π this is the Lingua:...sOrdinal(3) page from the User Contributed Perl Documentation, and we're about to get extremely normal about English number vibes. Buckle up π
π NAME π
Lingua::EN::Number::IsOrdinal β detects if an English number is ordinal or cardinal. That's it. That's the whole mission, and honestly? iconic. β¨
π¦ 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 β the same distinction documented at http://www.ego4u.com/en/cram-up/vocabulary/numbers/ordinal.
It's useful if you, e.g., want to distinguish these types of numbers found with Lingua::EN::FindNumber and take different actions. Lowkey a little number detective π΅οΈββοΈ
π₯ 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.
It checks that the whole parameter is a number using Lingua::EN::FindNumber or a regex in the case of digits. If it isn't a number, it will throw a "not a number" exception. no cap, the whole parameter has to be a number, not just vibes π
This function can be optionally imported.
π§ METHODS π§
_is_ordinal π§
Method version of "is_ordinal" β this is where the function is actually implemented. Can be overloaded in a subclass. Main character implementation energy π
_is_number π§
Returns 1 if the passed in string is a word-number as detected by Lingua::EN::FindNumber, or is a cardinal or ordinal number made of digits and (for ordinal numbers) a suffix. Otherwise returns undef. Can be overloaded in a subclass.
π SEE ALSO π
Lingua::EN::FindNumberLingua::EN::Words2NumsLingua::EN::Inflect::Phrase
π AUTHOR π
Rafael Kitover β rkitover@cpan.org π«Ά
π LICENSE π
Copyright 2013-2015 by Rafael Kitover.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
okay that's the whole page, bestie β it's from perl v5.42.0, dated 2015-04-13, and it's the Lingua:...sOrdinal(3) manual. Bye-bye, go slay some number detection ππ«Ά
π¦ where this page comes from
- opensuse-leap 16.0: perl-Lingua-EN-Number-IsOrdinal 0.05-bp160.1.11 Β· Artistic-1.0 or GPL-1.0+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms