/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * The READ half of the `sub-venue` slice recipe (#35 step 4): which surfaces a locale may emit, * what identifier follows them in that region, and which real names become the confound negatives. * `sub-venue.ts` owns the WRITE half (line rendering + the emit loop) and the recipe registration; * split because the two halves together run past the 750-line file cap, and this is the split — one * side reads disk and the ledger, the other side never touches either. * * Every rule in this file is a rule about EVIDENCE, and each one has a measurement behind it: * * - {@link promotedSurfacesFor} — a promotion names a designator, a phrase AND a locale, because the * same token is a designator in one language and a disaster in another (`hall` is 0-of-3,273 in * Great Britain and 35-of-40 in France). * - {@link hasPromotedShape} — an `identifier-required` promotion is exercised only as * ` `. The de-DE `halle` board is the founding case: its 168-hit confound * includes the CITY Halle (Saale), and only the identifier-bearing shape separates them. * - {@link buildIdentifierModel} — the identifier distribution is measured per REGION, because it * differs by country far more than the shared vocabulary suggests (GB gates 71% bare digit, ES * 35% ranges). * - {@link isVenueSlotName} / {@link isSignIdentifier} — the filters that keep bus-stop codes, route * descriptions and street names out of the slots they would mislabel. Both were written FROM * smoke output, not predicted; the docstrings name the strings that produced them. */ import type { PathBuilderLike } from "path-ts"; import type { LocaleBaseTuple } from "#synthesizers/locale"; import { type SubVenueLexiconTable, type SubVenuePromotion } from "#tools"; /** * The committed lexicon, resolved through the package manifest. */ export declare function defaultLexiconPath(): string; /** * Read and parse the lexicon. Strict: a corrupt lexicon is a build failure, not a fallback. */ export declare function readSubVenueLexicon(path?: string): Promise; /** * Reject a name that is a route description, a junction, or a code rather than a name: embedded `/`, `;`, `,`, `:`, * parentheses, no letters, or a bare source code. Measured motivation, not taste — the GB extract's `platform` tier * contributes 7,549 `other`-shaped names like `kntgwdgj` and `SPEKE HALL ROAD/HILLFOOT AVE`. */ export declare function isCleanName(name: string): boolean; /** * Is this name usable as a VENUE-slot string (positive venue or negative confound venue)? */ export declare function isVenueSlotName(name: string): boolean; /** * A (designator, surface) pair usable in one locale, with the shape constraint the ledger attached to it. */ export interface PromotedSurface { designatorID: string; phrase: string; /** * Rendering form — the phrase title-cased, which is how a sign writes it. */ surface: string; identifierRequired: boolean; modifierEligible: boolean; } /** * Title-case a designator phrase for rendering (`flugsteig` → `Flugsteig`). Single-token by construction: every * promoted phrase in the ledger is one word. */ export declare function titleCase(phrase: string): string; /** * Word-boundary containment, script-aware enough for the Latin legs this recipe runs. * * The boundary matters: without it `gate` matches Briggate and `wing` matches Wingate, which is how a harvest teaches * itself that a Yorkshire street is a sub-venue. (The lexicon's own harvest carries the same rule, and it drops the * boundary only for Han/Kana, which has no word boundaries and no leg here.) */ export declare function containsPhrase(lowerName: string, phrase: string): boolean; /** * Is `value` what a sub-venue identifier looks like on a sign — an atom, or a range of two? * * Applied on top of {@link USABLE_IDENTIFIER_SHAPES}, which classifies but does not bound: `WSW3687` classifies as * `letter-digit` and is a station code. */ export declare function isSignIdentifier(value: string): boolean; /** * Does a real extract name exercise `promoted` in one of the two shapes this slice teaches? * * Only ` ` and (English legs) ` ` qualify. That is stricter than "contains the * phrase", and the 2026-08-05 smoke is why: the loose test put `Glasgow Clyde College - Langside Campus`, `Terminal de * Ferry de Bilbao` and — worst — `Halle Wohnstadt Nord` into the attested pool, the last of which is a bare German * `Halle` wearing a name where the ledger requires an identifier. A whole venue's name is not a sub-venue string, and * an attested string that violates the promotion's own shape constraint is not attestation of it. * * The follower is checked with {@link classifyIdentifier} plus {@link isSignIdentifier} rather than "any following * word": `Wohnstadt` is a word, `8` is an identifier, and the de-DE board turns on exactly that difference. */ export declare function hasPromotedShape(lowerName: string, promoted: PromotedSurface, modifiers?: readonly string[], english?: boolean): boolean; /** * {@link hasPromotedShape} plus the length cap that makes a string usable AS a sub-venue span. * * The two are separate because the difference decides which POOL a name lands in. `navette n2 vers terminal 2g` carries * the promoted shape and is five tokens: too long to be a sub-venue string, and disqualified from being a NEGATIVE * precisely because it does contain the shape. It belongs to neither pool, and only splitting the test says so. */ export declare function matchesPromotedShape(lowerName: string, promoted: PromotedSurface, modifiers?: readonly string[], english?: boolean): boolean; /** * The surfaces a locale may emit as `unit`. * * Two inputs, and the difference between them is the advisory/binding split the ledger's docstring names: * * - The SHIPPED English vocabulary (`neural/venue-structure.ts`, re-declared in the lexicon as `shipped: true`) is a flat * English list with no locale gate. It is promoted-by-shipping for the English legs, because the span proposer fires * on it there today and the eval board's target cases are drawn from it. * - {@link SUBVENUE_PROMOTIONS} adds the localized surfaces and SUBTRACTS the rejections. A rejection of a shipped * designator cannot un-ship it (nothing here stops the proposer firing on "Red Wing"), but it absolutely stops this * recipe generating a positive: en-US `wing` produces negatives instead. */ export declare function promotedSurfacesFor(locale: string, lexicon: SubVenueLexiconTable, promotions?: readonly SubVenuePromotion[]): PromotedSurface[]; /** * The phrases REJECTED in a locale — the negatives' vocabulary. */ export declare function rejectedPhrasesFor(locale: string, promotions?: readonly SubVenuePromotion[]): string[]; interface ShapeBucket { shape: string; observations: number; examples: string[]; } /** * A region's identifier distributions: per designator, plus the pooled fallback. */ export interface IdentifierModel { byDesignator: Map; pooled: ShapeBucket[]; } /** * Build the per-region identifier model out of the lexicon's `identifierShapes`. */ export declare function buildIdentifierModel(lexicon: SubVenueLexiconTable, region: string): IdentifierModel; /** * Draw one identifier for `designatorID` in this region. * * Own distribution when it has {@link MIN_OWN_SHAPE_OBSERVATIONS} usable observations, else the region's pooled one. * Shapes are weighted by observation count and an example is drawn uniformly inside the chosen shape — the lexicon * ships up to eight per shape, which is the resolution available. */ export declare function sampleIdentifier(model: IdentifierModel, designatorID: string, random: () => number): string | null; /** * Per-leg pools read off disk once. */ export interface LegPools { context: LocaleBaseTuple[]; /** * Real venue names for the venue slot (stations, airports, campuses; US: airports, terminals, hospitals, rail). */ venues: string[]; /** * Real sub-venue strings, already filtered to this locale's promoted surfaces and their shape constraint. */ attested: string[]; /** * Real names carrying a surface REJECTED in this locale, for the venue slot of a negative row. */ rejectedVenues: string[]; /** * Real names that contain a designator inside a longer proper name — "Lochaline Ferry Terminal", "Kingdom Hall". The * whole string is `venue`; nothing in it is `unit`. */ longerNames: string[]; /** * Real names carrying a PROMOTED phrase in a shape the promotion does NOT cover — `Halle Rosengarten`, `PHOENIX * Halle`, `Halle-Südstadt`. The other half of an `identifier-required` ruling, and the only thing that teaches the * shape boundary rather than the word: de-DE has no `reject` row at all, so without this class its 168-hit confound * (97 of them the CITY Halle) would go untaught while its 32-hit promotion got 11,000 rows. */ unpromotedShapes: string[]; } /** * The name pools a source contributes. `attested` and `unpromotedShapes` come only from an extract — poi.db carries no * `tier` and no localized names, so it cannot say which side of a shape boundary a name sits on. */ export type NamePools = Pick; /** * The pools a source that has nothing to say contributes — en-US has no OSM extract, and DE/ES/GB are outside poi.db's * four countries. Empty rather than absent so a leg's merge is unconditional. */ export declare const EMPTY_NAME_POOLS: NamePools; /** * What every pool reader needs to know about the leg it is reading for. */ export interface PoolQuery { promoted: readonly PromotedSurface[]; rejectedPhrases: readonly string[]; designatorPhrases: readonly string[]; modifiers: readonly string[]; english: boolean; } /** * Read one OSM extract and split it into name pools. */ export declare function readExtractPools(path: string, query: PoolQuery): Promise; /** * Read the venue + confound pools for a country out of `poi.db`. * * Poi.db is FOUR COUNTRIES — US 11,521,612 / CA 794,418 / FR 721,352 / MX 644,316 — so this is reachable for en-US and * fr-FR and nothing else, and a zero here is evidence of absence in four countries rather than in the world. */ export declare function readPOIPools(dbPath: PathBuilderLike, country: string, query: PoolQuery): NamePools; /** * Merge two sources' name pools. */ export declare function mergeNamePools(a: NamePools, b: NamePools): NamePools; export {}; //# sourceMappingURL=sources.d.ts.map