/** * Stage 7: plain text and HTML reconciliation. * * Measured over the full corpus, 79.2 percent of messages carry both representations, and among * human replies that carry both, a quarter disagree about whether the message contains quoted * history at all. The disagreement is almost always in the same direction: the HTML part has a * quote container and the plain part is a flattened render where the quote markers are simply gone. * * So HTML is the primary representation when both exist and the HTML actually carries structure. * The plain part is still classified independently, and its verdict is used two ways: to confirm, * which raises nothing but costs nothing, and to contradict, which caps confidence so that a * disputed region is collapsed rather than hidden. * * Selection runs *before* classification, and that ordering is load bearing. A message can hold * several independent body sections, and the classifier has to see all of them as one linear * sequence for its positional rules to mean anything. Choosing the representation first is what * makes that possible, and it is possible because selection needs only length, anchor presence and * whether segmentation degraded. None of those are labels. See * `docs/adr-001-document-global-classification.md`. */ import { type Representation } from '../types'; import { type Block } from '../segment/types'; import { type BlockDecision } from './rules'; /** One representation of one body section, before any classification has run. */ export interface RepresentationInfo { representation: Representation; blocks: Block[]; /** Total characters of authored content, used to spot a stub representation. */ contentChars: number; /** True when the representation contains at least one structural anchor. */ hasAnchor: boolean; /** True when segmentation failed and the representation is one unclassified block. */ degraded: boolean; } export interface PrimaryChoice { primary: RepresentationInfo; /** The other representation of the same section, when it is worth cross checking against. */ secondary: RepresentationInfo | null; } /** * Choose which representation of one section drives the output. * * HTML wins by default when both exist, because it is where the structure survives. Plain text * wins when the HTML is a stub, which happens with clients that send a token HTML wrapper around a * text body, and when only the plain part has an anchor. */ export declare function pickPrimary(text: RepresentationInfo | null, html: RepresentationInfo | null): PrimaryChoice; /** * Apply cross representation evidence to one section's decisions, in place. * * The only adjustment made is downward. Raising confidence because the other representation agrees * would let two copies of the same mistake reinforce each other, and the cost of a wrong hide is * much higher than the cost of a collapse that could have been a hide. * * Scoped to one section on purpose. The comparison only means something between two renderings of * the same content; measuring one section against another section's alternative would compare * unrelated things. */ export declare function reconcileSection(primaryRepresentation: Representation, primaryDecisions: readonly BlockDecision[], secondaryDecisions: readonly BlockDecision[] | null, collapseCeiling?: number): void; //# sourceMappingURL=reconcile.d.ts.map