#!/usr/local/bin/perl # # transliterate-irmologion # # Justin Zamora, October 19, 2000 # For "Help Me Learn Church Slavonic" # http://justin.zamora.com/slavonic # Transliteration table $table[0x46] = 'F'; $table[0x49] = 'I'; $table[0x4f] = 'O'; $table[0x50] = 'PS'; $table[0x51] = 'w'; $table[0x53] = 'Z'; $table[0x54] = 'wt'; $table[0x55] = 'u'; $table[0x56] = 'V'; $table[0x57] = 'w'; $table[0x58] = 'KS'; $table[0x59] = 'V'; $table[0x5a] = 'ja'; $table[0x65] = 'E'; $table[0x66] = 'F'; $table[0x69] = 'I'; $table[0x6f] = 'O'; $table[0x70] = 'PS'; $table[0x71] = 'w'; $table[0x73] = 'Z'; $table[0x74] = 'wt'; $table[0x75] = 'u'; $table[0x76] = 'V'; $table[0x77] = 'w'; $table[0x78] = 'KS'; $table[0x79] = 'V'; $table[0x7a] = 'ja'; $table[0xc0] = 'a'; $table[0xc1] = 'b'; $table[0xc2] = 'v'; $table[0xc3] = 'g'; $table[0xc4] = 'd'; $table[0xc5] = 'e'; $table[0xc6] = 'zh'; $table[0xc7] = 'z'; $table[0xc8] = 'i'; $table[0xc9] = 'j'; $table[0xca] = 'k'; $table[0xcb] = 'l'; $table[0xcc] = 'm'; $table[0xcd] = 'n'; $table[0xce] = 'o'; $table[0xcf] = 'p'; $table[0xd0] = 'r'; $table[0xd1] = 's'; $table[0xd2] = 't'; $table[0xd3] = 'u'; $table[0xd4] = 'f'; $table[0xd5] = 'x'; $table[0xd6] = 'c'; $table[0xd7] = 'ch'; $table[0xd8] = 'sh'; $table[0xd9] = 'shch'; $table[0xda] = '"'; $table[0xdb] = 'y'; $table[0xdc] = "'"; $table[0xdd] = 'je'; $table[0xde] = 'ju'; $table[0xdf] = 'ja'; $table[0xe0] = 'a'; $table[0xe1] = 'b'; $table[0xe2] = 'v'; $table[0xe3] = 'g'; $table[0xe4] = 'd'; $table[0xe5] = 'e'; $table[0xe6] = 'zh'; $table[0xe7] = 'z'; $table[0xe8] = 'i'; $table[0xe9] = 'j'; $table[0xea] = 'k'; $table[0xeb] = 'l'; $table[0xec] = 'm'; $table[0xed] = 'n'; $table[0xee] = 'o'; $table[0xef] = 'p'; $table[0xf0] = 'r'; $table[0xf1] = 's'; $table[0xf2] = 't'; $table[0xf3] = 'u'; $table[0xf4] = 'f'; $table[0xf5] = 'x'; $table[0xf6] = 'c'; $table[0xf7] = 'ch'; $table[0xf8] = 'sh'; $table[0xf9] = 'shch'; $table[0xfa] = '"'; $table[0xfb] = 'y'; $table[0xfc] = "'"; $table[0xfd] = 'je'; $table[0xfe] = 'ju'; $table[0xff] = 'ja'; sub transliterate { my $c = shift(@_); # If it's defined in the table, use the table entry, # otherwise use the value passed in if ($table[$c]) { return $table[$c]; } else { return chr($c); } } while (<>) { @chars = unpack("C*", $_); @trans = map {transliterate($_)} @chars; $s = join('', @trans); # Use a lowercase 'i' before a vowel, and a lowercase 'e' and 'o' # at the beginning of a word $s =~ s/I([aeEoOyiIjwu])/i$1/g; $s =~ s/([^a-zA-Z'"])E/$1e/g; $s =~ s/^E/e/g; $s =~ s/([^a-zA-Z'"])O/$1o/g; $s =~ s/^O/o/g; # Use a lowercase 'ps' except before 'sja' s/PS([^j])/ps$1/g; s/PSj([^a])/psj$1/g; s/PSja([a-zA-Z'"])/psja$1/g; # Use a lowercase 'ks' except before 'sja' s/KS([^j])/ks$1/g; s/KSj([^a])/ksj$1/g; s/KSja([a-zA-Z'"])/ksja$1/g; print "$s"; }