@mailwoman/registry 5.8.0 → 5.10.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.
- package/out/address-key.d.ts +1 -1
- package/out/geocode-handler.d.ts +2 -2
- package/out/geojson.d.ts +1 -1
- package/out/index.d.ts +10 -10
- package/out/ingest.d.ts +1 -1
- package/out/learned-scorer.d.ts +2 -2
- package/out/learned-scorer.js +1 -1
- package/out/map-html.d.ts +1 -1
- package/out/reconcile.d.ts +2 -2
- package/out/reconcile.js +1 -1
- package/out/resolve.d.ts +1 -1
- package/out/tools/coverage-reconciliation.d.ts +51 -0
- package/out/tools/coverage-reconciliation.d.ts.map +1 -0
- package/out/tools/coverage-reconciliation.js +166 -0
- package/out/tools/coverage-reconciliation.js.map +1 -0
- package/out/tools/cross-dataset-correlation.d.ts +49 -0
- package/out/tools/cross-dataset-correlation.d.ts.map +1 -0
- package/out/tools/cross-dataset-correlation.js +340 -0
- package/out/tools/cross-dataset-correlation.js.map +1 -0
- package/out/tools/cross-source-threshold-sweep.d.ts +52 -0
- package/out/tools/cross-source-threshold-sweep.d.ts.map +1 -0
- package/out/tools/cross-source-threshold-sweep.js +328 -0
- package/out/tools/cross-source-threshold-sweep.js.map +1 -0
- package/out/tools/dedup-ceiling.d.ts +21 -3
- package/out/tools/dedup-ceiling.d.ts.map +1 -1
- package/out/tools/dedup-ceiling.js +16 -30
- package/out/tools/dedup-ceiling.js.map +1 -1
- package/out/tools/eval-geocoder.d.ts +45 -0
- package/out/tools/eval-geocoder.d.ts.map +1 -0
- package/out/tools/eval-geocoder.js +14 -0
- package/out/tools/eval-geocoder.js.map +1 -0
- package/out/tools/geocoder-namesake-probe.d.ts +26 -0
- package/out/tools/geocoder-namesake-probe.d.ts.map +1 -0
- package/out/tools/geocoder-namesake-probe.js +59 -0
- package/out/tools/geocoder-namesake-probe.js.map +1 -0
- package/out/tools/geocoder-vs-provided-coords.d.ts +38 -0
- package/out/tools/geocoder-vs-provided-coords.d.ts.map +1 -0
- package/out/tools/geocoder-vs-provided-coords.js +132 -0
- package/out/tools/geocoder-vs-provided-coords.js.map +1 -0
- package/out/tools/gold-set-sample.d.ts +22 -3
- package/out/tools/gold-set-sample.d.ts.map +1 -1
- package/out/tools/gold-set-sample.js +17 -32
- package/out/tools/gold-set-sample.js.map +1 -1
- package/out/tools/index.d.ts +36 -0
- package/out/tools/index.d.ts.map +1 -0
- package/out/tools/index.js +36 -0
- package/out/tools/index.js.map +1 -0
- package/out/tools/learned-scorer-clustering-eval.d.ts +54 -0
- package/out/tools/learned-scorer-clustering-eval.d.ts.map +1 -0
- package/out/tools/learned-scorer-clustering-eval.js +368 -0
- package/out/tools/learned-scorer-clustering-eval.js.map +1 -0
- package/out/tools/learned-scorer-crossstate-eval.d.ts +43 -0
- package/out/tools/learned-scorer-crossstate-eval.d.ts.map +1 -0
- package/out/tools/learned-scorer-crossstate-eval.js +305 -0
- package/out/tools/learned-scorer-crossstate-eval.js.map +1 -0
- package/out/tools/learned-scorer-eval.d.ts +59 -0
- package/out/tools/learned-scorer-eval.d.ts.map +1 -0
- package/out/tools/learned-scorer-eval.js +450 -0
- package/out/tools/learned-scorer-eval.js.map +1 -0
- package/out/tools/matcher-scale.d.ts +17 -3
- package/out/tools/matcher-scale.d.ts.map +1 -1
- package/out/tools/matcher-scale.js +14 -30
- package/out/tools/matcher-scale.js.map +1 -1
- package/out/tools/nppes-dedup-benchmark.d.ts +75 -0
- package/out/tools/nppes-dedup-benchmark.d.ts.map +1 -0
- package/out/tools/nppes-dedup-benchmark.js +846 -0
- package/out/tools/nppes-dedup-benchmark.js.map +1 -0
- package/out/tools/train-cross-gbt.d.ts +58 -0
- package/out/tools/train-cross-gbt.d.ts.map +1 -0
- package/out/tools/train-cross-gbt.js +324 -0
- package/out/tools/train-cross-gbt.js.map +1 -0
- package/out/tools/train-gbt.d.ts +51 -0
- package/out/tools/train-gbt.d.ts.map +1 -0
- package/out/tools/train-gbt.js +268 -0
- package/out/tools/train-gbt.js.map +1 -0
- package/out/tools/train-org-cross-gbt.d.ts +51 -0
- package/out/tools/train-org-cross-gbt.d.ts.map +1 -0
- package/out/tools/train-org-cross-gbt.js +296 -0
- package/out/tools/train-org-cross-gbt.js.map +1 -0
- package/out/tools/txhhsc-to-oarow.d.ts +14 -3
- package/out/tools/txhhsc-to-oarow.d.ts.map +1 -1
- package/out/tools/txhhsc-to-oarow.js +44 -52
- package/out/tools/txhhsc-to-oarow.js.map +1 -1
- package/out/tools/viz/cross-dataset-map.d.ts +23 -4
- package/out/tools/viz/cross-dataset-map.d.ts.map +1 -1
- package/out/tools/viz/cross-dataset-map.js +42 -46
- package/out/tools/viz/cross-dataset-map.js.map +1 -1
- package/out/tools/viz/geocode-first-surface.d.ts +17 -4
- package/out/tools/viz/geocode-first-surface.d.ts.map +1 -1
- package/out/tools/viz/geocode-first-surface.js +71 -78
- package/out/tools/viz/geocode-first-surface.js.map +1 -1
- package/out/tools/viz/render-map.d.ts +17 -3
- package/out/tools/viz/render-map.d.ts.map +1 -1
- package/out/tools/viz/render-map.js +26 -26
- package/out/tools/viz/render-map.js.map +1 -1
- package/out/tools/viz/render.d.ts +21 -3
- package/out/tools/viz/render.d.ts.map +1 -1
- package/out/tools/viz/render.js +43 -39
- package/out/tools/viz/render.js.map +1 -1
- package/out/tools/viz/source-provenance-map.d.ts +24 -5
- package/out/tools/viz/source-provenance-map.d.ts.map +1 -1
- package/out/tools/viz/source-provenance-map.js +53 -62
- package/out/tools/viz/source-provenance-map.js.map +1 -1
- package/out/tools/viz/yardstick-figure.d.ts +11 -3
- package/out/tools/viz/yardstick-figure.d.ts.map +1 -1
- package/out/tools/viz/yardstick-figure.js +68 -73
- package/out/tools/viz/yardstick-figure.js.map +1 -1
- package/package.json +50 -10
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Admin-tier wrong-region probe (#619 tail) — the geocoder-vs-provided-coords eval found an
|
|
7
|
+
* admin-tier tail to 11143 km (p99 2189 km). Hypothesis: when no street shard covers the address,
|
|
8
|
+
* the admin cascade resolves the locality by NAME and (when the region/postcode constraint is
|
|
9
|
+
* weak) picks the population-dominant FOREIGN namesake — Paris→France, Athens→Greece — instead of
|
|
10
|
+
* the in-state Texas city. This probes a curated set of TX namesake cities, with and without ZIP,
|
|
11
|
+
* and flags any result outside the Texas bounding box.
|
|
12
|
+
*
|
|
13
|
+
* Run: `mailwoman registry scorer-eval namesake-probe`
|
|
14
|
+
*/
|
|
15
|
+
import { haversineKm } from "@mailwoman/spatial";
|
|
16
|
+
// TX namesake cities with their real Texas coordinates + the famous foreign/other namesake to watch for.
|
|
17
|
+
const CASES = [
|
|
18
|
+
{ city: "Paris", zip: "75460", tx: [33.66, -95.55], namesake: "Paris, France (48.85, 2.35)" },
|
|
19
|
+
{ city: "Athens", zip: "75751", tx: [32.2, -95.85], namesake: "Athens, Greece (37.98, 23.72)" },
|
|
20
|
+
{ city: "Palestine", zip: "75801", tx: [31.76, -95.63], namesake: "Palestine, Levant (31.9, 35.2)" },
|
|
21
|
+
{ city: "Italy", zip: "76651", tx: [32.18, -96.88], namesake: "Italy, the country (~42, 12)" },
|
|
22
|
+
{ city: "Naples", zip: "75568", tx: [33.2, -94.68], namesake: "Naples, Italy (40.85, 14.27)" },
|
|
23
|
+
{ city: "Dublin", zip: "76446", tx: [32.08, -98.34], namesake: "Dublin, Ireland (53.35, -6.26)" },
|
|
24
|
+
{ city: "Nazareth", zip: "79063", tx: [34.54, -102.1], namesake: "Nazareth, Israel (32.7, 35.3)" },
|
|
25
|
+
{ city: "Odessa", zip: "79761", tx: [31.85, -102.37], namesake: "Odessa, Ukraine (46.48, 30.72)" },
|
|
26
|
+
];
|
|
27
|
+
// Texas bounding box (generous).
|
|
28
|
+
const TX_BBOX = { latMin: 25.8, latMax: 36.6, lonMin: -106.7, lonMax: -93.4 };
|
|
29
|
+
const inTexas = (lat, lon) => lat >= TX_BBOX.latMin && lat <= TX_BBOX.latMax && lon >= TX_BBOX.lonMin && lon <= TX_BBOX.lonMax;
|
|
30
|
+
/** Admin-tier wrong-region probe (#619 tail) — see the module doc. Prints one line per variant to stdout. */
|
|
31
|
+
export async function geocoderNamesakeProbe(options, report) {
|
|
32
|
+
report?.("[A] building the geocoder…");
|
|
33
|
+
const geocoder = await options.createGeocoder();
|
|
34
|
+
const geo = geocoder.geocode;
|
|
35
|
+
report?.("[B] probing TX namesake cities (with ZIP / without ZIP)…\n");
|
|
36
|
+
let wrongRegion = 0;
|
|
37
|
+
let total = 0;
|
|
38
|
+
for (const c of CASES) {
|
|
39
|
+
for (const variant of [`${c.city}, TX ${c.zip}`, `${c.city}, TX`, `${c.city}, Texas`]) {
|
|
40
|
+
total++;
|
|
41
|
+
const g = await geo(variant);
|
|
42
|
+
if (g.lat === null || g.lon === null) {
|
|
43
|
+
console.log(` ✗ "${variant}" → UNPLACED`);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const ok = inTexas(g.lat, g.lon);
|
|
47
|
+
const km = haversineKm(c.tx[0], c.tx[1], g.lat, g.lon);
|
|
48
|
+
if (!ok) {
|
|
49
|
+
wrongRegion++;
|
|
50
|
+
}
|
|
51
|
+
console.log(` ${ok ? "✓" : "✗ WRONG-REGION"} "${variant}" → ${g.lat.toFixed(3)},${g.lon.toFixed(3)} ` +
|
|
52
|
+
`[${g.resolution_tier ?? "?"}] ${km > 100 ? `${km.toFixed(0)}km off TX (cf ${c.namesake})` : `${(km * 1000).toFixed(0)}m off`}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
geocoder.close();
|
|
56
|
+
console.log(`\n ${wrongRegion}/${total} variants resolved OUTSIDE Texas (wrong-region).`);
|
|
57
|
+
return { wrongRegion, total };
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=geocoder-namesake-probe.js.map
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copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Geocoder validation against provided coordinates (#619) — a free, honest, real-world accuracy
|
|
7
|
+
* eval.
|
|
8
|
+
*
|
|
9
|
+
* TX HHSC's nursing-facilities registry ships a `Geo Location` (`lat,lon`) per facility alongside
|
|
10
|
+
* its physical address. We geocode the address with mailwoman's real parser + resolver and
|
|
11
|
+
* measure the great-circle delta to the provided point — p50 / p90, broken down by the resolution
|
|
12
|
+
* tier we assign (address_point / interpolated / admin). This is an independent check of the
|
|
13
|
+
* geocoder on real facility addresses; it does not touch the matcher.
|
|
14
|
+
*
|
|
15
|
+
* The provided coordinate is treated as ground truth for _this_ eval, with the honest caveat that
|
|
16
|
+
* it is itself a third-party geocode of unknown provenance — a large delta is a discrepancy to
|
|
17
|
+
* inspect, not automatically our error.
|
|
18
|
+
*
|
|
19
|
+
* Run: `mailwoman registry scorer-eval vs-provided-coords [--max 1176] [--wof <admin.db>]
|
|
20
|
+
* [--data-root <dir>] [--out-md docs/articles/evals/<date>-...md]`
|
|
21
|
+
*/
|
|
22
|
+
import type { EvalGeocoderFactory } from "./eval-geocoder.ts";
|
|
23
|
+
/** Options for {@linkcode geocoderVsProvidedCoords}. */
|
|
24
|
+
export interface GeocoderVsProvidedCoordsOptions {
|
|
25
|
+
/** The injected geocoder factory (the command wires `mailwoman/geocode-core`; see `./eval-geocoder.ts`). */
|
|
26
|
+
createGeocoder: EvalGeocoderFactory;
|
|
27
|
+
/** Record-matcher sources directory. Default `$MAILWOMAN_DATA_ROOT/record-matcher/sources`. */
|
|
28
|
+
sources?: string;
|
|
29
|
+
/** Facilities geocoded. Default 2000. */
|
|
30
|
+
max?: number;
|
|
31
|
+
/** Also write the markdown report here. */
|
|
32
|
+
outMd?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Geocoder validation against provided coordinates (#619) — see the module doc. Emits the report to stdout. */
|
|
35
|
+
export declare function geocoderVsProvidedCoords(options: GeocoderVsProvidedCoordsOptions, report?: (line: string) => void): Promise<{
|
|
36
|
+
markdown: string;
|
|
37
|
+
}>;
|
|
38
|
+
//# sourceMappingURL=geocoder-vs-provided-coords.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geocoder-vs-provided-coords.d.ts","sourceRoot":"","sources":["../../tools/geocoder-vs-provided-coords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAQH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,wDAAwD;AACxD,MAAM,WAAW,+BAA+B;IAC/C,4GAA4G;IAC5G,cAAc,EAAE,mBAAmB,CAAA;IACnC,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,yCAAyC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAoBD,gHAAgH;AAChH,wBAAsB,wBAAwB,CAC7C,OAAO,EAAE,+BAA+B,EACxC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAmH/B"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Geocoder validation against provided coordinates (#619) — a free, honest, real-world accuracy
|
|
7
|
+
* eval.
|
|
8
|
+
*
|
|
9
|
+
* TX HHSC's nursing-facilities registry ships a `Geo Location` (`lat,lon`) per facility alongside
|
|
10
|
+
* its physical address. We geocode the address with mailwoman's real parser + resolver and
|
|
11
|
+
* measure the great-circle delta to the provided point — p50 / p90, broken down by the resolution
|
|
12
|
+
* tier we assign (address_point / interpolated / admin). This is an independent check of the
|
|
13
|
+
* geocoder on real facility addresses; it does not touch the matcher.
|
|
14
|
+
*
|
|
15
|
+
* The provided coordinate is treated as ground truth for _this_ eval, with the honest caveat that
|
|
16
|
+
* it is itself a third-party geocode of unknown provenance — a large delta is a discrepancy to
|
|
17
|
+
* inspect, not automatically our error.
|
|
18
|
+
*
|
|
19
|
+
* Run: `mailwoman registry scorer-eval vs-provided-coords [--max 1176] [--wof <admin.db>]
|
|
20
|
+
* [--data-root <dir>] [--out-md docs/articles/evals/<date>-...md]`
|
|
21
|
+
*/
|
|
22
|
+
import { writeFileSync } from "node:fs";
|
|
23
|
+
import { dataRootPath, percentile } from "@mailwoman/core/utils";
|
|
24
|
+
import { haversineKm } from "@mailwoman/match";
|
|
25
|
+
import { streamRows } from "@mailwoman/registry";
|
|
26
|
+
const norm = (s) => (s ?? "").trim();
|
|
27
|
+
/** Parse a `lat,lon` string into a coordinate, or null if malformed / out of range. */
|
|
28
|
+
function parseLatLon(raw) {
|
|
29
|
+
if (!raw)
|
|
30
|
+
return null;
|
|
31
|
+
const [a, b] = raw.split(",").map((x) => Number(x.trim()));
|
|
32
|
+
if (!Number.isFinite(a) || !Number.isFinite(b))
|
|
33
|
+
return null;
|
|
34
|
+
if (Math.abs(a) > 90 || Math.abs(b) > 180)
|
|
35
|
+
return null;
|
|
36
|
+
return { latitude: a, longitude: b };
|
|
37
|
+
}
|
|
38
|
+
// The core nearest-rank `percentile` (q in [0,100]) replaces the retired local `quantile(sorted, q)`
|
|
39
|
+
// — byte-identical semantics (floor index, clamped); `?? NaN` preserves the empty-sample behavior.
|
|
40
|
+
const quantile = (xs, q) => percentile(xs, q * 100) ?? NaN;
|
|
41
|
+
/** Geocoder validation against provided coordinates (#619) — see the module doc. Emits the report to stdout. */
|
|
42
|
+
export async function geocoderVsProvidedCoords(options, report) {
|
|
43
|
+
const SOURCES = options.sources || dataRootPath("record-matcher", "sources");
|
|
44
|
+
const MAX = options.max ?? 2000;
|
|
45
|
+
const OUT_MD = options.outMd || "";
|
|
46
|
+
const FILE = `${SOURCES}/txhhsc_nursing-facilities_20260611.tsv`;
|
|
47
|
+
report?.("[A] building the geocoder…");
|
|
48
|
+
const geocoder = await options.createGeocoder();
|
|
49
|
+
report?.(`[B] geocoding ≤${MAX} TX nursing facilities + measuring delta to provided coords…`);
|
|
50
|
+
const results = [];
|
|
51
|
+
let scanned = 0;
|
|
52
|
+
let noCoord = 0;
|
|
53
|
+
let noPlace = 0;
|
|
54
|
+
for await (const r of streamRows(FILE)) {
|
|
55
|
+
if (results.length >= MAX)
|
|
56
|
+
break;
|
|
57
|
+
const provided = parseLatLon(r["Geo Location"]);
|
|
58
|
+
const line = norm(r["Physical Address"]);
|
|
59
|
+
const city = norm(r["Physical Address CITY"]);
|
|
60
|
+
const state = norm(r["Physical Address State"]);
|
|
61
|
+
const zip = norm(r["Physical Address Zipcode"]);
|
|
62
|
+
if (!provided || !line) {
|
|
63
|
+
noCoord++;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
scanned++;
|
|
67
|
+
const address = [line, city, state, zip].filter(Boolean).join(", ");
|
|
68
|
+
const g = await geocoder.geocode(address);
|
|
69
|
+
if (g.lat === null || g.lon === null) {
|
|
70
|
+
noPlace++;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const deltaM = haversineKm(provided, { latitude: g.lat, longitude: g.lon }) * 1000;
|
|
74
|
+
results.push({ deltaM, tier: g.resolution_tier ?? "unknown" });
|
|
75
|
+
}
|
|
76
|
+
geocoder.close();
|
|
77
|
+
// Overall + per-tier percentiles.
|
|
78
|
+
const all = results.map((r) => r.deltaM).sort((a, b) => a - b);
|
|
79
|
+
const byTier = new Map();
|
|
80
|
+
for (const r of results) {
|
|
81
|
+
const list = byTier.get(r.tier) ?? [];
|
|
82
|
+
list.push(r.deltaM);
|
|
83
|
+
byTier.set(r.tier, list);
|
|
84
|
+
}
|
|
85
|
+
const m = (x) => (x >= 1000 ? `${(x / 1000).toFixed(2)} km` : `${Math.round(x)} m`);
|
|
86
|
+
report?.(` geocoded ${results.length}/${scanned} placed (${noPlace} unplaced, ${noCoord} skipped no-coord/addr); ` +
|
|
87
|
+
`p50 ${m(quantile(all, 0.5))}, p90 ${m(quantile(all, 0.9))}`);
|
|
88
|
+
const lines = [];
|
|
89
|
+
lines.push(`# Geocoder vs provided coordinates (#619)`);
|
|
90
|
+
lines.push("");
|
|
91
|
+
lines.push(`_Generated by \`mailwoman registry scorer-eval vs-provided-coords\`. Source: TX HHSC ` +
|
|
92
|
+
`nursing-facilities (\`Geo Location\` = provided \`lat,lon\`). We geocode each facility's physical address ` +
|
|
93
|
+
`with mailwoman's parser + resolver and measure the great-circle delta to the provided point. The provided ` +
|
|
94
|
+
`coordinate is a third-party geocode of unknown provenance — a large delta is a discrepancy to inspect, not ` +
|
|
95
|
+
`automatically our error._`);
|
|
96
|
+
lines.push("");
|
|
97
|
+
lines.push(`## Result`);
|
|
98
|
+
lines.push("");
|
|
99
|
+
lines.push(`- facilities geocoded: **${results.length}** of ${scanned} with a usable address + provided coord`);
|
|
100
|
+
lines.push(`- unplaced by our geocoder: ${noPlace} · skipped (no coord / no address): ${noCoord}`);
|
|
101
|
+
lines.push(`- **overall delta: p50 ${m(quantile(all, 0.5))}, p90 ${m(quantile(all, 0.9))}, p99 ${m(quantile(all, 0.99))}** ` +
|
|
102
|
+
`(max ${m(all[all.length - 1] ?? 0)})`);
|
|
103
|
+
lines.push("");
|
|
104
|
+
lines.push(`## By resolution tier`);
|
|
105
|
+
lines.push("");
|
|
106
|
+
lines.push(`| tier | n | p50 | p90 |`);
|
|
107
|
+
lines.push(`|---|---:|---:|---:|`);
|
|
108
|
+
for (const [tier, list] of [...byTier.entries()].sort((a, b) => b[1].length - a[1].length)) {
|
|
109
|
+
const s = [...list].sort((a, b) => a - b);
|
|
110
|
+
lines.push(`| ${tier} | ${list.length} | ${m(quantile(s, 0.5))} | ${m(quantile(s, 0.9))} |`);
|
|
111
|
+
}
|
|
112
|
+
lines.push("");
|
|
113
|
+
lines.push(`## Reading`);
|
|
114
|
+
lines.push("");
|
|
115
|
+
lines.push(`Two regimes. **Street-tier placement is excellent** (the address_point + interpolated rows above) — ` +
|
|
116
|
+
`rooftop-to-segment medians, the precision that makes geo-first blocking and the distance evidence ` +
|
|
117
|
+
`trustworthy. The **admin (centroid) tier** is where no street shard covered the address: accuracy is ` +
|
|
118
|
+
`necessarily km-scale, and it carries a catastrophic tail (the p90/p99/max above) from wrong-region admin ` +
|
|
119
|
+
`resolutions and/or malformed provided coordinates — NOT street-tier error. Those extremes are a signal to ` +
|
|
120
|
+
`inspect, and they motivate wider street-shard coverage for rural TX plus an admin-tier sanity bound. The ` +
|
|
121
|
+
`self-reported-vs-independent coordinate discrepancy is itself a data-quality column the reconciliation ` +
|
|
122
|
+
`surfaces (#621).`);
|
|
123
|
+
lines.push("");
|
|
124
|
+
const md = lines.join("\n");
|
|
125
|
+
console.log(md);
|
|
126
|
+
if (OUT_MD) {
|
|
127
|
+
writeFileSync(OUT_MD, md);
|
|
128
|
+
report?.(`\n[written] ${OUT_MD}`);
|
|
129
|
+
}
|
|
130
|
+
return { markdown: md };
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=geocoder-vs-provided-coords.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geocoder-vs-provided-coords.js","sourceRoot":"","sources":["../../tools/geocoder-vs-provided-coords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAgBhD,MAAM,IAAI,GAAG,CAAC,CAAqB,EAAE,EAAE,CAAC,CAAC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,CAAA;IAClC,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;AACxB,CAAC"}
|
|
@@ -16,8 +16,27 @@
|
|
|
16
16
|
* (human or LLM-as-judge, flagged as such) can label "same real-world entity? yes/no" and we can
|
|
17
17
|
* MEASURE how often the programmatic truth matches judgment.
|
|
18
18
|
*
|
|
19
|
-
* Run:
|
|
20
|
-
* [--
|
|
19
|
+
* Run: `mailwoman registry gold-set-sample [--cap 200000] [--state TX] [--tau 0.7] [--n 300]
|
|
20
|
+
* [--out-jsonl <path>]`
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
/** Options for {@linkcode goldSetSample}. */
|
|
23
|
+
export interface GoldSetSampleOptions {
|
|
24
|
+
/** Record-matcher sources directory. Default `$MAILWOMAN_DATA_ROOT/record-matcher/sources`. */
|
|
25
|
+
sources?: string;
|
|
26
|
+
/** Providers sampled from the registry. Default 200000. */
|
|
27
|
+
cap?: number;
|
|
28
|
+
/** State filter. Default TX. */
|
|
29
|
+
state?: string;
|
|
30
|
+
/** Org-name Jaccard collision threshold. Default 0.7. */
|
|
31
|
+
tau?: number;
|
|
32
|
+
/** Adjudication sample size. Default 300. */
|
|
33
|
+
n?: number;
|
|
34
|
+
/** Write the sampled pairs here as JSONL (otherwise the first 10 print to stdout). */
|
|
35
|
+
outJsonl?: string;
|
|
36
|
+
}
|
|
37
|
+
/** Gold-set P3 (#625) — sample the HARD co-located name-collision slice for adjudication. */
|
|
38
|
+
export declare function goldSetSample(options?: GoldSetSampleOptions, report?: (line: string) => void): Promise<{
|
|
39
|
+
hardPairs: number;
|
|
40
|
+
sampled: number;
|
|
41
|
+
}>;
|
|
23
42
|
//# sourceMappingURL=gold-set-sample.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gold-set-sample.d.ts","sourceRoot":"","sources":["../../tools/gold-set-sample.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}
|
|
1
|
+
{"version":3,"file":"gold-set-sample.d.ts","sourceRoot":"","sources":["../../tools/gold-set-sample.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAOH,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACpC,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,6CAA6C;IAC7C,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAmED,6FAA6F;AAC7F,wBAAsB,aAAa,CAClC,OAAO,GAAE,oBAAyB,EAClC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA0HjD"}
|
|
@@ -16,35 +16,12 @@
|
|
|
16
16
|
* (human or LLM-as-judge, flagged as such) can label "same real-world entity? yes/no" and we can
|
|
17
17
|
* MEASURE how often the programmatic truth matches judgment.
|
|
18
18
|
*
|
|
19
|
-
* Run:
|
|
20
|
-
* [--
|
|
19
|
+
* Run: `mailwoman registry gold-set-sample [--cap 200000] [--state TX] [--tau 0.7] [--n 300]
|
|
20
|
+
* [--out-jsonl <path>]`
|
|
21
21
|
*/
|
|
22
22
|
import { writeFileSync } from "node:fs";
|
|
23
|
-
import { parseArgs } from "node:util";
|
|
24
23
|
import { dataRootPath } from "@mailwoman/core/utils";
|
|
25
24
|
import { addressFrequencyKey, streamRows } from "@mailwoman/registry";
|
|
26
|
-
// Loose scan parity with the retired local argv helpers: unknown flags tolerated.
|
|
27
|
-
const { values: rawValues } = parseArgs({
|
|
28
|
-
options: {
|
|
29
|
-
cap: { type: "string" },
|
|
30
|
-
n: { type: "string" },
|
|
31
|
-
"out-jsonl": { type: "string" },
|
|
32
|
-
sources: { type: "string" },
|
|
33
|
-
state: { type: "string" },
|
|
34
|
-
tau: { type: "string" },
|
|
35
|
-
},
|
|
36
|
-
strict: false,
|
|
37
|
-
allowPositionals: true,
|
|
38
|
-
});
|
|
39
|
-
// Typed view: strict:false loosens TS inference, but declared options always parse to their schema type.
|
|
40
|
-
const values = rawValues;
|
|
41
|
-
const SOURCES = values["sources"] || dataRootPath("record-matcher", "sources");
|
|
42
|
-
const CAP = Number(values["cap"] || "200000");
|
|
43
|
-
const STATE = (values["state"] || "TX").toUpperCase();
|
|
44
|
-
const TAU = Number(values["tau"] || "0.7");
|
|
45
|
-
const N = Number(values["n"] || "300");
|
|
46
|
-
const OUT = values["out-jsonl"] || "";
|
|
47
|
-
const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`;
|
|
48
25
|
const norm = (s) => (s ?? "").trim();
|
|
49
26
|
const STOP = new Set([
|
|
50
27
|
"llc",
|
|
@@ -95,8 +72,16 @@ const C = {
|
|
|
95
72
|
parentLBN: "Parent Organization LBN",
|
|
96
73
|
parentTIN: "Parent Organization TIN",
|
|
97
74
|
};
|
|
98
|
-
|
|
99
|
-
|
|
75
|
+
/** Gold-set P3 (#625) — sample the HARD co-located name-collision slice for adjudication. */
|
|
76
|
+
export async function goldSetSample(options = {}, report) {
|
|
77
|
+
const SOURCES = options.sources || dataRootPath("record-matcher", "sources");
|
|
78
|
+
const CAP = options.cap ?? 200000;
|
|
79
|
+
const STATE = (options.state || "TX").toUpperCase();
|
|
80
|
+
const TAU = options.tau ?? 0.7;
|
|
81
|
+
const N = options.n ?? 300;
|
|
82
|
+
const OUT = options.outJsonl || "";
|
|
83
|
+
const REGISTRY = `${SOURCES}/nppes_npi-registry_20260607.tsv`;
|
|
84
|
+
report?.(`[A] streaming ${STATE} org providers (cap ${CAP})…`);
|
|
100
85
|
const byAddr = new Map();
|
|
101
86
|
let kept = 0;
|
|
102
87
|
for await (const r of streamRows(REGISTRY)) {
|
|
@@ -130,7 +115,7 @@ async function main() {
|
|
|
130
115
|
if (kept >= CAP)
|
|
131
116
|
break;
|
|
132
117
|
}
|
|
133
|
-
|
|
118
|
+
report?.(` ${kept} providers at ${byAddr.size} addresses`);
|
|
134
119
|
const hard = [];
|
|
135
120
|
for (const provs of byAddr.values()) {
|
|
136
121
|
const distinct = new Map();
|
|
@@ -172,20 +157,20 @@ async function main() {
|
|
|
172
157
|
}
|
|
173
158
|
}
|
|
174
159
|
}
|
|
175
|
-
|
|
160
|
+
report?.(` ${hard.length} hard co-located name-collision pairs (non-flagged-subpart)`);
|
|
176
161
|
// Deterministic spread sample of N (stride, not head — avoid file-order bias, the dedup-ceiling lesson).
|
|
177
162
|
const stride = Math.max(1, Math.floor(hard.length / N));
|
|
178
163
|
const sample = hard.filter((_, i) => i % stride === 0).slice(0, N);
|
|
179
|
-
|
|
164
|
+
report?.(` sampling ${sample.length} (stride ${stride}) for adjudication`);
|
|
180
165
|
if (OUT) {
|
|
181
166
|
writeFileSync(OUT, sample.map((p) => JSON.stringify(p)).join("\n") + "\n");
|
|
182
|
-
|
|
167
|
+
report?.(`[written] ${OUT}`);
|
|
183
168
|
}
|
|
184
169
|
else {
|
|
185
170
|
for (const p of sample.slice(0, 10)) {
|
|
186
171
|
console.log(JSON.stringify(p));
|
|
187
172
|
}
|
|
188
173
|
}
|
|
174
|
+
return { hardPairs: hard.length, sampled: sample.length };
|
|
189
175
|
}
|
|
190
|
-
await main();
|
|
191
176
|
//# sourceMappingURL=gold-set-sample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gold-set-sample.js","sourceRoot":"","sources":["../../tools/gold-set-sample.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":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
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Registry operator tools — the `run()`-style modules behind `mailwoman registry …` commands. No
|
|
7
|
+
* argv, no `process.exit`: commands own parsing, rendering, and exit codes (see the 2026-07-09
|
|
8
|
+
* scripts→Pastel spec). The heavy geocoder is INJECTED via {@link EvalGeocoderFactory} — the
|
|
9
|
+
* registry package never imports the runtime (`mailwoman` depends on this package, so the reverse
|
|
10
|
+
* import would cycle). Heavy render deps (playwright/Chromium) are lazy-imported inside their
|
|
11
|
+
* entry fns.
|
|
12
|
+
*/
|
|
13
|
+
export * from "./coverage-reconciliation.ts";
|
|
14
|
+
export * from "./cross-dataset-correlation.ts";
|
|
15
|
+
export * from "./cross-source-threshold-sweep.ts";
|
|
16
|
+
export * from "./dedup-ceiling.ts";
|
|
17
|
+
export * from "./eval-geocoder.ts";
|
|
18
|
+
export * from "./geocoder-namesake-probe.ts";
|
|
19
|
+
export * from "./geocoder-vs-provided-coords.ts";
|
|
20
|
+
export * from "./gold-set-sample.ts";
|
|
21
|
+
export * from "./learned-scorer-clustering-eval.ts";
|
|
22
|
+
export * from "./learned-scorer-crossstate-eval.ts";
|
|
23
|
+
export * from "./learned-scorer-eval.ts";
|
|
24
|
+
export * from "./matcher-scale.ts";
|
|
25
|
+
export * from "./nppes-dedup-benchmark.ts";
|
|
26
|
+
export * from "./train-cross-gbt.ts";
|
|
27
|
+
export * from "./train-gbt.ts";
|
|
28
|
+
export * from "./train-org-cross-gbt.ts";
|
|
29
|
+
export * from "./txhhsc-to-oarow.ts";
|
|
30
|
+
export * from "./viz/cross-dataset-map.ts";
|
|
31
|
+
export * from "./viz/geocode-first-surface.ts";
|
|
32
|
+
export * from "./viz/render-map.ts";
|
|
33
|
+
export * from "./viz/render.ts";
|
|
34
|
+
export * from "./viz/source-provenance-map.ts";
|
|
35
|
+
export * from "./viz/yardstick-figure.ts";
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,8BAA8B,CAAA;AAC5C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mCAAmC,CAAA;AACjD,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kCAAkC,CAAA;AAChD,cAAc,sBAAsB,CAAA;AACpC,cAAc,qCAAqC,CAAA;AACnD,cAAc,qCAAqC,CAAA;AACnD,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gCAAgC,CAAA;AAC9C,cAAc,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Registry operator tools — the `run()`-style modules behind `mailwoman registry …` commands. No
|
|
7
|
+
* argv, no `process.exit`: commands own parsing, rendering, and exit codes (see the 2026-07-09
|
|
8
|
+
* scripts→Pastel spec). The heavy geocoder is INJECTED via {@link EvalGeocoderFactory} — the
|
|
9
|
+
* registry package never imports the runtime (`mailwoman` depends on this package, so the reverse
|
|
10
|
+
* import would cycle). Heavy render deps (playwright/Chromium) are lazy-imported inside their
|
|
11
|
+
* entry fns.
|
|
12
|
+
*/
|
|
13
|
+
export * from "./coverage-reconciliation.js";
|
|
14
|
+
export * from "./cross-dataset-correlation.js";
|
|
15
|
+
export * from "./cross-source-threshold-sweep.js";
|
|
16
|
+
export * from "./dedup-ceiling.js";
|
|
17
|
+
export * from "./eval-geocoder.js";
|
|
18
|
+
export * from "./geocoder-namesake-probe.js";
|
|
19
|
+
export * from "./geocoder-vs-provided-coords.js";
|
|
20
|
+
export * from "./gold-set-sample.js";
|
|
21
|
+
export * from "./learned-scorer-clustering-eval.js";
|
|
22
|
+
export * from "./learned-scorer-crossstate-eval.js";
|
|
23
|
+
export * from "./learned-scorer-eval.js";
|
|
24
|
+
export * from "./matcher-scale.js";
|
|
25
|
+
export * from "./nppes-dedup-benchmark.js";
|
|
26
|
+
export * from "./train-cross-gbt.js";
|
|
27
|
+
export * from "./train-gbt.js";
|
|
28
|
+
export * from "./train-org-cross-gbt.js";
|
|
29
|
+
export * from "./txhhsc-to-oarow.js";
|
|
30
|
+
export * from "./viz/cross-dataset-map.js";
|
|
31
|
+
export * from "./viz/geocode-first-surface.js";
|
|
32
|
+
export * from "./viz/render-map.js";
|
|
33
|
+
export * from "./viz/render.js";
|
|
34
|
+
export * from "./viz/source-provenance-map.js";
|
|
35
|
+
export * from "./viz/yardstick-figure.js";
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,8BAA8B,CAAA;AAC5C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mCAAmC,CAAA;AACjD,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kCAAkC,CAAA;AAChD,cAAc,sBAAsB,CAAA;AACpC,cAAc,qCAAqC,CAAA;AACnD,cAAc,qCAAqC,CAAA;AACnD,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gCAAgC,CAAA;AAC9C,cAAc,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Learned-scorer CLUSTERING A/B (#603 Tier 2) — the definitive test the pairwise probe
|
|
7
|
+
* (`learned-scorer-eval.ts`) deferred. The probe showed a learned scorer ranks candidate pairs
|
|
8
|
+
* better than Fellegi-Sunter (GBT +0.0177 AUC, +6.6pp pairwise F1); a better pairwise scorer need
|
|
9
|
+
* NOT lift the assembled clustering F1 (clustering depends on the threshold +
|
|
10
|
+
* connected-components). This measures the clustering F1 directly, leakage-free:
|
|
11
|
+
*
|
|
12
|
+
* 1. Sample NPI-keyed records (real registry + name-drift + address-variation), geocode once.
|
|
13
|
+
* 2. Split the NPIs into TRAIN / EVAL. Train a GBT + an LR on pairs blocked among TRAIN records (label
|
|
14
|
+
* = same-NPI). The eval NPIs' records are never seen in training.
|
|
15
|
+
* 3. Cluster the EVAL records three ways via the SAME `resolveEntities` pipeline (block → score →
|
|
16
|
+
* connected-components) — once with the FS baseline, once with the GBT as the link scorer
|
|
17
|
+
* (the new `ResolveConfig.scorer` hook), once with the LR. Sweep the link threshold for
|
|
18
|
+
* each; take best F1.
|
|
19
|
+
* 4. Report the eval clustering F1 (the dedup benchmark's metric): does the learned scorer beat the FS
|
|
20
|
+
* baseline on the ASSEMBLED output, not just pairwise ranking?
|
|
21
|
+
*
|
|
22
|
+
* The FS arm IS the benchmark's baseline (same model: address-frequency + collapsed spatial,
|
|
23
|
+
* EM-fit), so the comparison is credible. Honest framing: in-domain (one state), a held-out-NPI
|
|
24
|
+
* split (not a held-out STATE — generalization across states is the next axis), a compact
|
|
25
|
+
* pure-Node GBT.
|
|
26
|
+
*
|
|
27
|
+
* Run: `mailwoman registry scorer-eval clustering [--npis 2000] [--split 0.67] [--seed 1]
|
|
28
|
+
* [--out-md <md>]`
|
|
29
|
+
*/
|
|
30
|
+
import type { EvalGeocoderFactory } from "./eval-geocoder.ts";
|
|
31
|
+
/** Options for {@linkcode scorerClusteringEval}. */
|
|
32
|
+
export interface ScorerClusteringEvalOptions {
|
|
33
|
+
/** The injected geocoder factory (the command wires `mailwoman/geocode-core`; see `./eval-geocoder.ts`). */
|
|
34
|
+
createGeocoder: EvalGeocoderFactory;
|
|
35
|
+
/** Record-matcher sources directory. Default `$MAILWOMAN_DATA_ROOT/record-matcher/sources`. */
|
|
36
|
+
sources?: string;
|
|
37
|
+
/** State filter. Default TX. */
|
|
38
|
+
state?: string;
|
|
39
|
+
/** NPIs sampled. Default 2000. */
|
|
40
|
+
npis?: number;
|
|
41
|
+
/** Train fraction of the NPI split. Default 0.67. */
|
|
42
|
+
split?: number;
|
|
43
|
+
/** Base PRNG seed. Default 1. */
|
|
44
|
+
seed?: number;
|
|
45
|
+
/** Held-out-NPI splits averaged. Default 4. */
|
|
46
|
+
seeds?: number;
|
|
47
|
+
/** Also write the markdown report here. */
|
|
48
|
+
outMd?: string;
|
|
49
|
+
}
|
|
50
|
+
/** Learned-scorer clustering A/B (#603 Tier 2) — see the module doc. Emits the markdown report to stdout. */
|
|
51
|
+
export declare function scorerClusteringEval(options: ScorerClusteringEvalOptions, report?: (line: string) => void): Promise<{
|
|
52
|
+
markdown: string;
|
|
53
|
+
}>;
|
|
54
|
+
//# sourceMappingURL=learned-scorer-clustering-eval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learned-scorer-clustering-eval.d.ts","sourceRoot":"","sources":["../../tools/learned-scorer-clustering-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAmBH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,oDAAoD;AACpD,MAAM,WAAW,2BAA2B;IAC3C,4GAA4G;IAC5G,cAAc,EAAE,mBAAmB,CAAA;IACnC,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAoFD,6GAA6G;AAC7G,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,2BAA2B,EACpC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA6V/B"}
|