@mailwoman/neural 4.16.2 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/out/address-system.d.ts +4 -5
  2. package/out/address-system.d.ts.map +1 -1
  3. package/out/address-system.js +4 -5
  4. package/out/address-system.js.map +1 -1
  5. package/out/anchor-inference.d.ts +16 -18
  6. package/out/anchor-inference.d.ts.map +1 -1
  7. package/out/anchor-inference.js +16 -18
  8. package/out/anchor-inference.js.map +1 -1
  9. package/out/browser.js +1 -1
  10. package/out/case-normalize.d.ts +13 -8
  11. package/out/case-normalize.d.ts.map +1 -1
  12. package/out/case-normalize.js +18 -11
  13. package/out/case-normalize.js.map +1 -1
  14. package/out/classifier.d.ts +125 -134
  15. package/out/classifier.d.ts.map +1 -1
  16. package/out/classifier.js +46 -49
  17. package/out/classifier.js.map +1 -1
  18. package/out/fst-prior.d.ts +19 -21
  19. package/out/fst-prior.d.ts.map +1 -1
  20. package/out/fst-prior.js +13 -14
  21. package/out/fst-prior.js.map +1 -1
  22. package/out/gazetteer-inference.d.ts +13 -16
  23. package/out/gazetteer-inference.d.ts.map +1 -1
  24. package/out/gazetteer-inference.js +13 -16
  25. package/out/gazetteer-inference.js.map +1 -1
  26. package/out/index.d.ts +1 -1
  27. package/out/index.js +1 -1
  28. package/out/labels.d.ts +9 -10
  29. package/out/labels.d.ts.map +1 -1
  30. package/out/labels.js +5 -6
  31. package/out/labels.js.map +1 -1
  32. package/out/onnx-runner.d.ts +33 -21
  33. package/out/onnx-runner.d.ts.map +1 -1
  34. package/out/onnx-runner.js +39 -19
  35. package/out/onnx-runner.js.map +1 -1
  36. package/out/postcode-anchor.d.ts +28 -34
  37. package/out/postcode-anchor.d.ts.map +1 -1
  38. package/out/postcode-anchor.js +48 -55
  39. package/out/postcode-anchor.js.map +1 -1
  40. package/out/postcode-binary-resolver.d.ts +10 -13
  41. package/out/postcode-binary-resolver.d.ts.map +1 -1
  42. package/out/postcode-binary-resolver.js +12 -15
  43. package/out/postcode-binary-resolver.js.map +1 -1
  44. package/out/postcode-repair.d.ts +5 -5
  45. package/out/postcode-repair.d.ts.map +1 -1
  46. package/out/postcode-repair.js +9 -10
  47. package/out/postcode-repair.js.map +1 -1
  48. package/out/proposal-classifier.d.ts +3 -3
  49. package/out/proposal-classifier.d.ts.map +1 -1
  50. package/out/proposal-classifier.js.map +1 -1
  51. package/out/query-shape-prior.d.ts +10 -11
  52. package/out/query-shape-prior.d.ts.map +1 -1
  53. package/out/query-shape-prior.js +12 -15
  54. package/out/query-shape-prior.js.map +1 -1
  55. package/out/scorer.d.ts +28 -31
  56. package/out/scorer.d.ts.map +1 -1
  57. package/out/scorer.js +39 -44
  58. package/out/scorer.js.map +1 -1
  59. package/out/soft-features.d.ts +12 -14
  60. package/out/soft-features.d.ts.map +1 -1
  61. package/out/soft-features.js +5 -6
  62. package/out/soft-features.js.map +1 -1
  63. package/out/span-bridge.d.ts +9 -11
  64. package/out/span-bridge.d.ts.map +1 -1
  65. package/out/span-bridge.js +8 -10
  66. package/out/span-bridge.js.map +1 -1
  67. package/out/span-proposal-prior.d.ts +13 -15
  68. package/out/span-proposal-prior.d.ts.map +1 -1
  69. package/out/span-proposal-prior.js +2 -2
  70. package/out/span-proposal-prior.js.map +1 -1
  71. package/out/span-proposer-lexicon.d.ts +2 -3
  72. package/out/span-proposer-lexicon.d.ts.map +1 -1
  73. package/out/span-proposer-lexicon.js +9 -10
  74. package/out/span-proposer-lexicon.js.map +1 -1
  75. package/out/street-morphology-prior.d.ts +11 -12
  76. package/out/street-morphology-prior.d.ts.map +1 -1
  77. package/out/street-morphology-prior.js +8 -9
  78. package/out/street-morphology-prior.js.map +1 -1
  79. package/out/tokenizer.d.ts +6 -7
  80. package/out/tokenizer.d.ts.map +1 -1
  81. package/out/tokenizer.js +6 -7
  82. package/out/tokenizer.js.map +1 -1
  83. package/out/unit-repair.d.ts +2 -2
  84. package/out/unit-repair.d.ts.map +1 -1
  85. package/out/unit-repair.js +11 -14
  86. package/out/unit-repair.js.map +1 -1
  87. package/out/viterbi.d.ts +13 -13
  88. package/out/viterbi.d.ts.map +1 -1
  89. package/out/viterbi.js +12 -12
  90. package/out/viterbi.js.map +1 -1
  91. package/out/vitest.config.d.ts.map +1 -1
  92. package/out/vitest.config.js.map +1 -1
  93. package/out/weights.d.ts +62 -71
  94. package/out/weights.d.ts.map +1 -1
  95. package/out/weights.js +33 -37
  96. package/out/weights.js.map +1 -1
  97. package/out/word-consistency.d.ts +4 -4
  98. package/out/word-consistency.d.ts.map +1 -1
  99. package/out/word-consistency.js +4 -4
  100. package/out/word-consistency.js.map +1 -1
  101. package/package.json +13 -13
@@ -18,27 +18,31 @@ import { ANCHOR_FEATURE_DIM } from "./anchor-inference.js";
18
18
  import { GAZETTEER_FEATURE_DIM } from "./gazetteer-inference.js";
19
19
  /** Default sequence length for v0.1.0 / v0.2.0 (BertConfig max_position_embeddings = 128). */
20
20
  export const DEFAULT_FIXED_SEQ_LEN = 128;
21
- export class OnnxRunner {
21
+ export class ONNXRunner {
22
22
  modelPath;
23
23
  modelBytes;
24
24
  session = null;
25
25
  loadPromise = null;
26
26
  fixedSeqLen;
27
+ executionProviders;
27
28
  constructor(modelPath, modelBytes, opts) {
28
29
  this.modelPath = modelPath;
29
30
  this.modelBytes = modelBytes;
30
31
  this.fixedSeqLen = opts.fixedSeqLen ?? DEFAULT_FIXED_SEQ_LEN;
32
+ const requested = opts.executionProviders ?? ["cpu"];
33
+ // CPU is the universal final fallback — append it so a GPU-only list still has somewhere to land.
34
+ this.executionProviders = requested.includes("cpu") ? requested : [...requested, "cpu"];
31
35
  }
32
36
  /** Load by path. Reads the model lazily unless `warmup` is true. */
33
37
  static async create(modelPath, opts = {}) {
34
- const runner = new OnnxRunner(modelPath, null, opts);
38
+ const runner = new ONNXRunner(modelPath, null, opts);
35
39
  if (opts.warmup)
36
40
  await runner.ensureSession();
37
41
  return runner;
38
42
  }
39
43
  /** Load from an already-read byte buffer. */
40
44
  static async fromBytes(modelBytes, opts = {}) {
41
- const runner = new OnnxRunner("(bytes)", modelBytes, opts);
45
+ const runner = new ONNXRunner("(bytes)", modelBytes, opts);
42
46
  if (opts.warmup)
43
47
  await runner.ensureSession();
44
48
  return runner;
@@ -49,27 +53,43 @@ export class OnnxRunner {
49
53
  if (!this.loadPromise) {
50
54
  this.loadPromise = (async () => {
51
55
  const bytes = this.modelBytes ?? new Uint8Array(await fs.readFile(this.modelPath));
52
- const session = await ort.InferenceSession.create(bytes, {
53
- executionProviders: ["cpu"],
54
- graphOptimizationLevel: "all",
55
- });
56
- this.session = session;
57
- return session;
56
+ this.session = await this.createSession(bytes);
57
+ return this.session;
58
58
  })();
59
59
  }
60
60
  return this.loadPromise;
61
61
  }
62
+ /**
63
+ * Create the session on the configured execution providers, guarded: GPU providers (`cuda`/`webgpu`) throw at
64
+ * create-time when their runtime/driver is missing, so on failure we retry on CPU alone. A box with the GPU runtime
65
+ * uses it; a box without one transparently lands on CPU.
66
+ */
67
+ async createSession(bytes) {
68
+ try {
69
+ return await ort.InferenceSession.create(bytes, {
70
+ executionProviders: this.executionProviders,
71
+ graphOptimizationLevel: "all",
72
+ });
73
+ }
74
+ catch (err) {
75
+ if (this.executionProviders.length === 1 && this.executionProviders[0] === "cpu")
76
+ throw err;
77
+ // A requested GPU provider failed to initialize — fall back to CPU so inference still loads.
78
+ console.warn(`[ONNXRunner] execution providers [${this.executionProviders.join(", ")}] failed to initialize ` +
79
+ `(${err.message.split("\n")[0]}); falling back to CPU.`);
80
+ return ort.InferenceSession.create(bytes, { executionProviders: ["cpu"], graphOptimizationLevel: "all" });
81
+ }
82
+ }
62
83
  /**
63
84
  * Run inference on a single token id sequence.
64
85
  *
65
- * Pads to `fixedSeqLen` (default 128) with id 0 + mask 0; truncates if longer. Output is sliced
66
- * back to the actual input length.
86
+ * Pads to `fixedSeqLen` (default 128) with id 0 + mask 0; truncates if longer. Output is sliced back to the actual
87
+ * input length.
67
88
  *
68
89
  * @param tokenIds The id sequence produced by the tokenizer (no special tokens added).
69
- * @param anchor Optional postcode-anchor channel (#239/#240). When supplied (only for anchor
70
- * models — exported with the `anchor_features`/`anchor_confidence` inputs), per-piece features
71
- * `(seqLen × dim)` + confidence `(seqLen,)` are fed, zero-padded to `fixedSeqLen`. Omit for
72
- * plain models, whose ONNX has no anchor inputs.
90
+ * @param anchor Optional postcode-anchor channel (#239/#240). When supplied (only for anchor models — exported with
91
+ * the `anchor_features`/`anchor_confidence` inputs), per-piece features `(seqLen × dim)` + confidence `(seqLen,)`
92
+ * are fed, zero-padded to `fixedSeqLen`. Omit for plain models, whose ONNX has no anchor inputs.
73
93
  */
74
94
  async infer(tokenIds, anchor, gazetteer) {
75
95
  const session = await this.ensureSession();
@@ -154,10 +174,10 @@ export class OnnxRunner {
154
174
  return { logits, numLabels, ...(localeLogits ? { localeLogits } : {}) };
155
175
  }
156
176
  /**
157
- * The model's declared input names (loads the session if not already loaded). Used by the
158
- * ProductionScorer (#718) back-compat path: when a model-card has no `requires` block, the
159
- * required soft-feature channels are INFERRED from the graph a model exporting
160
- * `anchor_features` / `gazetteer_features` declared those channels mandatory at train time.
177
+ * The model's declared input names (loads the session if not already loaded). Used by the ProductionScorer (#718)
178
+ * back-compat path: when a model-card has no `requires` block, the required soft-feature channels are INFERRED from
179
+ * the graph a model exporting `anchor_features` / `gazetteer_features` declared those channels mandatory at train
180
+ * time.
161
181
  */
162
182
  async inputNames() {
163
183
  const session = await this.ensureSession();
@@ -1 +1 @@
1
- {"version":3,"file":"onnx-runner.js","sourceRoot":"","sources":["../onnx-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,GAAG,MAAM,kBAAkB,CAAA;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,M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AAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,IAAoB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QAE7F,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;IACxE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,UAAU;QACf,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAA;QAE1C,OAAO,OAAO,CAAC,UAAU,CAAA;IAC1B,CAAC;CACD"}
@@ -35,10 +35,9 @@ export interface PostcodePlace {
35
35
  lon: number;
36
36
  }
37
37
  /**
38
- * The minimal surface the anchor needs from a gazetteer. Implementations: an in-memory fake (tests)
39
- * or a SQLite-backed lookup over the `postalcode-*.db` shards (`@mailwoman/resolver-wof-sqlite`).
40
- * Keeping the seam this narrow lets a future FST/WASM resolver drop in without touching the anchor
41
- * logic.
38
+ * The minimal surface the anchor needs from a gazetteer. Implementations: an in-memory fake (tests) or a SQLite-backed
39
+ * lookup over the `postalcode-*.db` shards (`@mailwoman/resolver-wof-sqlite`). Keeping the seam this narrow lets a
40
+ * future FST/WASM resolver drop in without touching the anchor logic.
42
41
  */
43
42
  export interface PostcodeResolver {
44
43
  /** Exact-match lookup of a normalized postcode string across every country shard. */
@@ -56,62 +55,57 @@ export interface PostcodeAnchor {
56
55
  /** Coordinate-bearing gazetteer hits — best-effort centroid(s), one representative per country. */
57
56
  candidates: PostcodePlace[];
58
57
  /**
59
- * Uniform distribution over the countries the postcode exists in (membership,
60
- * coordinate-independent).
58
+ * Uniform distribution over the countries the postcode exists in (membership, coordinate-independent).
61
59
  */
62
60
  posterior: Record<string, number>;
63
61
  /** `1 - normalizedEntropy(posterior)` when the postcode exists; `0` when it is in no gazetteer. */
64
62
  confidence: number;
65
63
  /**
66
- * `exact` — the string is a real postcode; `outward` — a GB unit (`SO4 3RX`) resolved to its
67
- * outward district (`SO4`), the granularity the GB gazetteer is aggregated at (no penalty — it is
68
- * a real, confident GB match); `fuzzy` — only an edit-distance-1 variant exists (a likely typo /
69
- * OCR slip), so the confidence carries a penalty; `none` — in no gazetteer.
64
+ * `exact` — the string is a real postcode; `outward` — a GB unit (`SO4 3RX`) resolved to its outward district
65
+ * (`SO4`), the granularity the GB gazetteer is aggregated at (no penalty — it is a real, confident GB match); `fuzzy`
66
+ * — only an edit-distance-1 variant exists (a likely typo / OCR slip), so the confidence carries a penalty; `none` —
67
+ * in no gazetteer.
70
68
  */
71
69
  matchType: "exact" | "outward" | "fuzzy" | "none";
72
70
  /**
73
- * Structural house-number prior in [0, 1]: `1` for a code that cannot be a house number, and
74
- * below `1` for a digit-only code sharing its comma-delimited segment with a street word (so it
75
- * reads as a house number rather than a postcode). Already folded into {@link confidence}; exposed
76
- * so a consumer can rank competing spans, or see why one was down-weighted, without re-deriving
77
- * it.
71
+ * Structural house-number prior in [0, 1]: `1` for a code that cannot be a house number, and below `1` for a
72
+ * digit-only code sharing its comma-delimited segment with a street word (so it reads as a house number rather than a
73
+ * postcode). Already folded into {@link confidence}; exposed so a consumer can rank competing spans, or see why one
74
+ * was down-weighted, without re-deriving it.
78
75
  */
79
76
  positionFactor: number;
80
77
  }
81
78
  export interface ExtractPostcodeAnchorsOpts {
82
79
  /**
83
- * When an exact lookup finds nothing, retry Damerau–Levenshtein ≤1 variants to absorb typos and
84
- * OCR slips (`75OO8` → `75008`). Off by default so existing callers keep exact-match behaviour.
80
+ * When an exact lookup finds nothing, retry Damerau–Levenshtein ≤1 variants to absorb typos and OCR slips (`75OO8` →
81
+ * `75008`). Off by default so existing callers keep exact-match behaviour.
85
82
  */
86
83
  fuzzy?: boolean;
87
84
  }
88
85
  /**
89
- * Class-aware edit-distance-1 variants of a postcode string: deletions, same-class substitutions
90
- * (digit↔digit, letter↔letter), same-class insertions, and adjacent transpositions. Restricting
91
- * substitutions/insertions to the character's class mirrors how humans mistype or OCR a postcode (a
92
- * digit becomes another digit, not a letter) and keeps the candidate set small.
86
+ * Class-aware edit-distance-1 variants of a postcode string: deletions, same-class substitutions (digit↔digit,
87
+ * letter↔letter), same-class insertions, and adjacent transpositions. Restricting substitutions/insertions to the
88
+ * character's class mirrors how humans mistype or OCR a postcode (a digit becomes another digit, not a letter) and
89
+ * keeps the candidate set small.
93
90
  */
94
91
  export declare function editDistance1Variants(s: string): string[];
95
92
  /**
96
- * Normalize a shaped span to the canonical gazetteer key: uppercase, collapse internal whitespace
97
- * to a single space, and strip the German `D-` courtesy prefix (the shards store `68161`, not
98
- * `D-68161`).
93
+ * Normalize a shaped span to the canonical gazetteer key: uppercase, collapse internal whitespace to a single space,
94
+ * and strip the German `D-` courtesy prefix (the shards store `68161`, not `D-68161`).
99
95
  */
100
96
  export declare function normalizePostcode(raw: string): string;
101
97
  /**
102
- * The GB outward code of a normalized unit postcode — the part before the space when the inward
103
- * half is `\d[A-Z]{2}` (`SO4 3RX` → `SO4`). The GB gazetteer is aggregated to outward codes (2.7M
104
- * units is too large + too fine for an anchor), so the extractor retries the outward code when a
105
- * full GB unit misses. Returns `null` for any string that isn't a GB unit postcode (so it never
106
- * fires elsewhere).
98
+ * The GB outward code of a normalized unit postcode — the part before the space when the inward half is `\d[A-Z]{2}`
99
+ * (`SO4 3RX` → `SO4`). The GB gazetteer is aggregated to outward codes (2.7M units is too large + too fine for an
100
+ * anchor), so the extractor retries the outward code when a full GB unit misses. Returns `null` for any string that
101
+ * isn't a GB unit postcode (so it never fires elsewhere).
107
102
  */
108
103
  export declare function gbOutwardCode(normalized: string): string | null;
109
104
  /**
110
- * Extract postcode anchors from raw text. For each postcode-shaped span, resolve it against the
111
- * gazetteer and emit a soft anchor (country posterior + confidence). Spans that match a shape but
112
- * exist in no gazetteer are still returned, with an empty posterior and confidence 0 — an explicit
113
- * "looks like a postcode, but isn't one" so the caller can see the extractor fired and chose not to
114
- * anchor.
105
+ * Extract postcode anchors from raw text. For each postcode-shaped span, resolve it against the gazetteer and emit a
106
+ * soft anchor (country posterior + confidence). Spans that match a shape but exist in no gazetteer are still returned,
107
+ * with an empty posterior and confidence 0 — an explicit "looks like a postcode, but isn't one" so the caller can see
108
+ * the extractor fired and chose not to anchor.
115
109
  */
116
110
  export declare function extractPostcodeAnchors(text: string, resolver: PostcodeResolver, opts?: ExtractPostcodeAnchorsOpts): PostcodeAnchor[];
117
111
  //# sourceMappingURL=postcode-anchor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"postcode-anchor.d.ts","sourceRoot":"","sources":["../postcode-anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAQH,uGAAuG;AACvG,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACX;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAChC,qFAAqF;IACrF,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE,CAAA;CACzC;AAED,MAAM,WAAW,cAAc;IAC9B,8EAA8E;IAC9E,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IAClD,qGAAqG;IACrG,UAAU,EAAE,MAAM,CAAA;IAClB,mGAAmG;IACnG,UAAU,EAAE,aAAa,EAAE,CAAA;IAC3B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,mGAAmG;IACnG,UAAU,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,SAAS,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;IACjD;;;;;;OAMG;IACH,cAAc,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,0BAA0B;IAC1C;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AAE,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;IACjD;;;;;OAKG;IACH,cAAc,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,0BAA0B;IAC1C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CACf;AAUD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAoBzD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAUrD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM/D;AA6GD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,GAAE,0BAA+B,GACnC,cAAc,EAAE,CA4ElB"}
@@ -34,23 +34,23 @@ import { isFrenchStreetWord } from "@mailwoman/codex/fr";
34
34
  import { isStreetSuffixToken, isUsStateAbbreviation } from "@mailwoman/codex/us";
35
35
  import { collectMatches } from "./postcode-repair.js";
36
36
  /**
37
- * Entropy cap for the confidence formula: a k-way country split saturates toward 0 confidence at
38
- * k=10.
37
+ * Entropy cap for the confidence formula: a k-way country split saturates toward 0 confidence at k=10.
39
38
  */
40
39
  const MAX_COUNTRIES = 10;
41
40
  /** A fuzzy (typo-corrected) match is less certain than an exact one — scale its confidence down. */
42
41
  const FUZZY_PENALTY = 0.6;
43
42
  /**
44
- * Class-aware edit-distance-1 variants of a postcode string: deletions, same-class substitutions
45
- * (digit↔digit, letter↔letter), same-class insertions, and adjacent transpositions. Restricting
46
- * substitutions/insertions to the character's class mirrors how humans mistype or OCR a postcode (a
47
- * digit becomes another digit, not a letter) and keeps the candidate set small.
43
+ * Class-aware edit-distance-1 variants of a postcode string: deletions, same-class substitutions (digit↔digit,
44
+ * letter↔letter), same-class insertions, and adjacent transpositions. Restricting substitutions/insertions to the
45
+ * character's class mirrors how humans mistype or OCR a postcode (a digit becomes another digit, not a letter) and
46
+ * keeps the candidate set small.
48
47
  */
49
48
  export function editDistance1Variants(s) {
50
49
  const classOf = (ch) => /[0-9]/.test(ch) ? "0123456789" : /[A-Z]/.test(ch) ? "ABCDEFGHIJKLMNOPQRSTUVWXYZ" : "";
51
50
  const variants = new Set();
52
51
  for (let i = 0; i < s.length; i++)
53
- variants.add(s.slice(0, i) + s.slice(i + 1)); // deletions
52
+ variants.add(s.slice(0, i) + s.slice(i + 1));
53
+ // deletions
54
54
  for (let i = 0; i < s.length; i++) {
55
55
  for (const c of classOf(s[i]))
56
56
  if (c !== s[i])
@@ -66,24 +66,24 @@ export function editDistance1Variants(s) {
66
66
  return [...variants];
67
67
  }
68
68
  /**
69
- * Normalize a shaped span to the canonical gazetteer key: uppercase, collapse internal whitespace
70
- * to a single space, and strip the German `D-` courtesy prefix (the shards store `68161`, not
71
- * `D-68161`).
69
+ * Normalize a shaped span to the canonical gazetteer key: uppercase, collapse internal whitespace to a single space,
70
+ * and strip the German `D-` courtesy prefix (the shards store `68161`, not `D-68161`).
72
71
  */
73
72
  export function normalizePostcode(raw) {
74
73
  let s = raw.trim().toUpperCase().replace(/\s+/g, " ");
75
74
  if (/^D-\d{5}$/.test(s))
76
- s = s.slice(2); // German courtesy prefix: D-68161 → 68161
75
+ s = s.slice(2);
76
+ // German courtesy prefix: D-68161 → 68161
77
77
  if (/^\d{4} [A-Z]{2}$/.test(s))
78
- s = s.replace(" ", ""); // Dutch: gazetteer stores 1012LM, not 1012 LM
78
+ s = s.replace(" ", "");
79
+ // Dutch: gazetteer stores 1012LM, not 1012 LM
79
80
  return s;
80
81
  }
81
82
  /**
82
- * The GB outward code of a normalized unit postcode — the part before the space when the inward
83
- * half is `\d[A-Z]{2}` (`SO4 3RX` → `SO4`). The GB gazetteer is aggregated to outward codes (2.7M
84
- * units is too large + too fine for an anchor), so the extractor retries the outward code when a
85
- * full GB unit misses. Returns `null` for any string that isn't a GB unit postcode (so it never
86
- * fires elsewhere).
83
+ * The GB outward code of a normalized unit postcode — the part before the space when the inward half is `\d[A-Z]{2}`
84
+ * (`SO4 3RX` → `SO4`). The GB gazetteer is aggregated to outward codes (2.7M units is too large + too fine for an
85
+ * anchor), so the extractor retries the outward code when a full GB unit misses. Returns `null` for any string that
86
+ * isn't a GB unit postcode (so it never fires elsewhere).
87
87
  */
88
88
  export function gbOutwardCode(normalized) {
89
89
  const sp = normalized.indexOf(" ");
@@ -92,8 +92,7 @@ export function gbOutwardCode(normalized) {
92
92
  return /^\d[A-Z]{2}$/.test(normalized.slice(sp + 1)) ? normalized.slice(0, sp) : null;
93
93
  }
94
94
  /**
95
- * `1 - log2(k)/log2(MAX_COUNTRIES)`, clamped to [0, 1]. k=1 → 1.0; k=2 → ~0.70; k≥MAX_COUNTRIES →
96
- * 0.
95
+ * `1 - log2(k)/log2(MAX_COUNTRIES)`, clamped to [0, 1]. k=1 → 1.0; k=2 → ~0.70; k≥MAX_COUNTRIES → 0.
97
96
  */
98
97
  function confidenceFromCountryCount(k) {
99
98
  if (k <= 0)
@@ -104,19 +103,18 @@ function confidenceFromCountryCount(k) {
104
103
  return Math.max(0, Math.min(1, c));
105
104
  }
106
105
  /**
107
- * Confidence scale for a digit-only code that shares its segment with a street word. A house number
108
- * and a 5-digit postcode are the same shape, so membership alone can't separate `12345 Main St`
109
- * (house number that happens to be a real ZIP elsewhere) from `San Francisco 94105` (postcode). The
110
- * structural tell is cheap and locale-general: house numbers sit beside the street, postcodes
111
- * beside the city. We scale rather than zero the gazetteer still vouches for the shape, so a lone
112
- * code in a street-only line stays usable; the penalty just lets a real trailing postcode out-rank
106
+ * Confidence scale for a digit-only code that shares its segment with a street word. A house number and a 5-digit
107
+ * postcode are the same shape, so membership alone can't separate `12345 Main St` (house number that happens to be a
108
+ * real ZIP elsewhere) from `San Francisco 94105` (postcode). The structural tell is cheap and locale-general: house
109
+ * numbers sit beside the street, postcodes beside the city. We scale rather than zero — the gazetteer still vouches for
110
+ * the shape, so a lone code in a street-only line stays usable; the penalty just lets a real trailing postcode out-rank
113
111
  * it.
114
112
  */
115
113
  const HOUSE_NUMBER_PENALTY = 0.2;
116
114
  /**
117
- * Standalone street-type words for the locales without a codex slice yet (ES/IT). US comes from
118
- * `@mailwoman/codex/us`, German from `@mailwoman/codex/de`, French from `@mailwoman/codex/fr`; the
119
- * Dutch compound suffixes are still inline below pending a `codex/nl` slice.
115
+ * Standalone street-type words for the locales without a codex slice yet (ES/IT). US comes from `@mailwoman/codex/us`,
116
+ * German from `@mailwoman/codex/de`, French from `@mailwoman/codex/fr`; the Dutch compound suffixes are still inline
117
+ * below pending a `codex/nl` slice.
120
118
  */
121
119
  const NON_US_STREET_WORDS = new Set([
122
120
  // Spanish
@@ -141,21 +139,18 @@ const NON_US_STREET_WORDS = new Set([
141
139
  /** Dutch compound street suffixes — matched against a token's tail (pending a `codex/nl` slice). */
142
140
  const NL_STREET_SUFFIXES = ["straat", "laan", "plein", "gracht", "kade", "dijk", "steeg", "dreef"];
143
141
  /**
144
- * True when a token denotes a street. US suffixes come from the USPS Pub-28 table in
145
- * `@mailwoman/codex/us` (complete, so `Trl`/`Holw`/`Xing` all match), EXCEPT the abbreviations that
146
- * collide with a state code — `KY` (Key vs Kentucky), `PR` (Prairie vs Puerto Rico) — which sit in
147
- * the postcode's own `City, ST ZIP` segment. German compounds come from `@mailwoman/codex/de`
148
- * ({@link isGermanStreetToken}), whose suffix set already excludes the place-name endings (`-berg`,
149
- * `-burg`, `-dorf`) that would otherwise flag a city token. French voie words come from
150
- * `@mailwoman/codex/fr` ({@link isFrenchStreetWord}). ES/IT and Dutch fall back to the inline
151
- * lists.
142
+ * True when a token denotes a street. US suffixes come from the USPS Pub-28 table in `@mailwoman/codex/us` (complete,
143
+ * so `Trl`/`Holw`/`Xing` all match), EXCEPT the abbreviations that collide with a state code — `KY` (Key vs Kentucky),
144
+ * `PR` (Prairie vs Puerto Rico) — which sit in the postcode's own `City, ST ZIP` segment. German compounds come from
145
+ * `@mailwoman/codex/de` ({@link isGermanStreetToken}), whose suffix set already excludes the place-name endings
146
+ * (`-berg`, `-burg`, `-dorf`) that would otherwise flag a city token. French voie words come from `@mailwoman/codex/fr`
147
+ * ({@link isFrenchStreetWord}). ES/IT and Dutch fall back to the inline lists.
152
148
  *
153
- * `systems` GATES which vocabularies are consulted — only the systems the postcode plausibly
154
- * belongs to (its gazetteer membership, e.g. a US-only ZIP gates to `{us}` and never checks the
155
- * German or French vocab). This is what lets the check scale to 15-20 systems without a
156
- * cross-locale collision (German `-ring` vs English `spring`): an unrelated system's vocabulary is
157
- * simply never asked. The gate carries lowercase system/locale tags (`us`, `de`, `fr`, `es`, `it`,
158
- * `nl`).
149
+ * `systems` GATES which vocabularies are consulted — only the systems the postcode plausibly belongs to (its gazetteer
150
+ * membership, e.g. a US-only ZIP gates to `{us}` and never checks the German or French vocab). This is what lets the
151
+ * check scale to 15-20 systems without a cross-locale collision (German `-ring` vs English `spring`): an unrelated
152
+ * system's vocabulary is simply never asked. The gate carries lowercase system/locale tags (`us`, `de`, `fr`, `es`,
153
+ * `it`, `nl`).
159
154
  */
160
155
  function looksLikeStreetWord(token, systems) {
161
156
  const t = token.toLowerCase().replace(/[^\p{L}]/gu, "");
@@ -174,15 +169,14 @@ function looksLikeStreetWord(token, systems) {
174
169
  return false;
175
170
  }
176
171
  /**
177
- * Position-aware confidence factor for a postcode span: `1` for anything that cannot be confused
178
- * with a house number, and {@link HOUSE_NUMBER_PENALTY} for a digit-only code sharing its
179
- * comma-delimited segment with a street word. This is the structural prior that lets the anchor
180
- * tell a leading `12345 Main St` house number from a trailing `San Francisco 94105` postcode with
181
- * no model in the loop — and lets a consumer pick the right span by confidence instead of by raw
182
- * position.
172
+ * Position-aware confidence factor for a postcode span: `1` for anything that cannot be confused with a house number,
173
+ * and {@link HOUSE_NUMBER_PENALTY} for a digit-only code sharing its comma-delimited segment with a street word. This
174
+ * is the structural prior that lets the anchor tell a leading `12345 Main St` house number from a trailing `San
175
+ * Francisco 94105` postcode with no model in the loop — and lets a consumer pick the right span by confidence instead
176
+ * of by raw position.
183
177
  *
184
- * `systems` narrows the street vocabularies to the ones this code plausibly belongs to (its
185
- * gazetteer membership, or — for a code in no gazetteer — the format-shape candidates from codex).
178
+ * `systems` narrows the street vocabularies to the ones this code plausibly belongs to (its gazetteer membership, or —
179
+ * for a code in no gazetteer — the format-shape candidates from codex).
186
180
  */
187
181
  function positionFactor(text, start, normalized, systems) {
188
182
  if (!/^\d+$/.test(normalized))
@@ -198,11 +192,10 @@ function positionFactor(text, start, normalized, systems) {
198
192
  return 1;
199
193
  }
200
194
  /**
201
- * Extract postcode anchors from raw text. For each postcode-shaped span, resolve it against the
202
- * gazetteer and emit a soft anchor (country posterior + confidence). Spans that match a shape but
203
- * exist in no gazetteer are still returned, with an empty posterior and confidence 0 — an explicit
204
- * "looks like a postcode, but isn't one" so the caller can see the extractor fired and chose not to
205
- * anchor.
195
+ * Extract postcode anchors from raw text. For each postcode-shaped span, resolve it against the gazetteer and emit a
196
+ * soft anchor (country posterior + confidence). Spans that match a shape but exist in no gazetteer are still returned,
197
+ * with an empty posterior and confidence 0 — an explicit "looks like a postcode, but isn't one" so the caller can see
198
+ * the extractor fired and chose not to anchor.
206
199
  */
207
200
  export function extractPostcodeAnchors(text, resolver, opts = {}) {
208
201
  const anchors = [];
@@ -1 +1 @@
1
- {"version":3,"file":"postcode-anchor.js","sourceRoot":"","sources":["../postcode-anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CA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K,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAA;YAE9E,IAAI,MAAM;gBAAE,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACpC,CAAC;QAED,0FAA0F;QAC1F,0FAA0F;QAC1F,+FAA+F;QAC/F,MAAM,OAAO,GACZ,SAAS,CAAC,MAAM,GAAG,CAAC;YACnB,CAAC,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;YAChD,CAAC,CAAC,IAAI,GAAG,CAAS,2BAA2B,CAAC,UAAU,CAAC,CAAC,CAAA;QAC5D,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;QACvE,MAAM,UAAU,GAAG,0BAA0B,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAA;QAEzG,OAAO,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;YAC5D,UAAU;YACV,UAAU;YACV,SAAS;YACT,UAAU;YACV,SAAS;YACT,cAAc,EAAE,QAAQ;SACxB,CAAC,CAAA;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AACf,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * Browser-side postcode resolver for the anchor (#240). A pure-JS, zero-dependency
7
7
  * `PostcodeResolver` backed by a compact flat binary instead of SQLite, so the postcode anchor
8
8
  * runs in the WASM/browser parser behind the same `lookup()` seam as the server-side
9
- * `WofPostcodeLookup`.
9
+ * `WOFPostcodeLookup`.
10
10
  *
11
11
  * This file owns BOTH ends of the format — `serializePostcodeBinary` (run in Node by
12
12
  * `scripts/build-postcode-binary.ts`) and `PostcodeBinaryResolver` (run in the browser) — so the
@@ -32,28 +32,25 @@ export interface PostcodeBinaryEntry {
32
32
  lon: number;
33
33
  }
34
34
  /**
35
- * Serialize postcode entries into the flat binary. Entries are sorted by (postcode, country) so
36
- * equal postcodes land in adjacent records. Run in Node; consumed by
37
- * {@link PostcodeBinaryResolver}.
35
+ * Serialize postcode entries into the flat binary. Entries are sorted by (postcode, country) so equal postcodes land in
36
+ * adjacent records. Run in Node; consumed by {@link PostcodeBinaryResolver}.
38
37
  */
39
38
  export declare function serializePostcodeBinary(entries: readonly PostcodeBinaryEntry[]): Uint8Array;
40
39
  /**
41
- * Pure-JS, browser-safe postcode resolver over the flat binary. Implements the same `lookup()` seam
42
- * as the SQLite `WofPostcodeLookup`, so `extractPostcodeAnchors` is agnostic to which backs it.
40
+ * Pure-JS, browser-safe postcode resolver over the flat binary. Implements the same `lookup()` seam as the SQLite
41
+ * `WOFPostcodeLookup`, so `extractPostcodeAnchors` is agnostic to which backs it.
43
42
  */
44
43
  export declare class PostcodeBinaryResolver {
45
44
  #private;
46
45
  constructor(bytes: Uint8Array);
47
46
  lookup(postcode: string): PostcodePlace[];
48
47
  /**
49
- * Decode the whole binary into an {@link AnchorLookup} (`Map<postcode, AnchorEntry>`) for the
50
- * neural anchor channel (#239/#240): each postcode → a uniform posterior over its member
51
- * countries
48
+ * Decode the whole binary into an {@link AnchorLookup} (`Map<postcode, AnchorEntry>`) for the neural anchor channel
49
+ * (#239/#240): each postcode → a uniform posterior over its member countries
52
50
  *
53
- * - The mean of its non-zero centroids. This is the browser-side equivalent of the pilot
54
- * postcode→anchor lookup the model trained against, built live from the shipped binary instead
55
- * of a precomputed JSON. Records are stored sorted by (postcode, country), so equal keys are
56
- * contiguous.
51
+ * - The mean of its non-zero centroids. This is the browser-side equivalent of the pilot postcode→anchor lookup the
52
+ * model trained against, built live from the shipped binary instead of a precomputed JSON. Records are stored
53
+ * sorted by (postcode, country), so equal keys are contiguous.
57
54
  */
58
55
  toAnchorLookup(): AnchorLookup;
59
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"postcode-binary-resolver.d.ts","sourceRoot":"","sources":["../postcode-binary-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAOzD,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACX;AAUD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,GAAG,UAAU,CA2C3F;AAED;;;GAGG;AACH,qBAAa,sBAAsB;;gBAStB,KAAK,EAAE,UAAU;IA2B7B,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE;IA2BzC;;;;;;;;;OASG;IACH,cAAc,IAAI,YAAY;CA+C9B"}
1
+ {"version":3,"file":"postcode-binary-resolver.d.ts","sourceRoot":"","sources":["../postcode-binary-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAOzD,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACX;AAUD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,GAAG,UAAU,CA6C3F;AAED;;;GAGG;AACH,qBAAa,sBAAsB;;gBAStB,KAAK,EAAE,UAAU;IAgC7B,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE;IA+BzC;;;;;;;OAOG;IACH,cAAc,IAAI,YAAY;CAuD9B"}
@@ -6,7 +6,7 @@
6
6
  * Browser-side postcode resolver for the anchor (#240). A pure-JS, zero-dependency
7
7
  * `PostcodeResolver` backed by a compact flat binary instead of SQLite, so the postcode anchor
8
8
  * runs in the WASM/browser parser behind the same `lookup()` seam as the server-side
9
- * `WofPostcodeLookup`.
9
+ * `WOFPostcodeLookup`.
10
10
  *
11
11
  * This file owns BOTH ends of the format — `serializePostcodeBinary` (run in Node by
12
12
  * `scripts/build-postcode-binary.ts`) and `PostcodeBinaryResolver` (run in the browser) — so the
@@ -28,17 +28,16 @@ const REC_TAIL = 5; // countryIdx(1) + latQ(2) + lonQ(2)
28
28
  const LAT_Q = 32767 / 90;
29
29
  const LON_Q = 32767 / 180;
30
30
  /**
31
- * Right-pad an ASCII postcode to `width` with NUL; `\0` sorts below any real char, so shorter keys
32
- * order before longer ones with the same prefix, which is what we want.
31
+ * Right-pad an ASCII postcode to `width` with NUL; `\0` sorts below any real char, so shorter keys order before longer
32
+ * ones with the same prefix, which is what we want.
33
33
  */
34
34
  function encodeKey(s, width, out, offset) {
35
35
  for (let i = 0; i < width; i++)
36
36
  out[offset + i] = i < s.length ? s.charCodeAt(i) & 0x7f : 0;
37
37
  }
38
38
  /**
39
- * Serialize postcode entries into the flat binary. Entries are sorted by (postcode, country) so
40
- * equal postcodes land in adjacent records. Run in Node; consumed by
41
- * {@link PostcodeBinaryResolver}.
39
+ * Serialize postcode entries into the flat binary. Entries are sorted by (postcode, country) so equal postcodes land in
40
+ * adjacent records. Run in Node; consumed by {@link PostcodeBinaryResolver}.
42
41
  */
43
42
  export function serializePostcodeBinary(entries) {
44
43
  const sorted = [...entries].sort((a, b) => a.postcode < b.postcode
@@ -80,8 +79,8 @@ export function serializePostcodeBinary(entries) {
80
79
  return buf;
81
80
  }
82
81
  /**
83
- * Pure-JS, browser-safe postcode resolver over the flat binary. Implements the same `lookup()` seam
84
- * as the SQLite `WofPostcodeLookup`, so `extractPostcodeAnchors` is agnostic to which backs it.
82
+ * Pure-JS, browser-safe postcode resolver over the flat binary. Implements the same `lookup()` seam as the SQLite
83
+ * `WOFPostcodeLookup`, so `extractPostcodeAnchors` is agnostic to which backs it.
85
84
  */
86
85
  export class PostcodeBinaryResolver {
87
86
  #buf;
@@ -146,14 +145,12 @@ export class PostcodeBinaryResolver {
146
145
  return out;
147
146
  }
148
147
  /**
149
- * Decode the whole binary into an {@link AnchorLookup} (`Map<postcode, AnchorEntry>`) for the
150
- * neural anchor channel (#239/#240): each postcode → a uniform posterior over its member
151
- * countries
148
+ * Decode the whole binary into an {@link AnchorLookup} (`Map<postcode, AnchorEntry>`) for the neural anchor channel
149
+ * (#239/#240): each postcode → a uniform posterior over its member countries
152
150
  *
153
- * - The mean of its non-zero centroids. This is the browser-side equivalent of the pilot
154
- * postcode→anchor lookup the model trained against, built live from the shipped binary instead
155
- * of a precomputed JSON. Records are stored sorted by (postcode, country), so equal keys are
156
- * contiguous.
151
+ * - The mean of its non-zero centroids. This is the browser-side equivalent of the pilot postcode→anchor lookup the
152
+ * model trained against, built live from the shipped binary instead of a precomputed JSON. Records are stored
153
+ * sorted by (postcode, country), so equal keys are contiguous.
157
154
  */
158
155
  toAnchorLookup() {
159
156
  const out = new Map();