#!/usr/bin/perl -w # 10/2001: Taal en Spraak Materiaal # display: XYZA # plus query string # ./MateriaalTaal.pl MateriaalTaal.html print "Content-type: text/html\n\n"; my $qs = $ENV{'QUERY_STRING'}; # export QUERY_STRING='42&bla&bla' my $cnt = 1; my $np = 0; my $myfont = "Helvetica"; my $mysize = "h5"; if ( !( $qs =~ /^[0-9-]*\&[A-Za-z\+\.]*\&[A-Za-z\+\.]*$/ ) ) { die "Illegal query string"; } ($nr,$instr1,$instr2) = split(/\&/,$qs); $next_qs = "http://.../InstrTest.cgi" . "?" . ($nr+1) . "\&" . $instr1 . "\&" . $instr2; $np = 1 + ($nr % 3); # very random :-) # next, we un-encode the spaces: $instr1 =~ tr/+/ /; $instr2 =~ tr/+/ /; # example use: # "maak duidelijk dat + NP1 + meest belangrijk is" # or: # "maak duidelijk dat het + NP1 + is + RC" # so: if part 2 is "is", 2nd scheme, else 1st. 2 parts needed. # THIRD, # we need "sentence": idea: use negative number for this! # so: pos/question -> neg/sentence -> increment, repeat open(WBLISTE,"production task <$mysize>

\n

\n"; foreach () { chomp; # remove trailing CR if any tr/\011/;/; # convert TAB to ; tr/ /_/; # change space to _ s/_*\;/\;/g; # remove trailing spaces s/\;_*/\;/g; # remove leading spaces # s/\#/\é\;/g; # replace # by é $dings = $_; # maybe dings = dequote(...): quotes suck! # hmpf... how did we do strlen again??? # print STDERR size($dings) ."of $dings\n"; # if (strlen($dings) > 20) if ($dings =~ /......................./) { # only go on if line is long enough if ($cnt == $nr) { ($np1, $np2, $np3, $rc) = split(';',$dings); if ($instr2 eq "is") { $sent = $np1 . " " . $np2 . " " . $np3 . " " . $rc; } else { $sent = $np1 . " " . $np2 . " " . $np3; } $sent =~ tr/_/ /; # convert _ back to space # without RC if instr2 is NOT "is" # now we have the sentence: next, generate the instr... # now convert PP2 and PP3 to real NPs: remove the first words $np2 =~ s/^[^_]*_//g; $np3 =~ s/^[^_]*_//g; # downcase the first letter... substr($np1,0,1) =~ tr/A-Z/a-z/; # last, we convert _ back to space $np1 =~ tr/_/ /; $np2 =~ tr/_/ /; $np3 =~ tr/_/ /; $rc =~ tr/_/ /; $bla = $instr1 . " "; if ($np == 1) { $bla .= $np1; } if ($np == 2) { $bla .= $np2; } if ($np == 3) { $bla .= $np3; } $bla .= " " . $instr2; if ($instr2 eq "is") { $bla .= " " . $rc; } # add RC print " $bla
\n
<$mysize>
\ \ $sent\ \ 
\n"; } $cnt = $cnt + 1; } } print "\n
\n
\ncontinue
\n"; print "\n
\n
"; print "\n\n"; close(WBLISTE);