/** * Stage 6: rule based sequence classification. * * Blocks are classified in context, never independently. The rules encode the four sequences that * matter, in the order they are resolved: * * NEW_CONTENT, SIGNATURE, REPLY_HEADER, REPLY_HISTORY top posting, the common case * INLINE_QUOTE, NEW_CONTENT, INLINE_QUOTE, NEW_CONTENT interleaved answers * NEW_CONTENT, FORWARD_HEADER, FORWARDED_CONTENT forwarding with a comment * REPLY_HISTORY, NEW_CONTENT bottom posting * * The load bearing rule is the anchor requirement. A quote region may only become REPLY_HISTORY * when something independent of the quoting itself says that it is history: an attribution line, a * client quote container, or a match against a message that already existed. Quote depth alone * gives INLINE_QUOTE or UNKNOWN, both of which stay visible. * * The reason a bare quote is not treated as history is the difference between the two examples in * the brief. Quoted questions with answers under them are context the reader needs. A trailing * quoted copy of the previous mail is noise. Only the surrounding structure tells them apart. */ import { type Label, type Reason } from '../types'; import { type Block } from '../segment/types'; import { type ConfidenceConfig } from './confidence'; export interface BlockDecision { block: Block; label: Label; confidence: number; reasons: Reason[]; } export interface ClassifyOptions { config?: ConfidenceConfig; /** * Indices of blocks whose text was found in a known earlier message. Supplies the anchor for * blocks that have no structural evidence of their own. */ historyMatchedIndices?: ReadonlySet; /** * Blocks whose match against an earlier message was strong enough to stand on its own. * * A subset of `historyMatchedIndices`. Used only for unmarked history, below, where there is no * markup to corroborate and the match is the entire case. */ historyStrongIndices?: ReadonlySet; /** * Display name and local part of the sender, lowercased. A trailing short block containing the * sender's own name is strong evidence of a signature: it is how nearly every signature begins, * and unlike a greeting phrase it is language independent. */ senderTokens?: readonly string[]; /** * The subject marks the message as a forward and not as a reply. Several clients introduce a * forward with the same separators they use for reply history ("-------- Original Message * --------", Outlook's #divRplyFwdMsg, quote containers), so without this the forwarded message * is hidden as history. With it, whatever the reply rules call history is forwarded instead. */ messageIsForward?: boolean; } /** * Classify one representation's blocks. * * Runs in four passes so that later passes can see the whole picture: footers first, because they * bound where history can start; then anchors; then regions; then defaults. */ export declare function classifyBlocks(blocks: readonly Block[], options?: ClassifyOptions): BlockDecision[]; //# sourceMappingURL=rules.d.ts.map