Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracing back 'inferred' synsets to their reference lexicons #167

Open
francis-dion opened this issue May 28, 2022 · 3 comments
Open

Tracing back 'inferred' synsets to their reference lexicons #167

francis-dion opened this issue May 28, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@francis-dion
Copy link

When looking at relations for the omw-fr-00619230-n synset, I saw four INFERRED synsets for the hyponym relation and two for the has_domain_topic one.

The oewn and omw-en lexicons both return two hyponyms and one has_domain_topic synsets for the translation of omw-fr-00619230-n.

print(wn.synset('omw-fr-00619230-n').relations())
#{'omw-fr-00618734-n':
##[Synset('omw-fr-00618734-n')],
##'hyponym': [Synset('*INFERRED*'), Synset('*INFERRED*'), Synset('*INFERRED*'), Synset('*INFERRED*')],
##'has_domain_topic': [Synset('*INFERRED*'), Synset('*INFERRED*')]}

print(wn.synset('omw-fr-00619230-n').translate('oewn')[0].relations())
#{'hypernym': [Synset('oewn-00619974-n')],
##'hyponym': [Synset('oewn-00620659-n'), Synset('oewn-00620818-n')],
##'has_domain_topic': [Synset('oewn-06506364-n')]}

My understanding is that the relations() function detects the relations in the two English lexicons I have loaded.
It seems that, at the moment, these are the only two lexicons I am working with which are providing "extra relations".
Since I'm hoping to work with (or eventually create/support) other lexicons with their own relations, I envision a challenge in retrieving the source lexicon for any given inferred synset.

My question is thus, is there currently (or planned) a mean to retrieve the source lexicon of an inferred synset?

Thanks!

@goodmami goodmami added the enhancement New feature or request label May 30, 2022
@goodmami
Copy link
Owner

First of all, the functions of the wn module are provided only as a convenience. For any real work I strongly suggest creating a wn.Wordnet object so you can be clear where the data are coming from:

>>> import wn
>>> fr = wn.Wordnet('omw-fr', expand='omw-en')
>>> fr.synset('omw-fr-00619230-n').relations()
{'omw-fr-00618734-n': [Synset('omw-fr-00618734-n')], 'hyponym': [Synset('*INFERRED*'), Synset('*INFERRED*')], 'has_domain_topic': [Synset('*INFERRED*')]}

If you just use the wn module functions for your queries, it queries all installed lexicons, which may yield surprising or repetitive results.

It's not a bad idea to somehow retain the lexicon whence an synset was inferred, though.

@francis-dion
Copy link
Author

Thanks for the Wordnet class tip. I had seen it in the docs but it somehow didn't register in my mind.
Sorry for yet another newbie question, but are the relation types constrained or somehow "standardized" by OMW, the GWA or others? If not, I'm tempted to explore "masking" relationships, whereby a lexicon can block some specific relations provided by an expand lexicon.

@goodmami
Copy link
Owner

goodmami commented Jun 3, 2022

are the relation types constrained or somehow "standardized" by OMW, the GWA or others?

See https://github.com/globalwordnet/schemas/

I'm tempted to explore "masking" relationships, whereby a lexicon can block some specific relations provided by an expand lexicon.

This might be implemented as an element rather than a relation type, because the relation type + target can help it select the thing to be masked (relations don't have unique IDs). E.g.:

<ExternalSynset id="...">
  <SynsetRelationMask relType="hyponym" target="..." />
</ExternalSynset>

A problem with this is that if you want to mask a certain relation type between synsets A and B and then want to create a new relationship of the same type between A and B, we'd have to be careful to apply those extensions in the proper order, otherwise the mask might block the new relation, too.

If you have a proposal for how to do this, create an issue at https://github.com/globalwordnet/schemas/ so it can be tracked and discussed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants