import type { ComponentTag } from "@mailwoman/codex/component"; import type { WhosOnFirstPlacetype } from "@mailwoman/gazetteer/whosonfirst"; import { type NameSlot, type WOFVariantSpec } from "#adapters/wof/json-rows"; import { type CorpusAdapter } from "#types"; import { type AncestorRecords, type WOFRecord } from "#utils"; /** * Map a WOF placetype to a Mailwoman `ComponentTag`, or `undefined` to skip. * * Per-adapter deliberately (the postalcode adapter has its own): each table is a record * filter for its adapter's emission set rather than a shared vocabulary. */ export declare function placetypeToTag(placetype: WhosOnFirstPlacetype | string): ComponentTag | null; /** * The country whose hierarchy order and line join a language's own hierarchies are written in. * * A language official in several countries resolves to the layout (order and join) that * more than half of them write, and the first such country in table order is returned. * Korean resolves in both Koreas. * * Chinese resolves to China's unseparated largest-first layout. * China, Taiwan and Hong Kong write in Chinese script. * * A language whose countries have no majority layout resolves to `null`, * and its hierarchies take the record's own country's layout. */ export declare function layoutCountryForLanguage(language: string): string | null; /** * Compute the hierarchy variants for a record given its ancestors and the name slot being rendered. * * The slot's value is the surface form of the record's own component * (locality, region, country, subregion or dependent locality). * The canonical `wof:name` fills the `"default"` slot and a `name:*` value fills the others. * * A slot with a language renders only chains written in that language ({@linkcode localizedVariants}). * Every other slot takes its ancestor names from each ancestor's canonical `wof:name`. * * A dependent locality also renders with its parent locality (`Brooklyn, New York`). * Addresses write the place this way. * * Country variants substitute `COUNTRY_DISPLAY_NAME` for the default slot so the * OpenCage template produces the canonicalized form (`"United States of America"`), * matching the legacy SQLite adapter's behavior. * * Every variant that writes a dependent locality also writes its parent locality * ({@linkcode writesParentLocality}), so a record without a locality ancestor renders no row. */ export declare function variantsFor(row: WOFRecord, ancestry: AncestorRecords, slot: NameSlot): WOFVariantSpec[]; /** * Whether a row's components write a dependent locality only beside its locality. * * The #3156 label policy writes `dependent_locality` beside a verified parent locality. * A bare `Camden` or `Camden, England` is the postal form of some places * and a district of another post town for others. * * The WOF record states neither, so the adapter writes no row for that form * rather than a dependent locality with no locality. */ export declare function writesParentLocality(components: Partial>): boolean; /** * Build the per-record name-slot list. * * The canonical `"default"` slot uses the OpenCage-canonical country form * when the record is itself a country (matches SQLite-adapter behavior); * every other placetype's default slot uses `wof:name` verbatim. * * The official and served languages keep their language, and other languages keep * theirs within {@linkcode LOCALIZED_HIERARCHY_CAP}. * A kept language is what makes {@linkcode variantsFor} render a localized hierarchy for a slot. */ export declare function nameSlotsFor(rec: WOFRecord): NameSlot[]; /** * Whether the adapter renders `record` as a place: its placetype maps to a * component tag, and WOF assigns it to a country. * * The place-coverage audit counts the places a corpus can train against this same rule. */ export declare function rendersWOFAdminPlace(record: WOFRecord): boolean; /** * The `wof:country` WOF writes on a record it assigns to no country, * such as a disputed area or a record not yet placed. * * A row takes its country from the record, so such a record's rows are tagged `XX` * and write another country's region: `Pecinan, England, United Kingdom`. */ export declare const WOF_NO_COUNTRY = "XX"; /** * Registry id for this adapter. * * Stamped into every row it emits, so a corpus record can be traced back to the dataset it came from. */ export declare const WOF_ADMIN_ADAPTER_ID = "wof-admin"; /** * Construct the wof-admin JSON-bundle adapter. * * The adapter is stateless across runs. * Two calls with the same input directory produce byte-identical `canonical.jsonl` * (records are emitted in sorted `wof:id` order to be insensitive to filesystem walk ordering). */ export declare function createWOFAdminAdapter(): CorpusAdapter; /** * Single shared instance, suitable for `defaultAdapterRegistry`. */ export declare const wofAdminAdapter: CorpusAdapter; //# sourceMappingURL=adapter.d.ts.map