Repository navigation
Keep original text and origin spans on month range tokens - #65
Merged
Merged
Conversation
Commit 14c566c (review fixes for the month range tokens of PR #63) built the DATEREL, hyphen and DATEREL tokens of e.g. 'mars-apríl' from plain strings instead of splitting the source token. The new tokens had original=None and no origin spans, so with original=True the range vanished from the reconstructed text and its character offsets were lost. Split the token again, keeping the walrus refactor. The regression is unreleased (3.6.4 predates PR #63). With the fix, the original text of test/toktest_large.txt is reconstructed exactly from its tokens, except for the final newline: trailing whitespace at the end of the input belongs to no token, as in 3.6.4. Co-Authored-By: Claude Opus 5.5 <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.
Problem
The review fixes for PR #63 (
14c566c) built the three tokens of a month range such asmars-apríl(DATEREL, hyphen, DATEREL) from plain strings, instead of splitting the source token. The new tokens haveoriginal=Noneand noorigin_spans, so withoriginal=True:" mars-apríl"is lost), andThe regression is unreleased: 3.6.4 predates PR #63.
Fix
Split the source token with
Tok.split()again, as the original PR #63 code did, keeping the walrus refactor from the review.Testing
test_month_range_original(hyphen and en-dash ranges): checks that the input is reconstructed from the tokens'originaltext and that each part has its original text and origin spans. It fails without the fix.test/toktest_large.txtis now reconstructed exactly from its tokens' original text, except for the file's final newline: trailing whitespace at the end of the input belongs to no token, the same as in 3.6.4.🤖 Generated with Claude Code