#!/usr/local/bin/perl # alibata.pl 1.0 # Takes a word as input, syllabilizes it, then outputs the # corresponding glyphs. # You also need PNGs of the glyphs, found at # http://www.ocf.berkeley.edu/~vganata/alibata # Copyright (C) 2001 by Victor Ganata # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. use CGI qw(:all); %CVmap = qw (ba ba be be-bi bi be-bi bo bo-bu bu bo-bu ca ka ce ke-ki ci ke-ki co ko-ku cu ko-ku da da de de-di di de-di do do-du du do-du fa pa fe pe-pi fi pe-pi fo po-pu fu po-pu ga ga ge ge-gi gi ge-gi go go-gu gu go-gu ha ha he he-hi hi he-hi ho ho-hu hu ho-hu ka ka ke ke-ki ki ke-ki ko ko-ku ku ko-ku la la le le-li li le-li lo lo-lu lu lo-lu ma ma me me-mi mi me-mi mo mo-mu mu mo-mu na na ne ne-ni ni ne-ni no no-nu nu no-nu pa pa pe pe-pi pi pe-pi po po-pu pu po-pu qa ka qe ke-ki qi ke-ki qo ko-ku ra da re de-di ri de-di ro do-du ru do-du sa sa se se-si si se-si so so-su su so-su ta ta te te-ti ti te-ti to to-tu tu to-tu va wa ve we-wi vi we-wi vo wo-wu vu wo-wu wa wa we we-wi wi we-wi wo wo-wu wu wo-wu ya ya ye ye-yi yi ye-yi yo yo-yu yu yo-yu za sa ze se-si zi se-si zo so-su zu so-su); %CCVmap = qw (nga nga nge nge-ngi ngi nge-ngi ngo ngo-ngu ngu ngo-ngu); %Vmap = qw (a a e e-i i e-i o o-u u o-u); %Cmap = qw (b b c k d d f p g g h h j h k k l l m m n n p p q k r d s s t t v w w w y y z s); my $word = param("word"); print header, start_html("alibata transliterator"), h1("alibata transliterator"); if ($word) { $word_ptr=0; $glyph_ptr=0; @chars = split //, $word; while ($word_ptr <= $#chars) { $test1 = $chars[$word_ptr]; $test2 = $chars[$word_ptr] . $chars[$word_ptr+1]; $test3 = $chars[$word_ptr] . $chars[$word_ptr+1] . $chars[$word_ptr+2]; SWITCH: { if ($test2 =~ /j[aeiou]/) { # print "jV"; push (@glyph, "de-di"); $second="y" . substr($test2,1,1); push (@glyph, $CVmap{$second}); $word_ptr = $word_ptr + 2; last SWITCH; } if ($test2 =~ /x[aeiou]/) { # print "xV"; push (@glyph, "k"); $second="s" . substr($test2,1,1); push (@glyph, $CVmap{$second}); $word_ptr = $word_ptr + 2; last SWITCH; } if ($test3 =~ /ng[aeiou]/) { # print "ngV"; push (@glyph, $CCVmap{$test3}); $word_ptr = $word_ptr + 3; last SWITCH; } if ($test3 =~ /qu[aeiou]/) { # print "quV"; push (@glyph, "ko-ku"); push (@glyph, $CVmap{"w" . substr($test3,2,1)}); $word_ptr = $word_ptr + 3; last SWITCH; } if ($test2 =~ /[bcdfghklmnprstvwyz][aeiou]/) { # print "CV"; push (@glyph, $CVmap{$test2}); $word_ptr = $word_ptr + 2; last SWITCH; } if ($test2 =~ /q[aeio]/) { # print "qV"; push (@glyph, $CVmap{$test2}); $word_ptr = $word_ptr + 2; last SWITCH; } if ($test2 =~ /[bcdfghklmnprstvwyz][bcdfghklmnprstvwyz]/) { # print "C"; push (@glyph, $Cmap{$test1}); $word_ptr = $word_ptr + 1; last SWITCH; } if ($test1 =~ /[aeiou]/) { # print "V"; push (@glyph, $Vmap{$test1}); $word_ptr = $word_ptr + 1; last SWITCH; } if ($test1 =~ /[bcdfghjklmnpqrstvwxyz]/ && $word_ptr==$#chars) { # print "C*"; push (@glyph, $Cmap{$test1}); $word_ptr = $word_ptr + 1; last SWITCH; } push (@glyph, "?"); $word_ptr = $word_ptr + 1; } } $count=0; print "\n"; print "$word\n"; print "\n"; print "\n"; for (@glyph) { $_=$glyph[$count]; $syllable_size=tr/a-z-//; if ($syllable_size != 1 || $glyph[$count] eq "a") { print "\n"; } $count++; } print "\n"; print "\n"; $count=0; for (@glyph) { $_=$glyph[$count]; $syllable_size=tr/a-z-//; if ($syllable_size != 1 || $glyph[$count] eq "a") { print "\n"; } $count++; } print "\n"; print "
"; print ""; print "
"; print "$glyph[$count]"; print "
\n"; } else { print start_form(); print p("Enter word you wish to transliterate: ", textfield("word")); print end_form(); } print "
\n"; print "Return to alibata | See source code | Report a bug\n"; print "
\n"; print <Copyright (C) 2001 by Victor Ganata

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

END_of_GPL print end_html;