FEAT: Add TatweelConverter for Arabic kashida insertion#1869
Merged
romanlutz merged 7 commits intoJun 2, 2026
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ter24/add-tatweel-converter Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
romanlutz
approved these changes
Jun 1, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
romanlutz
added a commit
to romanlutz/PyRIT
that referenced
this pull request
Jun 2, 2026
Brings in 3 new commits from main: - 648faa9 FEAT: Backfill class-level metadata for all remote seed datasets (microsoft#1780) - 092126d MAINT: Migrate AddImage/AddTextImage converter deprecations to print_deprecation_message (microsoft#1875) - 376e000 FEAT: Add TatweelConverter for Arabic kashida insertion (microsoft#1869) Conflict resolution (11 files): took main's version everywhere (`git checkout --theirs`), then re-ran `ruff check --fix` to re-apply the PEP 604 sweep to main's new code (~36 violations auto-fixed). Same hand-fix for the runtime `Optional[dict]` in `pyrit/models/message_piece.py` PlainSerializer `return_type` that ruff can't auto-rewrite. Verification: - ruff check pyrit/ tests/ doc/ - clean - ruff format --check - clean - pytest tests/unit -n 4 - 8977 passed, 5 skipped, 0 failures Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Description
Adds
TatweelConverter, a deterministicPromptConverterthat inserts the Arabic tatweel (kashida, U+0640) between adjacent Arabic letters. The tatweel is a connector that visually elongates a word without changing its meaning, so the output stays legible to a reader while changing the underlying code point and token sequence. Characters outside the main Arabic block, and Arabic letters not directly followed by another Arabic letter, are left untouched.tatweel_countcontrols how many tatweel are inserted per gap.Second in a small set of atomic Arabic-script converters, following BidiConverter (#1832).
cc @romanlutz
Tests and Documentation
tests/unit/prompt_converter/test_tatweel_converter.py: single-pair and multi-pair insertion,tatweel_countscaling, non-Arabic boundary handling, non-Arabic passthrough, empty input, determinism, invalid-count rejection, and unsupported-input-type rejection. All pass:uv run pytest tests/unit/prompt_converter/test_tatweel_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 (uv run jupytext --sync).ruffandtyare clean; the converter-documentation conformance test passes.