/** * `prominent-places`: each country's prominent places in their short query shapes (#3156). * * The input is the tuple file the prominent-places census writes * (`packages/mailwoman/tools/dev-tools/corpus/prominent/places.run.ts tuples`): one line * per prominent Who's On First locality or sub-locality, with its parent locality, region * and region abbreviations from the candidate table, and the rows to write in each shape. * Every country is ranked and drawn by the same rule from the same sources, and the census, * never this recipe, sets the row counts, stratified by country, placetype band and shape. * * {@linkcode prominentPlaceTag} is the #3156 label policy. * The launch receipt reads it too: * * - A locality is written as `locality` in every shape. * - A sub-locality is written as `dependent_locality` beside the parent locality * WOF's hierarchy records (`Camden, London`). * - A postal pair is written as `locality` and `region` (`Brooklyn, New York`): the sub-locality is * the postal place at its own location, and its parent's name is also a first-level WOF region's. * - A sub-locality written bare or with its region or country gets no row. * `dependent_locality` without a locality is never written, and its postal reading is unresolved. * * The text of every row is a WOF name, a WOF region abbreviation, a codex country form, * or the runtime's English region name for a territory WOF records under no country. */ import type { ComponentTag } from "@mailwoman/codex/component"; import { type CorpusRecipe } from "#recipes/scaffold"; /** * The placetype bands a place is ranked within, each a set of WOF placetypes. * * A borough sits in the sub-locality band because WOF parents it under a locality * (Brooklyn under New York, Camden under London). */ export declare const PLACE_BANDS: { readonly locality: readonly ["locality", "localadmin"]; readonly sublocality: readonly ["borough", "macrohood", "neighbourhood", "microhood"]; }; /** * One placetype band. */ export type PlaceBand = keyof typeof PLACE_BANDS; /** * The short query shapes, by how the second segment relates to the place. */ export declare const QUERY_SHAPES: readonly ["bare", "parent", "region", "region_abbr", "country"]; /** * One query shape. */ export type QueryShape = (typeof QUERY_SHAPES)[number]; /** * The tag a place's own span takes in one shape, or `null` when the recipe writes no row in the shape. * * The launch receipt requires the same tag, and defers a shape this returns `null` for. * * A sub-locality beside its parent is a dependent locality, unless its pair is a postal pair * (`postalPair`): the child is the postal place at its own location and the parent's name * is also a first-level WOF region's, so `Brooklyn, New York` is a locality and its region. * The census decides a pair by `isPostalLocalityPair` in the gazetteer's pair tools, * the predicate a pair-index build can also read. * * A sub-locality written bare or with its region or country is its postal form. * The only planetary evidence for that reading is a GeoNames postal-name match. * * The #3156 decision treats such a match as provisional. * GeoNames' postal export gives `N1C` and `NW1W` the place name `Camden`, although their * post town is London, so even a match that lies on the place can't decide the label. * Those forms wait for a postal authority's own list. */ export declare function prominentPlaceTag(band: PlaceBand, shape: QueryShape, postalPair?: boolean): "locality" | "dependent_locality" | null; /** * The tag of a shape's second segment: a sub-locality's parent is a locality, * or the region of a postal pair. * * A region or its abbreviation is a region, a country a country, and a bare shape has none. */ export declare function prominentSecondTag(shape: QueryShape, postalPair?: boolean): "locality" | "region" | "country" | null; /** * One prominent place as the census writes it for this recipe. */ export interface ProminentPlaceTuple { spr_id: number; country: string; band: PlaceBand; name: string; parent_locality: string | null; region: string | null; region_abbrs: readonly string[]; /** * Whether a sub-locality's pair with its parent locality reads * as `locality: name, region: parent_locality`. * See {@linkcode prominentPlaceTag}. */ postal_pair: boolean; /** * The country's WOF name, or its English region name for a territory WOF records under no * country or dependency, written when the codex lists no display name for the country. */ country_name: string | null; /** * The rows to write in each shape. * A shape without a count gets none. */ rows: Partial>; } /** * One rendered row before alignment. */ export interface ProminentPlaceRow { shape: QueryShape; raw: string; components: Partial>; sourceID: string; } /** * The `source` of every row the recipe writes, the key a training config weights it under. */ export declare const PROMINENT_PLACES_SOURCE: string; /** * Every row one place writes: in each shape with a count, its variants in turn until the count is written. * * A count larger than the variants repeats them, and each repetition takes its own `source_id`. */ export declare function prominentPlaceRows(tuple: ProminentPlaceTuple): ProminentPlaceRow[]; /** * The `prominent-places` recipe. */ export declare const prominentPlacesRecipe: CorpusRecipe; //# sourceMappingURL=places.d.ts.map