#!/usr/bin/perl -T # # a script for viewing just one word. # loren jan wilson, sometime in 2003 use strict; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use DBI; use Reviews; $CGI::POST_MAX=1024 * 15; # max 20K posts $CGI::DISABLE_UPLOADS = 1; # no uploads $ENV{PATH} = ""; my $q = new CGI; print $q->header(-expires=>'now'); print $q->start_html(); #my $begin_time = time(); my $dbh = make_db_handle; my $id = $q->param('id') || 100; $id =~ s/[^\d]//g; $id = substr($id, 0, 10); my $word_id = $id; my $word = $q->param('word'); $word =~ s/[^A-Za-z-]//g; $word = substr($word, 0, 30); if ($word) { $word_id = dbquery($dbh, qq/ SELECT word.id FROM word WHERE word LIKE "$word" /); if (! $word_id) { print qq/"$word" not found in database./; exit; } } # get word and print it at the top my $word = dbquery($dbh, qq/ SELECT word FROM word WHERE id = $word_id /); print "
"; print "\n"; } else { print "There are too few occurrences of this word in the database to calculate useful statistics.
";
}
print qq%See sentences which use this word: KWIC (Key Word In Context)
\n%;
print qq%See other words which appear in the same sentence as this word: coex (coexistence)
%;
print qq%See words which appear close to this word: close (phrase coexistence)%;
# print a quick form...
print
$q->start_form,
"Choose a particular word: ",
$q->textfield(-name=>'word', -default=>'', -override=>1),
$q->submit(-name=>"Submit");
#my $end_time = time();
#my $time_elapsed = $end_time - $begin_time;
#print "\nquery time: $time_elapsed seconds\n";
print $q->end_html();