#!/usr/bin/perl use Getopt::Long; GetOptions("help!"=>\$help,"path=s"=>\$vibh_home,"input=s"=>\$input,"output=s",\$output); print "Unprocessed by Getopt::Long\n" if $ARGV[0]; foreach (@ARGV) { print "$_\n"; exit(0); } if($help eq 1) { print "Telugu Generator - Generator Version 0.91\n(9th Sep 2008 )\n\n"; print "usage : perl ./mul_word.pl --path=/home/mul_word [-i inputfile|--input=\"input_file\"] [-o outputfile|--output=\"output_file\"] \n"; print "\tIf the output file is not mentioned then the output will be printed to STDOUT\n"; exit(0); } if($vibh_home eq "") { print "Please Specify the Path as defined in --help\n"; exit(0); } require "$vibh_home/API/shakti_tree_api.pl"; require "$vibh_home/API/feature_filter.pl"; #open(ROOTDICT,"$vibh_home/data_src/Rule"); #@ROOTS = ; #chomp(@ROOTS); %root_hash = (); foreach $root_1 (@ROOTS) { ($root,$pdgm) = split(/\,/,$root_1); $key = $root; $root_hash{$key} = $pdgm; } sub mul_word { &read($input); @nodes=&get_leaves(); @tree=&get_children(); for($n=0;$n<=@node;$n++) { #for($n=0;$n<=@tree;$n++) { #$cword2 = &get_field($tree[$n],4); $cword2 = &get_field($node[$n],4); $fst = &read_FS($cword2); @hvib = &get_values("vib", $fst); @hhead = &get_values("lex", $fst); for($i=0;$i<=@nodes;$i++) { $cword = &get_field($nodes[$i],4); $fs_array = &read_FS($cword); @lex = &get_values("lex", $fs_array); @cat = &get_values("cat", $fs_array); @vib = &get_values("vib", $fs_array); @name = &get_values("name", $fs_array); foreach $lex(@lex) { $lex=~s/_.*$//g; $cword = $lex; $ccat = $cat[0]; $cvib = $vib[0]; } if($i!=0) { $pword1 = &get_field($nodes[$i-1],4); $fs_array1 = &read_FS($pword1); @lex1 = &get_values("lex", $fs_array1); @cat1 = &get_values("cat", $fs_array1); @name1 = &get_values("name", $fs_array1); my @vib1 = &get_values("vib", $fs_array1); foreach $lex1(@lex1) { $lex1=~s/_.*$//g; $pword1 = $lex1; $pcat1=$cat1[0]; $pvib1=$vib1[0]; } $pword2=""; #$key1=$pword1." ".$cword; } if($i!=0 and $i!=1) { $pword1 = &get_field($nodes[$i-1],4); $fs_array1 = &read_FS($pword1); @lex1 = &get_values("lex", $fs_array1); @cat1 = &get_values("cat", $fs_array1); @name1 = &get_values("name", $fs_array1); my @vib1 = &get_values("vib", $fs_array1); foreach $lex1(@lex1) { $pword1 = $lex1; $pvib1 = $vib1[0]; $pcat1 = $cat1[0]; } $pword2 = &get_field($nodes[$i-2],4); $fs_array2 = &read_FS($pword2); @lex2 = &get_values("lex", $fs_array2); @cat2 = &get_values("cat", $fs_array2); my @vib2 = &get_values("vib", $fs_array2); @name2 = &get_values("name", $fs_array2); $lex23=$lex2[0]; foreach $lex2(@lex2) { $pword2 = $lex2; $pcat2 = $cat2[0]; $pvib2 = $vib2[0]; } if($pword1=~/minus;$/){ $pword1="-"; } $key2=$pcat2.":".$pvib2."__".$pcat1.":".$pvib1."__".$ccat.":".$cvib; $key1=$pword2." ".$pword1." ".$cword; print "iam here with $key2\n"; if($root_hash{$key1} ne "") { my @arr1=split(" ",$root_hash{$key1}); $j=$i-2; foreach (@arr1) { $lex[0]=$_; if($lex[0]!~/^-/){ $lex[0]="^@".$lex[0]; } if($lex[0]=~/:/){ ($templex,$cas)=split(/:/,$lex[0]); $cas=~s/-/-^@/g; $cas=~s/_/_^@/g; $newvib1[0]="^-@".$cas; $lex[0]=$templex; &modify_field($nodes[$j],2,$lex[0]); &update_attr_val("vib",\@newvib1, $fs_array,$sent); my $string1=&make_string($fs_array,$sent); &modify_field($nodes[$j],4,$string1); } $fs=&get_field($nodes[$j],4); $fs_array = &read_FS($fs,$sent); &update_attr_val("lex",\@lex, $fs_array,$sent); my $string=&make_string($fs_array,$sent); &modify_field($nodes[$j],4,$string); $j++; } } } &modify_field($node,2,$root); &update_attr_val("lex", \@lex, $fs_array,$sent); my $string=&make_string($fs_array,$sent); &modify_field($node,4,$string); } } } &mul_word(); if($output eq "") { &print_tree(); } else { &print_tree_file($output); }