Lingua:...dNumber(3)
π NAME π
This is the Lingua:...dNumber(3) page from the User Contributed Perl Documentation, and it's all about Lingua::EN::FindNumber β the module that locates (written) numbers in English text. Yes bestie, it finds number words in actual English sentences, no cap. π
β¨ SYNOPSIS β¨
Okay so here's the group-chat demo β literally the exact code, don't touch the punctuation:
use Lingua::EN::FindNumber;
my $text = "Fourscore and seven years ago, our four fathers...";
numify($text); # "87 years ago, our 4 fathers..."
@numbers = extract_numbers($text); # "Fourscore and seven", "four"
while ($text =~ /$number_re/g) { # Build your own iterator
π¦ DESCRIPTION π¦
This module provides a regular expression for finding numbers in English text. It also provides functions for extracting and manipulating such numbers. That's the whole plot, and honestly it's giving main character energy, periodt. π
πΈ EXPORTED METHODS πΈ
π extract_numbers / numify / $number_re π
The exported lineup is extract_numbers, numify, and the regex $number_re β iconic behavior only. Here are the examples again, because repetition is how we learn and also because they ate:
numify($text); # "87 years ago, our 4 fathers..."
@numbers = extract_numbers($text); # "Fourscore and seven", "four"
while ($text =~ /$number_re/g) { # Build your own iterator
π SEE ALSO π
This module was written for the Natural Languages chapter of the second edition of Advanced Perl Programming β yes, that's the lore. π
It works rather well in conjunction with Lingua::EN::Words2Nums, which is a very cool module anyway. (And Simon stole some of this module's code from it. Thanks, Joey!) π«Ά It may also be involved with Lingua::EN::NamedEntity in the future, so check that one out too. π
π§ REPOSITORY π§
The repo is right here, bestie: <https://github.com/neilb/Lingua-EN-FindNumber> β go click around, iykyk. β¨
π AUTHOR π
This module was originally written by Simon Cozens. It was then maintained from 2004 to 2005 by Tony Bowden. Since 2014 it has been maintained by Neil Bowers. A whole handoff timeline, honestly. π
π BUGS and QUERIES π
Please direct all correspondence regarding this module to:
bug-Lingua-EN-Number@rt.cpan.org
Not me putting the email in its own little code block, but it's giving "important contact info" and we respect that. π
π COPYRIGHT AND LICENSE π
Copyright 2003-2005 by Simon Cozens
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 β source/version perl v5.42.0, dated 2015-10-29, and the manual name is Lingua:...dNumber(3). Slay and goodbye! π«Άπ
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Lingua-EN-FindNumber 1.32-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