import type { PlaceBand } from "#recipes/prominent/places"; /** * The slots a surface fills, by the letter its key starts with. */ export declare const SurfaceSlot: { /** * The place's own name. */ readonly Name: "n"; /** * The parent locality of a sub-locality. */ readonly Parent: "p"; /** * The region's name. */ readonly Region: "r"; /** * The region's abbreviation. */ readonly RegionAbbreviation: "a"; /** * The country. */ readonly Country: "c"; }; /** * One slot. */ export type SurfaceSlot = (typeof SurfaceSlot)[keyof typeof SurfaceSlot]; /** * One surface a form may contain. */ export interface SeedSurface { /** * The slot letter and a one-based index, the key the model cites: `n1`, `c3`. */ key: string; slot: SurfaceSlot; text: string; /** * The ISO 639-3 language of a WOF `names` row, or `null` for a surface recorded without one. */ language: string | null; /** * The record the surface was read from, such as `wof:names:85922583:eng:preferred`. */ origin: string; } /** * A surface before it has a key. */ export type SurfaceDraft = Omit; /** * One prominent place and the surfaces its forms are written from. */ export interface ShapeSeed { wof_id: number; country: string; band: PlaceBand; /** * The place's rank within its country and band, or `null` for a capital the rank left out. */ rank: number | null; capital: boolean; /** * The tag of the place's own span. */ place_tag: "locality" | "dependent_locality"; /** * The tag of a parent span, or `null` when the seed has no parent slot. */ parent_tag: "locality" | "region" | null; surfaces: SeedSurface[]; } /** * The reasons a prominent place gets no seed. */ export declare const SeedSkip: { /** * A sub-locality without a parent locality: the label policy writes it only beside one. */ readonly NoParent: "sublocality_without_parent"; /** * A sub-locality whose name equals its parent's, so every query form reads the same for both. */ readonly ParentNamesake: "sublocality_named_as_parent"; /** * Every name of the place is refused as a typed surface, so no form could cite a name. */ readonly NoName: "no_typed_name"; }; /** * One skip reason. */ export type SeedSkip = (typeof SeedSkip)[keyof typeof SeedSkip]; /** * What one prominent place contributes to a seed, as read from the census and Who's On First. */ export interface SeedInput { wof_id: number; country: string; band: PlaceBand; rank: number | null; capital: boolean; postal_pair: boolean; names: readonly SurfaceDraft[]; parents: readonly SurfaceDraft[]; regions: readonly SurfaceDraft[]; region_abbreviations: readonly SurfaceDraft[]; countries: readonly SurfaceDraft[]; } /** * Builds a place's seed, or returns the reason the label policy writes no form for it. * * A place whose every name is refused gets no seed in either band, because every form needs one name. * A locality has no parent slot. * * A postal pair writes its parent's name in the region slot, and keeps the region's * abbreviations only when the region is that same name (`Brooklyn, NY`). */ export declare function assembleSeed(input: SeedInput): ShapeSeed | SeedSkip; /** * Keeps each country and band's highest-ranked `limit` seeds, and every capital. */ export declare function limitSeedsPerBand(seeds: readonly ShapeSeed[], limit: number): ShapeSeed[]; /** * Groups seeds into requests of at most `size` places, each of one country, * so a request lists its country's surfaces once. */ export declare function chunkSeedsByCountry(seeds: readonly ShapeSeed[], size: number): ShapeSeed[][]; //# sourceMappingURL=seeds.d.ts.map