#!/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 = "
Orthography | ID | Freq. | |
---|---|---|---|
".$row[1]." | "; $out .= "".$row[0]." | "; $out .= "".$row[2]." | "; $out .= ""; $out .= "sentences | "; $out .= "
$mes