Repository navigation
[JA] Show the synonyms under their meaning when they give its number - #2839
Merged
Merged
Conversation
The synonyms of a JA entry often give the number of their meaning: "*語義1:[[ふむ]]", a "語義1" line above a list, or "*[[気楽]](語義1、語義2)". Those are now put under their meaning as a sub-definition, and the list stays as it is when a line can't be matched.
Member
|
Awesome! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following your note on #2815 about ふうん and 年生.
Many JA synonym lists give the number of the meaning they belong to, but they were rendered as a separate list. Three layouts are common:
*語義1:[[ふむ]]、[[なるほど]],*(語義1)[[退職]],* {{sense|語義1}} ...語義1line (or;語義1,(語義1),語義1:) above the bullets that belong to it*[[気楽]](語義1、語義2)attach_synonyms()in the JA module reads these and puts the synonyms of each meaning under it as one sub-definition, after its examples:The meanings are the
#items of the section the synonyms belong to. A list stays as it is when one of its lines has no number, or a number the meanings don't have, so a list without numbers is not touched.Testing
python -m wikidict ja --parse, Python 3.13.18 inpython:3.13-slimon Windows 11.parse_word()on all 8,247 pages that contain "語義", with main and with this branch. 458 pages now have their synonyms under their meanings, none loses a meaning, and pages with a separate synonyms list go from 888 to 450 (the rest have no numbers).tests/test_ja.pyand the JA doctests pass (the new function has doctests for each layout and for the lists left alone), and ruff and mypy are clean.