@mailwoman/resolver-wof-sqlite 4.16.2 → 5.0.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-point-interpolation.d.ts.map +1 -1
- package/out/address-point-interpolation.js +6 -6
- package/out/address-point-interpolation.js.map +1 -1
- package/out/address-point-schema.d.ts +5 -6
- package/out/address-point-schema.d.ts.map +1 -1
- package/out/address-point-schema.js +7 -2
- package/out/address-point-schema.js.map +1 -1
- package/out/address-point.d.ts +22 -8
- package/out/address-point.d.ts.map +1 -1
- package/out/address-point.js +29 -13
- package/out/address-point.js.map +1 -1
- package/out/ancestry-backfill.d.ts +53 -0
- package/out/ancestry-backfill.d.ts.map +1 -0
- package/out/ancestry-backfill.js +150 -0
- package/out/ancestry-backfill.js.map +1 -0
- package/out/ancestry.d.ts +6 -6
- package/out/ancestry.d.ts.map +1 -1
- package/out/ancestry.js +6 -6
- package/out/ancestry.js.map +1 -1
- package/out/build-candidate-cli.d.ts.map +1 -1
- package/out/build-candidate-cli.js.map +1 -1
- package/out/build-candidate.d.ts +4 -5
- package/out/build-candidate.d.ts.map +1 -1
- package/out/build-candidate.js +15 -14
- package/out/build-candidate.js.map +1 -1
- package/out/build-coincident-roles-cli.d.ts.map +1 -1
- package/out/build-coincident-roles-cli.js.map +1 -1
- package/out/build-fts-cli.d.ts +1 -1
- package/out/build-fts-cli.d.ts.map +1 -1
- package/out/build-fts-cli.js +6 -6
- package/out/build-fts-cli.js.map +1 -1
- package/out/build-slim-cli.d.ts +1 -1
- package/out/build-slim-cli.d.ts.map +1 -1
- package/out/build-slim-cli.js +3 -3
- package/out/build-slim-cli.js.map +1 -1
- package/out/build-slim.d.ts +7 -8
- package/out/build-slim.d.ts.map +1 -1
- package/out/build-slim.js +9 -9
- package/out/build-slim.js.map +1 -1
- package/out/candidate-fts.d.ts +5 -7
- package/out/candidate-fts.d.ts.map +1 -1
- package/out/candidate-fts.js +5 -7
- package/out/candidate-fts.js.map +1 -1
- package/out/candidate-lookup.d.ts +7 -7
- package/out/candidate-lookup.d.ts.map +1 -1
- package/out/candidate-lookup.js +31 -35
- package/out/candidate-lookup.js.map +1 -1
- package/out/candidate-schema.d.ts +13 -14
- package/out/candidate-schema.d.ts.map +1 -1
- package/out/candidate-schema.js +9 -9
- package/out/candidate-schema.js.map +1 -1
- package/out/coincident-roles.d.ts +9 -11
- package/out/coincident-roles.d.ts.map +1 -1
- package/out/coincident-roles.js +7 -7
- package/out/coincident-roles.js.map +1 -1
- package/out/convention.d.ts +30 -35
- package/out/convention.d.ts.map +1 -1
- package/out/convention.js +19 -21
- package/out/convention.js.map +1 -1
- package/out/fst-autocomplete.d.ts +5 -5
- package/out/fst-autocomplete.d.ts.map +1 -1
- package/out/fst-autocomplete.js +12 -13
- package/out/fst-autocomplete.js.map +1 -1
- package/out/fst-builder.d.ts +7 -7
- package/out/fst-builder.d.ts.map +1 -1
- package/out/fst-builder.js +9 -9
- package/out/fst-builder.js.map +1 -1
- package/out/fst-deserialize-web.d.ts +4 -4
- package/out/fst-deserialize-web.d.ts.map +1 -1
- package/out/fst-deserialize-web.js +4 -4
- package/out/fst-deserialize-web.js.map +1 -1
- package/out/fst-matcher.d.ts +12 -12
- package/out/fst-matcher.d.ts.map +1 -1
- package/out/fst-matcher.js +25 -25
- package/out/fst-matcher.js.map +1 -1
- package/out/fst-serialize.d.ts +5 -5
- package/out/fst-serialize.d.ts.map +1 -1
- package/out/fst-serialize.js +7 -6
- package/out/fst-serialize.js.map +1 -1
- package/out/fst-types.d.ts +13 -13
- package/out/fts.d.ts +74 -80
- package/out/fts.d.ts.map +1 -1
- package/out/fts.js +65 -71
- package/out/fts.js.map +1 -1
- package/out/geo.d.ts +14 -15
- package/out/geo.d.ts.map +1 -1
- package/out/geo.js +8 -8
- package/out/geo.js.map +1 -1
- package/out/geonames-aliases.d.ts +18 -9
- package/out/geonames-aliases.d.ts.map +1 -1
- package/out/geonames-aliases.js +70 -12
- package/out/geonames-aliases.js.map +1 -1
- package/out/index.d.ts +9 -9
- package/out/index.js +7 -7
- package/out/interpolation.d.ts +8 -10
- package/out/interpolation.d.ts.map +1 -1
- package/out/interpolation.js +6 -6
- package/out/interpolation.js.map +1 -1
- package/out/lookup.d.ts +74 -81
- package/out/lookup.d.ts.map +1 -1
- package/out/lookup.js +114 -128
- package/out/lookup.js.map +1 -1
- package/out/postal-city-alias-lookup.d.ts +9 -10
- package/out/postal-city-alias-lookup.d.ts.map +1 -1
- package/out/postal-city-alias-lookup.js +13 -14
- package/out/postal-city-alias-lookup.js.map +1 -1
- package/out/postal-city-alias-schema.d.ts +5 -6
- package/out/postal-city-alias-schema.d.ts.map +1 -1
- package/out/postal-city-alias-schema.js +3 -4
- package/out/postal-city-alias-schema.js.map +1 -1
- package/out/postal-city-candidate-schema.d.ts +7 -10
- package/out/postal-city-candidate-schema.d.ts.map +1 -1
- package/out/postal-city-candidate-schema.js +4 -6
- package/out/postal-city-candidate-schema.js.map +1 -1
- package/out/postcode-point-lookup.d.ts +3 -4
- package/out/postcode-point-lookup.d.ts.map +1 -1
- package/out/postcode-point-lookup.js +2 -2
- package/out/postcode-point-lookup.js.map +1 -1
- package/out/reverse.d.ts +26 -29
- package/out/reverse.d.ts.map +1 -1
- package/out/reverse.js +36 -38
- package/out/reverse.js.map +1 -1
- package/out/schema.d.ts +32 -33
- package/out/schema.d.ts.map +1 -1
- package/out/sharding.d.ts +26 -28
- package/out/sharding.d.ts.map +1 -1
- package/out/sharding.js +16 -16
- package/out/sharding.js.map +1 -1
- package/out/sqlite-convention-source.d.ts +3 -3
- package/out/sqlite-convention-source.d.ts.map +1 -1
- package/out/sqlite-convention-source.js +6 -6
- package/out/sqlite-convention-source.js.map +1 -1
- package/out/sqlite-utils.d.ts +4 -5
- package/out/sqlite-utils.d.ts.map +1 -1
- package/out/sqlite-utils.js +4 -5
- package/out/sqlite-utils.js.map +1 -1
- package/out/street-morphology-fst-builder.d.ts +15 -18
- package/out/street-morphology-fst-builder.d.ts.map +1 -1
- package/out/street-morphology-fst-builder.js +17 -17
- package/out/street-morphology-fst-builder.js.map +1 -1
- package/out/street-normalize.d.ts +43 -28
- package/out/street-normalize.d.ts.map +1 -1
- package/out/street-normalize.js +96 -34
- package/out/street-normalize.js.map +1 -1
- package/out/street-segment-schema.d.ts +5 -5
- package/out/street-segment-schema.js +2 -2
- package/out/types.d.ts +42 -47
- package/out/types.d.ts.map +1 -1
- package/out/types.js +1 -1
- package/out/unified-schema.d.ts +6 -6
- package/out/unified-schema.d.ts.map +1 -1
- package/out/unified-schema.js +10 -10
- package/out/unified-schema.js.map +1 -1
- package/package.json +26 -22
package/out/reverse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reverse.js","sourceRoot":"","sources":["../reverse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAwB,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"reverse.js","sourceRoot":"","sources":["../reverse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAwB,MAAM,UAAU,CAAA;AA4D9E,MAAM,sBAAsB,GAAG,GAAG,CAAA;AAClC,MAAM,0BAA0B,GAAG,EAAE,CAAA;AAErC;;;GAGG;AACH,MAA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
/**
|
|
18
18
|
* The FTS5 virtual table built by this package on first open (NOT shipped by upstream WOF).
|
|
19
19
|
*
|
|
20
|
-
* `content` is unindexed — it's there so we can roundtrip the original name back to the caller
|
|
21
|
-
*
|
|
20
|
+
* `content` is unindexed — it's there so we can roundtrip the original name back to the caller without a second SELECT.
|
|
21
|
+
* The actual FTS rebuild happens in `fts.ts::buildPlaceSearchFTS`.
|
|
22
22
|
*/
|
|
23
23
|
export interface PlaceSearchTable {
|
|
24
24
|
rowid: number;
|
|
@@ -27,16 +27,16 @@ export interface PlaceSearchTable {
|
|
|
27
27
|
alt_names: string | null;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* `spr` — the Who's On First "Standard Places Response": a denormalized lightweight summary of one
|
|
31
|
-
*
|
|
30
|
+
* `spr` — the Who's On First "Standard Places Response": a denormalized lightweight summary of one row per place. The
|
|
31
|
+
* resolver's main lookup table.
|
|
32
32
|
*
|
|
33
|
-
* Lifecycle flags carry TWO conventions, both meaning "currently valid": `is_current = -1` (modern
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
33
|
+
* Lifecycle flags carry TWO conventions, both meaning "currently valid": `is_current = -1` (modern Who's On First) and
|
|
34
|
+
* `is_current = 1` (legacy Mapzen-era). Only `is_current = 0` means "not current". Filters in `lookup.ts` and `fts.ts`
|
|
35
|
+
* use `is_current != 0 AND is_deprecated = 0` — see #91 for the diagnostic that uncovered the mixed-convention
|
|
36
|
+
* reality.
|
|
37
37
|
*
|
|
38
|
-
* Lat/lon live directly on this row — no GeoJSON extraction needed for centroid resolution. `min_*`
|
|
39
|
-
*
|
|
38
|
+
* Lat/lon live directly on this row — no GeoJSON extraction needed for centroid resolution. `min_*` / `max_*` form a
|
|
39
|
+
* bounding box if callers want one (Phase 4.3 candidate).
|
|
40
40
|
*/
|
|
41
41
|
export interface SprTable {
|
|
42
42
|
id: number;
|
|
@@ -60,9 +60,9 @@ export interface SprTable {
|
|
|
60
60
|
lastmodified: number;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* Alternate names per place, keyed by language tag subfields (BCP-47 components). Joins back to
|
|
64
|
-
* `
|
|
65
|
-
*
|
|
63
|
+
* Alternate names per place, keyed by language tag subfields (BCP-47 components). Joins back to `spr.id` via `id` (NOT
|
|
64
|
+
* `place_id` — the real WOF schema uses the same column name as the spr primary key; this is a normal join across two
|
|
65
|
+
* tables with the same FK column name).
|
|
66
66
|
*
|
|
67
67
|
* No `kind` column in real WOF — the FTS build just concatenates ALL names per id.
|
|
68
68
|
*/
|
|
@@ -81,9 +81,8 @@ export interface NamesTable {
|
|
|
81
81
|
lastmodified: number;
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
|
-
* Per-place GeoJSON blob. Centroid lat/lon are already exposed via `spr.{latitude,longitude}` so
|
|
85
|
-
*
|
|
86
|
-
* full geometry for bbox / polygon work.
|
|
84
|
+
* Per-place GeoJSON blob. Centroid lat/lon are already exposed via `spr.{latitude,longitude}` so the resolver doesn't
|
|
85
|
+
* need to parse this; we keep the table modeled in case Phase 4.3 wants the full geometry for bbox / polygon work.
|
|
87
86
|
*/
|
|
88
87
|
export interface GeojsonTable {
|
|
89
88
|
id: number;
|
|
@@ -94,8 +93,8 @@ export interface GeojsonTable {
|
|
|
94
93
|
lastmodified: number;
|
|
95
94
|
}
|
|
96
95
|
/**
|
|
97
|
-
* Adjacency table for ancestor relationships. One row per (place, ancestor) pair, including
|
|
98
|
-
*
|
|
96
|
+
* Adjacency table for ancestor relationships. One row per (place, ancestor) pair, including transitive ancestors. Used
|
|
97
|
+
* to implement `FindPlaceQuery.parentID` (descendant lookup).
|
|
99
98
|
*/
|
|
100
99
|
export interface AncestorsTable {
|
|
101
100
|
id: number;
|
|
@@ -104,25 +103,25 @@ export interface AncestorsTable {
|
|
|
104
103
|
lastmodified: number;
|
|
105
104
|
}
|
|
106
105
|
/**
|
|
107
|
-
* `place_population` — `id → wof:population`, split off `spr` so a population-rank join is a single
|
|
108
|
-
*
|
|
109
|
-
*
|
|
106
|
+
* `place_population` — `id → wof:population`, split off `spr` so a population-rank join is a single indexed probe.
|
|
107
|
+
* Written by the build/augment ingest + the GeoNames backfill; read by the candidate build's `neg_rank`. WOF carries
|
|
108
|
+
* population for ~15% of localities; absent = unknown, not zero.
|
|
110
109
|
*/
|
|
111
110
|
export interface PlacePopulationTable {
|
|
112
111
|
id: number;
|
|
113
112
|
population: number;
|
|
114
113
|
}
|
|
115
114
|
/**
|
|
116
|
-
* `place_abbr` — `id → abbreviation` (e.g. `IL → Illinois`), derived from `names` rows whose
|
|
117
|
-
*
|
|
115
|
+
* `place_abbr` — `id → abbreviation` (e.g. `IL → Illinois`), derived from `names` rows whose `language = 'abbr'`. Lets
|
|
116
|
+
* the resolver accept a 2-letter region abbreviation as an exact match.
|
|
118
117
|
*/
|
|
119
118
|
export interface PlaceAbbrTable {
|
|
120
119
|
id: number;
|
|
121
120
|
abbr: string;
|
|
122
121
|
}
|
|
123
122
|
/**
|
|
124
|
-
* `concordances` — external-id cross-references per place (`id → (other_source, other_id)`), e.g. a
|
|
125
|
-
*
|
|
123
|
+
* `concordances` — external-id cross-references per place (`id → (other_source, other_id)`), e.g. a GeoNames or
|
|
124
|
+
* Overture GERS id. Metadata only; not part of the resolve path.
|
|
126
125
|
*/
|
|
127
126
|
export interface ConcordancesTable {
|
|
128
127
|
id: number;
|
|
@@ -131,9 +130,9 @@ export interface ConcordancesTable {
|
|
|
131
130
|
lastmodified: number;
|
|
132
131
|
}
|
|
133
132
|
/**
|
|
134
|
-
* `coincident_roles` (#402) — the dual-role relation: a place that is BOTH an admin region AND a
|
|
135
|
-
*
|
|
136
|
-
*
|
|
133
|
+
* `coincident_roles` (#402) — the dual-role relation: a place that is BOTH an admin region AND a locality (Berlin the
|
|
134
|
+
* city-state). One row per (admin, locality) pair the resolver can complete a hierarchy with. Surfaced by
|
|
135
|
+
* {@link MailwomanLookupLike.coincidentRolesFor}.
|
|
137
136
|
*/
|
|
138
137
|
export interface CoincidentRolesTable {
|
|
139
138
|
admin_id: number;
|
|
@@ -144,12 +143,12 @@ export interface CoincidentRolesTable {
|
|
|
144
143
|
locality_population: number;
|
|
145
144
|
}
|
|
146
145
|
/**
|
|
147
|
-
* The full schema we hand to `Kysely<
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
146
|
+
* The full schema we hand to `Kysely<WOFDatabase>` / `new DatabaseClient<WOFDatabase>(...)`. Tables not listed here
|
|
147
|
+
* will fail type-checked queries — by design. The reader ({@link WOFSqlitePlaceLookup}) already consumes this; the
|
|
148
|
+
* build/augment WRITERS adopt it so a column rename is a compile error on both sides (the drift that bit the corpus
|
|
149
|
+
* TIGER adapter).
|
|
151
150
|
*/
|
|
152
|
-
export interface
|
|
151
|
+
export interface WOFDatabase {
|
|
153
152
|
place_search: PlaceSearchTable;
|
|
154
153
|
spr: SprTable;
|
|
155
154
|
names: NamesTable;
|
package/out/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,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CAAA;IAC/B,gBAAgB,EAAE,oBAAoB,CAAA;CACtC"}
|
package/out/sharding.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Multi-shard support for `
|
|
6
|
+
* Multi-shard support for `WOFSqlitePlaceLookup` — opens multiple WOF SQLite distributions on one
|
|
7
7
|
* connection via `ATTACH DATABASE`, and routes queries to the right shard based on placetype.
|
|
8
8
|
*
|
|
9
9
|
* ## The FTS5 syntax rule that drove this design
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
* scope.
|
|
24
24
|
*/
|
|
25
25
|
/**
|
|
26
|
-
* Derive a SQL-safe schema name from a WOF distribution filename. Used by `ATTACH DATABASE … AS
|
|
27
|
-
*
|
|
26
|
+
* Derive a SQL-safe schema name from a WOF distribution filename. Used by `ATTACH DATABASE … AS <name>` so each shard
|
|
27
|
+
* gets a stable, predictable handle.
|
|
28
28
|
*
|
|
29
|
-
* Convention strips the `whosonfirst-data-` prefix and the `-latest.db` (or just `.db`) suffix,
|
|
30
|
-
*
|
|
29
|
+
* Convention strips the `whosonfirst-data-` prefix and the `-latest.db` (or just `.db`) suffix, then replaces `-` with
|
|
30
|
+
* `_` for SQL identifier safety.
|
|
31
31
|
*
|
|
32
32
|
* Examples:
|
|
33
33
|
*
|
|
@@ -36,34 +36,32 @@
|
|
|
36
36
|
* - `whosonfirst-data-admin-latest.db` → `admin`
|
|
37
37
|
* - `my-custom.db` → `my_custom`
|
|
38
38
|
*
|
|
39
|
-
* Callers can override the derived name explicitly via `ShardConfig.schemaName` when the filename
|
|
40
|
-
*
|
|
39
|
+
* Callers can override the derived name explicitly via `ShardConfig.schemaName` when the filename doesn't follow WOF
|
|
40
|
+
* convention.
|
|
41
41
|
*/
|
|
42
42
|
export declare function deriveSchemaName(path: string): string;
|
|
43
43
|
/**
|
|
44
|
-
* Per-shard configuration. The simple form is just a path string — the schema name is derived from
|
|
45
|
-
*
|
|
46
|
-
*
|
|
44
|
+
* Per-shard configuration. The simple form is just a path string — the schema name is derived from it. The object form
|
|
45
|
+
* lets callers override the derived schema name (useful when a filename doesn't follow WOF convention) or attach an
|
|
46
|
+
* extra hint about which placetypes route here.
|
|
47
47
|
*/
|
|
48
48
|
export interface ShardConfig {
|
|
49
49
|
path: string;
|
|
50
50
|
/**
|
|
51
|
-
* Override the auto-derived schema name. Useful when the filename doesn't match WOF convention or
|
|
52
|
-
*
|
|
53
|
-
* `[a-zA-Z_][a-zA-Z0-9_]*`.
|
|
51
|
+
* Override the auto-derived schema name. Useful when the filename doesn't match WOF convention or when you want a
|
|
52
|
+
* memorable handle. Must be a valid SQLite identifier — `[a-zA-Z_][a-zA-Z0-9_]*`.
|
|
54
53
|
*/
|
|
55
54
|
schemaName?: string;
|
|
56
55
|
/**
|
|
57
|
-
* Optional explicit list of placetypes this shard serves. When set, queries against any listed
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* `postalcode` queries) is preferred for that placetype.
|
|
56
|
+
* Optional explicit list of placetypes this shard serves. When set, queries against any listed placetype are routed
|
|
57
|
+
* to this shard. When omitted, routing falls back to a name-match heuristic: a shard whose `schemaName` contains the
|
|
58
|
+
* placetype as a substring (e.g. `postalcode_us` for `postalcode` queries) is preferred for that placetype.
|
|
61
59
|
*/
|
|
62
60
|
placetypes?: readonly string[];
|
|
63
61
|
}
|
|
64
62
|
/**
|
|
65
|
-
* Resolved post-derivation: paired path + chosen schema name + (possibly empty) placetypes hint.
|
|
66
|
-
*
|
|
63
|
+
* Resolved post-derivation: paired path + chosen schema name + (possibly empty) placetypes hint. Used internally by
|
|
64
|
+
* `WOFSqlitePlaceLookup` so the routing logic operates on uniform structures.
|
|
67
65
|
*/
|
|
68
66
|
export interface ResolvedShard {
|
|
69
67
|
path: string;
|
|
@@ -71,11 +69,11 @@ export interface ResolvedShard {
|
|
|
71
69
|
placetypes: readonly string[];
|
|
72
70
|
}
|
|
73
71
|
/**
|
|
74
|
-
* Normalize the user-provided `databasePath` opt (which may be a single string, an array of
|
|
75
|
-
*
|
|
72
|
+
* Normalize the user-provided `databasePath` opt (which may be a single string, an array of strings, or an array of
|
|
73
|
+
* `ShardConfig` objects) into a uniform `ResolvedShard[]`.
|
|
76
74
|
*
|
|
77
|
-
* The first shard becomes `main` regardless of its derived schema name — that's the SQLite
|
|
78
|
-
*
|
|
75
|
+
* The first shard becomes `main` regardless of its derived schema name — that's the SQLite convention. Subsequent
|
|
76
|
+
* shards keep their derived (or override) schema name.
|
|
79
77
|
*/
|
|
80
78
|
export declare function resolveShards(input: string | ReadonlyArray<string | ShardConfig>): ResolvedShard[];
|
|
81
79
|
/**
|
|
@@ -84,13 +82,13 @@ export declare function resolveShards(input: string | ReadonlyArray<string | Sha
|
|
|
84
82
|
* Routing rules, in order:
|
|
85
83
|
*
|
|
86
84
|
* 1. If any shard has explicit `placetypes` that includes the requested placetype, use it.
|
|
87
|
-
* 2. Otherwise, if a non-main shard's `schemaName` matches the placetype (e.g. `postalcode_us` matches
|
|
88
|
-
*
|
|
85
|
+
* 2. Otherwise, if a non-main shard's `schemaName` matches the placetype (e.g. `postalcode_us` matches `postalcode`), use
|
|
86
|
+
* it.
|
|
89
87
|
* 3. Otherwise, fall back to `main`.
|
|
90
88
|
*
|
|
91
|
-
* This deliberately doesn't UNION across shards — BM25 scores aren't comparable across separately-
|
|
92
|
-
*
|
|
93
|
-
*
|
|
89
|
+
* This deliberately doesn't UNION across shards — BM25 scores aren't comparable across separately- indexed corpora, and
|
|
90
|
+
* the typical mailwoman query has a single placetype anyway. If a caller needs cross-shard results they can issue two
|
|
91
|
+
* `findPlace` calls.
|
|
94
92
|
*/
|
|
95
93
|
export declare function pickShardForPlacetype(shards: ResolvedShard[], placetype: string | undefined): ResolvedShard;
|
|
96
94
|
//# sourceMappingURL=sharding.d.ts.map
|
package/out/sharding.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharding.d.ts","sourceRoot":"","sources":["../sharding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"sharding.d.ts","sourceRoot":"","sources":["../sharding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAYrD;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;CAC7B;AAKD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,GAAG,aAAa,EAAE,CAuClG;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,CAuB3G"}
|
package/out/sharding.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Multi-shard support for `
|
|
6
|
+
* Multi-shard support for `WOFSqlitePlaceLookup` — opens multiple WOF SQLite distributions on one
|
|
7
7
|
* connection via `ATTACH DATABASE`, and routes queries to the right shard based on placetype.
|
|
8
8
|
*
|
|
9
9
|
* ## The FTS5 syntax rule that drove this design
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { basename } from "node:path";
|
|
26
26
|
/**
|
|
27
|
-
* Derive a SQL-safe schema name from a WOF distribution filename. Used by `ATTACH DATABASE … AS
|
|
28
|
-
*
|
|
27
|
+
* Derive a SQL-safe schema name from a WOF distribution filename. Used by `ATTACH DATABASE … AS <name>` so each shard
|
|
28
|
+
* gets a stable, predictable handle.
|
|
29
29
|
*
|
|
30
|
-
* Convention strips the `whosonfirst-data-` prefix and the `-latest.db` (or just `.db`) suffix,
|
|
31
|
-
*
|
|
30
|
+
* Convention strips the `whosonfirst-data-` prefix and the `-latest.db` (or just `.db`) suffix, then replaces `-` with
|
|
31
|
+
* `_` for SQL identifier safety.
|
|
32
32
|
*
|
|
33
33
|
* Examples:
|
|
34
34
|
*
|
|
@@ -37,8 +37,8 @@ import { basename } from "node:path";
|
|
|
37
37
|
* - `whosonfirst-data-admin-latest.db` → `admin`
|
|
38
38
|
* - `my-custom.db` → `my_custom`
|
|
39
39
|
*
|
|
40
|
-
* Callers can override the derived name explicitly via `ShardConfig.schemaName` when the filename
|
|
41
|
-
*
|
|
40
|
+
* Callers can override the derived name explicitly via `ShardConfig.schemaName` when the filename doesn't follow WOF
|
|
41
|
+
* convention.
|
|
42
42
|
*/
|
|
43
43
|
export function deriveSchemaName(path) {
|
|
44
44
|
const stem = basename(path)
|
|
@@ -54,11 +54,11 @@ export function deriveSchemaName(path) {
|
|
|
54
54
|
/** SQLite identifier regex — `[A-Za-z_][A-Za-z0-9_]*`. */
|
|
55
55
|
const SQLITE_IDENT_RE = /^[A-Za-z_][A-Za-z0-9_]*$/u;
|
|
56
56
|
/**
|
|
57
|
-
* Normalize the user-provided `databasePath` opt (which may be a single string, an array of
|
|
58
|
-
*
|
|
57
|
+
* Normalize the user-provided `databasePath` opt (which may be a single string, an array of strings, or an array of
|
|
58
|
+
* `ShardConfig` objects) into a uniform `ResolvedShard[]`.
|
|
59
59
|
*
|
|
60
|
-
* The first shard becomes `main` regardless of its derived schema name — that's the SQLite
|
|
61
|
-
*
|
|
60
|
+
* The first shard becomes `main` regardless of its derived schema name — that's the SQLite convention. Subsequent
|
|
61
|
+
* shards keep their derived (or override) schema name.
|
|
62
62
|
*/
|
|
63
63
|
export function resolveShards(input) {
|
|
64
64
|
const list = typeof input === "string" ? [input] : input;
|
|
@@ -97,13 +97,13 @@ export function resolveShards(input) {
|
|
|
97
97
|
* Routing rules, in order:
|
|
98
98
|
*
|
|
99
99
|
* 1. If any shard has explicit `placetypes` that includes the requested placetype, use it.
|
|
100
|
-
* 2. Otherwise, if a non-main shard's `schemaName` matches the placetype (e.g. `postalcode_us` matches
|
|
101
|
-
*
|
|
100
|
+
* 2. Otherwise, if a non-main shard's `schemaName` matches the placetype (e.g. `postalcode_us` matches `postalcode`), use
|
|
101
|
+
* it.
|
|
102
102
|
* 3. Otherwise, fall back to `main`.
|
|
103
103
|
*
|
|
104
|
-
* This deliberately doesn't UNION across shards — BM25 scores aren't comparable across separately-
|
|
105
|
-
*
|
|
106
|
-
*
|
|
104
|
+
* This deliberately doesn't UNION across shards — BM25 scores aren't comparable across separately- indexed corpora, and
|
|
105
|
+
* the typical mailwoman query has a single placetype anyway. If a caller needs cross-shard results they can issue two
|
|
106
|
+
* `findPlace` calls.
|
|
107
107
|
*/
|
|
108
108
|
export function pickShardForPlacetype(shards, placetype) {
|
|
109
109
|
if (!placetype)
|
package/out/sharding.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharding.js","sourceRoot":"","sources":["../sharding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,I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C,CAAC,CAAA;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACX,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAuB,EAAE,SAA6B;IAC3F,IAAI,CAAC,SAAS;QAAE,OAAO,MAAM,CAAC,CAAC,CAAE,CAAA;IAEjC,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACxB,IAAI,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC;YAAE,OAAO,CAAC,CAAA;IAC/C,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACxB,IAAI,CAAC,CAAC,UAAU,KAAK,MAAM;YAAE,SAAQ;QAErC,qFAAqF;QACrF,qFAAqF;QACrF,kCAAkC;QAClC,IACC,CAAC,CAAC,UAAU,KAAK,SAAS;YAC1B,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,SAAS,GAAG,CAAC;YACxC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,SAAS,EAAE,CAAC,EACrC,CAAC;YACF,OAAO,CAAC,CAAA;QACT,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC,CAAC,CAAE,CAAA;AAClB,CAAC"}
|
|
@@ -20,10 +20,10 @@ export declare class SqliteConventionSource implements ConventionSource {
|
|
|
20
20
|
#private;
|
|
21
21
|
/**
|
|
22
22
|
* @param db An open handle to a DB that has the convention asset attached (or is it).
|
|
23
|
-
* @param schema The schema name the `address_convention` table lives under (`main` or an ATTACHed
|
|
24
|
-
*
|
|
23
|
+
* @param schema The schema name the `address_convention` table lives under (`main` or an ATTACHed shard name —
|
|
24
|
+
* `WOFSqlitePlaceLookup` auto-detects which shard carries the table).
|
|
25
25
|
*/
|
|
26
26
|
constructor(db: DatabaseSync, schema: string);
|
|
27
|
-
get(
|
|
27
|
+
get(wofID: number): Convention | undefined;
|
|
28
28
|
}
|
|
29
29
|
//# sourceMappingURL=sqlite-convention-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-convention-source.d.ts","sourceRoot":"","sources":["../sqlite-convention-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,EAA4B,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElG,qBAAa,sBAAuB,YAAW,gBAAgB;;IAM9D;;;;OAIG;gBACS,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAK5C,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"sqlite-convention-source.d.ts","sourceRoot":"","sources":["../sqlite-convention-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,EAA4B,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElG,qBAAa,sBAAuB,YAAW,gBAAgB;;IAM9D;;;;OAIG;gBACS,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAK5C,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;CAqB1C"}
|
|
@@ -22,22 +22,22 @@ export class SqliteConventionSource {
|
|
|
22
22
|
#cache = new Map();
|
|
23
23
|
/**
|
|
24
24
|
* @param db An open handle to a DB that has the convention asset attached (or is it).
|
|
25
|
-
* @param schema The schema name the `address_convention` table lives under (`main` or an ATTACHed
|
|
26
|
-
*
|
|
25
|
+
* @param schema The schema name the `address_convention` table lives under (`main` or an ATTACHed shard name —
|
|
26
|
+
* `WOFSqlitePlaceLookup` auto-detects which shard carries the table).
|
|
27
27
|
*/
|
|
28
28
|
constructor(db, schema) {
|
|
29
29
|
this.#db = db;
|
|
30
30
|
this.#schema = schema;
|
|
31
31
|
}
|
|
32
|
-
get(
|
|
33
|
-
const cached = this.#cache.get(
|
|
32
|
+
get(wofID) {
|
|
33
|
+
const cached = this.#cache.get(wofID);
|
|
34
34
|
if (cached !== undefined)
|
|
35
35
|
return cached ?? undefined;
|
|
36
36
|
let value = null;
|
|
37
37
|
try {
|
|
38
38
|
const row = this.#db
|
|
39
39
|
.prepare(`SELECT convention FROM ${this.#schema}.${ADDRESS_CONVENTION_TABLE} WHERE wof_id = ?`)
|
|
40
|
-
.get(
|
|
40
|
+
.get(wofID);
|
|
41
41
|
if (row?.convention)
|
|
42
42
|
value = JSON.parse(row.convention);
|
|
43
43
|
}
|
|
@@ -46,7 +46,7 @@ export class SqliteConventionSource {
|
|
|
46
46
|
// WORLD_DEFAULT). The build script validates structure, so this is purely defensive.
|
|
47
47
|
value = null;
|
|
48
48
|
}
|
|
49
|
-
this.#cache.set(
|
|
49
|
+
this.#cache.set(wofID, value);
|
|
50
50
|
return value ?? undefined;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-convention-source.js","sourceRoot":"","sources":["../sqlite-convention-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,wBAAwB,EAA0C,MAAM,iBAAiB,CAAA;AAElG,MAAM,OAAO,sBAAsB;IACzB,GAAG,CAAc;IACjB,OAAO,CAAQ;IACxB,oGAAoG;IAC3F,MAAM,GAAG,IAAI,GAAG,EAA6B,CAAA;IAEtD;;;;OAIG;IACH,YAAY,EAAgB,EAAE,MAAc;QAC3C,IAAI,CAAC,GAAG,GAAG,EAAE,CAAA;QACb,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,GAAG,CAAC,KAAa;QAChB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"sqlite-convention-source.js","sourceRoot":"","sources":["../sqlite-convention-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,wBAAwB,EAA0C,MAAM,iBAAiB,CAAA;AAElG,MAAM,OAAO,sBAAsB;IACzB,GAAG,CAAc;IACjB,OAAO,CAAQ;IACxB,oGAAoG;IAC3F,MAAM,GAAG,IAAI,GAAG,EAA6B,CAAA;IAEtD;;;;OAIG;IACH,YAAY,EAAgB,EAAE,MAAc;QAC3C,IAAI,CAAC,GAAG,GAAG,EAAE,CAAA;QACb,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,GAAG,CAAC,KAAa;QAChB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAErC,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,MAAM,IAAI,SAAS,CAAA;QACpD,IAAI,KAAK,GAAsB,IAAI,CAAA;QAEnC,IAAI,CAAC;YACJ,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG;iBAClB,OAAO,CAAC,0BAA0B,IAAI,CAAC,OAAO,IAAI,wBAAwB,mBAAmB,CAAC;iBAC9F,GAAG,CAAC,KAAK,CAAuC,CAAA;YAElD,IAAI,GAAG,EAAE,UAAU;gBAAE,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAe,CAAA;QACtE,CAAC;QAAC,MAAM,CAAC;YACR,oFAAoF;YACpF,qFAAqF;YACrF,KAAK,GAAG,IAAI,CAAA;QACb,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QAE7B,OAAO,KAAK,IAAI,SAAS,CAAA;IAC1B,CAAC;CACD"}
|
package/out/sqlite-utils.d.ts
CHANGED
|
@@ -7,11 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { DatabaseSync } from "node:sqlite";
|
|
9
9
|
/**
|
|
10
|
-
* True when `name` is a table in the open database. The street-level lookups use this to degrade
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* no-op miss.
|
|
10
|
+
* True when `name` is a table in the open database. The street-level lookups use this to degrade gracefully on an
|
|
11
|
+
* empty/tableless shard — an interrupted `build-*-shard.ts`, or a stray 0-byte file (e.g. `sqlite3 <missing>.db "…"`
|
|
12
|
+
* CREATES one) — rather than throwing `no such table` at construction and taking down a whole state's geocode (#568). A
|
|
13
|
+
* missing table makes the lookup a no-op miss.
|
|
15
14
|
*/
|
|
16
15
|
export declare function hasTable(db: DatabaseSync, name: string): boolean;
|
|
17
16
|
//# sourceMappingURL=sqlite-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-utils.d.ts","sourceRoot":"","sources":["../sqlite-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C
|
|
1
|
+
{"version":3,"file":"sqlite-utils.d.ts","sourceRoot":"","sources":["../sqlite-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAQhE"}
|
package/out/sqlite-utils.js
CHANGED
|
@@ -6,11 +6,10 @@
|
|
|
6
6
|
* Small shared helpers for the SQLite-backed lookups.
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
|
-
* True when `name` is a table in the open database. The street-level lookups use this to degrade
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* no-op miss.
|
|
9
|
+
* True when `name` is a table in the open database. The street-level lookups use this to degrade gracefully on an
|
|
10
|
+
* empty/tableless shard — an interrupted `build-*-shard.ts`, or a stray 0-byte file (e.g. `sqlite3 <missing>.db "…"`
|
|
11
|
+
* CREATES one) — rather than throwing `no such table` at construction and taking down a whole state's geocode (#568). A
|
|
12
|
+
* missing table makes the lookup a no-op miss.
|
|
14
13
|
*/
|
|
15
14
|
export function hasTable(db, name) {
|
|
16
15
|
try {
|
package/out/sqlite-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-utils.js","sourceRoot":"","sources":["../sqlite-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH
|
|
1
|
+
{"version":3,"file":"sqlite-utils.js","sourceRoot":"","sources":["../sqlite-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAgB,EAAE,IAAY;IACtD,IAAI,CAAC;QACJ,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,uEAAuE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAEzG,OAAO,GAAG,KAAK,SAAS,CAAA;IACzB,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAA;IACb,CAAC;AACF,CAAC"}
|
|
@@ -19,41 +19,38 @@
|
|
|
19
19
|
* Source: `core/data/libpostal/dictionaries/{locale}/street_types.txt`. Each line is pipe-delimited
|
|
20
20
|
* surface forms with the canonical form first: avenue|av|ave|aven|avenu|avn|avnu|avnue
|
|
21
21
|
*
|
|
22
|
-
* Output: an `
|
|
22
|
+
* Output: an `FSTMatcher` ready to serialize via `serializeFST` to e.g.
|
|
23
23
|
* `fst-street-morphology.bin`.
|
|
24
24
|
*/
|
|
25
|
-
import {
|
|
26
|
-
import type {
|
|
27
|
-
export interface
|
|
25
|
+
import { FSTMatcher } from "./fst-matcher.js";
|
|
26
|
+
import type { FSTProvenance } from "./fst-types.js";
|
|
27
|
+
export interface BuildStreetMorphologyFSTOpts {
|
|
28
28
|
/** Path to the `core/data/libpostal/dictionaries` directory containing per-locale subfolders. */
|
|
29
29
|
dictionariesDir: string;
|
|
30
30
|
/**
|
|
31
|
-
* Optional locale filter — only ingest these locale subfolders. Defaults to all that have a
|
|
32
|
-
* `street_types.txt`.
|
|
31
|
+
* Optional locale filter — only ingest these locale subfolders. Defaults to all that have a `street_types.txt`.
|
|
33
32
|
*/
|
|
34
33
|
locales?: string[];
|
|
35
34
|
/**
|
|
36
|
-
* Minimum length (in characters, post-normalization) of variant surface forms to insert into the
|
|
37
|
-
* trie. Defaults to 3.
|
|
35
|
+
* Minimum length (in characters, post-normalization) of variant surface forms to insert into the trie. Defaults to 3.
|
|
38
36
|
*
|
|
39
|
-
* Rationale: libpostal's street_types dictionaries contain 1-2 character abbreviations (`a`, `b`,
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* while filtering out the noise.
|
|
37
|
+
* Rationale: libpostal's street_types dictionaries contain 1-2 character abbreviations (`a`, `b`, `av`, `bd`, `br`,
|
|
38
|
+
* ...) that collide with non-affix tokens at parse time — notably US state abbreviations (`OR`, `CA`, `ND`, `NY`),
|
|
39
|
+
* single-letter unit designators, and arbitrary short tokens. Empirically these collisions push the morphology prior
|
|
40
|
+
* to mis-tag state abbreviations as `street_suffix`. A minimum length of 3 retains useful forms (`ave`, `blvd`,
|
|
41
|
+
* `rue`, `str`) while filtering out the noise.
|
|
45
42
|
*/
|
|
46
43
|
minVariantLength?: number;
|
|
47
44
|
/** Optional progress callback. */
|
|
48
45
|
onProgress?: (phase: string, detail?: string) => void;
|
|
49
46
|
}
|
|
50
|
-
export interface
|
|
51
|
-
matcher:
|
|
52
|
-
provenance:
|
|
47
|
+
export interface BuildStreetMorphologyFSTResult {
|
|
48
|
+
matcher: FSTMatcher;
|
|
49
|
+
provenance: FSTProvenance;
|
|
53
50
|
canonicalCount: number;
|
|
54
51
|
variantCount: number;
|
|
55
52
|
insertCount: number;
|
|
56
53
|
locales: string[];
|
|
57
54
|
}
|
|
58
|
-
export declare function
|
|
55
|
+
export declare function buildStreetMorphologyFST(opts: BuildStreetMorphologyFSTOpts): BuildStreetMorphologyFSTResult;
|
|
59
56
|
//# sourceMappingURL=street-morphology-fst-builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"street-morphology-fst-builder.d.ts","sourceRoot":"","sources":["../street-morphology-fst-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"street-morphology-fst-builder.d.ts","sourceRoot":"","sources":["../street-morphology-fst-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,OAAO,EAAE,UAAU,EAAmB,MAAM,kBAAkB,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,gBAAgB,CAAA;AAW/D,MAAM,WAAW,4BAA4B;IAC5C,iGAAiG;IACjG,eAAe,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,kCAAkC;IAClC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CACrD;AAED,MAAM,WAAW,8BAA8B;IAC9C,OAAO,EAAE,UAAU,CAAA;IACnB,UAAU,EAAE,aAAa,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,EAAE,CAAA;CACjB;AAsBD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,4BAA4B,GAAG,8BAA8B,CAwI3G"}
|