wn icon indicating copy to clipboard operation
wn copied to clipboard

Allow .relations(data=True) instead of .relation_map()

Open goodmami opened this issue 5 months ago • 0 comments

Is your feature request related to a problem? Please describe.

The data=True parameter on Forms, Counts, etc. was added so the methods return custom classes instead of basic datatypes, but Sense.relations() and Synset.relations() don't follow this pattern and instead have separate Sense.relation_map() and Synset.relation_map() methods.

Describe the solution you'd like

For the sake of consistency, give Sense.relations() and Synset.relations() the data parameter. If this is done in a 1.0 release, the .relation_map() methods should be removed, or maybe just raise an error with an explanation of what to do instead.

Note that, unlike the other classes, this doesn't just change the type of list items, but also changes the value of the mapping from a list to a single item ({relname: [relatable]} to {relation: relatable}).

Describe alternatives you've considered

Keeping things the way they are is ok, but this seems like an opportunity for a cleaner API (well, fewer methods at the expense of more complex methods).

goodmami avatar Jul 13 '25 00:07 goodmami