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

Add Relation class and .relation_map() methods #227

Merged
merged 6 commits into from
Dec 11, 2024

Conversation

goodmami
Copy link
Owner

This PR adds the Relation class for modeling sense and synset relations so the source lexicon, metadata, etc. of the relations are accessible. This allows for two main use cases:

  1. Inspecting metadata, particularly for other relations
  2. Identifying the source lexicon of a relation used in an interlingual query

Resolves #167
Resolves #216

Senses and Synsets now have an `incoming_relation()` method. The value
of this method returns a SenseRelation, SenseSynsetRelation, or
SynsetRelation object if the Sense/Synset is the result of a relation
traversal. Otherwise the method returns `None`.

The new relation objects specify the relation name, the source and
target IDs of the relation, and the lexicon where the relation
originated.

Fixes #216
Fixes #167
The .relation_map() method is like .relations(), but the keys are
relation objects and map 1-to-1 to targets.

This commit also removes the .source() and .target() methods as they
didn't work in common situations, as well as the .incoming_relation()
method as it was not favored.

This commit also adds a new utility function and associated unit tests.
Previous commit only added the method for Synsets.

Fixes #167
Fixes #216
@goodmami goodmami merged commit c994588 into main Dec 11, 2024
14 checks passed
@goodmami goodmami deleted the gh-216-relation-metadata branch December 11, 2024 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get sense/synset relation metadata Tracing back 'inferred' synsets to their reference lexicons
1 participant