import { type SurfaceIndex } from "#subvenue/surfaces"; import type { IdentifierShape, SubVenueSurface } from "#subvenue/table"; /** * One row of a harvestable source, as read back off jsonl or out of a layer database. * * This type accepts rows from any source. * An Overture Places row in the `airport_terminal` category has the shape * `{ designatorID, name }` and fits unchanged. * * The harvest function's hardcoded `osm:name` source stamp didn't fit that input. * See `overture-subvenue.ts` for the source handling. * * Declared locally so the builder doesn't import `@mailwoman/osm` * (which `@mailwoman/corpus` doesn't depend on) just to name a shape it reads from a file. */ export interface SubVenueHarvestRow { /** * The designator the source's rule assigned to the feature. * * Not necessarily the record a matched phrase names. * See this file's header on phrase attribution. * Passed into {@link SubVenueSurface.context}. */ designatorID: string; /** * `venue` (station, airport, campus) or `sub_venue`, when the source's rule assigns one. * * The harvest itself doesn't read it. * The sub-venue recipe fills its venue slot from it. */ tier?: string; name?: string | null; ref?: string | null; localizedNames?: Record; } /** * Classify an OSM `ref` into an {@link IdentifierShape} class. * * The classes are the ones Berlin's airport gates produced, plus the two aviation forms * the corpus task names (`Terminal 2F` is digit-letter, `Concourse B` is letter). * `range` covers both separators OSM uses for a boarding gate serving more * than one stand: `16-18` and `0/1`. */ export declare function classifyIdentifier(ref: string): string; /** * Options for one harvest pass. * * They set the source stamp and region recorded on each surface. * * Both default to the OSM/unknown-region values wave 1 hardcoded, so an existing caller is unchanged. */ export interface HarvestOptions { /** * Source family: `osm` yields `osm:name` / `osm:name:`, `overture` yields `overture:name`. */ source?: string; /** * ISO 3166-1 alpha-2 of the extract or partition. * * `""` when unknown. */ region?: string; } /** * Harvest attested phrases and identifier shapes out of a source's rows. * * `index` decides whether the name harvest runs. * A name contributes only when it contains a phrase already in the table. * * That filter is the whole reason this function is safe to run over raw OSM: * see this file's header for the Berlin measurement that motivated it. * * The index decides which record receives each hit. * The row's designator is recorded as `context`. * * @returns Surfaces with real `observations` counts, so the lexicon can rank * `terminal` above a phrase attested once. */ export declare function extractAttestedPhrases(rows: Iterable, index: SurfaceIndex, options?: HarvestOptions): { surfaces: SubVenueSurface[]; identifierShapes: IdentifierShape[]; }; /** * Read a jsonl file of {@link SubVenueHarvestRow}s. * * The reader skips blank lines and rows it cannot parse. * A malformed line doesn't stop lexicon generation. */ export declare function readSubVenueJSONL(path: string): Promise; //# sourceMappingURL=harvest.d.ts.map