fix: boundary treats combining marks as word characters, like Ruby - #11
Merged
Merged
Conversation
Ruby's \b counts combining marks (Arabic diacritics) as word characters; Python's \w does not — Mn is not alphanumeric. At a hamza-carrier + kasra junction Ruby saw no boundary while Python did, so every word-final rule (X + boundary -> "'a") fired wrongly and doubled vowels: دَائِم became dā'aim instead of dā'im. The boundary now compiles to an explicit word/non-word transition over a word class that includes combining marks. Through the Ruby bridge, alalc-ara: 10 failures -> 4.
This was referenced Oct 1, 2026
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.
Ruby's
\bcounts combining marks (Arabic diacritics) as word characters; Python's\wdoes not — Mn is not alphanumeric. Proven with a two-line test:ئ\bon دَائِم does not match in Ruby, does in Python. Every word-final rule (X + boundary → "’a") therefore fired wrongly, doubling vowels — دَائِم → "dā’aim" instead of "dā’im".The boundary now compiles to an explicit word/non-word transition whose word class includes combining marks (0300–036F, Arabic diacritics 064B–065F, 0670, Quranic annotation 06D6–06ED), pinned by a spec on the hamza-carrier/kasra junction both ways.
Through the Ruby bridge against the ISC corpus: alalc-ara goes 10 failures → 4 (dā’im, mala’a, al-miṣrī, al-ghazzī, al-aṣl all heal; zero regressions). Builds on #10's Ruby-exact selection ordering.