I'm going to Greece tomorrow and I noticed to my dismay that mkgmap's transliteration tables for the Greek alphabet were totally missing.
So I hacked up a small Perl script which uses the Unicode::UCD and the Text::Unidecode modules to fillin the blanks: a...@aoeu:~/src/mkgmap/resources/chars/ascii$ perl re-transliterate.pl < row03.trans > row03.trans.tmp && mv row03.trans.tmp row03.trans The script and a patch to row03.trans which Works For Me are attached. But of course the tool can also be run on the rest of the files to fill in more blanks. And my script can of course be modified a bit further to spit out transliterations for files not yet in mkgmap row* files. I don't know what the row* files were originally based on but there's a lot of prior art for transliterating Unicode and there's no need to redo all this work for mkgmap. The Unicode Consortium has published transliteration tables (which Text::Unidecode is largely based on), it's much easier to use stuff like that rather than doing all the work yourselves. Anyway, off to pack for my flight.
#!/usr/bin/env perl use feature ':5.10'; use strict; use warnings; use Unicode::UCD 'charinfo'; use Text::Unidecode; use Data::Dump 'dump'; sub new_trans { my $char_name = shift; if (my $info = charinfo($char_name)) { my $chr = chr hex $info->{code}; my $t; if ($t = unidecode($chr) and $t ne '[?]') { return $t; } } return; } while (<>) { chomp; if (/^U\+/) { my ($char_name, $trans, $annotate) = $_ =~ m[^(U\+\S+)\s+(\S+)\s+(.*)]; my $new_trans; if ($trans eq '?' and ($new_trans = new_trans($char_name))) { say "$char_name $new_trans" . (" " x (10 - length($new_trans))) . "$annotate"; } else { say; } } else { say; } }
Index: row03.trans =================================================================== --- row03.trans (revision 1131) +++ row03.trans (working copy) @@ -127,8 +127,8 @@ U+0371 ? # character ͱ U+0372 ? # character Ͳ U+0373 ? # character ͳ -U+0374 ? # character ʹ -U+0375 ? # character ͵ +U+0374 ' # character ʹ +U+0375 , # character ͵ U+0376 ? # character Ͷ U+0377 ? # character ͷ U+0378 ? # character @@ -137,7 +137,7 @@ U+037b ? # character ͻ U+037c ? # character ͼ U+037d ? # character ͽ -U+037e ? # character ; +U+037e ? # character ; U+037f ? # character Ϳ U+0380 ? # character U+0381 ? # character @@ -145,116 +145,116 @@ U+0383 ? # character U+0384 ? # character ΄ U+0385 ? # character ΅ -U+0386 ? # character Ά -U+0387 ? # character · -U+0388 ? # character Έ -U+0389 ? # character Ή -U+038a ? # character Ί +U+0386 A # character Ά +U+0387 ; # character · +U+0388 E # character Έ +U+0389 E # character Ή +U+038a I # character Ί U+038b ? # character -U+038c ? # character Ό +U+038c O # character Ό U+038d ? # character -U+038e ? # character Ύ -U+038f ? # character Ώ -U+0390 ? # character ΐ -U+0391 ? # character Α -U+0392 ? # character Β -U+0393 ? # character Γ -U+0394 ? # character Δ -U+0395 ? # character Ε -U+0396 ? # character Ζ -U+0397 ? # character Η -U+0398 ? # character Θ -U+0399 ? # character Ι -U+039a ? # character Κ -U+039b ? # character Λ -U+039c ? # character Μ -U+039d ? # character Ν -U+039e ? # character Ξ -U+039f ? # character Ο -U+03a0 ? # character Π -U+03a1 ? # character Ρ +U+038e U # character Ύ +U+038f O # character Ώ +U+0390 I # character ΐ +U+0391 A # character Α +U+0392 B # character Β +U+0393 G # character Γ +U+0394 D # character Δ +U+0395 E # character Ε +U+0396 Z # character Ζ +U+0397 E # character Η +U+0398 Th # character Θ +U+0399 I # character Ι +U+039a K # character Κ +U+039b L # character Λ +U+039c M # character Μ +U+039d N # character Ν +U+039e Ks # character Ξ +U+039f O # character Ο +U+03a0 P # character Π +U+03a1 R # character Ρ U+03a2 ? # character -U+03a3 ? # character Σ -U+03a4 ? # character Τ -U+03a5 ? # character Υ -U+03a6 ? # character Φ -U+03a7 ? # character Χ -U+03a8 ? # character Ψ -U+03a9 ? # character Ω -U+03aa ? # character Ϊ -U+03ab ? # character Ϋ -U+03ac ? # character ά -U+03ad ? # character έ -U+03ae ? # character ή -U+03af ? # character ί -U+03b0 ? # character ΰ -U+03b1 ? # character α -U+03b2 ? # character β -U+03b3 ? # character γ -U+03b4 ? # character δ -U+03b5 ? # character ε -U+03b6 ? # character ζ -U+03b7 ? # character η -U+03b8 ? # character θ -U+03b9 ? # character ι -U+03ba ? # character κ -U+03bb ? # character λ -U+03bc ? # character μ -U+03bd ? # character ν -U+03be ? # character ξ -U+03bf ? # character ο -U+03c0 ? # character π -U+03c1 ? # character ρ -U+03c2 ? # character ς -U+03c3 ? # character σ -U+03c4 ? # character τ -U+03c5 ? # character υ -U+03c6 ? # character φ -U+03c7 ? # character χ -U+03c8 ? # character ψ -U+03c9 ? # character ω -U+03ca ? # character ϊ -U+03cb ? # character ϋ -U+03cc ? # character ό -U+03cd ? # character ύ -U+03ce ? # character ώ +U+03a3 S # character Σ +U+03a4 T # character Τ +U+03a5 U # character Υ +U+03a6 Ph # character Φ +U+03a7 Kh # character Χ +U+03a8 Ps # character Ψ +U+03a9 O # character Ω +U+03aa I # character Ϊ +U+03ab U # character Ϋ +U+03ac a # character ά +U+03ad e # character έ +U+03ae e # character ή +U+03af i # character ί +U+03b0 u # character ΰ +U+03b1 a # character α +U+03b2 b # character β +U+03b3 g # character γ +U+03b4 d # character δ +U+03b5 e # character ε +U+03b6 z # character ζ +U+03b7 e # character η +U+03b8 th # character θ +U+03b9 i # character ι +U+03ba k # character κ +U+03bb l # character λ +U+03bc m # character μ +U+03bd n # character ν +U+03be x # character ξ +U+03bf o # character ο +U+03c0 p # character π +U+03c1 r # character ρ +U+03c2 s # character ς +U+03c3 s # character σ +U+03c4 t # character τ +U+03c5 u # character υ +U+03c6 ph # character φ +U+03c7 kh # character χ +U+03c8 ps # character ψ +U+03c9 o # character ω +U+03ca i # character ϊ +U+03cb u # character ϋ +U+03cc o # character ό +U+03cd u # character ύ +U+03ce o # character ώ U+03cf ? # character Ϗ -U+03d0 ? # character ϐ -U+03d1 ? # character ϑ -U+03d2 ? # character ϒ -U+03d3 ? # character ϓ -U+03d4 ? # character ϔ -U+03d5 ? # character ϕ -U+03d6 ? # character ϖ -U+03d7 ? # character ϗ +U+03d0 b # character ϐ +U+03d1 th # character ϑ +U+03d2 U # character ϒ +U+03d3 U # character ϓ +U+03d4 U # character ϔ +U+03d5 ph # character ϕ +U+03d6 p # character ϖ +U+03d7 & # character ϗ U+03d8 ? # character Ϙ U+03d9 ? # character ϙ -U+03da ? # character Ϛ -U+03db ? # character ϛ -U+03dc ? # character Ϝ -U+03dd ? # character ϝ -U+03de ? # character Ϟ -U+03df ? # character ϟ -U+03e0 ? # character Ϡ -U+03e1 ? # character ϡ -U+03e2 ? # character Ϣ -U+03e3 ? # character ϣ -U+03e4 ? # character Ϥ -U+03e5 ? # character ϥ -U+03e6 ? # character Ϧ -U+03e7 ? # character ϧ -U+03e8 ? # character Ϩ -U+03e9 ? # character ϩ -U+03ea ? # character Ϫ -U+03eb ? # character ϫ -U+03ec ? # character Ϭ -U+03ed ? # character ϭ -U+03ee ? # character Ϯ -U+03ef ? # character ϯ -U+03f0 ? # character ϰ -U+03f1 ? # character ϱ -U+03f2 ? # character ϲ -U+03f3 ? # character ϳ +U+03da St # character Ϛ +U+03db st # character ϛ +U+03dc W # character Ϝ +U+03dd w # character ϝ +U+03de Q # character Ϟ +U+03df q # character ϟ +U+03e0 Sp # character Ϡ +U+03e1 sp # character ϡ +U+03e2 Sh # character Ϣ +U+03e3 sh # character ϣ +U+03e4 F # character Ϥ +U+03e5 f # character ϥ +U+03e6 Kh # character Ϧ +U+03e7 kh # character ϧ +U+03e8 H # character Ϩ +U+03e9 h # character ϩ +U+03ea G # character Ϫ +U+03eb g # character ϫ +U+03ec CH # character Ϭ +U+03ed ch # character ϭ +U+03ee Ti # character Ϯ +U+03ef ti # character ϯ +U+03f0 k # character ϰ +U+03f1 r # character ϱ +U+03f2 c # character ϲ +U+03f3 j # character ϳ U+03f4 ? # character ϴ U+03f5 ? # character ϵ U+03f6 ? # character ϶
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev