Lingua::TH::Numbers - Convert and spell Thai numbers.
Version 1.0.6
use Lingua::TH::Numbers; # Input. my $ten = Lingua::TH::Numbers->new( '10' ); my $sip = Lingua::TH::Numbers->new( '๑๐' ); my $lop_sip = Lingua::TH::Numbers->new( '-๑๐' ); my $three_point_one_four = Lingua::TH::Numbers->new( '3.14' ); my $nueng_chut_sun_song = Lingua::TH::Numbers->new( '๑.๐๒' ); # Output. print $ten->thai_numerals(), "\n"; print $sip->arabic_numerals(), "\n"; print $lop_sip->arabic_numerals(), "\n"; print $three_point_one_four->thai_numerals(), "\n"; print $nueng_chut_sun_song->arabic_numerals(), "\n"; # Spell. print $three_point_one_four->spell(), "\n"; print $three_point_one_four->spell( output_type => 'thai' ), "\n"; print $nueng_chut_sun_song->spell( output_type => 'rtgs' ), "\n"; print $nueng_chut_sun_song->spell( output_type => 'rtgs', informal => 1 ), "\n";
Create a new Lingua::TH::Numbers object.
my $ten = Lingua::TH::Numbers->new( '10' ); my $sip = Lingua::TH::Numbers->new( '๑๐' ); my $lop_sip = Lingua::TH::Numbers->new( '-๑๐' ); my $three_point_one_four = Lingua::TH::Numbers->new( '3.14' ); my $nueng_chut_sun_song = Lingua::TH::Numbers->new( '๑.๐๒' );
The input can use either Thai or Arabic numerals, but not both at the same time.
Output the number stored in the object using thai numerals.
my $ten = Lingua::TH::Numbers->new( '10' ); print $ten->thai_numerals(), "\n";
Output the number stored in the object using arabic numerals.
my $lop_sip = Lingua::TH::Numbers->new( '-๑๐' ); print $lop_sip->arabic_numerals(), "\n";
Spell the number stored in the object.
By default, spelling is done using Thai script, but the method also supports the spelling of the Royal Thai General System with the parameter output_mode set to rtgs.
This method also supports spelling shortcuts for informal language, using the parameter informal.
# Spell using Thai script. print Lingua::TH::Numbers->new( '10' )->spell(), "\n"; # Spell using the Royal Thai General System. print Lingua::TH::Numbers->new( '10' )->spell( output_mode => 'rtgs' ), "\n"; # Spell using Thai script, with informal shortcuts. print Lingua::TH::Numbers->new( '10' )->spell( informal => 1 ), "\n"; # Spell using the Royal Thai General System, with informal shortcuts. print Lingua::TH::Numbers->new( '10' )->spell( output_mode => 'rtgs', informal => 1 ), "\n";
Spell the integer passed as parameter.
This internal function should not be used, as it is designed to handle a sub-case of spell() only in order to spell integers lesser than 10,000,000.
spell()
my @spelling = Lingua::TH::Numbers::_spell_integer( 10, $output_mode_index, $is_informal );
Guillaume Aubert, <aubertg at cpan.org>.
<aubertg at cpan.org>
There's too many Unicode issues in Perl 5.6 (in particular with tr/// which this module uses) and Perl 5.6 is 10 year old at this point, so I decided to make Perl 5.8 the minimum requirement for this module after a lot of time spent jumping through pre-5.8 hoops.
If you really need this module and you are still using a version of Perl that predates 5.8, please let me know although I would really encourage you to upgrade.
Please report any bugs or feature requests to bug-lingua-th-numbers at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=lingua-th-numbers. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-lingua-th-numbers at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Lingua::TH::Numbers
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=lingua-th-numbers
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/lingua-th-numbers
CPAN Ratings
http://cpanratings.perl.org/d/lingua-th-numbers
Search CPAN
http://search.cpan.org/dist/lingua-th-numbers/
Copyright 2011-2012 Guillaume Aubert.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/
To install Lingua::TH::Numbers, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::TH::Numbers
CPAN shell
perl -MCPAN -e shell install Lingua::TH::Numbers
For more information on module installation, please visit the detailed CPAN module installation guide.