import type { PathBuilderLike } from "path-ts"; /** * The only corpus split the suite reads. * * A model fits `train`. * Its training run selects checkpoints on `val`. * Neither is held out. */ export declare const NON_NATIVE_ORDER_SPLIT = "test"; /** * Refuses any split other than {@linkcode NON_NATIVE_ORDER_SPLIT}. */ export declare function assertHeldOutSplit(split: string): void; /** * The corpus columns the extraction reads. */ export declare const NON_NATIVE_ORDER_COLUMNS: readonly ["raw", "span_tags", "span_starts", "span_ends", "country", "source", "source_id"]; /** * One corpus row as {@linkcode NON_NATIVE_ORDER_COLUMNS} projects it. */ export interface NonNativeOrderCorpusRow { raw: string; span_tags: readonly string[]; span_starts: readonly number[]; span_ends: readonly number[]; country: string; source: string; source_id: string; } /** * One extracted tuple. */ export interface NonNativeOrderTuple { house_number: string; street: string; locality: string; postcode: string; /** * ISO 3166-1 alpha-2, from the corpus row's `country`. */ cc: string; /** * The corpus source the row was stored under. */ source: string; /** * Whether the source row wrote the street ahead of the house number, so the rendering keeps that order. */ streetFirst: boolean; /** * The corpus row's `source_id`. */ baseSourceID: string; } /** * The tuple one corpus row yields, or null when the row lacks one of the four components. * * The first span of each tag is read, by the UTF-16 offsets `alignRow` wrote. * * @throws When the span triple isn't three parallel arrays. * A malformed row read as one without the components would hide a corrupt file behind a smaller sample. */ export declare function nonNativeOrderTupleOf(row: NonNativeOrderCorpusRow): NonNativeOrderTuple | null; /** * The `WHERE` clause that keeps rows of the chosen countries and sources carrying all four components. */ export declare function nonNativeOrderFilterSQL(countries: readonly string[], sources: readonly string[]): string; /** * Options for {@linkcode sampleNonNativeOrderTuples}. */ export interface NonNativeOrderSampleOptions { /** * Tuples one (country, source) pair may contribute. */ cap: number; /** * Tuples one locality may hold while the stream is read. * * @defaultValue `8` */ localityQuota?: number; } /** * Samples tuples capped per (country, source) and stratified by locality. * * Rows arrive in file order, so each locality keeps its first `localityQuota` tuples. * The cap is then spent one tuple per locality per round, as `applyCountryBudget` * spends a country's budget across regions. */ export declare function sampleNonNativeOrderTuples(tuples: AsyncIterable | Iterable, options: NonNativeOrderSampleOptions): Promise; /** * Streams the tuples of the chosen countries and sources out of a corpus split's parquet files. * The tuples arrive in file order. * * @throws Unless `split` is the held-out {@linkcode NON_NATIVE_ORDER_SPLIT}. */ export declare function readNonNativeOrderTuples(split: string, files: readonly PathBuilderLike[], countries: readonly string[], sources: readonly string[]): AsyncGenerator; /** * Renders one tuple with the postcode opposite its country's native slot, * or returns null when the country's layout states no order. */ export declare function renderPostcodeOrder(tuple: NonNativeOrderTuple, random: () => number): string | null; /** * One golden evaluation row, in the shape `fr-order --golden` writes. */ export interface NonNativeOrderGoldenRow { raw: string; components: { house_number: string; street: string; locality: string; postcode: string; }; country: string; /** * The corpus source and `source_id` the tuple came from, so a failure traces to its test-split row. */ source: string; baseSourceID: string; } /** * The golden rows for `tuples`, skipping a country whose layout states no order. * * @returns The rows and the count skipped, so a shortfall is reported rather than hidden. */ export declare function nonNativeOrderGoldenRows(tuples: readonly NonNativeOrderTuple[], seed: number): { rows: NonNativeOrderGoldenRow[]; skipped: number; }; //# sourceMappingURL=non-native-order.d.ts.map