in reply to Correct case

I've not personally used it, but the module Lingua::EN::NameCase may be useful. It seems to have a series of rules that deal with cases like the following:

Original Name Case -------- --------- KEITH Keith LEIGH-WILLIAMS Leigh-Williams MCCARTHY McCarthy O'CALLAGHAN O'Callaghan ST. JOHN St. John

Regards,
Dom.

Replies are listed 'Best First'.
Re: Re: Correct case
by herveus (Prior) on Jan 13, 2003 at 21:25 UTC
    Howdy!

    ...but feed it "Owen ap Tudor", "Sveinn inn Danska", and "David ben Jesse"...

    Of course, that's Lingua::EN::NameCase, not Lingua::welsh, scandihoovian, or jewish::NameCase...

    The original question has no general solution, since name capitalization conventions vary from culture to culture.

    yours,
    Michael

      Hi herveus,

      ++ on the point that there is no general solution to this problem but I thought I would just check out how Lingua::EN::NameCase would deal with your examples...

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