/** * Agreement between annotators. * * `evaluate` scores the extractor against a reference. This scores an annotator against other * annotators, which is the question a new annotator has to answer before its labels are worth * anything: two strong models agree on 97.6 percent of blocks and a weak one on 80.5 * (docs/annotation.md), so a candidate's agreement with the strong models says which of those it * resembles. * * Pure over rows, so it is testable without a database. */ import { type Label } from '../types'; import { type LabelProbabilities } from './probabilities'; export interface AnnotatedBlock { path: string; representation: string; blockIndex: number; mimePart: string | null; blockStart: number | null; blockEnd: number | null; charCount: number; label: Label; probabilities: LabelProbabilities | null; lang: string | null; } export interface PairCount { reference: Label; candidate: Label; blocks: number; } export interface ReferenceAgreement { name: string; /** Blocks labelled by both the candidate and this reference. */ shared: number; agreed: number; sharedChars: number; agreedChars: number; /** The candidate would hide what this reference calls authored: the expensive direction. */ expensive: { blocks: number; chars: number; }; /** The candidate leaves visible what this reference calls history: the cheap direction. */ cheap: { blocks: number; chars: number; }; /** Most frequent disagreements, largest first. */ pairs: PairCount[]; perLabel: { label: Label; support: number; agreed: number; }[]; perLang: { lang: string; shared: number; agreed: number; }[]; } export interface AgreementReport { candidateBlocks: number; /** Candidate blocks no reference has a label for, usually because segmentation changed. */ unmatched: number; /** Cost ratio re-applied to the candidate's stored distributions, or null for stored labels. */ costRatio: number | null; /** Candidate blocks whose label was recomputed from a stored distribution. */ rescored: number; references: ReferenceAgreement[]; /** * Blocks every reference calls authored and the candidate would hide. The gate number: an * annotator that hides what all strong models agree was written by the sender cannot be used * to size content loss, whatever its overall agreement. */ consensusExpensive: { blocks: number; chars: number; shared: number; }; } /** * Identity of a block. Offsets as well as the index, because annotation runs made under different * extractor versions can segment the same message differently, and pairing block 7 with a * different block 7 would count a segmentation change as a disagreement. */ export declare function blockKey(block: Pick): string; /** * Compare a candidate annotator against one or more references. * * @param candidate the candidate's labels, in run order * @param references each reference's labels, in run order * @param costRatio when set, re-derive the candidate's label from its stored distribution with * this ratio instead of using the stored label; blocks without a distribution keep their label */ export declare function compareAnnotators(candidate: readonly AnnotatedBlock[], references: readonly { name: string; blocks: readonly AnnotatedBlock[]; }[], costRatio?: number | null): AgreementReport; //# sourceMappingURL=agreement.d.ts.map