#perl -w
use strict;
use warnings;
use Lingua::EN::NameCase qw( NameCase nc ) ;
my @proper_names = (
'Owen ap Tudor',
'Sveinn inn Danska',
'David ben Jesse'
);
my @lowercase_names = map { lc } @proper_names ;
my @result = NameCase( @lowercase_names ) ;
my ($iCount, $bMatch);
for ($iCount = 0; $iCount <= $#result; $iCount++) {
$bMatch = $proper_names[$iCount] eq $result[$iCount] ? 'Y' : 'N';
write;
}
exit;
format STDOUT_TOP =
Orignal case Output from NameCase Match
============================== ============================== =====
.
format STDOUT =
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<
$proper_names[$iCount], $result[$iCount], $bMatch
.
__END__
Surprisingly the output looks like this:
Orignal case Output from NameCase Match
============================== ============================== =====
Owen ap Tudor Owen ap Tudor Y
Sveinn inn Danska Sveinn Inn Danska N
David ben Jesse David ben Jesse Y
"Sveinn Inn Danska" is not correct but surprisingly for a Lingua::EN module it does deal well with the other cases. Also from the documentation there is a variable that can be set to deal with special cases for Spanish... Perhaps the module itself has evolved to become a misnomer.
Regards,
Dom.
Update: Corrected typo on link.
Update: Corrected typo on incorrect name.
|