Skip to content

Commit

Permalink
Merge branch 'main' into improve-citation-filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
flooie authored Feb 7, 2025
2 parents c837e84 + 42dd315 commit 4fcdd14
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions eyecite/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,18 @@ def _extract_shortform_citation(
strings_only=True,
forward=False,
)
offset = 0
if m:
ante_start, ante_end = m.span()
offset = ante_end - ante_start
antecedent_guess = m["antecedent"].strip()

# Get pin_cite
cite_token = cast(CitationToken, words[index])
pin_cite, span_end, parenthetical = extract_pin_cite(
words, index, prefix=cite_token.groups["page"]
)
span_end = span_end if span_end else 0

# make ShortCaseCitation
citation = ShortCaseCitation(
Expand All @@ -264,6 +268,8 @@ def _extract_shortform_citation(
exact_editions=cite_token.exact_editions,
variation_editions=cite_token.variation_editions,
span_end=span_end,
full_span_start=cite_token.start - offset,
full_span_end=max([span_end, cite_token.end]),
metadata={
"antecedent_guess": antecedent_guess,
"pin_cite": pin_cite,
Expand Down

0 comments on commit 4fcdd14

Please sign in to comment.