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

fix(parentheticals): Fix three bugs in parenthetical functionality #1919

Merged
merged 5 commits into from
Feb 18, 2022

Conversation

ProbablyFaiz
Copy link
Contributor

@ProbablyFaiz ProbablyFaiz commented Feb 18, 2022

Bug 1: Parentheticals are stored n times in the database for n parallel citations that appear in the citation the parenthetical does. (See also freelawproject/eyecite#111)

Fixed in 14d5d72

Bug 2: We show the following explainer text on the summaries page even when there are zero summaries:

We looked through our complete collection of opinions and identified the following parenthetical summaries that describe this case:

Fixed in cb63fb4

Bug 3: Using a compiled regex in an f-string does not quite work properly and was causing some incorrect computations of scores for holding that-style parentheticals. .pattern has the expected behavior.

Fixed in 885b630

Lastly, the parenthetical filtering is tightened up to handle more edge cases.

@mlissner
Copy link
Member

I'm skeptical eyecite has a bug here, but I'll take a look. My guess is this has to do with the different kinds of short citations that eyecite can identify.

@ProbablyFaiz
Copy link
Contributor Author

ProbablyFaiz commented Feb 18, 2022

I'm skeptical eyecite has a bug here, but I'll take a look. My guess is this has to do with the different kinds of short citations that eyecite can identify.

I can confirm that the behavior concerned here is caused by every reporter in a parallel citation being matched as a separate citation (see the eyecite issue linked above for a minimum reproducible example). That may not necessarily a bad thing, but here it leads to citations being double- or triple-counted for purposes of the depth field and the same parenthetical being registered multiple times.

@ProbablyFaiz ProbablyFaiz changed the title fix(parentheticals): Fix two bugs in parenthetical functionality fix(parentheticals): Fix three bugs in parenthetical functionality Feb 18, 2022
Copy link
Member

@mlissner mlissner left a comment

Choose a reason for hiding this comment

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

Everything here looks good, but see my comment re eyecite, please. Thank you!

Comment on lines +166 to +169
# Currently, eyecite has a bug where parallel citations are
# detected individually. We avoid creating duplicate parentheticals
# because of that by keeping track of what we've seen so far.
parenthetical_texts = set()
Copy link
Member

Choose a reason for hiding this comment

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

This is a pretty good fix. I'd prefer if we could fix it upstream though in eyecite, and then fix it properly here, rather than hack around it. That'd make our code better, and would provide a nice enhancement to eyecite users to. See: freelawproject/eyecite#76

@mlissner mlissner merged commit c2c76f3 into freelawproject:main Feb 18, 2022
@mlissner
Copy link
Member

Merging this in conjunction with a pinky swear from @ProbablyFaiz that once eyecite is fixed, he'll return here and clean up the workaround. Very well. :)

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

Successfully merging this pull request may close these issues.

2 participants