@mailwoman/resolver-wof-sqlite 9.4.0 → 10.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 (548) hide show
  1. package/README.md +8 -8
  2. package/lib/address/{point-interpolation.ts → point/interpolation.ts} +40 -38
  3. package/lib/address/point/schema.ts +132 -0
  4. package/lib/address/point.ts +68 -81
  5. package/lib/{address/index.ts → address.ts} +2 -2
  6. package/lib/ancestry/backfill.ts +24 -88
  7. package/lib/{ancestry/index.ts → ancestry.ts} +19 -15
  8. package/lib/build/candidate.ts +608 -0
  9. package/lib/build/population-corrections.ts +64 -0
  10. package/lib/build/slim.ts +338 -0
  11. package/lib/candidate/alias-bags.ts +74 -14
  12. package/lib/candidate/ancestors/schema.ts +211 -0
  13. package/lib/candidate/{ancestors-sidecar.ts → ancestors/sidecar.ts} +17 -24
  14. package/lib/candidate/country-display-names.ts +6 -20
  15. package/lib/candidate/extract-fold.ts +12 -57
  16. package/lib/candidate/fts.ts +28 -0
  17. package/lib/candidate/importance.ts +221 -0
  18. package/lib/candidate/lookup.ts +669 -0
  19. package/lib/candidate/name-roles.ts +16 -34
  20. package/lib/candidate/own-name.ts +34 -31
  21. package/lib/candidate/place-attrs.ts +20 -13
  22. package/lib/candidate/schema.ts +211 -0
  23. package/lib/candidate/scoring.ts +222 -0
  24. package/lib/capital-schema.ts +21 -17
  25. package/lib/capitals.ts +26 -24
  26. package/lib/coincident-roles.ts +74 -55
  27. package/lib/convention/schema.ts +13 -7
  28. package/lib/convention.ts +144 -0
  29. package/lib/coverage-manifest-schema.ts +34 -39
  30. package/lib/currency-backfill.ts +24 -69
  31. package/lib/env.ts +1 -1
  32. package/lib/exact-match.ts +31 -20
  33. package/lib/extracts.ts +96 -73
  34. package/lib/fst/autocomplete.ts +52 -35
  35. package/lib/fst/builder.ts +30 -36
  36. package/lib/fst/deserialize-web.ts +8 -9
  37. package/lib/fst/format.ts +41 -23
  38. package/lib/fst/freshness.ts +17 -95
  39. package/lib/fst/matcher.ts +2 -2
  40. package/lib/fst/serialize.ts +45 -60
  41. package/lib/fst/types.ts +71 -59
  42. package/lib/fts/query.ts +5 -36
  43. package/lib/fts.ts +280 -0
  44. package/lib/geonames/aliases.ts +72 -149
  45. package/lib/geonames/postal.ts +162 -77
  46. package/lib/index.ts +20 -27
  47. package/lib/interpolation.ts +43 -96
  48. package/lib/lookup.ts +137 -257
  49. package/lib/name-score.ts +9 -7
  50. package/lib/nsul/lookup.ts +36 -53
  51. package/lib/nsul/schema.ts +16 -43
  52. package/lib/paths.ts +159 -0
  53. package/lib/place-importance-schema.ts +57 -164
  54. package/lib/poi/lookup.ts +100 -109
  55. package/lib/poi/schema.ts +42 -26
  56. package/lib/polygon-schema.ts +10 -6
  57. package/lib/postal/city/alias/lookup.ts +79 -0
  58. package/lib/postal/{city-alias-schema.ts → city/alias/schema.ts} +14 -10
  59. package/lib/postal/{city-candidate-schema.ts → city/candidate-schema.ts} +26 -20
  60. package/lib/postal.ts +9 -0
  61. package/lib/postcode-point-lookup.ts +9 -19
  62. package/lib/primary-preference.ts +45 -125
  63. package/lib/proximity-rerank.ts +43 -32
  64. package/lib/ranking-weights.ts +98 -76
  65. package/lib/region-keys.ts +68 -40
  66. package/lib/reverse.ts +108 -72
  67. package/lib/schema.ts +74 -42
  68. package/lib/search-fetch.ts +90 -68
  69. package/lib/sqlite/convention-source.ts +57 -0
  70. package/lib/sqlite/utils.ts +79 -0
  71. package/lib/street/centroid/schema.ts +149 -0
  72. package/lib/street/centroid.ts +16 -25
  73. package/lib/street/{morphology-fst-builder.ts → morphology/fst/builder.ts} +56 -41
  74. package/lib/street/{morphology-fst-loader.ts → morphology/fst/loader.ts} +36 -29
  75. package/lib/street/name-lookup.ts +43 -35
  76. package/lib/street/normalize.ts +85 -216
  77. package/lib/street/segment-schema.ts +116 -43
  78. package/lib/{street/index.ts → street.ts} +3 -3
  79. package/lib/types.ts +94 -140
  80. package/lib/unified-schema.ts +29 -29
  81. package/lib/uprn/existence.ts +30 -19
  82. package/lib/uprn/lookup.ts +28 -67
  83. package/lib/uprn/schema.ts +18 -40
  84. package/lib/weights-overlay-linker.ts +204 -232
  85. package/out/address/point/interpolation.d.ts +45 -0
  86. package/out/address/point/interpolation.d.ts.map +1 -0
  87. package/out/address/{point-interpolation.js → point/interpolation.js} +38 -38
  88. package/out/address/point/interpolation.js.map +1 -0
  89. package/out/address/point/schema.d.ts +74 -0
  90. package/out/address/point/schema.d.ts.map +1 -0
  91. package/out/address/{point-schema.js → point/schema.js} +4 -20
  92. package/out/address/point/schema.js.map +1 -0
  93. package/out/address/point.d.ts +24 -21
  94. package/out/address/point.d.ts.map +1 -1
  95. package/out/address/point.js +60 -77
  96. package/out/address/point.js.map +1 -1
  97. package/out/{address/index.js → address.d.ts} +3 -3
  98. package/out/address.d.ts.map +1 -0
  99. package/out/{address/index.d.ts → address.js} +3 -3
  100. package/out/address.js.map +1 -0
  101. package/out/ancestry/backfill.d.ts +11 -64
  102. package/out/ancestry/backfill.d.ts.map +1 -1
  103. package/out/ancestry/backfill.js +18 -76
  104. package/out/ancestry/backfill.js.map +1 -1
  105. package/out/ancestry.d.ts +49 -0
  106. package/out/ancestry.d.ts.map +1 -0
  107. package/out/ancestry.js +59 -0
  108. package/out/ancestry.js.map +1 -0
  109. package/out/build/candidate.d.ts +170 -0
  110. package/out/build/candidate.d.ts.map +1 -0
  111. package/out/{build-candidate.js → build/candidate.js} +33 -102
  112. package/out/build/candidate.js.map +1 -0
  113. package/out/build/population-corrections.d.ts +52 -0
  114. package/out/build/population-corrections.d.ts.map +1 -0
  115. package/out/build/population-corrections.js +40 -0
  116. package/out/build/population-corrections.js.map +1 -0
  117. package/out/build/slim.d.ts +44 -0
  118. package/out/build/slim.d.ts.map +1 -0
  119. package/out/{build-slim.js → build/slim.js} +33 -94
  120. package/out/build/slim.js.map +1 -0
  121. package/out/candidate/alias-bags.d.ts +13 -5
  122. package/out/candidate/alias-bags.d.ts.map +1 -1
  123. package/out/candidate/alias-bags.js +55 -12
  124. package/out/candidate/alias-bags.js.map +1 -1
  125. package/out/candidate/ancestors/schema.d.ts +166 -0
  126. package/out/candidate/ancestors/schema.d.ts.map +1 -0
  127. package/out/candidate/ancestors/schema.js +131 -0
  128. package/out/candidate/ancestors/schema.js.map +1 -0
  129. package/out/candidate/ancestors/sidecar.d.ts +27 -0
  130. package/out/candidate/ancestors/sidecar.d.ts.map +1 -0
  131. package/out/candidate/{ancestors-sidecar.js → ancestors/sidecar.js} +17 -24
  132. package/out/candidate/ancestors/sidecar.js.map +1 -0
  133. package/out/candidate/country-display-names.d.ts +5 -15
  134. package/out/candidate/country-display-names.d.ts.map +1 -1
  135. package/out/candidate/country-display-names.js +6 -20
  136. package/out/candidate/country-display-names.js.map +1 -1
  137. package/out/candidate/extract-fold.d.ts +8 -16
  138. package/out/candidate/extract-fold.d.ts.map +1 -1
  139. package/out/candidate/extract-fold.js +6 -48
  140. package/out/candidate/extract-fold.js.map +1 -1
  141. package/out/candidate/fts.d.ts +19 -0
  142. package/out/candidate/fts.d.ts.map +1 -0
  143. package/out/candidate/fts.js +22 -0
  144. package/out/candidate/fts.js.map +1 -0
  145. package/out/candidate/importance.d.ts +127 -0
  146. package/out/candidate/importance.d.ts.map +1 -0
  147. package/out/candidate/importance.js +162 -0
  148. package/out/candidate/importance.js.map +1 -0
  149. package/out/candidate/lookup.d.ts +36 -0
  150. package/out/candidate/lookup.d.ts.map +1 -0
  151. package/out/candidate/lookup.js +456 -0
  152. package/out/candidate/lookup.js.map +1 -0
  153. package/out/candidate/name-roles.d.ts +10 -22
  154. package/out/candidate/name-roles.d.ts.map +1 -1
  155. package/out/candidate/name-roles.js +15 -33
  156. package/out/candidate/name-roles.js.map +1 -1
  157. package/out/candidate/own-name.d.ts +23 -25
  158. package/out/candidate/own-name.d.ts.map +1 -1
  159. package/out/candidate/own-name.js +34 -31
  160. package/out/candidate/own-name.js.map +1 -1
  161. package/out/candidate/place-attrs.d.ts +20 -13
  162. package/out/candidate/place-attrs.d.ts.map +1 -1
  163. package/out/candidate/place-attrs.js +4 -5
  164. package/out/candidate/place-attrs.js.map +1 -1
  165. package/out/candidate/schema.d.ts +120 -0
  166. package/out/candidate/schema.d.ts.map +1 -0
  167. package/out/{candidate-schema.js → candidate/schema.js} +11 -23
  168. package/out/candidate/schema.js.map +1 -0
  169. package/out/{candidate-scoring.d.ts → candidate/scoring.d.ts} +8 -9
  170. package/out/candidate/scoring.d.ts.map +1 -0
  171. package/out/candidate/scoring.js +157 -0
  172. package/out/candidate/scoring.js.map +1 -0
  173. package/out/capital-schema.d.ts +21 -17
  174. package/out/capital-schema.d.ts.map +1 -1
  175. package/out/capital-schema.js +17 -15
  176. package/out/capital-schema.js.map +1 -1
  177. package/out/capitals.d.ts +26 -24
  178. package/out/capitals.d.ts.map +1 -1
  179. package/out/capitals.js +23 -21
  180. package/out/capitals.js.map +1 -1
  181. package/out/coincident-roles.d.ts +60 -43
  182. package/out/coincident-roles.d.ts.map +1 -1
  183. package/out/coincident-roles.js +61 -50
  184. package/out/coincident-roles.js.map +1 -1
  185. package/out/convention/schema.d.ts +12 -6
  186. package/out/convention/schema.d.ts.map +1 -1
  187. package/out/convention/schema.js +6 -4
  188. package/out/convention/schema.js.map +1 -1
  189. package/out/convention.d.ts +97 -0
  190. package/out/convention.d.ts.map +1 -0
  191. package/out/convention.js +81 -0
  192. package/out/convention.js.map +1 -0
  193. package/out/coverage-manifest-schema.d.ts +33 -38
  194. package/out/coverage-manifest-schema.d.ts.map +1 -1
  195. package/out/coverage-manifest-schema.js +20 -29
  196. package/out/coverage-manifest-schema.js.map +1 -1
  197. package/out/currency-backfill.d.ts +13 -35
  198. package/out/currency-backfill.d.ts.map +1 -1
  199. package/out/currency-backfill.js +12 -39
  200. package/out/currency-backfill.js.map +1 -1
  201. package/out/env.d.ts +2 -2
  202. package/out/env.js +1 -1
  203. package/out/exact-match.d.ts +19 -10
  204. package/out/exact-match.d.ts.map +1 -1
  205. package/out/exact-match.js +31 -20
  206. package/out/exact-match.js.map +1 -1
  207. package/out/extracts.d.ts +65 -54
  208. package/out/extracts.d.ts.map +1 -1
  209. package/out/extracts.js +63 -55
  210. package/out/extracts.js.map +1 -1
  211. package/out/fst/autocomplete.d.ts +28 -20
  212. package/out/fst/autocomplete.d.ts.map +1 -1
  213. package/out/fst/autocomplete.js +38 -27
  214. package/out/fst/autocomplete.js.map +1 -1
  215. package/out/fst/builder.d.ts.map +1 -1
  216. package/out/fst/builder.js +30 -36
  217. package/out/fst/builder.js.map +1 -1
  218. package/out/fst/deserialize-web.d.ts +3 -3
  219. package/out/fst/deserialize-web.d.ts.map +1 -1
  220. package/out/fst/deserialize-web.js +8 -9
  221. package/out/fst/deserialize-web.js.map +1 -1
  222. package/out/fst/format.d.ts +41 -23
  223. package/out/fst/format.d.ts.map +1 -1
  224. package/out/fst/format.js +41 -23
  225. package/out/fst/format.js.map +1 -1
  226. package/out/fst/freshness.d.ts +11 -73
  227. package/out/fst/freshness.d.ts.map +1 -1
  228. package/out/fst/freshness.js +12 -76
  229. package/out/fst/freshness.js.map +1 -1
  230. package/out/fst/matcher.d.ts +1 -1
  231. package/out/fst/matcher.d.ts.map +1 -1
  232. package/out/fst/matcher.js +2 -2
  233. package/out/fst/matcher.js.map +1 -1
  234. package/out/fst/serialize.d.ts +30 -26
  235. package/out/fst/serialize.d.ts.map +1 -1
  236. package/out/fst/serialize.js +44 -58
  237. package/out/fst/serialize.js.map +1 -1
  238. package/out/fst/types.d.ts +71 -59
  239. package/out/fst/types.d.ts.map +1 -1
  240. package/out/fst/types.js +1 -4
  241. package/out/fst/types.js.map +1 -1
  242. package/out/{fst/index.js → fst.d.ts} +1 -1
  243. package/out/fst.d.ts.map +1 -0
  244. package/out/{fst/index.d.ts → fst.js} +1 -1
  245. package/out/fst.js.map +1 -0
  246. package/out/fts/query.d.ts +2 -27
  247. package/out/fts/query.d.ts.map +1 -1
  248. package/out/fts/query.js +5 -36
  249. package/out/fts/query.js.map +1 -1
  250. package/out/fts.d.ts +126 -0
  251. package/out/fts.d.ts.map +1 -0
  252. package/out/fts.js +188 -0
  253. package/out/fts.js.map +1 -0
  254. package/out/geonames/aliases.d.ts +26 -67
  255. package/out/geonames/aliases.d.ts.map +1 -1
  256. package/out/geonames/aliases.js +44 -121
  257. package/out/geonames/aliases.js.map +1 -1
  258. package/out/geonames/postal.d.ts +84 -50
  259. package/out/geonames/postal.d.ts.map +1 -1
  260. package/out/geonames/postal.js +115 -78
  261. package/out/geonames/postal.js.map +1 -1
  262. package/out/{geonames/index.js → geonames.d.ts} +1 -1
  263. package/out/geonames.d.ts.map +1 -0
  264. package/out/{geonames/index.d.ts → geonames.js} +1 -1
  265. package/out/geonames.js.map +1 -0
  266. package/out/index.d.ts +20 -21
  267. package/out/index.d.ts.map +1 -1
  268. package/out/index.js +14 -15
  269. package/out/index.js.map +1 -1
  270. package/out/interpolation.d.ts +15 -52
  271. package/out/interpolation.d.ts.map +1 -1
  272. package/out/interpolation.js +25 -68
  273. package/out/interpolation.js.map +1 -1
  274. package/out/lookup.d.ts +24 -53
  275. package/out/lookup.d.ts.map +1 -1
  276. package/out/lookup.js +117 -223
  277. package/out/lookup.js.map +1 -1
  278. package/out/name-score.d.ts +2 -2
  279. package/out/name-score.d.ts.map +1 -1
  280. package/out/name-score.js +9 -7
  281. package/out/name-score.js.map +1 -1
  282. package/out/nsul/lookup.d.ts +33 -34
  283. package/out/nsul/lookup.d.ts.map +1 -1
  284. package/out/nsul/lookup.js +26 -40
  285. package/out/nsul/lookup.js.map +1 -1
  286. package/out/nsul/schema.d.ts +16 -43
  287. package/out/nsul/schema.d.ts.map +1 -1
  288. package/out/nsul/schema.js +9 -35
  289. package/out/nsul/schema.js.map +1 -1
  290. package/out/{nsul/index.d.ts → nsul.d.ts} +1 -1
  291. package/out/nsul.d.ts.map +1 -0
  292. package/out/{nsul/index.js → nsul.js} +1 -1
  293. package/out/nsul.js.map +1 -0
  294. package/out/paths.d.ts +124 -0
  295. package/out/paths.d.ts.map +1 -0
  296. package/out/paths.js +104 -0
  297. package/out/paths.js.map +1 -0
  298. package/out/place-importance-schema.d.ts +49 -141
  299. package/out/place-importance-schema.d.ts.map +1 -1
  300. package/out/place-importance-schema.js +25 -140
  301. package/out/place-importance-schema.js.map +1 -1
  302. package/out/poi/lookup.d.ts +38 -42
  303. package/out/poi/lookup.d.ts.map +1 -1
  304. package/out/poi/lookup.js +67 -90
  305. package/out/poi/lookup.js.map +1 -1
  306. package/out/poi/schema.d.ts +41 -25
  307. package/out/poi/schema.d.ts.map +1 -1
  308. package/out/poi/schema.js +25 -17
  309. package/out/poi/schema.js.map +1 -1
  310. package/out/{poi/index.js → poi.d.ts} +1 -1
  311. package/out/poi.d.ts.map +1 -0
  312. package/out/{poi/index.d.ts → poi.js} +1 -1
  313. package/out/poi.js.map +1 -0
  314. package/out/polygon-schema.d.ts +10 -6
  315. package/out/polygon-schema.d.ts.map +1 -1
  316. package/out/polygon-schema.js +2 -2
  317. package/out/polygon-schema.js.map +1 -1
  318. package/out/postal/{city-alias-lookup.d.ts → city/alias/lookup.d.ts} +22 -25
  319. package/out/postal/city/alias/lookup.d.ts.map +1 -0
  320. package/out/postal/city/alias/lookup.js +49 -0
  321. package/out/postal/city/alias/lookup.js.map +1 -0
  322. package/out/postal/{city-alias-schema.d.ts → city/alias/schema.d.ts} +15 -11
  323. package/out/postal/city/alias/schema.d.ts.map +1 -0
  324. package/out/postal/{city-alias-schema.js → city/alias/schema.js} +11 -9
  325. package/out/postal/city/alias/schema.js.map +1 -0
  326. package/out/postal/city/candidate-schema.d.ts +72 -0
  327. package/out/postal/city/candidate-schema.d.ts.map +1 -0
  328. package/out/postal/city/candidate-schema.js +60 -0
  329. package/out/postal/city/candidate-schema.js.map +1 -0
  330. package/out/postal.d.ts +9 -0
  331. package/out/postal.d.ts.map +1 -0
  332. package/out/postal.js +9 -0
  333. package/out/postal.js.map +1 -0
  334. package/out/postcode-point-lookup.d.ts +9 -19
  335. package/out/postcode-point-lookup.d.ts.map +1 -1
  336. package/out/postcode-point-lookup.js +5 -17
  337. package/out/postcode-point-lookup.js.map +1 -1
  338. package/out/primary-preference.d.ts +39 -93
  339. package/out/primary-preference.d.ts.map +1 -1
  340. package/out/primary-preference.js +13 -97
  341. package/out/primary-preference.js.map +1 -1
  342. package/out/proximity-rerank.d.ts +40 -29
  343. package/out/proximity-rerank.d.ts.map +1 -1
  344. package/out/proximity-rerank.js +38 -29
  345. package/out/proximity-rerank.js.map +1 -1
  346. package/out/ranking-weights.d.ts +91 -62
  347. package/out/ranking-weights.d.ts.map +1 -1
  348. package/out/ranking-weights.js +26 -25
  349. package/out/ranking-weights.js.map +1 -1
  350. package/out/region-keys.d.ts +48 -29
  351. package/out/region-keys.d.ts.map +1 -1
  352. package/out/region-keys.js +68 -40
  353. package/out/region-keys.js.map +1 -1
  354. package/out/reverse.d.ts +75 -50
  355. package/out/reverse.d.ts.map +1 -1
  356. package/out/reverse.js +61 -49
  357. package/out/reverse.js.map +1 -1
  358. package/out/schema.d.ts +74 -42
  359. package/out/schema.d.ts.map +1 -1
  360. package/out/schema.js +4 -5
  361. package/out/schema.js.map +1 -1
  362. package/out/search-fetch.d.ts +16 -12
  363. package/out/search-fetch.d.ts.map +1 -1
  364. package/out/search-fetch.js +83 -63
  365. package/out/search-fetch.js.map +1 -1
  366. package/out/sqlite/convention-source.d.ts +25 -0
  367. package/out/sqlite/convention-source.d.ts.map +1 -0
  368. package/out/sqlite/convention-source.js +48 -0
  369. package/out/sqlite/convention-source.js.map +1 -0
  370. package/out/sqlite/utils.d.ts +45 -0
  371. package/out/sqlite/utils.d.ts.map +1 -0
  372. package/out/sqlite/utils.js +56 -0
  373. package/out/sqlite/utils.js.map +1 -0
  374. package/out/street/centroid/schema.d.ts +100 -0
  375. package/out/street/centroid/schema.d.ts.map +1 -0
  376. package/out/street/centroid/schema.js +66 -0
  377. package/out/street/centroid/schema.js.map +1 -0
  378. package/out/street/centroid.d.ts +9 -19
  379. package/out/street/centroid.d.ts.map +1 -1
  380. package/out/street/centroid.js +11 -22
  381. package/out/street/centroid.js.map +1 -1
  382. package/out/street/{morphology-fst-builder.d.ts → morphology/fst/builder.d.ts} +21 -11
  383. package/out/street/morphology/fst/builder.d.ts.map +1 -0
  384. package/out/street/{morphology-fst-builder.js → morphology/fst/builder.js} +40 -34
  385. package/out/street/morphology/fst/builder.js.map +1 -0
  386. package/out/street/morphology/fst/loader.d.ts +74 -0
  387. package/out/street/morphology/fst/loader.d.ts.map +1 -0
  388. package/out/street/{morphology-fst-loader.js → morphology/fst/loader.js} +21 -21
  389. package/out/street/morphology/fst/loader.js.map +1 -0
  390. package/out/street/name-lookup.d.ts +24 -18
  391. package/out/street/name-lookup.d.ts.map +1 -1
  392. package/out/street/name-lookup.js +32 -31
  393. package/out/street/name-lookup.js.map +1 -1
  394. package/out/street/normalize.d.ts +35 -136
  395. package/out/street/normalize.d.ts.map +1 -1
  396. package/out/street/normalize.js +74 -191
  397. package/out/street/normalize.js.map +1 -1
  398. package/out/street/segment-schema.d.ts +79 -39
  399. package/out/street/segment-schema.d.ts.map +1 -1
  400. package/out/street/segment-schema.js +71 -21
  401. package/out/street/segment-schema.js.map +1 -1
  402. package/out/{street/index.d.ts → street.d.ts} +4 -4
  403. package/out/street.d.ts.map +1 -0
  404. package/out/{street/index.js → street.js} +4 -4
  405. package/out/street.js.map +1 -0
  406. package/out/types.d.ts +69 -138
  407. package/out/types.d.ts.map +1 -1
  408. package/out/types.js +0 -6
  409. package/out/types.js.map +1 -1
  410. package/out/unified-schema.d.ts +8 -12
  411. package/out/unified-schema.d.ts.map +1 -1
  412. package/out/unified-schema.js +29 -29
  413. package/out/unified-schema.js.map +1 -1
  414. package/out/uprn/existence.d.ts +28 -17
  415. package/out/uprn/existence.d.ts.map +1 -1
  416. package/out/uprn/existence.js +26 -16
  417. package/out/uprn/existence.js.map +1 -1
  418. package/out/uprn/lookup.d.ts +14 -44
  419. package/out/uprn/lookup.d.ts.map +1 -1
  420. package/out/uprn/lookup.js +20 -56
  421. package/out/uprn/lookup.js.map +1 -1
  422. package/out/uprn/schema.d.ts +18 -40
  423. package/out/uprn/schema.d.ts.map +1 -1
  424. package/out/uprn/schema.js +10 -32
  425. package/out/uprn/schema.js.map +1 -1
  426. package/out/{uprn/index.d.ts → uprn.d.ts} +1 -1
  427. package/out/uprn.d.ts.map +1 -0
  428. package/out/{uprn/index.js → uprn.js} +1 -1
  429. package/out/uprn.js.map +1 -0
  430. package/out/weights-overlay-linker.d.ts +132 -141
  431. package/out/weights-overlay-linker.d.ts.map +1 -1
  432. package/out/weights-overlay-linker.js +86 -154
  433. package/out/weights-overlay-linker.js.map +1 -1
  434. package/package.json +94 -599
  435. package/lib/address/point-schema.ts +0 -155
  436. package/lib/build-candidate.ts +0 -632
  437. package/lib/build-slim.ts +0 -408
  438. package/lib/candidate-ancestors-schema.ts +0 -195
  439. package/lib/candidate-fts.ts +0 -46
  440. package/lib/candidate-importance.ts +0 -224
  441. package/lib/candidate-lookup.ts +0 -977
  442. package/lib/candidate-schema.ts +0 -247
  443. package/lib/candidate-scoring.ts +0 -261
  444. package/lib/convention/index.ts +0 -154
  445. package/lib/fts/index.ts +0 -361
  446. package/lib/postal/city-alias-lookup.ts +0 -97
  447. package/lib/postal/index.ts +0 -9
  448. package/lib/sqlite-convention-source.ts +0 -65
  449. package/lib/sqlite-utils.ts +0 -82
  450. package/lib/street/centroid-schema.ts +0 -154
  451. package/out/address/index.d.ts.map +0 -1
  452. package/out/address/index.js.map +0 -1
  453. package/out/address/point-interpolation.d.ts +0 -49
  454. package/out/address/point-interpolation.d.ts.map +0 -1
  455. package/out/address/point-interpolation.js.map +0 -1
  456. package/out/address/point-schema.d.ts +0 -97
  457. package/out/address/point-schema.d.ts.map +0 -1
  458. package/out/address/point-schema.js.map +0 -1
  459. package/out/ancestry/index.d.ts +0 -45
  460. package/out/ancestry/index.d.ts.map +0 -1
  461. package/out/ancestry/index.js +0 -55
  462. package/out/ancestry/index.js.map +0 -1
  463. package/out/build-candidate.d.ts +0 -184
  464. package/out/build-candidate.d.ts.map +0 -1
  465. package/out/build-candidate.js.map +0 -1
  466. package/out/build-slim.d.ts +0 -80
  467. package/out/build-slim.d.ts.map +0 -1
  468. package/out/build-slim.js.map +0 -1
  469. package/out/candidate/ancestors-sidecar.d.ts +0 -32
  470. package/out/candidate/ancestors-sidecar.d.ts.map +0 -1
  471. package/out/candidate/ancestors-sidecar.js.map +0 -1
  472. package/out/candidate-ancestors-schema.d.ts +0 -150
  473. package/out/candidate-ancestors-schema.d.ts.map +0 -1
  474. package/out/candidate-ancestors-schema.js +0 -123
  475. package/out/candidate-ancestors-schema.js.map +0 -1
  476. package/out/candidate-fts.d.ts +0 -37
  477. package/out/candidate-fts.d.ts.map +0 -1
  478. package/out/candidate-fts.js +0 -40
  479. package/out/candidate-fts.js.map +0 -1
  480. package/out/candidate-importance.d.ts +0 -132
  481. package/out/candidate-importance.d.ts.map +0 -1
  482. package/out/candidate-importance.js +0 -169
  483. package/out/candidate-importance.js.map +0 -1
  484. package/out/candidate-lookup.d.ts +0 -76
  485. package/out/candidate-lookup.d.ts.map +0 -1
  486. package/out/candidate-lookup.js +0 -768
  487. package/out/candidate-lookup.js.map +0 -1
  488. package/out/candidate-schema.d.ts +0 -155
  489. package/out/candidate-schema.d.ts.map +0 -1
  490. package/out/candidate-schema.js.map +0 -1
  491. package/out/candidate-scoring.d.ts.map +0 -1
  492. package/out/candidate-scoring.js +0 -196
  493. package/out/candidate-scoring.js.map +0 -1
  494. package/out/convention/index.d.ts +0 -106
  495. package/out/convention/index.d.ts.map +0 -1
  496. package/out/convention/index.js +0 -93
  497. package/out/convention/index.js.map +0 -1
  498. package/out/fst/index.d.ts.map +0 -1
  499. package/out/fst/index.js.map +0 -1
  500. package/out/fts/index.d.ts +0 -184
  501. package/out/fts/index.d.ts.map +0 -1
  502. package/out/fts/index.js +0 -277
  503. package/out/fts/index.js.map +0 -1
  504. package/out/geonames/index.d.ts.map +0 -1
  505. package/out/geonames/index.js.map +0 -1
  506. package/out/nsul/index.d.ts.map +0 -1
  507. package/out/nsul/index.js.map +0 -1
  508. package/out/poi/index.d.ts.map +0 -1
  509. package/out/poi/index.js.map +0 -1
  510. package/out/postal/city-alias-lookup.d.ts.map +0 -1
  511. package/out/postal/city-alias-lookup.js +0 -62
  512. package/out/postal/city-alias-lookup.js.map +0 -1
  513. package/out/postal/city-alias-schema.d.ts.map +0 -1
  514. package/out/postal/city-alias-schema.js.map +0 -1
  515. package/out/postal/city-candidate-schema.d.ts +0 -66
  516. package/out/postal/city-candidate-schema.d.ts.map +0 -1
  517. package/out/postal/city-candidate-schema.js +0 -56
  518. package/out/postal/city-candidate-schema.js.map +0 -1
  519. package/out/postal/index.d.ts +0 -9
  520. package/out/postal/index.d.ts.map +0 -1
  521. package/out/postal/index.js +0 -9
  522. package/out/postal/index.js.map +0 -1
  523. package/out/sqlite-convention-source.d.ts +0 -29
  524. package/out/sqlite-convention-source.d.ts.map +0 -1
  525. package/out/sqlite-convention-source.js +0 -57
  526. package/out/sqlite-convention-source.js.map +0 -1
  527. package/out/sqlite-utils.d.ts +0 -45
  528. package/out/sqlite-utils.d.ts.map +0 -1
  529. package/out/sqlite-utils.js +0 -57
  530. package/out/sqlite-utils.js.map +0 -1
  531. package/out/street/centroid-schema.d.ts +0 -105
  532. package/out/street/centroid-schema.d.ts.map +0 -1
  533. package/out/street/centroid-schema.js +0 -78
  534. package/out/street/centroid-schema.js.map +0 -1
  535. package/out/street/index.d.ts.map +0 -1
  536. package/out/street/index.js.map +0 -1
  537. package/out/street/morphology-fst-builder.d.ts.map +0 -1
  538. package/out/street/morphology-fst-builder.js.map +0 -1
  539. package/out/street/morphology-fst-loader.d.ts +0 -67
  540. package/out/street/morphology-fst-loader.d.ts.map +0 -1
  541. package/out/street/morphology-fst-loader.js.map +0 -1
  542. package/out/uprn/index.d.ts.map +0 -1
  543. package/out/uprn/index.js.map +0 -1
  544. /package/lib/{fst/index.ts → fst.ts} +0 -0
  545. /package/lib/{geonames/index.ts → geonames.ts} +0 -0
  546. /package/lib/{nsul/index.ts → nsul.ts} +0 -0
  547. /package/lib/{poi/index.ts → poi.ts} +0 -0
  548. /package/lib/{uprn/index.ts → uprn.ts} +0 -0
@@ -2,62 +2,20 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * #743/#193 — fold GeoNames bilingual / alt-language place-names into a WOF/unified admin DB as
7
- * first-class places. The hard-filter recall gap on bilingual countries (the address says
8
- * "Karjaa" but the table holds the Swedish "Karis") is missing alt-LANGUAGE names, not missing
9
- * places: the WOF/Overture `names` carried only the primary, so the candidate build's Latin-alias
10
- * explode (build-candidate pass 2) had nothing to widen. GeoNames' per-country dump carries the
11
- * variants inline (the Karis row's `alternatenames` includes "Karjaa").
12
- *
13
- * For each POPULATED place (feature class `P`) this writes an `spr` row + `names` rows (primary +
14
- * Latin alt-names) + population into the SAME tables the WOF/Overture paths use — synthetic ids
15
- * based at {@link GEONAMES_ID_BASE} so the three sources never collide. The caller then rebuilds
16
- * `place_search` ({@link buildPlaceSearchFTS} with `drop: true`) so the candidate build carries
17
- * Karjaa↔Karis. Proven (FI hard-resolve 69.5 → 85.8 %, coverage 74.4 → 94.0 %); duplicating a
18
- * place already held under another source is benign — the rows share name_key+coord and the
19
- * candidate ranking dedupes by score.
20
- *
21
- * This is the package home so the canonical `build-unified-wof --geonames-countries`, the
22
- * pipeline fold (`gazetteer-pipeline/admin/fold-geonames`), AND the `mailwoman gazetteer` commands all share
23
- * ONE implementation. GeoNames dump = `download.geonames.org/export/dump/<CC>.zip` → `<CC>.txt`
24
- * (TSV).
25
5
  */
26
6
  import { isOfficialLanguage } from "@mailwoman/codex/country";
7
+ import { readUnquotedTSV } from "@mailwoman/core/fs/delimited";
27
8
  import { pathExists } from "@mailwoman/core/fs/readers";
28
- import { join } from "path-ts";
29
- import { TSVSpliterator } from "spliterator";
30
- import { GEONAMES_POSTAL_ID_BASE } from "#geonames/postal";
31
- /**
32
- * Synthetic id base for GeoNames-sourced rows (#743/#193) — above Overture's 8e12 so the three sources (WOF real ids,
33
- * Overture, GeoNames) never collide in a combined DB.
34
- */
35
- export const GEONAMES_ID_BASE = 9_000_000_000_000;
36
- /**
37
- * The four tables the alias fold writes into the range it owns. The purge and the ingest must agree on this list — a
38
- * table written but not purged is exactly the #1514 defect.
39
- */
9
+ import { GEONAMES_ID_BASE, GEONAMES_POSTAL_ID_BASE } from "@mailwoman/core/resolver/synthetic-id-ranges";
10
+ import { resolvePathBuilder } from "path-ts";
40
11
  const FOLD_OWNED_TABLES = ["spr", "names", "place_population", "ancestors"];
41
12
  /**
42
- * Clear everything the alias fold owns — `[GEONAMES_ID_BASE, GEONAMES_POSTAL_ID_BASE)` across {@link
43
- * FOLD_OWNED_TABLES}
44
- * — so a fold's output is a function of its country list and dumps ALONE, never of what the DB happened to hold first.
45
- * Returns the rows removed per table.
46
- *
47
- * This exists because the synthetic id is a POSITION (`GEONAMES_ID_BASE + n`, counted across the country list in
48
- * order), not a derivation from the geonameid: change the list, its order, or a dump's contents and every subsequent id
49
- * shifts. Without the purge, a second fold overwrote the `spr` PREFIX it reached (`INSERT OR REPLACE`) while its
50
- * `names`/`ancestors` rows merely appended (bare `INSERT`) and `place_population` skipped unpopulated places entirely —
51
- * so the previous run's names, ancestry and populations stayed bound to ids now describing other places.
13
+ * Deletes every row the GeoNames alias fold owns, with ids in
14
+ * `[GEONAMES_ID_BASE, GEONAMES_POSTAL_ID_BASE)`, and returns the count removed per table.
52
15
  *
53
- * Measured on the live 2026-08-05 artifact: a 14-country re-fold over the 161-country fold baked into
54
- * `admin-global-priority.db` put 522,184 of 2,110,096 name rows in the range (24.7 %) on a place from a different
55
- * country. Gaborone/BW at id 9000000121151 became Aichegg/AT and kept all 26 of its names; Kinshasa's 16,000,000
56
- * population landed on a Lithuanian hamlet.
57
- *
58
- * The upper bound is NOT the end of the id space. Each later extract owns a range above this one — GeoNames-postal @
59
- * 9.5e12, NL-PC6 @ 9.6e12, Code-Point @ 9.7e12, NI @ 9.8e12 — and a purge that ran past {@link GEONAMES_POSTAL_ID_BASE}
60
- * would delete them.
16
+ * Fold ids are assigned sequentially, so a re-fold without this purge would attach
17
+ * stale names, ancestors and populations to other places.
18
+ * The upper bound leaves the postal and postcode id ranges above it untouched.
61
19
  */
62
20
  export function purgeGeonamesAliasRange(db) {
63
21
  const removed = {};
@@ -70,26 +28,18 @@ export function purgeGeonamesAliasRange(db) {
70
28
  return removed;
71
29
  }
72
30
  /**
73
- * Parse a country's alternateNamesV2 file into `geonameid -> spelling -> attribution`, restricted to the populated
74
- * places (`P`) in `wanted`.
31
+ * Formats a GeoNames fold progress event as one log line.
75
32
  */
33
+ export function formatGeonamesIngestProgress(event, missingFile) {
34
+ if (event.skipped) {
35
+ return `${event.country}: ${missingFile ? `${missingFile} missing` : "dump missing"} — download from download.geonames.org/export/dump/${event.country}.zip; skipped`;
36
+ }
37
+ return `${event.country}: ${event.places.toLocaleString()} places, ${(event.aliasesRefused ?? 0).toLocaleString()} alt-names refused`;
38
+ }
76
39
  async function parseAlternateNamesV2(v2File, cc, wanted) {
77
40
  const v2 = new Map();
78
- // V2 columns (0-indexed): 1 geonameid, 2 isolanguage, 3 name, 4 isPreferredName, 5 isShortName,
79
- // 6 isColloquial, 7 isHistoric, 8 from, 9 to.
80
- //
81
- // Two passes, because historic-ness is a fact about the NAME, not the row: GeoNames splits one
82
- // spelling across rows — Malabo carries "Santa Isabel" as (es, unflagged) AND as (no-language,
83
- // isHistoric=1, to=1973). Officialness must see the flags from EVERY row for the spelling, or the
84
- // colonial-era name sails through on the language-tagged row (the #936 review's Malabo finding).
85
- // Do NOT condition on isPreferredName instead — it's sparse annotation, not a signal (Turku's sv "Åbo"
86
- // is unflagged; FI has 1,746 flags across the whole dump).
87
- //
88
- // Both passes STREAM the file rather than sharing one materialized array: NO's V2 dump is 33 MB,
89
- // and a second read off the page cache costs less than holding half a million line strings.
90
- // `header: false` — the dump is headerless.
91
41
  const historicNames = new Set();
92
- for await (const f of TSVSpliterator.fromAsync(v2File, { header: false })) {
42
+ for await (const f of readUnquotedTSV(v2File)) {
93
43
  if (f[6] === "1" || f[7] === "1" || (f[9] ?? "").trim() !== "") {
94
44
  const alt = (f[3] ?? "").trim();
95
45
  if (alt && wanted.has(Number(f[1]))) {
@@ -97,12 +47,11 @@ async function parseAlternateNamesV2(v2File, cc, wanted) {
97
47
  }
98
48
  }
99
49
  }
100
- for await (const f of TSVSpliterator.fromAsync(v2File, { header: false })) {
50
+ for await (const f of readUnquotedTSV(v2File)) {
101
51
  const gid = Number(f[1]);
102
52
  if (!wanted.has(gid))
103
53
  continue;
104
54
  const lang = f[2] ?? "";
105
- // ISO 639 codes are 2-3 letters; GeoNames' pseudo-codes (post, link, iata, wkdt, …) are 4+.
106
55
  if (!/^[a-z]{2,3}$/.test(lang))
107
56
  continue;
108
57
  const alt = (f[3] ?? "").trim();
@@ -131,70 +80,59 @@ async function parseAlternateNamesV2(v2File, cc, wanted) {
131
80
  return v2;
132
81
  }
133
82
  /**
134
- * Fold the GeoNames `P`-class places (+ their Latin alt-names) for `countries` into `db`'s `spr` / `names` /
135
- * `place_population` tables. Returns the total places ingested.
83
+ * Purges the fold's id range, then adds GeoNames `P`-class places and their
84
+ * alternate names for `countries` to `db`.
85
+ * It returns the number of places ingested.
136
86
  *
137
- * `onProgress` receives one event per country (default: a stderr line, matching the build scripts' legacy output). The
138
- * caller MUST rebuild `place_search` afterward (`buildPlaceSearchFTS(db, { drop: true })`) for the new names to reach
139
- * the candidate build's alias pass.
87
+ * The caller must then rebuild `place_search` with `buildPlaceSearchFTS(db, { drop: true })`
88
+ * to make the new names searchable.
140
89
  */
141
90
  export async function ingestGeonamesAliases(db, countries, geonamesDir, onProgress, opts) {
142
- // Latin-only, no bracket/paren noise GeoNames packs into `alternatenames` ("(( Karis Landskommun ))",
143
- // airport codes), 2–60 chars, at least one letter (drops bare postcodes/numbers).
144
91
  const LATIN_NAME = /^[\p{Script=Latin}\p{M}\s\-'.]{2,60}$/u;
145
92
  const clean = (s) => {
146
93
  const t = s.trim();
147
94
  return t && LATIN_NAME.test(t) && /\p{L}/u.test(t) ? t : null;
148
95
  };
96
+ const NAME_NOISE = /[()[\]{}<>|/\\_@#$%^*+=~`"]/u;
97
+ const NAME_MIN_LENGTH = 2;
98
+ const NAME_MAX_LENGTH = 60;
99
+ const cleanAlias = (s) => {
100
+ const t = s.trim();
101
+ return t.length >= NAME_MIN_LENGTH && t.length <= NAME_MAX_LENGTH && /\p{L}/u.test(t) && !NAME_NOISE.test(t)
102
+ ? t
103
+ : null;
104
+ };
149
105
  const sprInsert = db.prepare(`INSERT OR REPLACE INTO spr (id, parent_id, name, placetype, country, latitude, longitude, min_latitude, min_longitude, max_latitude, max_longitude, is_current, is_deprecated, is_ceased, is_superseded, is_superseding, lastmodified) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
150
106
  const namesInsert = db.prepare(`INSERT INTO names (id, name, placetype, country, language, privateuse, official, lastmodified) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`);
151
107
  const populationInsert = db.prepare(`INSERT OR REPLACE INTO place_population (id, population) VALUES (?, ?)`);
152
- // #267 admin linkage: ancestor rows (locality→region→country) so parentID scoping + adminCoherence reach
153
- // the gap countries. Only used for a country in opts.adminForCountries.
154
108
  const ancestorInsert = db.prepare(`INSERT INTO ancestors (id, ancestor_id, ancestor_placetype, lastmodified) VALUES (?, ?, ?, 0)`);
155
109
  const report = (event, missingFile) => {
156
110
  if (onProgress) {
157
111
  onProgress(event);
158
112
  }
159
- else if (event.skipped) {
160
- console.error(` GeoNames ${event.country}: ${missingFile} missing — download from download.geonames.org/export/dump/${event.country}.zip; skipped`);
161
- }
162
113
  else {
163
- console.error(` GeoNames ${event.country}: ${event.places.toLocaleString()} populated places (+ Latin alt-names)`);
114
+ console.error(` GeoNames ${formatGeonamesIngestProgress(event, missingFile)}`);
164
115
  }
165
116
  };
166
117
  let id = GEONAMES_ID_BASE;
167
118
  let total = 0;
168
119
  db.exec("BEGIN");
169
- // #1514: clear the range before writing it. Inside the transaction, so a fold that throws leaves the
170
- // DB as it found it rather than half-purged. See purgeGeonamesAliasRange for why the ids demand this.
171
120
  purgeGeonamesAliasRange(db);
172
121
  for (const cc of countries) {
173
- const file = join(geonamesDir, `${cc}.txt`);
122
+ const file = resolvePathBuilder(geonamesDir, `${cc}.txt`);
174
123
  if (!(await pathExists(file))) {
175
124
  report({ country: cc, places: 0, skipped: true }, file);
176
125
  continue;
177
126
  }
178
127
  let nc = 0;
179
- // #267: add A-class admin + ancestry only for the gap countries this country is in (never the EU set).
128
+ let refused = 0;
180
129
  const addAdmin = opts?.adminForCountries?.has(cc) ?? false;
181
- const v2File = opts?.alternateDir ? join(opts.alternateDir, `${cc}.txt`) : undefined;
130
+ const v2File = opts?.alternateDir ? resolvePathBuilder(opts.alternateDir, `${cc}.txt`) : undefined;
182
131
  const readV2 = Boolean(v2File && (await pathExists(v2File)));
183
- // Survey pass. The dump is STREAMED — NO's is 71 MB and only the caller knows which country
184
- // comes next — so what a later pass needs has to be collected here rather than re-scanned off a
185
- // materialized array. Two things qualify, and both are small: the P-class geonameid set the V2
186
- // decoration is restricted to, and the handful of A-class rows the admin pre-pass writes (one
187
- // PCL* + the ADM1s). Everything else is re-read in the emit pass below. Neither is wanted
188
- // without V2 tags or admin, and then the pass is skipped rather than read for nothing.
189
- //
190
- // GeoNames dump columns (0-indexed): 0 geonameid, 1 name, 2 asciiname, 3 alternatenames, 4 lat, 5 lon,
191
- // 6 feature_class, 7 feature_code, 10 admin1 code, 14 pop.
192
- //
193
- // `header: false` — the dump is headerless, so row 1 is a place, not column names.
194
132
  const wanted = new Set();
195
133
  const adminRows = [];
196
134
  if (readV2 || addAdmin) {
197
- for await (const f of TSVSpliterator.fromAsync(file, { header: false })) {
135
+ for await (const f of readUnquotedTSV(file)) {
198
136
  if (f[6] === "P") {
199
137
  if (readV2) {
200
138
  wanted.add(Number(f[0]));
@@ -206,12 +144,7 @@ export async function ingestGeonamesAliases(db, countries, geonamesDir, onProgre
206
144
  }
207
145
  }
208
146
  }
209
- // #936: V2 tags for this country's P-class rows — geonameid → exact alias spelling → tag. The V2
210
- // dump repeats one spelling under several languages ("Åbo" sv/da/no); the merged tag is official /
211
- // preferred if ANY qualifying row is.
212
147
  const v2 = readV2 ? await parseAlternateNamesV2(v2File, cc, wanted) : undefined;
213
- // #267 admin pre-pass (gap countries): fold the country (PCLI) + regions (ADM1), self+ancestry them, and
214
- // build the admin1→region map the localities link through. Point bbox (GeoNames gives a centroid only).
215
148
  let countryID = -1;
216
149
  const adminMap = new Map();
217
150
  if (addAdmin) {
@@ -222,11 +155,8 @@ export async function ingestGeonamesAliases(db, countries, geonamesDir, onProgre
222
155
  const lat = Number(f[4]) || 0;
223
156
  const lon = Number(f[5]) || 0;
224
157
  if (f[7]?.startsWith("PCL")) {
225
- // Any country-level political entity — PCLI (independent), PCLD (dependent territory),
226
- // PCLF (freely associated), PCLS (special administrative region: HK/MO/PS). All are the
227
- // country tier; restricting to PCLI left those ~17 territories without a country row.
228
158
  if (countryID >= 0)
229
- continue; // one country row
159
+ continue;
230
160
  countryID = id++;
231
161
  sprInsert.run(countryID, -1, aname, "country", cc, lat, lon, lat, lon, lat, lon, 1, 0, 0, 0, 0, 0);
232
162
  namesInsert.run(countryID, aname, "country", cc, "", "", 0, 0);
@@ -240,7 +170,6 @@ export async function ingestGeonamesAliases(db, countries, geonamesDir, onProgre
240
170
  adminMap.set(f[10], rid);
241
171
  }
242
172
  }
243
- // Re-parent regions + ancestor them to the (now-known) country.
244
173
  if (countryID >= 0) {
245
174
  for (const rid of adminMap.values()) {
246
175
  db.prepare("UPDATE spr SET parent_id = ? WHERE id = ?").run(countryID, rid);
@@ -248,10 +177,9 @@ export async function ingestGeonamesAliases(db, countries, geonamesDir, onProgre
248
177
  }
249
178
  }
250
179
  }
251
- // Emit pass — a second stream over the same file, off the page cache the survey pass just warmed.
252
- for await (const f of TSVSpliterator.fromAsync(file, { header: false })) {
180
+ for await (const f of readUnquotedTSV(file)) {
253
181
  if (f[6] !== "P")
254
- continue; // populated places only
182
+ continue;
255
183
  const lat = Number(f[4]);
256
184
  const lon = Number(f[5]);
257
185
  if (!Number.isFinite(lat) || !Number.isFinite(lon))
@@ -260,18 +188,10 @@ export async function ingestGeonamesAliases(db, countries, geonamesDir, onProgre
260
188
  if (!name)
261
189
  continue;
262
190
  const nid = id++;
263
- // #267: link to the locality's region (else country) for gap countries; -1 (orphan) otherwise.
264
191
  const regionID = addAdmin ? (adminMap.get(f[10] ?? "") ?? -1) : -1;
265
192
  const parentID = regionID >= 0 ? regionID : addAdmin && countryID >= 0 ? countryID : -1;
266
- // Point bbox — a GeoNames row is a centroid; the candidate's region-bbox disambiguation just
267
- // sees it as contained in itself, fine for a locality.
268
193
  sprInsert.run(nid, parentID, name, "locality", cc, lat, lon, lat, lon, lat, lon, 1, 0, 0, 0, 0, 0);
269
194
  namesInsert.run(nid, name, "locality", cc, "", "", 0, 0);
270
- // The SELF row is unconditional (#1514). `populateAncestors` writes one for every spr row it
271
- // sees, so a full build's freeze phase produces it either way — but the freeze does not run on
272
- // the fold-on-copy path, and since the purge now clears this range the fold has to emit
273
- // everything the closure would. Measured on the 161-country fold: 212,993 self rows, exactly the
274
- // non-gap countries' localities, which is what the base artifact carried and a fold-on-copy lost.
275
195
  ancestorInsert.run(nid, nid, "locality");
276
196
  if (addAdmin) {
277
197
  if (regionID >= 0) {
@@ -284,7 +204,10 @@ export async function ingestGeonamesAliases(db, countries, geonamesDir, onProgre
284
204
  const seen = new Set([name]);
285
205
  const tags = v2?.get(Number(f[0]));
286
206
  for (const raw of [f[2] ?? "", ...(f[3] ? f[3].split(",") : [])]) {
287
- const alt = clean(raw);
207
+ const alt = cleanAlias(raw);
208
+ if (!alt && raw.trim()) {
209
+ refused++;
210
+ }
288
211
  if (alt && !seen.has(alt)) {
289
212
  seen.add(alt);
290
213
  const tag = tags?.get(alt);
@@ -297,7 +220,7 @@ export async function ingestGeonamesAliases(db, countries, geonamesDir, onProgre
297
220
  }
298
221
  nc++;
299
222
  }
300
- report({ country: cc, places: nc, skipped: false });
223
+ report({ country: cc, places: nc, skipped: false, aliasesRefused: refused });
301
224
  total += nc;
302
225
  }
303
226
  db.exec("COMMIT");
@@ -1 +1 @@
1
- {"version":3,"file":"aliases.js","sourceRoot":"","sources":["../../lib/geonames/aliases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEvD,OAAO,EAAE,IAAI,EAAwB,MAAM,SAAS,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAG1D;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAA;AAEjD;;;GAGG;AACH,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,CAAU,CAAA;AAEpF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,uBAAuB,CAAK,EAAsB;IACjE,MAAM,OAAO,GAA2B,EAAE,CAAA;IAE1C,KAAK,MAAM,KAAK,IAAI,iBAAiB,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,EAAE;aACf,OAAO,CAAC,eAAe,KAAK,2BAA2B,CAAC;aACxD,GAAG,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAA;QAEhD,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACxC,CAAC;IAED,OAAO,OAAO,CAAA;AACf,CAAC;AA6BD;;;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AAG,EAAE,GAAG,CAAC,CAAA;YAC/B,CAAC;YAED,EAAE,EAAE,CAAA;QACL,CAAC;QAED,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,CAAA;QAC5E,KAAK,IAAI,EAAE,CAAA;IACZ,CAAC;IAED,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAEjB,OAAO,KAAK,CAAA;AACb,CAAC"}
@@ -3,49 +3,33 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * #920 — fold GeoNames POSTAL codes into a WOF/unified postcode extract as first-class
7
- * `postalcode` places, for the countries whose WOF postalcode repos don't exist (the
8
- * namesake-tail locales: FI/CZ/SK/SI/DK/NO/HR/PL and any future gap).
6
+ * Fold GeoNames postcode rows into a WOF or unified postcode extract as first-class `postalcode`
7
+ * places for countries whose WOF postalcode repos do not exist.
9
8
  *
10
- * Why: the night-31 taxonomy measured the cross-locale resolve tail as NAMESAKE COLLISION
11
- * (FI 300/1k … PL 75/1k offender rows), and the controlled experiment showed postcode-extract
12
- * coverage alone collapses it (FI 300→1, CZ 131→4): a resolvable postcode node feeds the
13
- * resolver's coordinate-first sibling-postcode candidate injection, which binds the locality
14
- * pick to its postcode neighborhood. The implementation already ships; it was coverage-starved.
9
+ * Two laws are enforced here in code rather than in a runbook.
15
10
  *
16
- * Two hard-won laws from the experiment are enforced HERE, in code, not in a runbook:
11
+ * 1. The name law. A postcode row's `name` is stored in the sanitized-query token shape with
12
+ * every non-letter and non-number stripped. `sanitizeFTSQuery` reduces the parsed token to
13
+ * that shape at lookup time. A stored `"110 00"` or `"11-041"` can never match the
14
+ * query `"11000"` or `"11041"`. The display form is preserved as an alt row in `names`.
15
+ * 2. The medoid law. A postcode whose rows contain scattered points has no single true center.
16
+ * Their average puts the code somewhere no address is. The medoid is the member point
17
+ * nearest the group's mean.
17
18
  *
18
- * 1. **The name law (#920 format law):** a postcode row's `name` is stored in the
19
- * SANITIZED-QUERY token shape — every non-letter/number stripped — because that is what
20
- * `sanitizeFTSQuery` reduces the parsed token to at lookup time. Stored `"110 00"` (CZ) or
21
- * `"11-041"` (PL) can never match the query `"11000"`/`"11041"`; the spaced CZ build
22
- * measured WORSE than no coverage (+13 namesake rows) because its bigrams partial-matched
23
- * WRONG codes. The display form is preserved as an alt row in `names`.
24
- * 2. **Medoid centroids:** GeoNames postal is one row per (postcode, settlement); the naive
25
- * mean-of-members centroid displaced tighter village coordinates on already-correct rows
26
- * (the p50-tax that ni-failed SK/SI/HR at 1.10–1.94 km CI). The MEDOID — the member point
27
- * nearest the mean — keeps the coordinate on a real settlement.
28
- *
29
- * Package home for the same reason as `geonames-aliases.ts`: `build-unified-wof
30
- * --geonames-postal-countries`, any standalone fold, and the `mailwoman gazetteer` commands
31
- * share ONE implementation. GeoNames postal dump = `download.geonames.org/export/zip/<CC>.zip`
32
- * → `<CC>.txt` (TSV: country, postcode, place, admin1, code1, admin2, code2, admin3, code3,
33
- * lat, lon, accuracy). License CC BY 4.0 — attribution rides the extract's `meta` provenance and
34
- * the model card like the existing GeoNames alias fold.
19
+ * `build-unified-wof --geonames-postal-countries`, standalone folds and the `mailwoman
20
+ * gazetteer` commands share one implementation. The GeoNames postal dump is
21
+ * `download.geonames.org/export/zip/<CC>.zip` → `<CC>.txt`, a headerless TSV of country,
22
+ * postcode, place, admin1, code1, admin2, code2, admin3, code3, lat, lon and accuracy.
23
+ * The license is CC BY 4.0. Attribution appears in the extract's `meta` provenance and model card.
35
24
  */
36
25
  import type { DatabaseClient } from "@mailwoman/sqlite/client";
37
26
  import { type PathBuilderLike } from "path-ts";
38
27
  import type { WOFDatabase } from "#schema";
39
28
  /**
40
- * Synthetic id base for GeoNames-POSTAL rows — its own namespace above the alias fold's {@link GEONAMES_ID_BASE} (9e12)
41
- * allocation so all four sources (WOF, Overture, GeoNames-alias, GeoNames-postal) coexist collision-free in a combined
42
- * DB.
43
- */
44
- export declare const GEONAMES_POSTAL_ID_BASE = 9500000000000;
45
- /**
46
- * The #920 name law: reduce a postcode to the sanitized-query token shape — strip every non-letter/number — so the
47
- * stored name matches what `sanitizeFTSQuery` produces from the parsed postcode token. `"110 00"` → `"11000"`,
48
- * `"11-041"` → `"11041"`, `"AD500"` → `"AD500"`.
29
+ * Reduce a postcode to the sanitized-query token shape, stripping every non-letter and non-number,
30
+ * so the stored name matches what `sanitizeFTSQuery` produces from the parsed postcode token.
31
+ *
32
+ * `"110 00"` → `"11000"`, `"11-041"` → `"11041"`, `"AD500"` → `"AD500"`.
49
33
  */
50
34
  export declare function normalizePostcodeName(raw: string): string;
51
35
  /**
@@ -53,22 +37,62 @@ export declare function normalizePostcodeName(raw: string): string;
53
37
  */
54
38
  export type PostcodePoint = readonly [number, number];
55
39
  /**
56
- * The #920 MEDOID law: pick the member point nearest the group's mean, never the mean itself.
40
+ * A medoid and the size of the group it came from.
57
41
  *
58
- * A postcode whose evidence is several scattered points has no single "true" centre, and the tempting answer — average
59
- * them — puts the code somewhere no address is. The night-31 experiment measured that as a p50 tax severe enough to
60
- * fail SK/SI/HR at 1.10–1.94 km CI: the mean displaced coordinates that were already correct. The medoid stays on a
61
- * real observation, so a single-member group is exactly its own point and a multi-member group is one of its members.
42
+ * These two integers describe the source dump.
43
+ * `@mailwoman/evidence`'s `EpistemicStatus` vocabulary belongs to the answering path.
62
44
  *
63
- * Distance is squared-Euclidean in DEGREES, not haversine. At the scale a postcode spans, the ranking the two produce
64
- * is the same, and this one carries no trig into a per-group inner loop. Ties go to the earliest member, which makes
65
- * the result a pure function of the input order — the property a rebuilt extract's ids depend on.
45
+ * `epistemicStatusFor` derives it there.
46
+ * These fields cannot use `observed` or `derived` here because that would give
47
+ * those words a second, local meaning.
48
+ */
49
+ export interface MedoidSupport {
50
+ /**
51
+ * The medoid over the distinct member points.
52
+ */
53
+ point: PostcodePoint;
54
+ /**
55
+ * Rows the group held.
56
+ */
57
+ rows: number;
58
+ /**
59
+ * Distinct coordinates among them.
60
+ *
61
+ * One means every row refers to the same point.
62
+ * In a dump whose coordinates are computed, that is one value inherited N times
63
+ * rather than N sources agreeing.
64
+ */
65
+ distinctPoints: number;
66
+ }
67
+ /**
68
+ * Pick the member point nearest the group's mean, never the mean itself.
69
+ *
70
+ * The medoid stays on a real observation, so a single-member group is exactly its own point
71
+ * and a multi-member group is one of its members.
72
+ * The bound applies only while the members are distinct, so duplicate points are collapsed first.
73
+ *
74
+ * Separate counts for N rows at one coordinate would weight that value by how many settlements
75
+ * inherited it. {@link MedoidSupport.distinctPoints} reports how many points the answer rested on.
76
+ *
77
+ * Distance is squared-Euclidean in degrees rather than haversine.
78
+ * At the scale a postcode spans, both methods produce the same ranking.
79
+ *
80
+ * Squared-Euclidean distance keeps trigonometry out of a per-group inner loop.
81
+ *
82
+ * Ties go to the earliest member, so the result is a pure function of input order.
83
+ * Rebuilt extract IDs depend on that property.
66
84
  *
67
- * Exported (rather than inlined at each ingest) because it is the second half of the #920 pair: every postcode source
68
- * that groups member points — GeoNames postal, OSM `addr:postcode` — owes the same law, and a second hand-rolled copy
69
- * is where they drift.
85
+ * Exported for reuse by every postcode source that groups member points:
86
+ * GeoNames postal and OSM `addr:postcode`.
87
+ * Both sources owe the same law.
88
+ * A second hand-rolled copy would let them drift.
70
89
  */
71
90
  export declare function medoidPoint(points: readonly PostcodePoint[]): PostcodePoint;
91
+ /**
92
+ * {@link medoidPoint} with the group size it rested on, for a caller that must
93
+ * record how thin the answer was.
94
+ */
95
+ export declare function medoidWithSupport(points: readonly PostcodePoint[]): MedoidSupport;
72
96
  export interface GeonamesPostalIngestResult {
73
97
  /**
74
98
  * Distinct postcodes inserted across all countries.
@@ -78,16 +102,26 @@ export interface GeonamesPostalIngestResult {
78
102
  * Per-country distinct-postcode counts.
79
103
  */
80
104
  byCountry: Record<string, number>;
105
+ /**
106
+ * Per-country count of inserted codes the dump listed on several rows that all refer to one point.
107
+ *
108
+ * The coordinate rests on a single value no matter how many settlements sit under the code.
109
+ * Reported because the point is still the best the source offers.
110
+ *
111
+ * A consumer weighing postal coverage needs to know how much of it is this.
112
+ */
113
+ singlePointByCountry: Record<string, number>;
81
114
  /**
82
115
  * Countries whose `<CC>.txt` was missing under the postal dir (skipped, reported).
83
116
  */
84
117
  missing: string[];
85
118
  }
86
119
  /**
87
- * Fold GeoNames postcodes for `countries` into an open unified/postcode ingest DB: one `spr` row per distinct
88
- * normalized postcode (placetype `postalcode`, medoid centroid, degenerate bbox), the normalized form as `name`, and
89
- * the display form as an extra `names` row when it differs. The caller owns the FTS rebuild (rows ride the standard
90
- * freeze phase).
120
+ * Fold GeoNames postcodes for `countries` into an open unified/postcode ingest DB: one `spr` row
121
+ * per distinct normalized postcode (placetype `postalcode`, medoid centroid, degenerate bbox),
122
+ * the normalized form as `name`, and the display form as an extra `names` row when it differs.
123
+ *
124
+ * The caller owns the FTS rebuild (rows ride the standard freeze phase).
91
125
  */
92
126
  export declare function ingestGeonamesPostal(db: DatabaseClient<WOFDatabase>, countries: readonly string[], postalDir: PathBuilderLike): Promise<GeonamesPostalIngestResult>;
93
127
  //# sourceMappingURL=postal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"postal.d.ts","sourceRoot":"","sources":["../../lib/geonames/postal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAQ,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAGpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAQ1C;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,gBAAoB,CAAA;AAExD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,MAAM,MAAM,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