/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Pre-compute corpus-wide token + bigram label distributions for the corpus linter. * * Reads one or more Parquet slices, builds per-(token, label) and per-(bigram, label-bigram) * histograms, and serializes them as JSON. The output file is consumed by `lint-corpus-slice.ts` * as the baseline against which a new slice is compared. * * Stats are cheap to compute (~5–30s per 100K rows) but expensive enough that we cache them between * linter invocations. Re-run this script whenever the corpus changes substantially (a new * mainline slice added, a source-pool re-weighted, etc.). * * Output schema: * * ```ts * interface CorpusStats { * row_count: number * slice_paths: string[] * tokens: { [token: string]: { [label: string]: number } } * bigrams: { [token_bigram: string]: { [label_bigram: string]: number } } * // token_bigram = "tok1tok2" (US sep), label_bigram = "lab1lab2" * // For memory: only keep bigrams with count >= MIN_BIGRAM_COUNT (2). * } * ``` * * Usage: node scripts/build-corpus-stats.ts\ * --slices \ * --output * * For a quick local-corpus baseline (limited but useful for linter testing): node * scripts/build-corpus-stats.ts\ * --slices $MAILWOMAN_DATA_ROOT/corpus/versioned/v0.4.0/corpus-v0.4.0/train/\ * --output /tmp/corpus-stats-local.json */ export interface CorpusStatsOptions { slicesArg: string; outputPath: string; limitPerSlice?: number; } export declare function buildCorpusStats(args: CorpusStatsOptions): Promise; //# sourceMappingURL=corpus-stats.d.ts.map