#!/usr/bin/perl -Tw use strict; use DB_File; use CGI ':standard'; use CGI::Carp 'fatalsToBrowser'; use lib '/home/staff/gene/lib'; use Lingua::TokenParse; my $max = 12; print header, start_html('Word Parser'), start_form, 'This program will try to score a word, based on familiarity with prefixes and suffixes from ', a({ -href => 'http://humanities.uchicago.edu/forms_unrest/webster.form.html' }, b("The Webster's Revised Unabridged Dictionary.")), p, 'Word: ', textfield('word', '', $max, $max), submit('submit', 'submit'), ' ex: paleolithic', p, "$max letters or less, please. (The smaller the word, the faster the parsing, of course.)", br, 'Also note that single letter fragments are ignored at this time.', hr; my ($word, $obj); if ($word = param 'word') { if (length ($word) > $max) { print p('This word, of ' . length ($word) . " letters will take too long to parse on this public server. Try one with $max characters."); } else { my $lexicon_file = '/home/staff/gene/ology.net/htdocs/stuff/lexicon'; my %lexicon; tie %lexicon, 'DB_File', $lexicon_file or die "Can't tie to $lexicon_file - $!\n"; @lexicon{ keys %lexicon } = ('x') x keys %lexicon; $obj = Lingua::TokenParse->new( word => $word, lexicon => \%lexicon, ); untie %lexicon if -e $lexicon_file; } } if ($word and $obj) { if (keys %{ $obj->knowns }) { print '
';
        $obj->output_knowns;
        print '
'; } else { print p('This word was totally unknown, given the lexicon.'); } } print hr, a({ -href => 'http://search.cpan.org/author/GENE/Lingua-TokenParse-0.07.1/' }, b('The Lingua::TokenParse module')), br, a({ -href => 'http://ology.net/dev/lex/code/token_parse' }, b('The code to this CGI')), br, 'Both, written by ', a({ -href => 'mailto:gene at ology dot net' }, b('Gene Boggs')), end_form, end_html;