/** * `osm`: OpenStreetMap address adapter for the countries no permissive source covers. * * Every row lists `ODbL-1.0`, whose recorded obligations include share-alike. * A build run under `LicensePolicy.ShareAlikeFree` refuses these rows at ingest, * so they reach only the open weights. * * That's why `defaultLicense` isn't an option on this adapter. */ import type { ComponentTag } from "@mailwoman/codex/component"; import { type AdapterOptions, type CanonicalRow, type CorpusAdapter } from "#types"; /** * Registry id for this adapter, stamped into every row it emits. */ export declare const OSM_ADAPTER_ID = "osm"; /** * The share of rows rendered with a trailing country name. * * An OpenStreetMap address holds no country token, and the country layouts print none. * Without a share that ends in the country's name, a country whose street rows all come * from this adapter has no `street, locality, country` row at all, and the model reads * such an address by the WOF shape `locality, region, country` (#2925). */ export declare const OSM_TRAILING_COUNTRY_SHARE = 0.3; /** * The row with `, ` appended when the source id's hash falls in the trailing-country share. * * The English name of {@linkcode MIN_TRAILING_COUNTRY_LENGTH} or more characters is used. * A country with no such name keeps the row unchanged. */ export declare function withTrailingCountry(raw: string, components: Partial>, country: string, sourceID: string): { raw: string; components: Partial>; }; /** * The per-row shape `@mailwoman/osm`'s `emit-corpus-jsonl` writes. */ interface OSMCorpusRow { street?: string | null; number?: string | null; postcode?: string | null; suburb?: string | null; city?: string | null; unit?: string | null; place?: string | null; subdistrict?: string | null; district?: string | null; province?: string | null; country?: string | null; /** * `emit-corpus-jsonl --locality-level` uses the containing administrative area's * name writes for a record without `addr:city`. */ boundary_locality?: string | null; /** * The same for a record without `addr:suburb`, from `--dependent-locality-level`. */ boundary_dependent_locality?: string | null; } /** * Whether `addr:housenumber` holds a street designator — digits with an optional letter, * fraction or dash suffix (`12`, `188a`, `14/E`, `1/1146`, `167-c`) or a one- * or two-letter block prefix (`B-77`, `L58`, `R 948`) — rather than free text such * as `House 34, Road 4, Sector 9`, `Plot #27` or a name. */ export declare function housenumberIsDesignator(value: string): boolean; /** * Whether `addr:street` matches the street-name shape. * * The value has no comma and contains at most {@link MAX_STREET_WORDS} words. * Direction phrases such as `Near Cozy Water Park`, `Opposite Askari Towers` or `Behind …` return false. */ export declare function isStreetName(value: string): boolean; /** * Split an `addr:city` carrying a neighborhood ahead of the city (`Mirpur 10, Dhaka` → * locality `Dhaka`, head `Mirpur 10`); a value without a comma is only the locality. */ export declare function splitCityValue(value: string): { locality: string; head: string | null; }; /** * Maps one jsonl row onto the components the corpus asserts, or returns null when the row is refused. * * A row with a street-shaped `addr:street` is a street address. * A row with no `addr:street` at all is admitted as a streetless premise when its house * number is designator-shaped and a tag that maps to `locality` or `dependent_locality` * (`addr:city`, `addr:place`, `addr:suburb`, `addr:subdistrict`, `addr:district`) * holds the identity the street would have held. * * That's OSM's documented scheme for addresses numbered within a place rather than * along a street, and it is the `streetless-premise-identity` shape. * A row whose `addr:street` holds a line rather than a name stays refused: * the mapper supplied a street, and the value is a line. * * A postcode is kept when the whole value has `country`'s postcode format. * * Each refusal and each discarded component increments its reason in `dropped`. */ export declare function componentsForOSMRow(row: OSMCorpusRow, country: string, dropped?: Pick): CanonicalRow["components"] | null; /** * Whether two place names are the same name: case, whitespace, diacritics and a leading * admin generic folded (`Bắc Ninh` = `Bac Ninh`; `Hà Nội` = `Thành phố Hà Nội`). */ export declare function sameName(a: string, b: string): boolean; export declare function createOSMAdapter(): CorpusAdapter; /** * The configured adapter instance registered with the corpus builder. */ export declare const osmAdapter: CorpusAdapter; export {}; //# sourceMappingURL=adapter.d.ts.map