From what I am collecting from the documentation on the website, it seems you need to query three tables.
First, you query the word table to get its wordno, the unique number that every word has. It will look something like this.
//assuming you've connected to your MySQL db $word=$_GET['s']; //This variable stores the value given through url if (ctype_alpha($word)){ // If it alphabetical $word_clean=mysql_real_escape_string($word); //Sanitize it for MySQL }else{ //Not a valid word, error handle exit(); } $query='SELECT wordno FROM word WHERE lemma=`$word_clean` LIMIT 1'; $result=mysql_query($query);
Then we need to query the table of meaning in order to get synsetno, which will display different feelings of the word. Ex: can (noun) and can (verb), each of which has a unique number, which is synsetno
The MySQL query will look like this:
$query='SELECT synsetno FROM sense WHERE wordno=`$wordno`';
For each result obtained from this query, you need to query the synset table to get a definition of each meaning. Can (noun) and can (verb) have different definitions. Request for each synsetno.
$query='SELECT definition FROM synset WHERE synsetno=`$synset`';
And presto! You have a pretty cool dictionary. However, pain in the processor should query three tables, each of which has a ton of records.
source share