/** * `us-county` — US counties written as an address writes them, read from Who's On First. * * The recipe writes three sources, so a training config weighs each shape on its own: * * - `rendered-us-county`: `Polk County, OR` and `Polk County, Oregon`, two rows per county. * - `rendered-us-city-county`: `Dallas, Polk County, OR 97338`, a WOF locality inside * that county, with one of the locality's ZIP Codes on half the rows that have one. * - `rendered-us-city-state`: `Dallas, OR` and `Dallas, OR 97338`, the same localities without * the county, so a trailing `, CA` has California rows to weigh against the Canadian ones. * * The designator (`County`, `Parish`, `Borough`, `Census Area`, `City and Borough`) * is part of the `subregion` span. * WOF's admin database writes a county's name bare (`Polk`), so the designator comes from * the record's own `wof:label` (`Polk County`), else from an English name that writes one. * * A county whose records write none, and an independent city (`City of Richmond`), get no county row. */ import { type USCountyDesignator } from "@mailwoman/codex/us/county"; import { type USStateAbbreviation } from "@mailwoman/codex/us/state"; import type { PathBuilderLike } from "path-ts"; import { type CanonicalRecipeRow, type CorpusRecipe } from "#recipes/scaffold"; /** * One county with the designator its WOF records write. */ export interface USCounty { id: number; /** * The county as an address writes it: `Polk County`. */ surface: string; designator: USCountyDesignator; state: USStateAbbreviation; } /** * One WOF locality inside exactly one county, with the ZIP Codes whose parent it is. */ export interface USCountyLocality { id: number; name: string; countyID: number; postcodes: readonly string[]; } /** * What {@link readUSCountyPool} read, and what it set aside with the reason. */ export interface USCountyPool { counties: readonly USCounty[]; localities: readonly USCountyLocality[]; /** * Current US county records the pool holds no county for, keyed by why. */ setAside: Readonly>; } /** * The surface a county's WOF record writes it with: the first of `wof:label` * and its English names that's its own name followed by a designator. */ export declare function countySurface(name: string, written: readonly unknown[]): { surface: string; designator: USCountyDesignator; } | null; /** * Where {@link readUSCountyPool} reads. */ export interface USCountyPoolPaths { /** * @defaultValue `$MAILWOMAN_DATA_ROOT/db/wof/admin-global-priority.db` */ adminDB?: PathBuilderLike; /** * @defaultValue `$MAILWOMAN_DATA_ROOT/db/wof/postalcode-us.db` */ postcodeDB?: PathBuilderLike; /** * The WOF record store. * It keeps each record's `wof:label`. * * @defaultValue the store for `$MAILWOMAN_DATA_ROOT/src/wof-repos` */ recordStore?: PathBuilderLike; } /** * Reads every current US county, its state and its designator, and every current locality * that WOF places in exactly one of those counties, with its ZIP Codes. * * @throws When a database is absent, because a pool read without one would hold * no designators or no ZIP Codes and still look whole. */ export declare function readUSCountyPool(paths?: USCountyPoolPaths): Promise; /** * The three sources this recipe writes, in the table spelling {@linkcode defaultRecipeSource} answers. */ export declare const US_COUNTY_SOURCES: { readonly county: string; readonly cityCounty: string; readonly cityState: string; }; /** * One row the recipe writes, before alignment, with the template that shaped it. */ export interface USCountyRow { canonical: CanonicalRecipeRow; template: string; } /** * Every county's two bare rows, `Polk County, OR` and `Polk County, Oregon`. */ export declare function countyRows(counties: readonly USCounty[]): USCountyRow[]; /** * `, County, [ ]` rows, at most `count`, spread so every * county contributes a row before any contributes a second. */ export declare function cityCountyRows(pool: USCountyPool, count: number, random: () => number): USCountyRow[]; /** * `, [ ]` rows, at most `count`, spread so every state contributes a row * before any contributes a second. */ export declare function cityStateRows(pool: USCountyPool, count: number, random: () => number): USCountyRow[]; /** * Recipe registered with the corpus builder. */ export declare const usCountyRecipe: CorpusRecipe; //# sourceMappingURL=county.d.ts.map