Wordnet SQL Explanation

Jmumby Clasul picture Jmumby Clasul · Aug 16, 2013 · Viewed 7k times · Source

I'm trying to get a simple synonym database up and running, so I can find synonyms of words the user entered (nothing else!). For this I grabbed a copy of the Wordnet sql thesarus (http://wnsql.sourceforge.net/), but now I'm presented with all these tables, and I can't find any simple explanation for their content anywhere:

adjpositions
adjpositiontypes
casedwords
lexdomains
lexlinks
linktypes
morphmaps
morphs
postypes
samples
semlinks
senses
synsets
vframemaps
vframes
vframesentencemaps
vframesentences
words

Could someone tell me what these tables contain and which I need, since I cant decipher their content based on their data.

Answer

Paul Preibisch picture Paul Preibisch · Nov 7, 2013

WordNet is a super cool word database. I have been researching it myself. I'll list my findings below - and hopefully it will help you to understand the tables better.

The Synset Table The synsets table is one of the most important tables in the database. It is responsible for housing all the definitions within WordNet. Each row in the synset table has a synsetid, a definition, a pos (parts of speech field) and a lexdomainid (which links to the lexdomain table) There are 117373 synsets in the WordNet Database.

The Words Table WordNet also has a “words” table, that only has two fields: a wordid, and a “lemma”. The words table is responsible for housing all the lemmas (base words) within the Wordnet Database. There are 146625 entries in this table

So.. how are these two tables linked? The answer? The sense table!

The Sense Table The sense table is responsible for linking together words (in the words table), with definitions (in the synset table). The entries in the sense table are referred as “word-sense pairs” - because each pairing of a wordid with a synset is one complete meaning of a word - a “sense of the word”.
There are a total of 206,354 word senses in the WordNet database.

The Lexdomains table The Lexdomains table is referenced by the sense table, and is used to define what lexical domain a word-sense pair belongs to. There are 45 lexical domains in the lexdomains table. The lexdomain table therefore, is WordNet’s way of “tagging” a word-sense pair. However, it is quite limited, because a word-sense pair can only belong to ONE lexical domain.

The 45 lexical domains include:

Adjectives: all, pert

Adverbs all

Nouns tops, act, animal, artifact, attribute,body, cognition, communication, event, feeling, food, group, location,motive,object, person, phenomenon, plant, possession, process, quantity,linkdef, shape, state, substance, time,

Verbs body, change, cognition,communication, competition, consumption, contact, creation, emotion, motion, perception, possession, social, stative, weather, ppl

The casedwords table Some words within the words table naturally have the first letter capitalized ie: “A-team”. Since the words table stores all words as lowercase, WordNet uses this table to specify the uppercase version of the word. There are 40313 entries in this table.

There are many other tables in the WordNet DB, once I have them researched, I'll post again.

Finding yer synonyms To answer your question regarding synonyms - You need to do the following.

Let's say you want to find the synonyms for the word "Carry". In order to do so, you would first search the words table for a lemma matching the word "carry". This would yield the wordid 21253. You would then search the senses table, to find all word-sense pairs for the word carry. This yields 41 results - each result lists the wordid 21253, and a senseid (which is the index of the word-sense pair) and a synsetid.

Now, you would then need to query the synset table for each of the synsetid's returned so you can access the associated definition field in the synset table.

Lastly to find the synonyms for each of the synsets listed, you'd simply need to search the sense table for other word-sense pairs that shared the same synset.

Example: One of the 41 word-sense pairs for the word "carry" is listed below: wordsense example If we lookup the definition for this synsetid 202083512, you will find “transmit or serve as the medium for transmission”

To find all the synonyms for this definition, you would then search the sense table for the same synsetid 202083512. This yields synonyms: channel, conduct, convey, impart, and transmit (note: you will need to left join the words table to get the actual lemmas)

I hope this helps demystify WordNet for you.. I'm finding it to be quite cool...