lgessler / wdp

A Python library for uploading to Wiktionary
MIT License
8 stars 1 forks source link

Semantic relations #4

Open aryamanarora opened 3 years ago

aryamanarora commented 3 years ago

Semantic relations can be easily represented using Wiktionary definition-line templates {{synonyms}}, {{antonyms}}, {{hypernyms}}, etc. These go on the same level as usage examples (sub-part to a definition), generally preceding them. See Entry layout § Synonyms, the second type of formatting is the norm in new entries so I'm describing that.

The problem is that semantic relations involve multiple Definitions; when we're producing entries, we want to make sure every Definition involved in relationships like synonymy is listed in the proper definition line. Our data model doesn't have a neat way to handle this yet.

A further issue is that on Wiktionary, semantic relations link to Words rather than Definitions. Since we have a highly-structured data model which will presumably maintain semantic relations at a finer level, we could try to link at the Definition-level. But linking to a Definition (which are list items) is not built into the Wikitext formatting, so we'd have to use a workaround with Wiktionary's template {{senseid}} to make a linkable anchor at the definition-level.

lgessler commented 3 years ago

Am I understanding right that for these relations the links only require a language code and a word form? If that's it, could we extend add_definition to take a list of strings, like college_word.add_definition('...', ..., synonyms=['university'])? Though that maybe is a bit complicated...

aryamanarora commented 3 years ago

I'm wondering about how to handle the multidirectionality. Like if definition X has synonyms Y and Z, we probably want to not make the library user add the same set three times. I'm not sure how FLEx and stuff handle this though