I have a use case where I have a word and I need to know the following things:
- Synonyms for the word (just the synonyms are sufficient)
- All senses of the word, where each sense contains - the synonyms matching that word in that sense, example sentences in that sense (if there), the part of speech for that sense.
Example - this query link. Screenshot for the word carry
:
For each 'sense', we have the part of speech (like V
), synonyms matching that sense, (like transport
in the first sense, pack
, take
in the second sense, etc), example sentences containing that word in that sense (This train is carrying nuclear waste
, carry the suitcase to the car
, etc in first sense, I always carry money
etc in the second sense, etc.).
How do I do this from a Wordnet MySQL database? I ran this query, it returns the list of meanings for the word:
SELECT a.lemma, c.definition FROM words a INNER JOIN senses b ON a.wordid = b.wordid INNER JOIN synsets c ON b.synsetid = c.synsetid WHERE a.lemma = 'carry';
How do I get the synonyms, example sentences, part of speech and synonyms specific to that sense for each sense? I queried the vframesentences
and vframesentencemaps
tables, saw example sentences with placeholders like %s
, and based on the wordid
column I tried to match them with the words
table, but got awfully wrong results.
Edit:
For the word carry
, if I run these queries, I get synonyms and sense meanings correctly:
1. select * from words where lemma='carry' //yield wordid as 21354
2. select * from senses where wordid=21354 //yield 41 sysnsetids, like 201062889
3. select * from synsets where synsetid=201062889 //yields the explanation "serve as a means for expressing something"
4. select * from senses where synsetid=20106288` /yields all matching synonyms for that sense as wordids, including "carry" - like 21354, 29630, 45011
5. select * from words where wordid=29630 //yields 'convey'
So all I now need is a way of finding the example sentence for the word carry
in each of the 41 senses. How do I do it?