Wordnet sqlite Synonyms and Samples

前端 未结 2 1381
后悔当初
后悔当初 2021-01-27 16:20

I am trying to get the list of Synonyms and Samples given the wordid. After a lot of trial and error I can get the samples for all the synsets but not the actual synonyms. Here

2条回答
  •  长发绾君心
    2021-01-27 16:36

    I'm not sure I exactly understand the question, but wouldn't something like this work?

    SELECT s1.wordid, s1.synsetid, s1.sensekey, synsets.definition
       , s2.wordid AS matchedWordID, w.*  -- Additional info not from question's query
    FROM senses AS s1
       LEFT JOIN synsets ON s1.synsetid = synsets.synsetid
       LEFT JOIN senses AS s2 ON s1.synsetid = s2.synsetid AND s1.wordid <> s2.wordid
       LEFT JOIN words AS w ON s2.wordid = w.wordid
    WHERE s1.wordid = 79459
    ;
    

    Note: ... is just short hand for the list of fields you actually want.

    Note#2: You can of course JOIN to samples using the synsets reference, but keep in mind the results would be repeated for every word pair and sample; and it is possible some word pairs may be repeated if they are synonyms in multiple meanings.

提交回复
热议问题