Lingua::Slavic::Numbers - Converts numeric values into their Slavic string equivalents. Bulgarian is supported so far.
# Procedural Style use Lingua::Slavic::Numbers qw(number_to_slavic ordinate_to_slavic); print number_to_slavic('bg', 345 ); my $twenty = ordinate_to_slavic('bg', 20 ); print "Ordinate of 20 is $twenty"; # OO Style use Lingua::Slavic::Numbers; # specifies default language my $number = Lingua::Slavic::Numbers->new( 123, Lingua:Slavic::Numbers::LANG_BG ); print $number->get_string; print $number->get_ordinate; # override language print $number->get_string(Lingua:Slavic::Numbers::LANG_BG); print $number->get_ordinate(Lingua:Slavic::Numbers::LANG_BG); # default language, no number my $other_number = Lingua::Slavic::Numbers->new(Lingua:Slavic::Numbers::LANG_BG); $other_number->parse( 7340 ); $bg_string = $other_number->get_string;
This module converts a number into a Slavic-language cardinal or ordinal. Bulgarian is supported so far.
The interface tries to conform to the one defined in Lingua::EN::Number, though this module does not provide any parse() method. Also, unlike Lingua::En::Numbers, you can use this module in a procedural manner by importing the number_to_LL() function (LL=bg so far).
If you plan to use this module with greater numbers (>10e20), you can use the Math::BigInt module:
use Math::BigInt; use Lingua::Slavic::Numbers qw( number_to_slavic ); my $big_num = new Math::BigInt '1.23e68'; print number_to_slavic('bg', $big_num);
use Lingua::Slavic::Numbers qw(number_to_slavic); my $depth = number_to_slavic('bg', 20_000 ); my $year = number_to_slavic('bg', 1870 ); # in honor of Lingua::FR::Numbers, which I copied to start this # module, I'm using a French example print "Жул Верн написа ,,$depth левги под морето'' в $year.";
This function can be exported by the module.
use Lingua::Slavic::Numbers qw(ordinate_to_slavic); my $twenty = ordinate_to_slavic('bg', 20 ); print "Номер $twenty";
Bulgarian: Lingua:Slavic::Numbers::LANG_BG ('bg')
Lingua::FR::Numbers for the code
Though the module should be able to convert big numbers (up to 10**36), I do not know how Perl handles them.
Please report any bugs or comments using the Request Tracker interface: https://rt.cpan.org/NoAuth/Bugs.html?Dist=Lingua-Slavic-Numbers
Copyright 2008, Ted Zlatanov (Теодор Златанов). All Rights Reserved. This module can be redistributed under the same terms as Perl itself.
Ted Zlatanov <tzz@lifelogs.com>
Lingua::EN::Numbers, Lingua::Word2Num
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in '"Жул'. Assuming UTF-8
To install Lingua::Slavic::Numbers, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::Slavic::Numbers
CPAN shell
perl -MCPAN -e shell install Lingua::Slavic::Numbers
For more information on module installation, please visit the detailed CPAN module installation guide.