import { type PathBuilderLike } from "path-ts"; /** * One country's counts in {@link SECOND_LEVEL_REGION_TABLE_PATH}. */ interface SecondLevelRegionCount { /** * Base rows of the country with a region. */ withRegion: number; /** * Those whose region is a second-level name of the country and no region name of it. */ secondLevelOnly: number; } /** * The census {@link SECOND_LEVEL_REGION_TABLE_PATH} holds. */ export interface SecondLevelRegionTable { $description: string; /** * The corpus manifest the counts were read from. */ manifest: string; countries: Record; } /** * The countries whose rows write a second-level name in the region slot at * {@link SECOND_LEVEL_MIN_SHARE} or more, in {@link SECOND_LEVEL_MIN_ROWS} rows or more. */ export declare function secondLevelAdmitted(table: Pick): string[]; /** * The part of an ISO 3166-2 code an address writes for `country`'s subdivision, `ZH` for * `CH-ZH`, or `null` when the code belongs to another country or its part holds no letter. * * A numeric part, such as Thailand's `TH-10` or Latvia's `LV-088`, is a register number * rather than a written form, and as a region it would admit a misplaced postcode or house number. */ export declare function writtenISOSubdivisionCode(country: string, isoCode: string): string | null; /** * The folded names and abbreviations of each country's regions. */ export interface RegionNames { /** * The database the names were read from. */ path: string; /** * Whether `region` folds to a name or abbreviation of one of `country`'s regions, or `null` * when neither source holds a region of `country` and the value cannot be judged. */ holds(country: string, region: string): boolean | null; } /** * The fold the resolver keys its region lookups with, with Arabic letter variants folded together. */ export declare const foldRegionName: (name: string) => string; /** * A folded region name with its spaces, dashes and format characters removed, * `nakhonphanom` for `nakhon phanom`, `bariavungtau` for `ba ria - vung tau`, * and `ชลบุรี` for `ชลบุรี` written with a trailing zero-width space. * * Over the WOF admin database of 2026-11-14, 11 of 5,095 regions and macroregions share a * compact key with another region of their country that no spaced key of theirs shares. */ export declare const compactRegionKey: (key: string) => string; /** * The compact keys a folded name of Latin words gives when a run of two or more of its * words is written as their initials: `ntb` and `ntbarat` for `nusa tenggara barat`, * `diyogyakarta` for `daerah istimewa yogyakarta`. * * The whole name collapses only when it has three or more words, so no two-letter key comes of it. * Over the WOF admin database of 2026-11-14 the 67,031 keys this gives include 143 that * are another country's region key, such as `slp` for San Luis Potosí. */ export declare function regionInitialisms(key: string): string[]; /** * Options for {@link readRegionNames}. */ export interface ReadRegionNamesOptions { /** * The countries whose second-level (WOF `county`) names a row's region may also hold. */ secondLevelCountries?: readonly string[]; /** * The GeoNames directory whose `admin1CodesASCII.txt` names each country's first-level divisions. * * Those names widen the country's set with the names GeoNames-derived rows * write (`Munster`, `Lesser Poland`). */ geonamesDirectory?: PathBuilderLike; } /** * Reads every current region's `spr` name, `names` rows, `place_abbr` abbreviations * and the written part of its ISO 3166-2 code, per country. * * A dependent territory also holds the names of the regions whose ISO or HASC code is the territory's, * as France's region `French Guiana` (ISO `GF`) is for `GF`, and of its own WOF country record. * Those names and the second-level names of `secondLevelCountries` widen a country * that already holds a region, and leave a country with none unjudged. * * @throws When the database holds no region at all, because an empty table would leave every row unjudged. */ export declare function readRegionNames(path: PathBuilderLike, options?: ReadRegionNamesOptions): Promise; /** * Every country's second-level (WOF `county`) names, for counting the rows of * each country that write one in the region slot. * * `holds` answers `null` for a country with no county in the database. */ export declare function readSecondLevelNames(path: PathBuilderLike): Promise; /** * The default WOF admin database's region names, with the second-level names of the * countries {@link SECOND_LEVEL_REGION_TABLE_PATH} admits and the data root's GeoNames * first-level names, or `null` when the database isn't on this host. * * @throws When the database is on this host and the GeoNames first-level file isn't. */ export declare function tryReadDefaultRegionNames(): Promise; /** * The files {@linkcode tryReadDefaultRegionNames} reads, so a build can * fingerprint what its align phase read. */ export declare function defaultRegionNameInputs(): { database: string; geonamesDirectory: string; secondLevelTable: string; }; export {}; //# sourceMappingURL=names.d.ts.map