NAME

Lingua::EN::WordsToNumbers - convert numbers written in English to actual numbers

DESCRIPTION

This module is a tiny 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).

SYNOPSIS

use Lingua::EN::WordsToNumbers qw(words_to_numbers);

print words_to_numbers("Forty-two");             # "42"

Lingua::EN::WordsToNumbers->set_debug('y');      # debug mode on
Lingua::EN::WordsToNumbers->set_debug('n');      # debug mode on

Lingua::EN::WordsToNumbers->set_billion(10**12); # use "English billion"

METHODS

words_to_numbers()

An alias for Lingua::EN::Words2Nums's words2nums method. Read that module's documentation to see how it works.

set_debug()

Lingua::EN::WordsToNumbers->set_debug('y');

Set Lingua::EN::Words2Nums debug mode. 'y' or 'Y' is on, 'n' or 'N' is off. Not exportable; call directly.

set_billion()

Lingua::EN::WordsToNumbers->set_billion(10**12);

Define the value of a billion ($Lingua::EN::Words2Nums::billion). Not exportable; call directly.

DEPRECATED METHODS

You know how, every now and then, you look at some of your code from a few years ago and think "What the hell was I smoking?" Well, this is that code. The following methods are a completely pointless OO interface to this module and I recommend ignoring them completely. They'll go away in the next version of this module - say in about a year's time.

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.

words2nums()

print $numberizer->words2nums("Forty-two"); # "42"

Same as above. Legacy method; deprecated.

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).

AUTHOR

Earle Martin <hex@cpan.org>

http://downlode.org/

CREDITS

All credit is due to Joey Hess (JOEY) for writing Lingua::EN::Words2Nums which does the actual work.

This module was jointly conceived with Leon Brocard (LBROCARD) one lunchtime.

LEGAL

Copyright 2004-2007 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.