/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * `wof-postalcode`: Who's On First postalcode GeoJSON-bundle adapter. * * **Phase 1.5.1 pivot.** Replaces the previous SpatiaLite-backed implementation (formerly at * `packages/corpus/src/adapters/wof-postalcode/`, removed in this same change). The rationale is * in `wof-admin-json/adapter.ts` and in `DECISIONS.md` — short version: the SQLite distribution * mirror is dead, the live distro tags every postcode row `mz:is_current = -1` which the old * `is_current = 1` predicate excluded, and localized `name:*` variants don't ship in the SQLite * export at all. * * Input: a directory containing one or more cloned `whosonfirst-data-postalcode-` repos plus * the relevant `whosonfirst-data-admin-` repos (postcode records reference admin ancestry by * `wof:parent_id`, so the locality / region / country records must be in the same walk for the * ancestry chain to resolve). The corpus pipeline clones all four repos under * `/data/corpus/sources/wof/repos/` and points the adapter at that root. * * Per live postalcode record, the adapter emits one row per `(name-variant, hierarchy-variant)` * pair: * * - **Name variants**: canonical `wof:name` (slot key `default`, typically the postcode digits * themselves) plus any `name:*` variants on the postcode feature. In practice WOF postcode * records rarely carry localized name variants, so this expansion is usually a no-op — but * the code path stays symmetric with the admin adapter for consistency. * - **Hierarchy variants** (unchanged from the SQLite adapter): self, +locality, +locality+region, * +locality+region+country. * * `source_id` is `wof-postalcode---`. Ancestor names always * come from the ancestor's canonical `wof:name`; this adapter does NOT iterate ancestor name * variants (e.g. it does not emit `"75008 Париж"` even when Paris has a `name:rus_x_preferred`). * That cross-product belongs to a future synthesis pass; emitting it here would multiply row * counts ~10× without a clear training-value story. * * License: CC0. */ import type { ComponentTag } from "@mailwoman/core/types"; import type { CorpusAdapter } from "@mailwoman/corpus/types"; import { type WOFRecord } from "@mailwoman/corpus/utils"; interface VariantSpec { suffix: string; components: Partial>; } /** * Compute hierarchy variants for a postcode record. `selfName` is the postcode surface form (canonical `wof:name` for * the `default` slot, a `name:*` localized variant otherwise). */ export declare function postcodeVariantsFor(row: WOFRecord, ancestry: WOFRecord[], selfName: string): VariantSpec[]; /** * Build the per-record name-slot list. The `default` slot uses `wof:name` verbatim (postcode digits); subsequent slots * come from `name:*` variants dedup'd against the default. */ export declare function nameSlotsFor(rec: WOFRecord): Array<{ key: string; value: string; }>; /** * 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_POSTALCODE_ADAPTER_ID = "wof-postalcode"; export declare function createWOFPostalcodeAdapter(): CorpusAdapter; /** * The configured adapter instance registered with the corpus builder. */ export declare const wofPostalcodeAdapter: CorpusAdapter; export {}; //# sourceMappingURL=adapter.d.ts.map