Skip to content

fix: extract USC citations when the section mark is omitted - #342

Open
aseem-ai wants to merge 1 commit into
freelawproject:mainfrom
aseem-ai:fix/usc-optional-section-mark
Open

fix: extract USC citations when the section mark is omitted#342
aseem-ai wants to merge 1 commit into
freelawproject:mainfrom
aseem-ai:fix/usc-optional-section-mark

Conversation

@aseem-ai

@aseem-ai aseem-ai commented Sep 1, 2026

Copy link
Copy Markdown

Fixes

Fixes #300

Summary

Federal Register and executive-order drafting omits the section mark, so
50 U.S.C. 1701 extracted as nothing while 50 U.S.C. § 1701 worked.

This makes the marker optional in the existing law citation pattern rather
than adding a normalizing pre-pass. The pattern comes from reporters-db via
the $section_marker variable, and that variable is used by exactly one of
the 373 law regexes there — the U.S.C. one — so widening it at eyecite's
existing variable-override chokepoint touches only U.S.C. and needs no
hardcoded reporter name. A title and a section number are both still
required, so bare prose mentions of the code do not match. No lookahead is
introduced, so HyperscanTokenizer still compiles it.

Lettered sections like § 2339B are unchanged and still unmatched; that is
#146 / #331.

Tests

python -m unittest discover -s tests -p 'test_*.py' → 56 tests, OK.

New test test_find_usc_citations_without_section_mark fails on main
([] != [FullLawCitation]) and passes here. It covers the no-§ form, the
§ form still matching once and not twice, et seq., the sentence from the
issue, and four prose negatives (the U.S.C. is a code, U.S.C. Title 18,
see U.S.C., codified at 50 U.S.C.).

Also checked by hand: extraction over tests/assets/opinion.txt returns the
same 170 citations before and after.

AI Disclosure

  • No AI tools were used to create the content of this PR.
  • 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.

Executive-branch and Federal Register drafting writes "50 U.S.C. 1701"
without the section mark, and those cites extracted as nothing. A title
and a section number are still both required, so bare mentions of the
code do not match.

@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

CLAassistant commented Sep 1, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@anseljh

anseljh commented Sep 5, 2026

Copy link
Copy Markdown
Member

@claude review

@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.

Code review found no issues

No high-confidence issues detected in this change.

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.

US Code citations without § symbol not extracted (e.g. 50 U.S.C. 1701)

3 participants