fix(encodings): use Cyrillic combining macron for long ā in Russian scheme - #8
Open
tym83 wants to merge 1 commit into
Open
fix(encodings): use Cyrillic combining macron for long ā in Russian scheme#8tym83 wants to merge 1 commit into
tym83 wants to merge 1 commit into
Conversation
…cheme Russian VedaBase writes long "ā"/"Ā" as Cyrillic "а"/"А" (U+0430/U+0410) followed by a COMBINING MACRON (U+0304), because Cyrillic А has no precomposed macron form in Unicode. The RUS table stored these as the Latin look-alikes "ā"/"Ā" (U+0101/U+0100), so real VedaBase input never matched: the Cyrillic base passed through unchanged and the orphaned macron was left floating over the neighbouring letter. Store positions 0 and 37 as the Cyrillic base + combining macron that VedaBase actually emits. Add regression tests using verbatim vedabase.io/ru strings that assert no combining marks survive a RUS -> Gaura Times conversion. Fixes kosperun#7. Signed-off-by: tym83 <6355522@gmail.com>
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.
Summary
Fixes #7. Long ā / Ā pasted from Russian VedaBase was not converted to Gaura Times, and the macron drifted onto the following letter.
Root cause
Russian VedaBase writes long ā as Cyrillic
а/А(U+0430 / U+0410) + COMBINING MACRON (U+0304) — Cyrillic А has no precomposed macron form in Unicode. TheRUStable stored positions 0 and 37 as the Latin look-alikesā/Ā(U+0101 / U+0100), so real input never matched: the Cyrillic base passed straight through and the orphaned macron was left floating over the neighbouring letter.Every other special letter in
RUSis already stored as Cyrillic base + combining mark (e.g.т̣,ш́,х̣), which is exactly why only long ā was affected — И and У have precomposed Cyrillic macron forms (Ӣ, Ӯ), but А does not, so the table fell back to Latin.Changes
src/encoding_mappings.py—RUSpositions 0 and 37 now use the Cyrillic base + combining macron that VedaBase actually emits, with a comment documenting the codepoints and the reason.tests/test_services.py— regression tests built from verbatimvedabase.io/rustrings, asserting that no combining marks survive aRUS → Gaura Timesconversion, plus aRUS ↔ IASTround-trip for long ā.Testing
All 90 tests pass (86 existing + 4 new). The existing round-trip tests are unaffected because they compare against the tuple itself.
Deliberately out of scope (follow-ups noted in #7)
convert()to make matching robust to combining-mark order (e.g. ṝ, whose order in the table is non-canonical) and to NFD-form sources. This is a broader change and is left for separate discussion.UKRtable appears to have the same Latin-vs-combining gap on long ā (positions 0 and 37) and is worth checking — not touched here to keep this PR focused on the reported bug.