/** * The stemma that explains the presence of the readings at the least * cost, searched among all of them, and what each node of it holds. */ import { Presence } from "./presence.js"; /** * What the search counts against a stemma. A reading arising costs * `gain`, and a reading the base text holds arose too. A reading lost * costs 1, or less where the editorial principles say a loss is weak * evidence. * @category Filiation */ export interface Costs { /** * A reading arising. Ten times a loss, since an addition at exactly * the same place is very unlikely to be made twice (shared addition), * while a perforation is easily struck. */ gain: number; /** * A redundant reading lost, for the share of a loss: the removal of * redundancies is expected and happens in two branches independently * (independent cleanup). */ redundantLoss: number; /** * A reading lost on the way into another system, for the share of a * loss: a re-cut was an editorial pass of its own, and what it lacks * says little about where it was cut from. */ transferLoss: number; /** * The copy carrying a version lacking one of its readings, since a * copy may fail to show what its version holds. Where it is * `Infinity`, a copy carries its version exactly. */ copyDeviation: number; /** A lost state, so that one is posited only where shared additions require it. */ lostState: number; } /** * The costs the edition of WM 225 is reproduced with: a gain 10, a lost * redundancy 0.25, a loss on a transfer 0.25, a deviation of a copy 1 * and a lost state 4. They were found by searching for values that give * that stemma, so they say that it is consistent with such rules, not * that the rules confirm it. * @category Filiation */ export declare const defaultCosts: Costs; /** * A stemma laid out for counting: its nodes children first, the root * last, each with the copy it carries, its parent, its system, whether * it was re-cut from its parent, and the copies at and below it. */ export interface LaidOut { copy: Int16Array; parent: Int16Array; transfer: Uint8Array; system: string[]; below: Int32Array; lost: number; notation: string; } /** * A stemma the search scored, in a notation naming the copies: a lost * state as `*`, the versions derived from a node in brackets after it. * @category Filiation */ export interface Scored { notation: string; cost: number; lost: number; } /** * How much more the best stemma without one of the best one's groupings * costs: the margin by which the copies decide it. * @category Filiation */ export interface Support { /** The copies the grouping holds, as the copies of a node and those below it. */ copies: string[]; /** * Where it is the grouping of a version carried by copies and lying * above others, rather than of the copies below a node: the copies * carrying that version. */ ancestor?: string[]; margin: number; } /** The outcome of the search. */ export interface Search { best: LaidOut; cost: number; scored: number; alternatives: Scored[]; supports: Support[]; } /** * Scores every stemma of the texts, each carried by one copy or by * several, and keeps the best, the runners-up and, for each grouping of * the best, the best stemma without it. Ties go to fewer lost states, * then to the notation, so that the outcome depends on nothing but the * copies and the costs. */ export declare const searchStemmata: (texts: readonly (readonly string[])[], names: readonly string[], systems: readonly string[], rows: readonly { presence: readonly Presence[]; redundant: boolean; }[], costs: Costs, transfers: ReadonlyMap>, keep: number) => Search; /** * What every node holds of one reading under the least costly account * of it: children first, as `LaidOut` orders the nodes. A node may be * held to a state (`fixed`), as an edit the editor wrote holds a * version to what it inserts or deletes. Where two accounts cost the * same, the one with the node lacking the reading is taken, so that a * reading arises as late as the copies allow. Nothing where the fixed * states cannot be met. */ export declare const statesOf: (tree: LaidOut, presence: readonly Presence[], redundant: boolean, costs: Costs, fixed?: ReadonlyMap) => boolean[] | undefined;