#!/pkg/bin/perl
#--------------------------------------------*
# Hindi Morpheme Tagger *
# Under development *
#By Vasu Renganathan vasur@ccat.sas.upenn.edu*
#--------------------------------------------*
#last modified on 2/27/97
$mypath = '/yourpath';
#print "Content-type: text/html\n\n";
@environment_variables = keys (%ENV);
$data = $ENV{QUERY_STRING};
$data =~ s/\+/ /g; # Replace pluses with spaces
$data =~ s/%2F/\//g; # Replace %2F with /
$data =~ s/%3F/?/g; # Replace %3F with question mark
$data =~ s/%3A/:/g; # Replace %3a with colon
$data =~ s/%2C/,/g; # Replace %2C with comma
$data =~ s/%27/'/g; # Replace %27 with apostrophe
$data =~ s/%22/"/g; # Replace %22 with double quote
$data =~ s/%21/!/g; # Replace %22 with exclamation
$data =~ s/%0D%0A/ /g; # Replace CR with space
$data =~ s/message//g;
$data =~ s/Guest//g;
$data =~ s/=//g;
$data =~ s/-/ /g;
$data =~ s/&//g;
$data =~ s/Tag$//g;
#chop($data);
#print(" Your Sentence:
");
#print("");
#print("$data
");
#print("Tagged output is:
");
#print("");
$inpline = $data;
#unshift (@INC, 'pwd');
require("mainverb.pl");
require("ambiguity.pl");
unless ( open(VERBFILE, "verbs.dat") ) { die("I can't find verbs.dat");}
unless ( open(NOUNFILE, "nouns.dat") ) { die("I can't find nouns.dat");}
@nounentry = ;
foreach $pro (@nounentry){
chop($pro);
push(@nouns,$pro);
# print("$pro");
}
@vbentry = ;
foreach $wo (@vbentry){
chop($wo);
push(@vbentries,$wo);
#print("$wo\n");
}
#print("Enter a simple Hindi sentence or a word. Enter q to quit\n");
#$inpline = ;
#chop($inpline);
@inpsent = split(/ /, $inpline);
# while ($inpsent[0] ne "q" ){
@senttag = ();
$i = 0;
while ( $line = $inpsent[$i++] ){
if ( ($a = &parword($line) ) eq "true") {
push(@senttag, @parwrd);
}
elsif ( ($a = &compoundword($line) ) ne "false" ){
push(@senttag, @comptag);
}
elsif ( ( $a = &empn($line) ) ne "false") {
push(@senttag, @nptag);
}
elsif ( ( $a = &konp($line) ) eq "true"){
push(@senttag, @nptag);
}
elsif ( ( $a = &np($line) ) ne "false" ){
push(@senttag, @nptag);
}
elsif ( ( $b = &vp($line) ) eq "true") {
push(@senttag, @tensetag);
}
elsif ( ($c = &pluralnoun($line) ) ne "false") {
push(@senttag, @nptag);
}
else { push(@senttag, "($line nul)" ); }
} #end while
#foreach $tag (@senttag){
# print("$tag ");
#}
&printhtml();
&writemyfile();
sub writemyfile{
open(STDIN);
open(STDOUT);
open(STDERR);
open (TEMP,">>$mypath/temp.txt");
print TEMP ("\n\n$data\n\n");
foreach $mytag (@senttag){
print TEMP ("$mytag ");
}
print("\n\n");
close(TEMP);
}
#&printhtml();
#print("\n");
#print("