From: "R (Chandra) Chandrasekhar" <[EMAIL PROTECTED]>
> 3. Some transliteration examples are shown below:
>
> a       a   U+0061   LATIN SMALL LETTER A
> aa      a   U+0101   LATIN SMALL LETTER A WITH MACRON
> A       a   U+0101   LATIN SMALL LETTER A WITH MACRON
> .a      '   U+0027   APOSTROPHE
> ~N         U+1E45   LATIN SMALL LETTER N WITH DOT ABOVE
> RRI        U+1E5D   LATIN SMALL LETTER R WITH DOT BELOW AND MACRON
> R^I      U+1E5D   LATIN SMALL LETTER R WITH DOT BELOW AND MACRON

Put the transliteration rules into a hash like this:

 %trans = (
  'aa' => 'a',
  'A'  => 'a',
  '.a' => "'",
  ...
 );

and build a regexp to match the 1-3 characters to replace:

 @signs = sort {length($b) <=> length($a)} keys %trans;
 @signs = map quotemeta($_) @signs;
 $re = join '|', @signs, '.';

and use the regexp to split the text into pieces and transliterate
them.

 $text =~ s/($re)/exists($trans{$1}) ? $trans{$1} : $1/geo;

HTH, Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to