/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Generates rows that tag venue-interior strings such as `Terminal 5` or `North Gate` as `unit` beside a `venue`, * with confound rows as negatives. */ import { type CorpusRecipe } from "#recipes/scaffold"; import { type IdentifierModel, type PromotedSurface } from "#recipes/sub/venue/sources"; export * from "#recipes/sub/venue/sources"; export * from "#recipes/sub/venue/context"; export * from "#recipes/sub/venue/render"; /** * One locale's leg of the recipe. * * `positiveShare` and `negativeShare` are relative weights that the run normalizes across legs. */ export interface SubVenueLeg { locale: string; country: string; /** * The ISO 3166-1 alpha-2 key into the lexicon's `identifierShapes`. * * Gate and terminal numbering differs by country, so each leg samples identifiers from its own region. */ region: string; /** * The OSM extract filename under `--extracts-dir`. * * A leg without an extract draws its venue and confound pools from `poi.db`. */ extract?: string; /** * Whether this leg may use the English ` ` form. * * The modifier list is English, so non-English legs emit only designator-plus-identifier forms. */ english: boolean; positiveShare: number; negativeShare: number; /** * Postcode prefixes that restrict the leg's address context. * * The ca-ES leg uses the prefixes of the Catalan-speaking provinces * because the OpenAddresses region strings are unreliable. */ postcodePrefixes?: readonly string[]; } /** * The locale legs and their shares. * * The English legs account for the largest shares because only English has the modifier form * and most eval confound rows are GB or US addresses. * The en-US leg accounts for the largest negative share because its confound pool is the largest. * * The JP corpus builder processes Japanese sub-venue rows. * It uses a different label set. */ export declare const SUBVENUE_LEGS: readonly SubVenueLeg[]; /** * The region whose identifier distribution the en-US leg uses. * * The en-US leg has no OSM extract. * Its `poi.db` contains venue names without refs. * The recipe borrows the identifier distribution from GB. */ export declare const US_IDENTIFIER_REGION_BORROWED_FROM = "GB"; /** * The suggested `--count` for this recipe. * * The training sampler drops a source from its multinomial once the source runs out of rows, * so an undersized output receives less than its configured weight. * At a source weight of 12.0 in a one-million-row epoch, the sampler draws * about 77,000 rows from this output. * The value 120,000 leaves headroom above that. */ export declare const RECOMMENDED_ROW_COUNT = 120000; /** * Lowercase surfaces from the eval board * in `packages/mailwoman/tools/eval-harness/fixtures/venue-structure-confounds.jsonl`. * * The recipe drops any row that contains one of these and counts it in `contaminated`. * The list is copied by hand because `@mailwoman/corpus` cannot read the board's fixture at run time. * Update it when the board changes. */ export declare const BOARD_RESERVED_SURFACES: readonly string[]; /** * Returns whether the row text contains any surface in {@link BOARD_RESERVED_SURFACES}. */ export declare function isBoardReserved(raw: string): boolean; /** * A sub-venue string with the form and designator that produced it. */ export interface SubVenueForm { text: string; form: "designator-identifier" | "modifier-designator" | "attested"; designatorID: string; } /** * Builds one sub-venue string for a leg, or returns `null` when it cannot. * * A promotion with `shape: "identifier-required"` always renders as ` `. * German `Halle` also serves as a place name. * * The identifier distinguishes the two readings. * The guard lives here so that every caller inherits it. */ export declare function buildSubVenueForm(leg: SubVenueLeg, promoted: readonly PromotedSurface[], model: IdentifierModel, modifiers: readonly string[], attested: readonly string[], random: () => number): SubVenueForm | null; /** * An alias of {@link buildSubVenueForm}. * * @deprecated Use {@link buildSubVenueForm}. */ export declare const buildPositiveForms: typeof buildSubVenueForm; /** * The confound classes that the recipe emits as negatives. */ export declare const NegativeClass: { /** * A surface rejected for the locale in the venue slot, such as `Red Wing Shoes`. */ readonly RejectedVenue: "rejected-venue"; /** * A longer proper name that contains a designator, tagged whole as `venue`, * such as `Lochaline Ferry Terminal`. */ readonly LongerName: "longer-name"; /** * A real street whose name contains a designator token, such as `Pier Road`. */ readonly DesignatorStreet: "designator-street"; /** * A real street with the ` ` shape, such as `East Gate`. */ readonly ModifierDesignatorStreet: "modifier-designator-street"; /** * A GB single-token `-gate` street, such as `Moorgate`. */ readonly GateSuffixStreet: "gate-suffix-street"; /** * A promoted phrase in a shape that its promotion excludes, such as `Halle Rosengarten`. * * See `LegPools.unpromotedShapes`. */ readonly UnpromotedShape: "unpromoted-shape"; }; /** * One of the {@link NegativeClass} values. */ export type NegativeClass = (typeof NegativeClass)[keyof typeof NegativeClass]; /** * Per-leg composition counts that the run prints. */ export interface SubVenueLegStats { locale: string; positives: number; negatives: number; byForm: Record; byDesignator: Record; byNegativeClass: Record; byRegister: Record; poolSizes: Record; } /** * Splits `total` across relative `shares` by the largest-remainder method, so the parts sum to `total`. */ export declare function allocate(total: number, shares: readonly number[]): number[]; /** * Generates sub-venue positives and confound negatives across the {@link SUBVENUE_LEGS}. * * Only (designator, locale) pairs that the promotion ledger accepted produce positives. * The recipe requires `--count`. */ export declare const subVenueRecipe: CorpusRecipe; //# sourceMappingURL=venue.d.ts.map