#!C:\local\PERL5\NTT\perl.exe $inline=; chop($inline); while ($inline){ # # word declensions are in two parts separated by = # First part is the English description, second the devnagari # formation. # In the second part, syllables are separated by spaces and need # joining. if ($inline =~ /:/) { print("## ".$inline." ##\n"); for ($count=1;$count<=2;$count++) { $inline=; chop($inline); &process_line; printf("%-30s %-30s \n",$desc,$devnag); } for ($i=1;$i<=8;$i++) { $printline=""; for ($j=1;$j<=3;$j++) { $inline=; chop($inline); &process_line; $printline=sprintf("%s %-30s",$printline,$devnag); } printf("%s \n",$printline); } }; $inline=; chop($inline); } die("## Finished processing ##\n"); sub process_line { #print ("processing \n"); @parts=split(/=/,$inline); $num = @parts; # # num is used to count number of parts. If it is 1, then # we have the defining word in roman script. #print($num); # # Always, the desc gets enclosed in ## ##. # $desc=@parts[0]; $desc =~ s//>##/; # # The devnag part gets transformed for ITRANS. # @devnag = split(/ /,@parts[1]); $devnag= join(/ /,@devnag); # # If the declension does not exist, we drop it! # if ($devnag =~/doesn't/) {$devnag=" "}; $devnag =~ s/s\.$/H ./; $devnag =~ s/m *$/m.h/; $devnag =~ s/n *$/n.h/; $devnag =~ s/r *$/H/; $devnag =~ s/s *$/H/; $devnag =~ s/t *$/t.h/; # # In case of meaning and gender, the devnag part is in English too! # Otherwise, devnag part is in devnagari! # if ($desc =~ /meaning/) {$devnag = ("##".@parts[1]."##");} if ($desc =~ //) {$devnag = ("##".@parts[1]."##");} }