package ILMT::KAN::HIN::Repair; #use strict; #use warnings; use Dir::Self; use Data::Dumper; use ILMT::KAN::HIN::Repair::load; use ILMT::KAN::HIN::Repair::modify; use ILMT::KAN::HIN::Repair::failsafe; use ILMT::KAN::HIN::Repair::pro_noun; use ILMT::KAN::HIN::Repair::rule_match; use ILMT::KAN::HIN::Repair::copy_np_head; use ILMT::KAN::HIN::Repair::copy_vg_head; use ILMT::KAN::HIN::SSFAPI::feature_filter; use ILMT::KAN::HIN::SSFAPI::shakti_tree_api; my @dispatch_seq = ( "failsafe", "pro_noun", "repair" ); sub process { my %args = @_; foreach my $submodule (@dispatch_seq) { #print Dumper($submodule); $args{'data'} = __PACKAGE__->can($submodule)->(%args); # print Dumper $args{'data'}; } return $args{"data"}; } sub repair { my %par = @_; my $input = $par{'data'}; read_story(\$input); my $result; undef (@_RULE_TREE_); my $ref_RULE_TREE_=&load(__DIR__ . "/Repair/data/hrRules",\@_RULE_TREE_); my $numBody = &get_bodycount(); 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"; # &rule_match($sent,$ref_RULE_TREE_); # ©_np_head($sent); # ©_vg_head($sent); } } } open OUTFILE, '>', \$result or die $!; select(OUTFILE); printstory(); select(STDOUT); return $result; }