/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Token/label co-occurrence accounting shared by the corpus-stats builder (`tools/corpus-stats.ts`) * and the slice linter (`tools/lint-slice.ts`). The two sides MUST agree on the bigram key format: * the linter looks its slice's bigrams up in the stats file's `bigrams` table, and a key built with * a different separator never matches — which silently blanks the bigram-collision check. */ /** * Separator inside a bigram key (`tok1␟tok2`) and a label-bigram value (`lab1␟lab2`): U+001F UNIT SEPARATOR, a * character no address token contains. Render a key for humans with `key.split(SLICE_STATS_SEP).join(" ")`. */ export declare const SLICE_STATS_SEP = "\u001F"; /** * Nested tally: outer key → (inner key → count). Token → label counts, or bigram key → label-bigram counts. */ type CooccurrenceTable = Map>; /** * The token + bigram co-occurrence tables one pass over labeled rows accumulates. */ export interface CooccurrenceStats { tokens: CooccurrenceTable; bigrams: CooccurrenceTable; } /** * An empty pair of tables for {@link accumulateCooccurrences}. */ export declare function createCooccurrenceStats(): CooccurrenceStats; /** * Fold one row's parallel `tokens`/`labels` into the tables. The caller has already checked the arrays are the same * length. */ export declare function accumulateCooccurrences(stats: CooccurrenceStats, tokens: readonly string[], labels: readonly string[]): void; /** * A slice row projected to the two columns the co-occurrence pass reads. */ export interface TokenLabelRow { tokens: string[]; labels: string[]; [key: string]: unknown; } /** * Stream a slice's `tokens`/`labels` columns. * * Projected rather than read whole: parquet is columnar, so the unused columns are never touched. `limit` stops the * iteration rather than filtering afterwards, so a capped run reads only the row groups it needs. */ export declare function streamTokenLabelRows(slicePath: string, limit?: number): AsyncIterable; export {}; //# sourceMappingURL=slice-stats.d.ts.map