Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use resolved object's metadata to find ReferenceCitations #199

Open
grossir opened this issue Jan 30, 2025 · 0 comments · May be fixed by #200
Open

Use resolved object's metadata to find ReferenceCitations #199

grossir opened this issue Jan 30, 2025 · 0 comments · May be fixed by #200
Assignees

Comments

@grossir
Copy link
Contributor

grossir commented Jan 30, 2025

We can improve finding both pincite-ReferenceCitations and name-only-ReferenceCitations by using metadata from the resolved object.

If eyecite fails to parse correctly the defendant or plaintiff, then we can't find reference citations. However, if a FullCaseCitation is resolved to an Opinion on Courtlistener, we could use the related OpinionCluster.case_name and OpinionCluster.case_name_short to try to find them. So, this step should happend after resolutions. We would basically increment the list of matchable names, and try again to see if we get new matches

Relevant code:
In eyecite

eyecite/eyecite/find.py

Lines 157 to 167 in abfc7f7

regexes = [
rf"(?P<{key}>{re.escape(value)})"
for key in ["plaintiff", "defendant"]
if (value := getattr(citation.metadata, key, None))
and is_valid_name(value)
]
if not regexes:
return []
pin_cite_re = (
rf"\b(?:{'|'.join(regexes)})\s+at\s+(?P<pin_cite>\d{{1,5}})\b"
)

In courtlistener:

    # Resolve all those different citation objects to Opinion objects,
    # using a variety of heuristics.
    citation_resolutions: Dict[
        MatchedResourceType, List[SupportedCitationType]
    ] = do_resolve_citations(citations, opinion)
    
    # add logic here
    second_round_of_resolutions(citation_resolutions, opinion.source_text)

    # Generate the citing opinion's new HTML with inline citation links
    opinion.html_with_citations = create_cited_html(
        opinion, citation_resolutions
    )
@grossir grossir moved this to Waiting on Feedback in Case Law Sprint Jan 30, 2025
grossir added a commit that referenced this issue Feb 1, 2025
…e_short for search and resolution

Fixes #199

- updated ReferenceCitation and FullCaseCitation models metadata to admit resolved_case_name_short and resolved_case_name
- update helpers.filter_citations to save metadata of duplicated ReferenceCitations on the kept object
- update tests to show how the finding and resolution will work
@grossir grossir moved this from Waiting on Feedback to PR'd Issues 🤞 in Case Law Sprint Feb 1, 2025
grossir added a commit that referenced this issue Feb 1, 2025
…e_short for search and resolution

Fixes #199

- updated ReferenceCitation and FullCaseCitation models metadata to admit resolved_case_name_short and resolved_case_name
- update helpers.filter_citations to save metadata of duplicated ReferenceCitations on the kept object
- update tests to show how the finding and resolution will work
grossir added a commit that referenced this issue Feb 1, 2025
…e_short for search and resolution

Fixes #199

- updated ReferenceCitation and FullCaseCitation models metadata to admit resolved_case_name_short and resolved_case_name
- update helpers.filter_citations to save metadata of duplicated ReferenceCitations on the kept object
- update tests to show how the finding and resolution will work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: PR'd Issues 🤞
1 participant