Skip to content

fix(regex): keep the court group inside its own parenthetical - #347

Open
arthrod wants to merge 1 commit into
freelawproject:mainfrom
arthrod:claude/hallucination-benchmark-attorneys-b57mmv
Open

fix(regex): keep the court group inside its own parenthetical#347
arthrod wants to merge 1 commit into
freelawproject:mainfrom
arthrod:claude/hallucination-benchmark-attorneys-b57mmv

Conversation

@arthrod

@arthrod arthrod commented Sep 8, 2026

Copy link
Copy Markdown

Fixes

Fixes court/year/full_span mis-association on string cites and on citations followed by another citation in the next sentence.

Summary

POST_FULL_CITATION_REGEX captured the court as (?P<court>.*?) followed by a lookahead for whitespace plus a month or year. When a citation's own year paren is (2007) there is no whitespace before the digits, so the lazy court group crawled forward across 2007). Later text (2d Cir. until it found 1997.

Fix: (?P<court>[^()]*?). Adds FindTest.test_court_year_paren_does_not_run_on covering four string-cite variants. Eyecite suite stays green (56 tests).

Defining input:

A v. B, 550 U.S. 544, 555 (2007). Later text here (2d Cir. 1997).
   -> year=2007, full_span = "A v. B, 550 U.S. 544, 555 (2007)"

AI Disclosure

  • Parts of this PR were created with the help of an AI tool, and I have carefully reviewed all of its content and take full responsibility for it.

POST_FULL_CITATION_REGEX's court group used a lazy .*? that crawled past a
citation's own (year) paren into a later (court year) paren, so year, court
and full_span were taken from a neighbour. Restrict the group to [^()]*?.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants