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::FindNumber
  • Lingua::EN::Words2Nums
  • Lingua::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