fix: keep statute "note" as a distinct citation identity - #345
Open
aseem-ai wants to merge 1 commit into
Open
Conversation
A note is a different provision than the section it is filed under, so the designator now lands in groups, which is what builds a citation's identity, rather than being dropped or folded into pin_cite. Fixes freelawproject#323
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.
Fixes
Fixes #323
Summary
42 U.S.C. § 1983 noteis a different provision than42 U.S.C. § 1983. A note holdsenacted-but-uncodified material filed under the nearest section, so the section number is
an address, not an identity. eyecite dropped the designator, and the two citations came
back equal.
The designator now lands in
groupsrather thanmetadata. That is deliberate:ResourceCitation.__hash__is built fromgroups, so anote: boolfield would haveneeded its own
__hash__override onFullLawCitationto affect identity, while onegroup key reuses the identity vocabulary the model already has.
sectionkeeps its plainsection number and no existing key changes value.
et seq.is untouched and stays apin_cite, because it really is part of the section.Because "note" is ordinary English,
LAW_NOTE_REGEXonly matches when nothing continuesit — end of text, or
.,;)(or a year parenthetical — and only lowercase,directly after the cite. So
§ 1983 notes that liability attachesand§ 1983. Note that the courtdo not attach. Both are in the tests, and both go red ifthe guard is removed.
The issue's third example,
42 U.S.C. § 5195c(b) note, is still a miss. That is thelettered-section tokenizer problem in #146 (PR #331), not this one, so it is left alone.
Tests
python -m unittest tests.test_FindTest.FindTest.test_find_law_citations— 15 failuresbefore the change (5 new rows x 3 tokenizers), passes after.
python -m unittest tests.test_ModelsTest— the two new tests failed before withFullLawCitation('42 U.S.C. § 1983') == FullLawCitation('42 U.S.C. § 1983')and'42 U.S.C. § 1983' != '42 U.S.C. § 1983 note'.python -m unittest discover -s tests -p 'test_*.py'— 57 tests, OK.pre-commit run --all-filesandmypy .— clean.AI Disclosure