Repository navigation
[RU][UK] Show the synonyms under their meaning - #2815
Conversation
|
Instead of appending, we could add use a sublist so that converters will display properly a subitem for the main definitions, WDYT? And I am also thinking if that would be cool to generalize the process to all locales 🤔 |
5e2144f to
a423892
Compare
|
Good idea, done: each synonym line is now a sub-definition of its meaning ( For other locales, I moved the code to I rebuilt the whole RU dictionary with this version and compared it with a build without synonyms: no word, form or definition is missing. |
If you are still willing to handle other locales, I'm 100% OK :) |
|
Sure, here are the first two:
I looked at the other locales too. PT mostly writes one list for the whole word, and only a few thousand lines use "De '''1''':", so I left it out for now. PL also numbers its synonyms with (1.1), but its definitions are read with a pattern that doesn't render sub-items, so it would first need a change in how PL definitions are read. FR, EL, LT, DA, JA, MG and most others write a single bulleted list per word, with nothing to match. The SV, TR, KO and ES Wiktionaries already write the synonyms next to each meaning. |
|
Awesome! For the future, if you would like to tackle other locales (when applicable) do not hesitate :) |
|
I saw this might also be possible for Japanese, example with https://ja.wiktionary.org/wiki/%E3%81%B5%E3%81%86%E3%82%93 ; it does not seem to be always this obvious, but it could improve the overall dictionary anyway. Another use case: https://ja.wiktionary.org/wiki/%E5%B9%B4%E7%94%9F |
|
good catch, JA is in #2839. it handles the "語義1" references in the three layouts I found (inline, a 語義1 line above the bullets, and (語義1、語義2) at the end). lists without numbers stay as they are, which is about half of them |
|
Note: NL could benefit of such an improvement, even if it is not as widely used as in other locales, example: https://nl.wiktionary.org/wiki/daardoor |
|
good catch, did NL in #2842. on daardoor the [1] synonyms now show under the first meaning, and it works on about 6.7k NL pages |
In the RU and UK Wiktionaries, the "Синонимы"/"Синоніми" section has one line per meaning, in the same order, with an empty line (or "-") for a meaning without synonyms. wikidict renders it as a separate numbered list and drops the empty lines and repeated synonyms, so the numbers stop matching the meanings. On the 20261101 dumps this happens in about 7,000 RU lists and 177 UK ones. For example:
Now
utils.attach_synonyms()puts each synonym line under its meaning as a sub-definition, and drops the section:Details:
#items, or unbalanced brackets. That's about 620 RU entries.I built the whole RU dictionary with this change and compared it with a build without synonyms: no word, form or definition is missing, and about 127,800 entries now show synonyms under their meanings.
Doctests cover each case, and the RU and UK tests now expect the synonyms under their meanings. The RU/UK/BG tests, doctests, ruff and mypy pass locally.