#!/usr/bin/perl use Log::Log4perl; use Getopt::Long; GetOptions("help"=>\$oHelp,"input=s"=>\$filename,"path=s"=>\$path); $SEN_GEN_HOME = $path; if($oHelp or $path eq "") { print "Usage : perl tam-suff.pl -i input_SSF --path=/home/tamsuff --input= db path\n"; exit(0); } if($version) { print "tam suff v1.1\n"; exit(0); } require "$path/API/shakti_tree_api.pl"; require "$path/API/feature_filter.pl"; open(TAMDICT,"$path/pronoun"); @TAMS = ; chomp(@TAMS); %tam_hash = (); foreach $tam_1 (@TAMS) { ($tam,$teltam) = split(/\,/,$tam_1); $key = $tam; $tam_hash{ $key } = $teltam; } sub sen_gen() { &read_story($filename); $numBody = &get_bodycount(); for(my($bodyNum)=1;$bodyNum<=$numBody;$bodyNum++) { $body = &get_body($bodyNum,$body); my($numPara) = &get_paracount($body); for(my($i1)=1;$i1<=$numPara;$i1++) { my($para); $para = &get_para($i1); my($numSent) = &get_sentcount($para); for(my($j1)=1;$j1<=$numSent;$j1++) { my($sent) = &get_sent($para,$j1); @nodes = &get_leaves($sent); #my @childNodes=&get_children(0,$sent); #@nodes = (@childNodes,@nodes1); foreach $node (@nodes) { my $pos=&get_field($node, 3,$sent); $child = $node; my $pos=&get_field($child, 3,$sent); my $temp_fs_4 = &get_field($child, 4,$sent); my $temp_fs = &read_FS($temp_fs_4,$sent); my @root = &get_values("lex",$temp_fs,$sent); my @lcat = &get_values("cat",$temp_fs,$sent); my @suff = &get_values("tam",$temp_fs,$sent); my $temp_fs_2=&get_field($child, 2,$sent); $suff=$suff[0]; if($lcat[0] eq "pn") { $key = $root[0]; $new_tam[0] = $tam_hash{$key}; } if($lcat[0] eq "pn") { if($new_tam[0] eq "exclu") { $suff[0]=$suff."_exclu"; } elsif($new_tam[0] eq "exclu-incl") { $suff[0]=$suff."_exclu-incl"; } elsif($new_tam[0] eq "dist") { $suff[0]=$suff."_dist"; } elsif($new_tam[0] eq "prox") { $suff[0]=$suff."_prox"; } elsif($new_tam[0] eq "interr") { $suff[0]=$suff."_interr"; } elsif($new_tam[0] eq "relat") { $suff[0]=$suff."_relat"; } &update_attr_val("tam",\@suff,$temp_fs,$sent); my $ret_string = &make_string($temp_fs,$sent); &modify_field($child,4,$ret_string,$sent); } } } } } } &sen_gen; if($output eq "" ) { &printstory(); } else { &printstory_file("$output"); }