From 7c6bface0f0bf5c86e7c334b5dca471c8b887076 Mon Sep 17 00:00:00 2001 From: amalsaidov Date: Wed, 2 Dec 2026 11:53:02 +0700 Subject: [PATCH] Fix BRAILLE_MAINLAND dropping the -iong final MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'ong' -> 'ung' normalization rule ran before the 'iong' -> cell rule, so every -iong/yong syllable was rewritten through iong -> iung -> v + eng and emitted the -eng cell (U+283C) plus a stray medial, instead of the dedicated -iong cell U+2839 (dots-1456). Removing the redundant 'ong' -> 'ung' rule lets '穷' render as ⠅⠹ and '用' as ⠹. Plain -ong syllables are unaffected: they are still handled by the direct 'ong' -> ⠲ rule, matching the Mainland Chinese Braille standard. --- pypinyin/style/braille_mainland.py | 1 - tests/test_pinyin.py | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pypinyin/style/braille_mainland.py b/pypinyin/style/braille_mainland.py index e174ac3..d179332 100644 --- a/pypinyin/style/braille_mainland.py +++ b/pypinyin/style/braille_mainland.py @@ -19,7 +19,6 @@ (re.compile(r'iu'), 'iou'), (re.compile(r'ui'), 'uei'), (re.compile(r'un'), 'uen'), - (re.compile(r'ong'), 'ung'), (re.compile(r'^yi?'), 'i'), (re.compile(r'^wu?'), 'u'), (re.compile(r'y'), 'i'), diff --git a/tests/test_pinyin.py b/tests/test_pinyin.py index 9f65b53..ae147ac 100644 --- a/tests/test_pinyin.py +++ b/tests/test_pinyin.py @@ -650,6 +650,13 @@ def test_gwoyeu(han, expect): [['⠱'], ['⠛⠩'], ['⠃⠥'], ['⠵⠖'], ['⠇⠢']]], ['时间不早了', Style.BRAILLE_MAINLAND_TONE, [['⠱⠂'], ['⠛⠩⠁'], ['⠃⠥⠆'], ['⠵⠖⠄'], ['⠇⠢']]], + # -iong/yong finals must map to the ⠹ (dots-1456) cell, + # not be rewritten to -eng via the ong -> ung normalization. + ['穷', Style.BRAILLE_MAINLAND, [['⠅⠹']]], + ['穷', Style.BRAILLE_MAINLAND_TONE, [['⠅⠹⠂']]], + ['用', Style.BRAILLE_MAINLAND, [['⠹']]], + ['用', Style.BRAILLE_MAINLAND_TONE, [['⠹⠆']]], + ['熊', Style.BRAILLE_MAINLAND, [['⠓⠹']]], ]) def test_braille(han, style, expect): got = pinyin(han, style=style)