/** * @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 recipe-output linter (`tools/lint/recipe-output/index.ts`). The two sides must agree on the bigram key * format: the linter looks its recipe output's bigrams up in the stats file's `bigrams` table. 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(COOCCURRENCE_KEY_SEP).join(" ")`. */ export declare const COOCCURRENCE_KEY_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 parquet row projected to the two columns the co-occurrence pass reads. */ export interface TokenLabelRow { tokens: string[]; labels: string[]; [key: string]: unknown; } /** * Stream a parquet file'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(parquetPath: string, limit?: number): AsyncIterable; export {}; //# sourceMappingURL=cooccurrence-stats.d.ts.map