Institut Universitari de Lingüística Aplicada Universitat Pompeu Fabra |
Lluís de Yzaguirre i Maura Tel 935.422.234 Fax 935.422.321 |
use lib ('/opt/perl/lib/site_perl/5.8.0/'); # cal posar-hi el directori personal de mòduls
use numeral;
my ($operacio,$text,$numero);
sub tractaText {
my ($mot,$retorn);
$text=$entrada;
$text =~ s/\.$/ \./;
$text =~ s/\. / \. /g;
my @tot = split(/ /,$text);
foreach $mot (@tot) {
if ($mot =~ /^[\d]+\.[\d]+$/) {$mot =~ s/\.//g}
$retorn=$mot;
if ($mot =~ /^[\d]+$/) {
$retorn = senseFonet(cardinal($mot));
}
print "$retorn ";
}
print "\n";
}
sub tractaXifra {
my ($mot,$retorn);
my @tot = split(/ /,$entrada);
foreach $mot (@tot) {
$text = cardinal($mot);
$text = senseFonet($text);
print "$mot\t$text\n";
}
}
sub tractaCardinal {
my ($mot,$retorn);
if (0) {
my @tot = split(/ /,$entrada);
foreach $mot (@tot) {
$text = cardinal2xifra($mot);
print "$mot\t$text\n";
}
}
else
{
$text = cardinal2xifra($entrada);
print "$entrada\t$text\n";
}
}
sub tractaRoma {
my ($mot,$retorn);
my @tot = split(/ /,$entrada);
foreach $mot (@tot) {
$numero = roma2valor($mot);
$text = cardinal($numero);
$text = senseFonet($text);
print "$mot\t$text\n";
}
}
sub explica {
print "NUMERALS INPUT\n";
print "1\tXifra->Cardinal\n";
print "2\tCardinal->Xifra\n";
print "3\tRoma->Cardinal\n";
print "4\tText\n";
}
$operacio=$ARGV[0] or '';
$entrada=$ARGV[1];
if (!$operacio) {explica}
elsif ($operacio eq '1') {tractaXifra}
elsif ($operacio eq '2') {tractaCardinal}
elsif ($operacio eq '3') {tractaRoma}
elsif ($operacio eq '4') {tractaText}
|
Per comentaris i observacions, poseu-vos en contacte amb de_yza@upf.es Lluís de Yzaguirre i Maura |