Lingua::EN::WordsToNumbers - convert numbers written in English to actual numbers
This module is an OO wrapper for Lingua::EN::Words2Nums, which is very nice, but has an unfortunate name (which doesn't help when you're searching CPAN for modules that turn words into numbers).
use Lingua::EN::WordsToNumbers; my $numberizer = Lingua::EN::WordsToNumbers->new; print $numberizer->parse("Forty-two"); # "42" $numberizer->debug(1); # debug on $numberizer->debug(undef); # debug off $numberizer->billion(10**12); # use "English billion"
new
my $numberizer = Lingua::EN::WordsToNumbers->new;
Gives you a new "object". Doesn't really do much.
parse
print $numberizer->parse("Forty-two"); # "42"
An alias for Lingua::EN::Words2Nums's words2nums method. Read that module's documentation to see how it works. You can also call this method as words2nums if you really want to.
words2nums
debug
$numberizer->debug(1);
Set Lingua::EN::Words2Nums debug mode. True values are on, anything else is off.
billion
$numberizer->billion(10**12);
Define the value of a billion ($Lingua::EN::Words2Nums::billion).
$Lingua::EN::Words2Nums::billion
Earle Martin <EMARTIN@cpan.org>
http://purl.oclc.org/net/earlemartin/
Thanks to Joey Hess (JOEY) for writing Lingua::EN::Words2Nums which does the real work.
This module was jointly conceived with Leon Brocard (LBROCARD) one lunchtime.
Copyright 2004 Earle Martin. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Lingua::EN::WordsToNumbers, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::EN::WordsToNumbers
CPAN shell
perl -MCPAN -e shell install Lingua::EN::WordsToNumbers
For more information on module installation, please visit the detailed CPAN module installation guide.