/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Feature extraction for the #244 coarse-placer — a fastText-style hashed char-n-gram * representation plus explicit Unicode-script presence tokens. Deterministic + pure (shared by * training and the always-resident inference), zero deps. A string → a set of active feature * indices in [0, FEATURE_DIM). * * Why these features: script is the dominant coarse-geography signal (CJK→East Asia, * Cyrillic→Eastern Europe, Arabic→MENA), and char n-grams separate WITHIN a script (Hangul→KR vs * kana→JP vs Han-only→CN, or Dutch "straat" vs French "rue" within Latin). A linear model over * both is a few hundred KB and runs in microseconds — the "always-resident, places the planet * coarsely" tier. */ /** * The trained classes: the well-represented corpus countries, the #743 Overture-sourced EU expansion, and `OTHER` — the * explicit off-map class (milestone 2) trained on non-Latin/non-CJK scripts via outlier exposure, so the model learns * the edge of its competence and routes "probably off my loaded map" instead of a confident mis-placement. Index order * is the label id. * * The first 11 are the original v0.5.0-corpus countries. The next 16 (#743) are EU locales the placer previously * couldn't emit — ambiguous names there (FI "Helsinki", PL "Rybnik") landed off-continent in the population-first * candidate gazetteer because no country prior pinned them. They're trained from the Overture per-country addresses * theme (`build-dataset.mjs`), and they're pulled OUT of the Latin off-map OTHER outlier set * (`build-outlier-latin.mjs`) that used to teach PL/PT/CZ → OTHER. Widening the class set is the soft-prior lever; it * never hard-filters, so a neighbour confusion (DK↔NO, EE↔LT↔LV) still keeps resolution in-region, off the global-pop * attractors. Adding a class requires a retrain + a fresh artifact — the bundled meta.json carries its own `classes`, * so this constant only drives training (`train.mjs`), not inference. */ export declare const COARSE_CLASSES: readonly ["US", "FR", "GB", "CN", "NL", "IT", "DE", "JP", "ES", "KR", "TW", "AT", "BE", "CH", "CZ", "DK", "EE", "FI", "HR", "LT", "LU", "LV", "NO", "PL", "PT", "SI", "SK", "AU", "OTHER"]; /** * Hashed-feature dimensionality (2^16). Keeps the weight matrix small (28×65536 ≈ 1.8 MB int8) while collisions stay * tolerable for a linear bag-of-features model; the discriminative n-grams are few. */ export declare const FEATURE_DIM: number; /** * Featurize an address into a deduped list of active feature indices: char 3/4/5-grams over the lowercased, * boundary-marked string + one presence token per Unicode script seen (+ the dominant script). Non-Latin characters are * PRESERVED (lowercasing only touches cased scripts). */ export declare function featurize(text: string): number[]; //# sourceMappingURL=featurize.d.ts.map