Improve Edict2 pinyin (romanization)#678
Merged
Merged
Conversation
Ensure that ü is rendered properly when it has a neutral tone or occurs in the diphthong üe. Previously, it would be rendered as a v in these cases.
This ensures that correct capitalization is preserved for proper names.
Put spaces between proper names and include apostrophes where required.
ilius
reviewed
Oct 12, 2025
| def render_syllables_no_color( | ||
| hf: T_htmlfile, | ||
| syllables: Sequence[str], | ||
| _tones: Sequence[str], |
ilius
reviewed
Oct 12, 2025
|
|
||
|
|
||
| def render_syllables( | ||
| color: bool, hf: T_htmlfile, syllables: Sequence[str], tones: Sequence[str] |
Owner
There was a problem hiding this comment.
Add a comma at the end and ruff format to break into separate lines.
And move color to the end of args, with default True value.
Owner
|
Please test it. |
Contributor
Author
|
I converted the CEdict file from here to an HTML directory using both simplified headwords with color, and traditional headwords without color. It looks good to me; here are screenshots showing the new features.
|
Owner
|
Can you upload a small subset of that glossary? |
Contributor
Author
|
Here's a file with a few representative words. I would want to keep an eye specifically on the following:
|
Owner
|
Thanks. |
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.




Some words were incorrectly romanized when they contained a 'ü', replacing it with a 'v' instead. This happened if the ü occurred with a neutral ("fifth") tone (the only current example of which is 閨女 guīnü), or if it was part of the 'üe' diphthong. This fix ensures that the correct ü is always used.
The romanization process was also converting words to lowercase in order to simplify adding tone diacritics. This restores the original case.
The romanization also previously omitted apostrophes where they should have been included. For example, 企鵝 qǐ'é was rendered as qǐé.
Finally, this adds spaces to separate capitalized names. So 孫中山 is now correctly rendered as Sūn Zhōngshān instead of sūnzhōngshān.