Repository navigation
Name the first strong character in the Phase P verbose trace - #21
Merged
Merged
Conversation
The P2/P3 trace passed identical Before/After rows to print_table, so it only ever printed "(no changes)". It now prints one line naming the character that set the paragraph level (P2), or saying that none was found and the default level applies (P3). README.md and CLAUDE.md describe the new line. Co-Authored-By: Claude <noreply@anthropic.com>
The scan tested R/AL and L in two branches that both stored the character and stopped. It now tests STRONG_TYPES once and chooses the level from the type: 0 for L, 1 for R or AL. Co-Authored-By: Claude <noreply@anthropic.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
With
verbose=True, Phase P passed the same list as both Before and After toprint_table. Becauseprint_tableprints "(no changes)" without a table when the two match, the P2/P3 trace never showed anything useful. In particular, it never said which character set the paragraph level.Phase P now prints one line after its header:
When no strong character is found outside isolates, it prints this instead:
The algorithm is unchanged; only the verbose output differs.
Changes
bidi.py:determine_paragraph_embedding_levelremembers the first strong character it finds and prints the P2 or P3 line. The comment that described a table that was never shown is replaced.bidi.py: the P2 scan now checksSTRONG_TYPESonce and then picks the level from the type (0 for L, 1 for R or AL). It used to test R/AL and L in two separate branches that did the same work. The result is the same.README.md: describes the Phase P line and adds it to the tracing example, copied from real output.CLAUDE.md: describes the Phase P line, and no longer mentions a P table.Testing
python tests/run_bidi_tests.py: 91,707 passed, 0 failedpython tests/run_bidi_type_tests.py: 770,241 passed, 0 failed🤖 Generated with Claude Code