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 ofexactQuoteto the substring atlocation; downstream matchers should treatmatchScore < 0.85as 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):
locationis non-null.exactQuoteis non-null and non-blank.matchScoreis a real number in[0.0, 1.0]—NaNand infinities are rejected.1.0means an exact substring match; lower values come from fuzzy / Levenshtein-style matchers.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionCitation(SourceLocation location, String exactQuote, double matchScore) Creates an instance of aCitationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theexactQuoterecord component.final inthashCode()Returns a hash code value for this object.location()Returns the value of thelocationrecord component.doubleReturns the value of thematchScorerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Citation
Creates an instance of aCitationrecord class.- Parameters:
location- the value for thelocationrecord componentexactQuote- the value for theexactQuoterecord componentmatchScore- the value for thematchScorerecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
location
-
exactQuote
Returns the value of theexactQuoterecord component.- Returns:
- the value of the
exactQuoterecord component
-
matchScore
public double matchScore()Returns the value of thematchScorerecord component.- Returns:
- the value of the
matchScorerecord component
-