FEAT: Add ArabicPresentationFormConverter for Arabic isolated-form substitution#1888
Merged
romanlutz merged 4 commits intoJun 2, 2026
Conversation
…entation form Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
romanlutz
approved these changes
Jun 2, 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.
Description
Adds
ArabicPresentationFormConverter, a deterministicPromptConverterthat substitutes Arabic letters with their isolated Arabic Presentation Forms-B glyphs (for example ALEF U+0627 -> U+FE8D). A reader still recognizes the same letters, shown in their non-joining isolated shapes, while the underlying code point and token sequence change. The substitution map is derived from Unicode decomposition data (not hand-maintained), so it stays correct across Unicode versions. Characters with no Arabic isolated presentation form (including Arabic digits and punctuation) are left unchanged.Third in a small set of atomic Arabic-script converters, following BidiConverter (#1832) and TatweelConverter (#1869). This is a character-substitution converter and can later migrate to a shared CharacterSubstitutionConverter base alongside the planned ArabiziConverter.
cc @romanlutz
Tests and Documentation
tests/unit/prompt_converter/test_arabic_presentation_form_converter.py: exact mapping, non-Arabic passthrough, mixed text, Arabic-non-letter (digit/punctuation) passthrough, empty input, determinism, and unsupported-input-type rejection. All pass:uv run pytest tests/unit/prompt_converter/test_arabic_presentation_form_converter.pypyrit/prompt_converter/__init__.py(import +__all__).doc/code/converters/1_text_to_text_converters.pyand regenerated the paired.ipynbplus the converter modality table in0_converters.ipynbvia JupyText.ruffandtyare clean; the converter-documentation conformance test passes.