#!/usr/local/bin/perl use strict; use warnings; use CGI; my $query = new CGI; my $dbroot = "/var/www/html/lextypedb/db"; my $cssdir = "/lextypedb"; my $cgidir = "/cgi-bin/lextypedb_tools"; my $charset = "utf-8"; if(-e "params"){ open(PARAM, "params"); while(){ chomp; (my $para, my $val) = split /=/;#/ if($para eq "dbroot"){ $dbroot = $val; }elsif($para eq "charset"){ $charset = $val; }elsif($para eq "cssdir"){ $cssdir = $val; }elsif($para eq "cgidir"){ $cgidir = $val; } } close(PARAM); } #Receive the lextype param. my $lextype = $query->param("lextype"); #Retrieve all words that belong to the lexical type. use DBI; my $lexicon_table = "lex_and_freq_tbl"; my $dbname = $dbroot."/"."lt.db"; my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {AutoCommit => 0}); ### sort in descending frequency my $sth = $dbh->prepare( "select wordid,orth,freq from $lexicon_table where lextype=? order by freq + 0 desc" ); $sth->execute($lextype); my $total = 0; my $out = ""; $out .= ""; while(my @row = $sth->fetchrow_array){ $out .= ""; $out .= ""; $out .= ""; $out .= ""; $out .= ""; $out .= ""; $total++; } $out .= "
OrthographyIDFreq.
".$row[1]."".$row[0]."".$row[2].""; $out .= "sentences
"; # Message ------------------------------------- print $query->header(-type => 'text/html;charset='.$charset), $query->start_html(-title=>$lextype.' (words)', -style=>{'src' => $cssdir.'/lextypedb.css'}); print <<"HTML_VIEW";
Confusing Types: 

$lextype (words)

$total words are found.
$out

HTML_VIEW print $query->end_html; exit; # Error report ----------------------------------- sub error { my ($mes) = @_; print $query->header(-type => 'text/html;charset='.$charset), $query->start_html(-title=>'Creation Error', -style=>{'src' => $cssdir.'/lextypedb.css'}); print <<"HTML_VIEW";

Lexical Type Database: ERROR

$mes


HTML_VIEW print $query->end_html; exit; } __END__