package ILMT::TEL::HIN::ComputeHead; use strict; use warnings; use Dir::Self; use Data::Dumper; use ILMT::TEL::HIN::SSFAPI::feature_filter; use ILMT::TEL::HIN::SSFAPI::shakti_tree_api; use ILMT::TEL::HIN::ComputeHead::make_chunk_name; use ILMT::TEL::HIN::ComputeHead::copy_np_head; use ILMT::TEL::HIN::ComputeHead::copy_vg_head; sub process { my %args = @_; my $input = $args{'data'}; read_story(\$input); my $numBody = get_bodycount(); my $result; my $body; for(my($bodyNum)=1;$bodyNum<=$numBody;$bodyNum++) { $body = &get_body($bodyNum,$body); # Count the number of Paragraphs in the story my($numPara) = &get_paracount($body); #print STDERR "Paras : $numPara\n"; # Iterate through paragraphs in the story for(my($i)=1;$i<=$numPara;$i++) { my($para); # Read Paragraph $para = &get_para($i); # Count the number of sentences in this paragraph my($numSent) = &get_sentcount($para); # print STDERR "\n $i no.of sent $numSent"; #print STDERR "Para Number $i, Num Sentences $numSent\n"; #print $numSent."\n"; # Iterate through sentences in the paragraph for(my($j)=1;$j<=$numSent;$j++) { #print " ... Processing sent $j\n"; # Read the sentence which is in SSF format my($sent) = &get_sent($para,$j); #print STDERR "$sent"; # print "check--\n"; # &print_tree($sent); # Get the nodes of the sentence (words in our case) #Copy NP head # &AddID($sent); &make_chunk_name($sent); ©_np_head($sent); #Copy NP VG head ©_vg_head($sent); } } } open OUTFILE, '>', \$result or die $!; select(OUTFILE); printstory(); select(STDOUT); return $result; } 1;