fix: handle double section symbol (§§) in statute citations#59
Closed
medelman17 wants to merge 1 commit intomainfrom
Closed
fix: handle double section symbol (§§) in statute citations#59medelman17 wants to merge 1 commit intomainfrom
medelman17 wants to merge 1 commit intomainfrom
Conversation
Update extractStatute regex to match §+ (one or more section symbols) instead of just a single §. This allows parsing of citations like "42 U.S.C. §§ 1983" which use the plural form in legal writing. - Updated regex pattern in src/extract/extractStatute.ts - Added unit test for §§ token parsing - Added integration test via full pipeline Fixes #43 Co-authored-by: Michael Edelman <medelman17@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #59 +/- ##
=======================================
Coverage 97.37% 97.37%
=======================================
Files 26 26
Lines 916 916
Branches 251 251
=======================================
Hits 892 892
Misses 24 24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Owner
Author
|
Closing — §§ support already shipped in PR #67 (federal statute rewrite). The enhanced USC/CFR patterns handle double section symbols. |
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
Fixes #43 by updating the statute extractor regex to handle double section symbols (§§).
Changes
src/extract/extractStatute.tsfrom§\s*to§+\s*The tokenizer already matched
§§correctly with its§+pattern, but the extractor regex only expected a single§. This simple fix aligns them and allows parsing citations like42 U.S.C. §§ 1983.Test Plan
pnpm testto verify new tests passpnpm typecheckto verify no type errorspnpm lintto verify code styleextractCitations('42 U.S.C. §§ 1983')no longer throwsGenerated with Claude Code