/** * Corpus feature extraction. * * Turns a parsed message into the flat, privacy safe record stored in the corpus database. The hard * rule here is that nothing derived from body text, subjects or addresses may leave this function * in readable form. Subjects and addresses become salted hashes, sender domains are kept because * they are needed for stratification, and body text is reduced to counts, ratios and a SimHash. */ import { type ReplyStyle } from '../canonical/text'; import { type ClientId } from '../detect/client'; import { type TrafficClass } from '../detect/traffic'; import { type ParsedMessage } from '../mime/model'; import { type LanguageCode } from '../util/lang'; export type BodyKind = 'both' | 'plain-only' | 'html-only' | 'none'; export interface MessageRecord { messageId: string | null; inReplyTo: string | null; referencesCount: number; referencesRoot: string | null; dateMs: number | null; fromDomain: string | null; fromHash: string | null; subjectHash: string | null; subjectPrefix: 'reply' | 'forward' | 'plain' | 'none'; subjectLength: number; structure: string; bodyKind: BodyKind; charsets: string; encodings: string; partCount: number; attachmentCount: number; hasRfc822: boolean; textChars: number; htmlChars: number; flowed: boolean; client: ClientId; clientSource: string; traffic: TrafficClass; trafficSignals: string; isReply: boolean; isForward: boolean; quoteDepthMax: number; quotedRatio: number; replyStyle: ReplyStyle | 'unknown'; /** Detector ids that fired, comma separated. Ids only, never matched text. */ markers: string; htmlHints: string; blockquoteCount: number; tableCount: number; hasImage: boolean; suspectMalformedHtml: boolean; lang: LanguageCode; langScore: number; bodySimhash: string; warnings: string; /** True when plain and HTML disagree about whether the message contains quoted history. */ quoteMarkingDisagrees: boolean; } /** * Build the corpus record for one parsed message. * * @param message parsed MIME structure * @param salt per database salt for the privacy preserving hashes */ export declare function analyzeMessage(message: ParsedMessage, salt: string): MessageRecord; //# sourceMappingURL=analyze.d.ts.map