import { type PathBuilderLike } from "path-ts"; import { type DuckDBLimits } from "#parquet/duckdb"; /** * Route and thoroughfare words disallowed in a US `street_prefix` span. * Supplements {@link thoroughfareClassOf} (locale `"us"`). * * Under USPS Publication 28 and `SCHEMA.mdx`, a US `street_prefix` holds only a pre-directional * or positional pre-modifier (`N`, `SW`, `North`, `Upper`, `Old`). * Numbered-route words and thoroughfare types belong inside `street` or `street_suffix`. */ export declare const US_STREET_PREFIX_DISALLOWED_WORDS: ReadonlySet; /** * One concrete row violating a corpus schema invariant, with exact UTF-16 span substrings. */ export interface SchemaInvariantSample { source_id: string; source: string; raw: string; street_prefix: string; street: string | null; offending_token: string; } /** * Frequency of one offending `street_prefix` string inside a failing source. */ export interface SchemaInvariantPrefixCount { prefix: string; count: number; offending_token: string; } /** * Measured denominator, violation count, top offending values, and sample rows for one source. */ export interface SchemaInvariantSourceReport { us_rows: number; checked_rows: number; violation_rows: number; violation_rate: number; top_prefixes: SchemaInvariantPrefixCount[]; samples: SchemaInvariantSample[]; } /** * Outcome of one schema invariant across all scanned sources. */ export interface SchemaInvariantResult { id: "us_street_prefix_directional_only"; status: "pass" | "fail"; total_us_rows: number; total_checked_rows: number; violation_rows: number; violation_rate: number; by_source: Record; } /** * Complete corpus schema-invariant audit report for one manifest. */ export interface SchemaInvariantAuditReport { corpus_dir: string; manifest_path: string; files_scanned: number; sources_filter: string[] | null; status: "pass" | "fail"; invariants: SchemaInvariantResult[]; } /** * Options for {@linkcode auditCorpusSchemaInvariants}. */ export interface SchemaInvariantAuditOptions { corpusDir: PathBuilderLike; manifestPath?: PathBuilderLike; /** * Optional source filter. * * An empty collection throws rather than producing a vacuous pass. */ sources?: readonly string[] | ReadonlySet | null; sampleLimit?: number; topPrefixLimit?: number; limits?: DuckDBLimits; } /** * Returns the first thoroughfare or route token in a US `street_prefix` span, or `null`. * * Removes periods before tokenizing so `U.S.` folds to `us` and `N.` folds to `n`. * * @public */ export declare function findDisallowedUSStreetPrefixToken(prefix: string): string | null; /** * Audits a corpus manifest's parquet files for adapter schema invariants before training. * * Currently enforces `us_street_prefix_directional_only`: every `US` row's `street_prefix` span * must hold only directional or positional pre-modifiers, never thoroughfare types or route words. * Non-US rows are excluded because Romance conventions place thoroughfare types * (`Rue`, `Via`, `Calle`) in `street_prefix`. * * @throws When the manifest is missing or lists no files, when any listed parquet file * is missing or unreadable, or when `sources` is explicitly empty. */ export declare function auditCorpusSchemaInvariants(options: SchemaInvariantAuditOptions): Promise; //# sourceMappingURL=schema-invariants.d.ts.map