@reventlessdev/reventless-spec 3.0.0-alpha.98 → 3.0.0-alpha.99

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 3.0.0-alpha.99 (2026-08-03)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **geocoding:** calibrate the confidence rule against a real index ([cd72b27](https://github.com/ReventlessDev/reventless-core/commit/cd72b2741460c871db2915a8603f7837b8191187))
11
+
12
+
6
13
  # 3.0.0-alpha.98 (2026-08-03)
7
14
 
8
15
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-spec",
3
- "version": "3.0.0-alpha.98",
3
+ "version": "3.0.0-alpha.99",
4
4
  "description": "Specifications for Reventless",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {
@@ -60,9 +60,35 @@ provider's job, and its canonical rendering comes back as `candidate.label`.
60
60
  */
61
61
  type search = (~text: string) => promise<result<array<candidate>, failure>>
62
62
 
63
- /** The default confidence floor. A starting point, not a finding — the first
64
- real corpus of addresses is what should set it. */
65
- let defaultMinRelevance = 0.8
63
+ /**
64
+ The default confidence floor, calibrated against Amazon Location's Esri index.
65
+
66
+ Measured, not guessed — and the measurement moved it a long way. Esri does not
67
+ spread its scores over 0…1: everything it is willing to return at all lands in
68
+ roughly 0.9…1.0, so a floor of `0.8` admitted almost every answer and left the
69
+ ambiguity margin doing all the work. The separation is up at the top of the
70
+ range instead — in a 24-address corpus the correct pinpoint matches scored
71
+ ≥ 0.988 while the wrong ones (a misspelling resolved to the wrong state, a
72
+ street name matched to a different street in the right city) scored 0.913…0.958.
73
+
74
+ `0.97` sits in that gap. The wider consequence is that these numbers are
75
+ *provider-calibrated* even though everything else in this module is
76
+ provider-neutral, which is exactly why both are labelled arguments: a geocoder
77
+ that scores on a different curve needs its own pair, and the defaults are the
78
+ Esri answer rather than a universal one.
79
+ */
80
+ let defaultMinRelevance = 0.97
81
+
82
+ /**
83
+ How close the runner-up may come before the answer is called ambiguous.
84
+
85
+ Deliberately small, for the same reason the floor is large. Genuine ambiguity in
86
+ Esri shows up as a *tie* — "Springfield" returns five states at exactly 1.0,
87
+ "221B Baker" five towns at exactly 0.8222 — not as a near miss. A wide margin
88
+ does not catch more of those; it only starts rejecting clear winners, because a
89
+ correct match at 0.991 routinely has a plausible runner-up at 0.962.
90
+ */
91
+ let defaultAmbiguityMargin = 0.01
66
92
 
67
93
  /**
68
94
  The one candidate confident enough to store, or `None`.
@@ -81,7 +107,7 @@ a caller that wants to show them.
81
107
  let confidentMatch = (
82
108
  candidates: array<candidate>,
83
109
  ~minRelevance: float=defaultMinRelevance,
84
- ~ambiguityMargin: float=0.1,
110
+ ~ambiguityMargin: float=defaultAmbiguityMargin,
85
111
  ): option<candidate> =>
86
112
  switch candidates->Array.get(0) {
87
113
  | None => None
@@ -3,8 +3,8 @@
3
3
  import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
4
4
 
5
5
  function confidentMatch(candidates, minRelevanceOpt, ambiguityMarginOpt) {
6
- let minRelevance = minRelevanceOpt !== undefined ? minRelevanceOpt : 0.8;
7
- let ambiguityMargin = ambiguityMarginOpt !== undefined ? ambiguityMarginOpt : 0.1;
6
+ let minRelevance = minRelevanceOpt !== undefined ? minRelevanceOpt : 0.97;
7
+ let ambiguityMargin = ambiguityMarginOpt !== undefined ? ambiguityMarginOpt : 0.01;
8
8
  let top = candidates[0];
9
9
  if (top === undefined) {
10
10
  return;
@@ -24,10 +24,13 @@ function confidentMatch(candidates, minRelevanceOpt, ambiguityMarginOpt) {
24
24
  }
25
25
  }
26
26
 
27
- let defaultMinRelevance = 0.8;
27
+ let defaultMinRelevance = 0.97;
28
+
29
+ let defaultAmbiguityMargin = 0.01;
28
30
 
29
31
  export {
30
32
  defaultMinRelevance,
33
+ defaultAmbiguityMargin,
31
34
  confidentMatch,
32
35
  }
33
36
  /* No side effect */