2026-03-28 23:44:37 -04:00

24 lines
820 B
TypeScript

import { z } from "zod";
import { LabelOutput } from "./label.ts";
/** A single human annotator's label for a gold-set paragraph. */
export const HumanLabel = z.object({
paragraphId: z.uuid(),
annotatorId: z.string(),
label: LabelOutput,
labeledAt: z.iso.datetime(),
notes: z.string().optional(),
});
export type HumanLabel = z.infer<typeof HumanLabel>;
/** Adjudicated gold-standard label after inter-rater agreement. */
export const GoldLabel = z.object({
paragraphId: z.uuid(),
finalLabel: LabelOutput,
adjudicationMethod: z.enum(["consensus", "majority", "discussion"]),
humanLabels: z.array(HumanLabel),
cohensKappa: z.number().optional(), // pairwise, for category
krippendorphAlpha: z.number().optional(), // ordinal, for specificity
});
export type GoldLabel = z.infer<typeof GoldLabel>;