Repository navigation
Leave characters removed by X9 out of the results and show their level as x - #19
Merged
Merged
Conversation
…l as x Rule X9 removes the embedding and override controls (LRE, RLE, LRO, RLO, PDF) and BN, but apply_bidi_algorithm still returned them: - reordered_text and visual_order now leave them out, as the _apply_l2 docstring already promised. Example 6 now ends with 'Hello םולש' instead of '[LRE]Hello םולש[PDF]'. - logical_levels keeps one entry per input character, but a removed character's entry is now None. The demo prints it as x, as the Unicode conformance files do. Verbose mode shows x for the removed characters' level in the tables from I1 on, and for their position after L2 (format_level_for_table and a new after_x9 flag on print_table). The P and X tables still show the levels the X rules assigned. The conformance runners now compare levels and visual order directly with the files, without filtering out the X9 types themselves. README.md, CLAUDE.md and example 6's note are updated to match. Both conformance suites still pass in full.
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.
Rule X9 removes the embedding and override controls (LRE, RLE, LRO, RLO, PDF) and BN, but
apply_bidi_algorithmstill returned them. Example 6 ended with:It now ends with:
Changes
bidi.py):reordered_textandvisual_orderleave out the removed characters, as the_apply_l2docstring already said the caller would.logical_levelsstill has one entry per input character, but a removed character's entry isNone. The demo prints it asx, the marker the Unicode conformance files use.verbose_table.py): from I1 on, the tables showxas a removed character's level, and the L2 table showsxas its position after reordering. This is done by a newformat_level_for_tablehelper and anafter_x9flag onprint_table. The P and X tables still show the levels the X rules assigned.README.md,CLAUDE.mdand example 6's "Watch for" note are updated to match.API change
Library callers get
Noneinlevelsfor removed characters, andvisual_order/reorderedare shorter than the input when it contains embedding controls or BN.Testing
python bidi.py --allruns without errors.