From aa287ef6edf983ff48015ea947c44481b2aa9961 Mon Sep 17 00:00:00 2001 From: mlissner Date: Thu, 9 Mar 2023 23:32:33 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20freelawp?= =?UTF-8?q?roject/eyecite@fbc2159329f5830840fe480fb6abf6268c23f0b6=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- annotate.html | 1 + index.html | 1 - models.html | 173 +++++++++++++++++++++++++++++++++++++++++++++----- resolve.html | 2 - 4 files changed, 157 insertions(+), 20 deletions(-) diff --git a/annotate.html b/annotate.html index 71a9c844..5c54aec6 100644 --- a/annotate.html +++ b/annotate.html @@ -170,6 +170,7 @@

Module eyecite.annotate

This indicates that offsets 0 to 4 need to be shifted by 0, and offsets 4 and up need to be shifted by 4. """ + # helpers for the two kinds of updates we need to apply to offsets: def shift_offset(offset, delta): return offset + delta diff --git a/index.html b/index.html index 01c3bad0..62959a62 100644 --- a/index.html +++ b/index.html @@ -531,7 +531,6 @@

Returns

# Iterate over each citation and attempt to resolve it to a resource for citation in citations: - # If the citation is a full citation, try to resolve it if isinstance(citation, FullCitation): resolution = resolve_full_citation(citation) diff --git a/models.html b/models.html index d7ddb334..9c5d9d64 100644 --- a/models.html +++ b/models.html @@ -38,6 +38,7 @@

Module eyecite.models

List, Optional, Sequence, + Tuple, Union, cast, ) @@ -98,6 +99,8 @@

Module eyecite.models

# span() overrides span_start: Optional[int] = None span_end: Optional[int] = None + full_span_start: Optional[int] = None + full_span_end: Optional[int] = None groups: dict = field(default_factory=dict) metadata: Any = None @@ -174,6 +177,26 @@

Module eyecite.models

self.span_end if self.span_end is not None else self.token.end, ) + def full_span(self) -> Tuple[int, int]: + """Span indices that fully cover the citation + + Start and stop offsets in source text for full citation text (including + plaintiff, defendant, post citation, ...) + + Relevant for FullCaseCitation, FullJournalCitation and FullLawCitation. + + :returns: Tuple of start and end indicies + """ + start = self.full_span_start + if start is None: + start = self.span()[0] + + end = self.full_span_end + if end is None: + end = self.span()[1] + + return start, end + @dataclass(eq=True, unsafe_hash=True, repr=False) class ResourceCitation(CitationBase): @@ -290,7 +313,7 @@

Module eyecite.models

i for i in (m.publisher, m.month, m.day, m.year) if i ) if publisher_date: - parts.append(f" ({publisher_date}") + parts.append(f" ({publisher_date})") if m.parenthetical: parts.append(f" ({m.parenthetical})") return "".join(parts) @@ -386,7 +409,7 @@

Module eyecite.models

parts.append(f", {m.pin_cite}") if m.extra: parts.append(m.extra) - publisher_date = " ".join(m[i] for i in (m.court, m.year) if i) + publisher_date = " ".join(i for i in (m.court, m.year) if i) if publisher_date: parts.append(f" ({publisher_date}") if m.parenthetical: @@ -576,6 +599,9 @@

Module eyecite.models

self.variation_editions = cast( tuple, self.variation_editions ) + cast(tuple, other.variation_editions) + # Remove duplicate editions after merge + self.exact_editions = tuple(set(self.exact_editions)) + self.variation_editions = tuple(set(self.variation_editions)) return self return None @@ -695,7 +721,7 @@

Classes

class CaseCitation -(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None) +(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, full_span_start: Optional[int] = None, full_span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None)

Convenience class which represents a single citation found in a @@ -788,6 +814,7 @@

Inherited members

  • corrected_citation_full
  • corrected_reporter
  • dump
  • +
  • full_span
  • guess_edition
  • matched_text
  • span
  • @@ -797,7 +824,7 @@

    Inherited members

    class CitationBase -(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None) +(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, full_span_start: Optional[int] = None, full_span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None)

    Base class for objects returned by get_citations(). We @@ -817,6 +844,8 @@

    Inherited members

    # span() overrides span_start: Optional[int] = None span_end: Optional[int] = None + full_span_start: Optional[int] = None + full_span_end: Optional[int] = None groups: dict = field(default_factory=dict) metadata: Any = None @@ -891,7 +920,27 @@

    Inherited members

    if self.span_start is not None else self.token.start, self.span_end if self.span_end is not None else self.token.end, - ) + ) + + def full_span(self) -> Tuple[int, int]: + """Span indices that fully cover the citation + + Start and stop offsets in source text for full citation text (including + plaintiff, defendant, post citation, ...) + + Relevant for FullCaseCitation, FullJournalCitation and FullLawCitation. + + :returns: Tuple of start and end indicies + """ + start = self.full_span_start + if start is None: + start = self.span()[0] + + end = self.full_span_end + if end is None: + end = self.span()[1] + + return start, end

    Subclasses

      @@ -906,6 +955,14 @@

      Class variables

      Define fields on self.metadata.

      +
      var full_span_end : Optional[int]
      +
      +
      +
      +
      var full_span_start : Optional[int]
      +
      +
      +
      var groups : dict
      @@ -1004,6 +1061,40 @@

      Methods

      }
      +
      +def full_span(self) ‑> Tuple[int, int] +
      +
      +

      Span indices that fully cover the citation

      +

      Start and stop offsets in source text for full citation text (including +plaintiff, defendant, post citation, …)

      +

      Relevant for FullCaseCitation, FullJournalCitation and FullLawCitation.

      +

      :returns: Tuple of start and end indicies

      +
      + +Expand source code + +
      def full_span(self) -> Tuple[int, int]:
      +    """Span indices that fully cover the citation
      +
      +    Start and stop offsets in source text for full citation text (including
      +    plaintiff, defendant, post citation, ...)
      +
      +    Relevant for FullCaseCitation, FullJournalCitation and FullLawCitation.
      +
      +    :returns: Tuple of start and end indicies
      +    """
      +    start = self.full_span_start
      +    if start is None:
      +        start = self.span()[0]
      +
      +    end = self.full_span_end
      +    if end is None:
      +        end = self.span()[1]
      +
      +    return start, end
      +
      +
      def matched_text(self)
      @@ -1074,6 +1165,9 @@

      Methods

      self.variation_editions = cast( tuple, self.variation_editions ) + cast(tuple, other.variation_editions) + # Remove duplicate editions after merge + self.exact_editions = tuple(set(self.exact_editions)) + self.variation_editions = tuple(set(self.variation_editions)) return self return None @@ -1128,6 +1222,9 @@

      Methods

      self.variation_editions = cast( tuple, self.variation_editions ) + cast(tuple, other.variation_editions) + # Remove duplicate editions after merge + self.exact_editions = tuple(set(self.exact_editions)) + self.variation_editions = tuple(set(self.variation_editions)) return self return None @@ -1219,7 +1316,7 @@

      Methods

    class FullCaseCitation -(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None) +(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, full_span_start: Optional[int] = None, full_span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None)

    Convenience class which represents a standard, fully named citation, @@ -1272,7 +1369,7 @@

    Methods

    parts.append(f", {m.pin_cite}") if m.extra: parts.append(m.extra) - publisher_date = " ".join(m[i] for i in (m.court, m.year) if i) + publisher_date = " ".join(i for i in (m.court, m.year) if i) if publisher_date: parts.append(f" ({publisher_date}") if m.parenthetical: @@ -1333,7 +1430,7 @@

    Methods

    parts.append(f", {m.pin_cite}") if m.extra: parts.append(m.extra) - publisher_date = " ".join(m[i] for i in (m.court, m.year) if i) + publisher_date = " ".join(i for i in (m.court, m.year) if i) if publisher_date: parts.append(f" ({publisher_date}") if m.parenthetical: @@ -1352,6 +1449,7 @@

    Inherited members

  • corrected_citation
  • corrected_reporter
  • dump
  • +
  • full_span
  • guess_court
  • guess_edition
  • matched_text
  • @@ -1362,7 +1460,7 @@

    Inherited members

    class FullCitation -(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None) +(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, full_span_start: Optional[int] = None, full_span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None)

    Abstract base class indicating that a citation fully identifies a @@ -1420,6 +1518,7 @@

    Inherited members

  • corrected_citation_full
  • corrected_reporter
  • dump
  • +
  • full_span
  • guess_edition
  • matched_text
  • span
  • @@ -1429,7 +1528,7 @@

    Inherited members

    class FullJournalCitation -(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None) +(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, full_span_start: Optional[int] = None, full_span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None)

    Citation to a source from reporters_db/journals.json.

    @@ -1501,6 +1600,7 @@

    Inherited members

  • corrected_citation_full
  • corrected_reporter
  • dump
  • +
  • full_span
  • guess_edition
  • matched_text
  • span
  • @@ -1510,7 +1610,7 @@

    Inherited members

    class FullLawCitation -(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None) +(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, full_span_start: Optional[int] = None, full_span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None)

    Citation to a source from reporters_db/laws.json.

    @@ -1548,7 +1648,7 @@

    Inherited members

    i for i in (m.publisher, m.month, m.day, m.year) if i ) if publisher_date: - parts.append(f" ({publisher_date}") + parts.append(f" ({publisher_date})") if m.parenthetical: parts.append(f" ({m.parenthetical})") return "".join(parts) @@ -1593,6 +1693,7 @@

    Inherited members

  • corrected_citation_full
  • corrected_reporter
  • dump
  • +
  • full_span
  • guess_edition
  • matched_text
  • span
  • @@ -1602,7 +1703,7 @@

    Inherited members

    class IdCitation -(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None) +(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, full_span_start: Optional[int] = None, full_span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None)

    Convenience class which represents an 'id' or 'ibid' citation, i.e., a @@ -1644,6 +1745,14 @@

    Ancestors

    Class variables

    +
    var full_span_end : Optional[int]
    +
    +
    +
    +
    var full_span_start : Optional[int]
    +
    +
    +
    var groups : dict
    @@ -1698,6 +1807,7 @@

    Inherited members

  • corrected_citation
  • corrected_citation_full
  • dump
  • +
  • full_span
  • matched_text
  • span
  • @@ -1905,7 +2015,7 @@

    Class variables

    class ResourceCitation -(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None) +(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, full_span_start: Optional[int] = None, full_span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None)

    Base class for a case, law, or journal citation. Could be short or @@ -2122,6 +2232,7 @@

    Inherited members

  • Metadata
  • corrected_citation_full
  • dump
  • +
  • full_span
  • matched_text
  • span
  • @@ -2183,7 +2294,7 @@

    Inherited members

    class ShortCaseCitation -(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None) +(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, full_span_start: Optional[int] = None, full_span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None, exact_editions: Sequence[Edition] = <factory>, variation_editions: Sequence[Edition] = <factory>, all_editions: Sequence[Edition] = <factory>, edition_guess: Optional[Edition] = None, year: Optional[int] = None)

    Convenience class which represents a short form citation, i.e., the kind @@ -2287,6 +2398,7 @@

    Inherited members

  • corrected_citation
  • corrected_reporter
  • dump
  • +
  • full_span
  • guess_court
  • guess_edition
  • matched_text
  • @@ -2350,7 +2462,7 @@

    Inherited members

    class SupraCitation -(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None) +(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, full_span_start: Optional[int] = None, full_span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None)

    Convenience class which represents a 'supra' citation, i.e., a citation @@ -2410,6 +2522,14 @@

    Ancestors

    Class variables

    +
    var full_span_end : Optional[int]
    +
    +
    +
    +
    var full_span_start : Optional[int]
    +
    +
    +
    var groups : dict
    @@ -2470,6 +2590,7 @@

    Inherited members

  • corrected_citation
  • corrected_citation_full
  • dump
  • +
  • full_span
  • matched_text
  • span
  • @@ -2784,7 +2905,7 @@

    Methods

    class UnknownCitation -(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None) +(token: Token, index: int, span_start: Optional[int] = None, span_end: Optional[int] = None, full_span_start: Optional[int] = None, full_span_end: Optional[int] = None, groups: dict = <factory>, metadata: Any = None)

    Convenience class which represents an unknown citation. A recognized @@ -2808,6 +2929,14 @@

    Ancestors

    Class variables

    +
    var full_span_end : Optional[int]
    +
    +
    +
    +
    var full_span_start : Optional[int]
    +
    +
    +
    var groups : dict
    @@ -2842,6 +2971,7 @@

    Inherited members

  • corrected_citation
  • corrected_citation_full
  • dump
  • +
  • full_span
  • matched_text
  • span
  • @@ -2888,6 +3018,9 @@

    corrected_citation
  • corrected_citation_full
  • dump
  • +
  • full_span
  • +
  • full_span_end
  • +
  • full_span_start
  • groups
  • index
  • matched_text
  • @@ -2962,6 +3095,8 @@

    IdCitation