feat(pipeline): read percentage ranges "10-20%" as a unit (#112) - #172
Merged
Conversation
After the #76 phase swap (Percentages before Ranges) the percentage phase consumed "20%" first, the range phase never saw "10-20", and the dash was left bare: "10-20%" read as "десять-двадцать процентов". The pre-swap output was equally broken ("от десяти до двадцати%"). Add a Percentage ranges phase immediately before Percentages: `\b(\d+)\s*-\s*(\d+)\s*%` is read via the existing normalize_range plus the fixed genitive-plural "процентов" (always correct after "до <genitive>") → "от десяти до двадцати процентов". Unparsable bounds leave the whole match untouched, mirroring the plain percentage phase. Closes #112
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
re_percentage_range()+ "Percentage ranges" phase right beforePercentages: "10-20%" → "от десяти до двадцати процентов" — no bare
dash, no bare "%" (pipeline: percentage range "10-20%" reads as "десять-двадцать процентов" #112)
are integer-only too); behavior there matches the existing range phase
read-percentage-ranges; "Ranges andpercentages" gains the range-percent reading, "Fixed phase order"
records the new phase
Reviewer findings folded in
appending " процентов" to raw digits — same failure mode as
normalize_percentage"x10-20%" (no range reading — pinned actual behavior, plain
percentage still claims "20%", pre-existing semantics)
Test plan
cargo test— 972 tests, incl. new unit tests + golden fixturerange_percent(char_map pinned)just lintopenspec validate --strictCloses #112