how to query any synset relation type, like 'agent', 'causes', etc ? #134
-
Hi, Many synset relation types are defined as wn.constants.SYNSET_RELATIONS in Is there a way to query any of them, maybe via Sqlite and how ? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
https://github.com/goodmami/wn/blob/main/wn/_queries.py i tracked this as a root of .similarity calculations: Line 459 in f587a33 which is called by :
i'm also looking of what are other ways of relations |
Beta Was this translation helpful? Give feedback.
-
Yes, in https://github.com/goodmami/wn/blob/main/wn/_queries.py |
Beta Was this translation helpful? Give feedback.
-
you can also use SQLite browser with ~/.wn_data/wn.db |
Beta Was this translation helpful? Give feedback.
-
The There is the Synset.get_related() method for finding relations with any available relation name. Similarly for senses is Sense.get_related(), and for sense-to-synset relations there is Sense.get_related_synsets(). Since the last release, both Methods like Synset.hypernyms() are just for convenience and they capture multiple individual relations. For instance, Lines 896 to 906 in f587a33 Also, as a general note, it is not the case that all relations in |
Beta Was this translation helpful? Give feedback.
-
thanks thats very helpful ..i'm trying to figure the relationship structure so I can figure different ways of word-similarity.. Monkey patched repr so I can follow it easier :
|
Beta Was this translation helpful? Give feedback.
-
Thanks very much @goodmami I missed the https://wn.readthedocs.io/en/latest/api/wn.html#wn.Synset.get_related in the doc. |
Beta Was this translation helpful? Give feedback.
The
wn._queries
module is not part of the public API, nor is any other module prefixed with_
. This means that the functions are not documented and they may (and do, occasionally) change from one version to the next without a CHANGELOG entry or change to the major version number. I do not recommend using those.There is the Synset.get_related() method for finding relations with any available relation name. Similarly for senses is Sense.get_related(), and for sense-to-synset relations there is Sense.get_related_synsets(). Since the last release, both
Synset
andSense
also have arelations()
method which does the same thing but returns a dictionary mapping the relation names to the lists of…