Record Class Citation

java.lang.Object
java.lang.Record
ai.doctruth.Citation
Record Components:
location - the source-document span this citation points at.
exactQuote - the literal text recovered from the source that justified the value.
matchScore - similarity of exactQuote to the substring at location; downstream matchers should treat matchScore < 0.85 as a warning.

public record Citation(SourceLocation location, String exactQuote, double matchScore) extends Record
The verifiable evidence anchor for a single extracted field. A Citation ties an extracted value back to a specific span of the source document plus the exact quote recovered from that span and a confidence score for the page-attribution match itself.

Invariants (enforced by the compact constructor):

  • location is non-null.
  • exactQuote is non-null and non-blank.
  • matchScore is a real number in [0.0, 1.0]NaN and infinities are rejected. 1.0 means an exact substring match; lower values come from fuzzy / Levenshtein-style matchers.
Since:
0.1.0
  • Constructor Details

    • Citation

      public Citation(SourceLocation location, String exactQuote, double matchScore)
      Creates an instance of a Citation record class.
      Parameters:
      location - the value for the location record component
      exactQuote - the value for the exactQuote record component
      matchScore - the value for the matchScore record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • location

      public SourceLocation location()
      Returns the value of the location record component.
      Returns:
      the value of the location record component
    • exactQuote

      public String exactQuote()
      Returns the value of the exactQuote record component.
      Returns:
      the value of the exactQuote record component
    • matchScore

      public double matchScore()
      Returns the value of the matchScore record component.
      Returns:
      the value of the matchScore record component