/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. */ import type { PathBuilderLike } from "path-ts"; import { type SubVenuePromotion } from "#subvenue/promotions"; import type { SubVenueLexiconTable } from "#subvenue/table"; import type { LocaleBaseTuple } from "#surfaces/locale"; /** * Resolves the path of the packaged sub-venue lexicon. */ export declare function defaultLexiconPath(): string; /** * Reads the sub-venue lexicon and throws on invalid JSON. */ export declare function readSubVenueLexicon(path?: string): Promise; /** * Reports whether a name has usable length and contains a letter. * It also rejects route punctuation. * * The check also rejects a single lowercase token because it represents a code in this source. */ export declare function isCleanName(name: string): boolean; /** * Reports whether a clean name can fill the venue slot. * * The check rejects names that start with a street or stop word or end with a street type. */ export declare function isVenueSlotName(name: string): boolean; /** * A designator phrase that may produce positives in one locale, with its shape constraints. */ export interface PromotedSurface { designatorID: string; phrase: string; /** * The title-cased form used when rendering the designator. */ surface: string; identifierRequired: boolean; modifierEligible: boolean; } /** * Reports whether a lowercased name contains the phrase at word boundaries. * * The boundary check keeps `gate` from matching inside `Briggate`. */ export declare function containsPhrase(lowerName: string, phrase: string): boolean; /** * Reports whether a value is a short sign identifier, such as `12`, `B` or `A3`, * or a range of two identifiers joined by `-` or `/`. * * Shape classification by itself accepts some values that this check rejects, so callers apply both. */ export declare function isSignIdentifier(value: string): boolean; /** * Reports whether a lowercased name uses a promoted phrase as ` `, * or as an English ` ` when the designator allows it. * * A bare mention of the phrase returns `false` because it does not show that the name is a sub-venue. */ export declare function hasPromotedShape(lowerName: string, promoted: PromotedSurface, modifiers?: readonly string[], english?: boolean): boolean; /** * Applies {@link hasPromotedShape} to names of at most four tokens. */ export declare function matchesPromotedShape(lowerName: string, promoted: PromotedSurface, modifiers?: readonly string[], english?: boolean): boolean; /** * Returns the designator surfaces that may produce `unit` positives in a locale. * * English locales get every shipped designator. * Every locale gets its promoted phrases. * * The function removes any pair that the ledger rejects for the locale. */ export declare function promotedSurfacesFor(locale: string, lexicon: SubVenueLexiconTable, promotions?: readonly SubVenuePromotion[]): PromotedSurface[]; /** * Returns the phrases that the promotion ledger rejects for a locale. */ export declare function rejectedPhrasesFor(locale: string, promotions?: readonly SubVenuePromotion[]): string[]; interface ShapeBucket { shape: string; observations: number; examples: string[]; } /** * One region's identifier shape distributions, per designator and pooled. */ export interface IdentifierModel { byDesignator: Map; pooled: ShapeBucket[]; } /** * Builds a region's identifier model from the lexicon's `identifierShapes`. * * The pooled fallback combines the gate, terminal and campus distributions. */ export declare function buildIdentifierModel(lexicon: SubVenueLexiconTable, region: string): IdentifierModel; /** * Samples an identifier for a designator, weighting shapes by observation count. * * A designator with fewer than 20 observations of its own uses the pooled distribution. */ export declare function sampleIdentifier(model: IdentifierModel, designatorID: string, random: () => number): string | null; /** * The address context and name pools for one recipe leg. */ export interface LegPools { context: LocaleBaseTuple[]; /** * Real venue-tier names that fit the venue slot, such as stations, airports, campuses and hospitals. */ venues: string[]; /** * Extract names of at most four tokens that use a promoted phrase in its required shape. */ attested: string[]; /** * Venue names that contain a phrase rejected for the locale. */ rejectedVenues: string[]; /** * Names that contain a designator inside a longer proper name, so the whole string is a `venue`. */ longerNames: string[]; /** * Venue names that contain a promoted phrase without its required shape. */ unpromotedShapes: string[]; } /** * The name pools that one source contributes to a recipe leg. * * Only OSM extracts fill `attested` and `unpromotedShapes`, because POI data has no tier or localized names. */ export type NamePools = Pick; /** * Empty name pools for a source that a leg lacks. */ export declare const EMPTY_NAME_POOLS: NamePools; /** * The locale-specific filters that the pool readers apply. */ export interface PoolQuery { promoted: readonly PromotedSurface[]; rejectedPhrases: readonly string[]; designatorPhrases: readonly string[]; modifiers: readonly string[]; english: boolean; } /** * Reads an OSM sub-venue extract and sorts its names into name pools. */ export declare function readExtractPools(path: string, query: PoolQuery): Promise; /** * Reads the venue and confound name pools for one country from `poi.db`. * * The database covers only a few countries, so an empty result may reflect missing coverage. */ export declare function readPOIPools(dbPath: PathBuilderLike, country: string, query: PoolQuery): NamePools; /** * Concatenates two sources' name pools. */ export declare function mergeNamePools(a: NamePools, b: NamePools): NamePools; export {}; //# sourceMappingURL=sources.d.ts.map