My Dictionary Lookup Program

 

1 Download Dictionary Databases http://www.enlight.ru/swaj/ptkdic.php3

http://www.enlight.ru/swaj/ptkdic.php3/dicts/eng_eng_main.gz

http://www.enlight.ru/swaj/ptkdic.php3/dicts/eng_eng_syn.gz

http://www.enlight.ru/swaj/ptkdic.php3/dicts/eng_eng_nw.gz

 

2 unpack the downloaded package

 

3 startup mysql server

#/etc/rc.d/init.d/mysqld start

#mysql -u root

Create a mysql test database user

mysql> grant all privileges on *.*  to test@localhost

             identified by test with grant option

 

4 dump database into mysql server

#mysql  -u test  -ptest test

mysql>source /path to/eng_eng_main

Deleted the table creation section of eng_eng_syn, and eng_eng_nw

mysql>source /path to/eng_eng_nw

mysql>source /path to/eng_eng_syn

 

5 small perl script to pick up the word (lookup)

#!/usr/bin/perl
$word=shift;
$host="localhost";
$test_db="test";
$user="test";
$passwd="test";
use DBI;
$|=1;
$table="eng_eng_main";
$dbh = DBI->connect("DBI:mysql:$test_db:$host",$user,$passwd) || die "Can't connect $DBI::errstr\n";
$sth = $dbh->prepare("select * from $table where word = '$word'") or die $dbh->errstr;
$sth->execute() or die $sth->errstr;
$row = $sth->fetchrow_arrayref;
print $row->[1]," ",$row->[2],"\n";

 

6 look up new word explaintion

#lookup newword