@mailwoman/resolver-wof-sqlite 11.2.0 → 11.4.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 (453) hide show
  1. package/lib/address/duplicate.ts +1 -1
  2. package/lib/address/keys/attribution.ts +6 -1
  3. package/lib/address/keys/build.ts +1 -1
  4. package/lib/address/keys/layout.ts +27 -1
  5. package/lib/address/keys/lookup.ts +2 -2
  6. package/lib/address/keys/point-lookup.ts +2 -2
  7. package/lib/address/number-forms.ts +42 -6
  8. package/lib/address/point/interpolation.ts +11 -3
  9. package/lib/address/point/schema.ts +1 -1
  10. package/lib/address/point.ts +15 -14
  11. package/lib/address/record.ts +1 -1
  12. package/lib/build/candidate.ts +136 -40
  13. package/lib/build/slim.ts +4 -1
  14. package/lib/build/sources.ts +50 -0
  15. package/lib/candidate/alias-bags.ts +22 -8
  16. package/lib/candidate/ancestors/schema.ts +1 -1
  17. package/lib/candidate/ancestors/sidecar.ts +13 -2
  18. package/lib/candidate/bare-admin-names.ts +1 -1
  19. package/lib/{capital-schema.ts → candidate/capital-schema.ts} +3 -3
  20. package/lib/{capitals.ts → candidate/capitals.ts} +1 -1
  21. package/lib/candidate/country-display-names.ts +1 -1
  22. package/lib/candidate/{extract-fold.ts → extract-rows.ts} +7 -4
  23. package/lib/candidate/importance.ts +86 -8
  24. package/lib/candidate/key-fold.ts +1 -1
  25. package/lib/candidate/lookup.ts +79 -48
  26. package/lib/candidate/name-roles.ts +1 -1
  27. package/lib/candidate/nickname-namesakes.ts +8 -1
  28. package/lib/candidate/overture-twins.ts +83 -0
  29. package/lib/candidate/place-attrs.ts +2 -2
  30. package/lib/candidate/postcode-browse.ts +173 -0
  31. package/lib/candidate/schema.ts +43 -2
  32. package/lib/candidate/scoring.ts +4 -4
  33. package/lib/convention.ts +1 -1
  34. package/lib/env.ts +15 -3
  35. package/lib/fst/builder.ts +8 -6
  36. package/lib/fst/deserialize-web.ts +1 -1
  37. package/lib/fst/freshness.ts +2 -2
  38. package/lib/fst/serialize.ts +1 -1
  39. package/lib/fts/query.ts +1 -1
  40. package/lib/{search-fetch.ts → fts/search-fetch.ts} +2 -2
  41. package/lib/geonames/aliases.ts +37 -33
  42. package/lib/geonames/postal.ts +3 -3
  43. package/lib/index.ts +20 -17
  44. package/lib/{postal/city → labels/locality/postal-city}/alias/lookup.ts +1 -1
  45. package/lib/{postal/city → labels/locality/postal-city}/candidate-schema.ts +1 -1
  46. package/lib/labels/locality.ts +6 -0
  47. package/lib/{region-keys.ts → labels/region.ts} +5 -2
  48. package/lib/{street → labels/street}/centroid/schema.ts +1 -1
  49. package/lib/{street → labels/street}/centroid.ts +7 -7
  50. package/lib/{interpolation.ts → labels/street/interpolation.ts} +56 -5
  51. package/lib/labels/street/locale.ts +117 -0
  52. package/lib/{street → labels/street}/morphology/fst/loader.ts +1 -1
  53. package/lib/{street → labels/street}/name-lookup.ts +2 -0
  54. package/lib/{street → labels/street}/normalize.ts +293 -133
  55. package/lib/{street → labels/street}/segment-schema.ts +1 -1
  56. package/lib/{street → labels/street}/table.ts +1 -1
  57. package/lib/labels/street.ts +11 -0
  58. package/lib/landmark/rows.ts +1 -1
  59. package/lib/lookup/browse.ts +304 -0
  60. package/lib/{extracts.ts → lookup/extracts.ts} +1 -1
  61. package/lib/lookup/former-divisions.ts +183 -0
  62. package/lib/{postcode-point-lookup.ts → lookup/postcode-point.ts} +5 -0
  63. package/lib/{reverse.ts → lookup/reverse.ts} +4 -4
  64. package/lib/{types.ts → lookup/types.ts} +10 -0
  65. package/lib/lookup.ts +21 -31
  66. package/lib/poi/schema.ts +1 -1
  67. package/lib/{primary-preference.ts → ranking/primary-preference.ts} +5 -0
  68. package/lib/schema/overture-match.ts +79 -0
  69. package/lib/{place-importance-schema.ts → schema/place-importance.ts} +86 -0
  70. package/lib/schema.ts +3 -3
  71. package/lib/sqlite/convention-source.ts +1 -1
  72. package/lib/uprn/existence.ts +2 -0
  73. package/lib/{weights-overlay-linker.ts → weights/overlay-linker.ts} +244 -103
  74. package/out/address/duplicate.js +1 -1
  75. package/out/address/duplicate.js.map +1 -1
  76. package/out/address/keys/attribution.d.ts +4 -0
  77. package/out/address/keys/attribution.d.ts.map +1 -1
  78. package/out/address/keys/attribution.js +5 -1
  79. package/out/address/keys/attribution.js.map +1 -1
  80. package/out/address/keys/build.d.ts.map +1 -1
  81. package/out/address/keys/build.js +1 -1
  82. package/out/address/keys/build.js.map +1 -1
  83. package/out/address/keys/layout.d.ts +18 -1
  84. package/out/address/keys/layout.d.ts.map +1 -1
  85. package/out/address/keys/layout.js +23 -1
  86. package/out/address/keys/layout.js.map +1 -1
  87. package/out/address/keys/lookup.js +2 -2
  88. package/out/address/keys/lookup.js.map +1 -1
  89. package/out/address/keys/point-lookup.d.ts.map +1 -1
  90. package/out/address/keys/point-lookup.js +2 -2
  91. package/out/address/keys/point-lookup.js.map +1 -1
  92. package/out/address/number-forms.d.ts +6 -1
  93. package/out/address/number-forms.d.ts.map +1 -1
  94. package/out/address/number-forms.js +36 -5
  95. package/out/address/number-forms.js.map +1 -1
  96. package/out/address/point/interpolation.d.ts +1 -1
  97. package/out/address/point/interpolation.d.ts.map +1 -1
  98. package/out/address/point/interpolation.js +9 -2
  99. package/out/address/point/interpolation.js.map +1 -1
  100. package/out/address/point/schema.d.ts +1 -1
  101. package/out/address/point/schema.d.ts.map +1 -1
  102. package/out/address/point.d.ts +4 -5
  103. package/out/address/point.d.ts.map +1 -1
  104. package/out/address/point.js +11 -11
  105. package/out/address/point.js.map +1 -1
  106. package/out/address/record.d.ts +1 -1
  107. package/out/address/record.d.ts.map +1 -1
  108. package/out/address/record.js +1 -1
  109. package/out/address/record.js.map +1 -1
  110. package/out/build/candidate.d.ts +26 -1
  111. package/out/build/candidate.d.ts.map +1 -1
  112. package/out/build/candidate.js +71 -32
  113. package/out/build/candidate.js.map +1 -1
  114. package/out/build/slim.d.ts.map +1 -1
  115. package/out/build/slim.js +4 -1
  116. package/out/build/slim.js.map +1 -1
  117. package/out/build/sources.d.ts +32 -0
  118. package/out/build/sources.d.ts.map +1 -0
  119. package/out/build/sources.js +35 -0
  120. package/out/build/sources.js.map +1 -0
  121. package/out/candidate/alias-bags.d.ts +0 -3
  122. package/out/candidate/alias-bags.d.ts.map +1 -1
  123. package/out/candidate/alias-bags.js +22 -7
  124. package/out/candidate/alias-bags.js.map +1 -1
  125. package/out/candidate/ancestors/schema.d.ts +1 -1
  126. package/out/candidate/ancestors/schema.d.ts.map +1 -1
  127. package/out/candidate/ancestors/sidecar.d.ts +0 -3
  128. package/out/candidate/ancestors/sidecar.d.ts.map +1 -1
  129. package/out/candidate/ancestors/sidecar.js +16 -2
  130. package/out/candidate/ancestors/sidecar.js.map +1 -1
  131. package/out/candidate/bare-admin-names.js +1 -1
  132. package/out/candidate/bare-admin-names.js.map +1 -1
  133. package/out/{capital-schema.d.ts → candidate/capital-schema.d.ts} +2 -2
  134. package/out/candidate/capital-schema.d.ts.map +1 -0
  135. package/out/{capital-schema.js → candidate/capital-schema.js} +2 -2
  136. package/out/candidate/capital-schema.js.map +1 -0
  137. package/out/candidate/capitals.d.ts.map +1 -0
  138. package/out/{capitals.js → candidate/capitals.js} +1 -1
  139. package/out/candidate/capitals.js.map +1 -0
  140. package/out/candidate/country-display-names.js +1 -1
  141. package/out/candidate/country-display-names.js.map +1 -1
  142. package/out/{coverage-manifest-schema.d.ts → candidate/coverage-manifest.d.ts} +1 -1
  143. package/out/candidate/coverage-manifest.d.ts.map +1 -0
  144. package/out/{coverage-manifest-schema.js → candidate/coverage-manifest.js} +1 -1
  145. package/out/candidate/coverage-manifest.js.map +1 -0
  146. package/out/candidate/{extract-fold.d.ts → extract-rows.d.ts} +2 -2
  147. package/out/candidate/extract-rows.d.ts.map +1 -0
  148. package/out/candidate/{extract-fold.js → extract-rows.js} +8 -5
  149. package/out/candidate/extract-rows.js.map +1 -0
  150. package/out/candidate/importance.d.ts +34 -3
  151. package/out/candidate/importance.d.ts.map +1 -1
  152. package/out/candidate/importance.js +53 -8
  153. package/out/candidate/importance.js.map +1 -1
  154. package/out/candidate/key-fold.d.ts +1 -1
  155. package/out/candidate/key-fold.d.ts.map +1 -1
  156. package/out/candidate/key-fold.js +1 -1
  157. package/out/candidate/key-fold.js.map +1 -1
  158. package/out/candidate/lookup.d.ts +5 -1
  159. package/out/candidate/lookup.d.ts.map +1 -1
  160. package/out/candidate/lookup.js +59 -43
  161. package/out/candidate/lookup.js.map +1 -1
  162. package/out/candidate/name-roles.d.ts.map +1 -1
  163. package/out/candidate/name-roles.js +1 -1
  164. package/out/candidate/name-roles.js.map +1 -1
  165. package/out/candidate/nickname-namesakes.d.ts +0 -4
  166. package/out/candidate/nickname-namesakes.d.ts.map +1 -1
  167. package/out/candidate/nickname-namesakes.js +12 -1
  168. package/out/candidate/nickname-namesakes.js.map +1 -1
  169. package/out/candidate/overture-twins.d.ts +30 -0
  170. package/out/candidate/overture-twins.d.ts.map +1 -0
  171. package/out/candidate/overture-twins.js +40 -0
  172. package/out/candidate/overture-twins.js.map +1 -0
  173. package/out/candidate/place-attrs.d.ts +2 -2
  174. package/out/candidate/postcode-browse.d.ts +36 -0
  175. package/out/candidate/postcode-browse.d.ts.map +1 -0
  176. package/out/candidate/postcode-browse.js +119 -0
  177. package/out/candidate/postcode-browse.js.map +1 -0
  178. package/out/candidate/schema.d.ts +30 -2
  179. package/out/candidate/schema.d.ts.map +1 -1
  180. package/out/candidate/schema.js +29 -0
  181. package/out/candidate/schema.js.map +1 -1
  182. package/out/candidate/scoring.d.ts +3 -3
  183. package/out/candidate/scoring.d.ts.map +1 -1
  184. package/out/candidate/scoring.js +2 -2
  185. package/out/candidate/scoring.js.map +1 -1
  186. package/out/convention.d.ts +1 -1
  187. package/out/convention.d.ts.map +1 -1
  188. package/out/env.d.ts +3 -0
  189. package/out/env.d.ts.map +1 -1
  190. package/out/env.js +14 -3
  191. package/out/env.js.map +1 -1
  192. package/out/fst/builder.d.ts.map +1 -1
  193. package/out/fst/builder.js +8 -6
  194. package/out/fst/builder.js.map +1 -1
  195. package/out/fst/deserialize-web.js +1 -1
  196. package/out/fst/deserialize-web.js.map +1 -1
  197. package/out/fst/freshness.js +2 -2
  198. package/out/fst/freshness.js.map +1 -1
  199. package/out/fst/serialize.js +1 -1
  200. package/out/fst/serialize.js.map +1 -1
  201. package/out/fts/query.d.ts +1 -1
  202. package/out/fts/query.d.ts.map +1 -1
  203. package/out/{search-fetch.d.ts → fts/search-fetch.d.ts} +2 -2
  204. package/out/fts/search-fetch.d.ts.map +1 -0
  205. package/out/fts/search-fetch.js.map +1 -0
  206. package/out/geonames/aliases.d.ts +18 -18
  207. package/out/geonames/aliases.d.ts.map +1 -1
  208. package/out/geonames/aliases.js +17 -17
  209. package/out/geonames/aliases.js.map +1 -1
  210. package/out/geonames/postal.d.ts +1 -1
  211. package/out/geonames/postal.js +3 -3
  212. package/out/index.d.ts +17 -17
  213. package/out/index.d.ts.map +1 -1
  214. package/out/index.js +12 -12
  215. package/out/index.js.map +1 -1
  216. package/out/{postal/city → labels/locality/postal-city}/alias/lookup.d.ts +1 -1
  217. package/out/labels/locality/postal-city/alias/lookup.d.ts.map +1 -0
  218. package/out/labels/locality/postal-city/alias/lookup.js.map +1 -0
  219. package/out/labels/locality/postal-city/alias/schema.d.ts.map +1 -0
  220. package/out/labels/locality/postal-city/alias/schema.js.map +1 -0
  221. package/out/{postal/city → labels/locality/postal-city}/candidate-schema.d.ts +1 -1
  222. package/out/labels/locality/postal-city/candidate-schema.d.ts.map +1 -0
  223. package/out/labels/locality/postal-city/candidate-schema.js.map +1 -0
  224. package/out/labels/locality.d.ts +4 -0
  225. package/out/labels/locality.d.ts.map +1 -0
  226. package/out/labels/locality.js +6 -0
  227. package/out/labels/locality.js.map +1 -0
  228. package/out/{region-keys.d.ts → labels/region.d.ts} +1 -1
  229. package/out/{region-keys.d.ts.map → labels/region.d.ts.map} +1 -1
  230. package/out/{region-keys.js → labels/region.js} +6 -3
  231. package/out/labels/region.js.map +1 -0
  232. package/out/{street → labels/street}/centroid/schema.d.ts +1 -1
  233. package/out/labels/street/centroid/schema.d.ts.map +1 -0
  234. package/out/labels/street/centroid/schema.js.map +1 -0
  235. package/out/{street → labels/street}/centroid.d.ts +5 -5
  236. package/out/labels/street/centroid.d.ts.map +1 -0
  237. package/out/{street → labels/street}/centroid.js +5 -5
  238. package/out/labels/street/centroid.js.map +1 -0
  239. package/out/{interpolation.d.ts → labels/street/interpolation.d.ts} +6 -1
  240. package/out/labels/street/interpolation.d.ts.map +1 -0
  241. package/out/{interpolation.js → labels/street/interpolation.js} +40 -9
  242. package/out/labels/street/interpolation.js.map +1 -0
  243. package/out/labels/street/locale.d.ts +26 -0
  244. package/out/labels/street/locale.d.ts.map +1 -0
  245. package/out/labels/street/locale.js +98 -0
  246. package/out/labels/street/locale.js.map +1 -0
  247. package/out/labels/street/morphology/fst/builder.d.ts.map +1 -0
  248. package/out/labels/street/morphology/fst/builder.js.map +1 -0
  249. package/out/labels/street/morphology/fst/loader.d.ts.map +1 -0
  250. package/out/{street → labels/street}/morphology/fst/loader.js +1 -1
  251. package/out/labels/street/morphology/fst/loader.js.map +1 -0
  252. package/out/labels/street/name-lookup.d.ts.map +1 -0
  253. package/out/{street → labels/street}/name-lookup.js +2 -0
  254. package/out/labels/street/name-lookup.js.map +1 -0
  255. package/out/labels/street/normalize.d.ts +207 -0
  256. package/out/labels/street/normalize.d.ts.map +1 -0
  257. package/out/{street → labels/street}/normalize.js +198 -119
  258. package/out/labels/street/normalize.js.map +1 -0
  259. package/out/{street → labels/street}/segment-schema.d.ts +1 -1
  260. package/out/labels/street/segment-schema.d.ts.map +1 -0
  261. package/out/labels/street/segment-schema.js.map +1 -0
  262. package/out/labels/street/table.d.ts.map +1 -0
  263. package/out/{street → labels/street}/table.js +1 -1
  264. package/out/labels/street/table.js.map +1 -0
  265. package/out/labels/street.d.ts +9 -0
  266. package/out/labels/street.d.ts.map +1 -0
  267. package/out/labels/street.js +11 -0
  268. package/out/labels/street.js.map +1 -0
  269. package/out/landmark/rows.js +1 -1
  270. package/out/landmark/rows.js.map +1 -1
  271. package/out/lookup/browse.d.ts +79 -0
  272. package/out/lookup/browse.d.ts.map +1 -0
  273. package/out/lookup/browse.js +194 -0
  274. package/out/lookup/browse.js.map +1 -0
  275. package/out/lookup/exact-match.d.ts.map +1 -0
  276. package/out/lookup/exact-match.js.map +1 -0
  277. package/out/lookup/extracts.d.ts.map +1 -0
  278. package/out/{extracts.js → lookup/extracts.js} +1 -1
  279. package/out/lookup/extracts.js.map +1 -0
  280. package/out/lookup/former-divisions.d.ts +99 -0
  281. package/out/lookup/former-divisions.d.ts.map +1 -0
  282. package/out/lookup/former-divisions.js +98 -0
  283. package/out/lookup/former-divisions.js.map +1 -0
  284. package/out/{postcode-point-lookup.d.ts → lookup/postcode-point.d.ts} +5 -1
  285. package/out/lookup/postcode-point.d.ts.map +1 -0
  286. package/out/{postcode-point-lookup.js → lookup/postcode-point.js} +1 -1
  287. package/out/lookup/postcode-point.js.map +1 -0
  288. package/out/{reverse.d.ts → lookup/reverse.d.ts} +1 -1
  289. package/out/lookup/reverse.d.ts.map +1 -0
  290. package/out/{reverse.js → lookup/reverse.js} +3 -3
  291. package/out/lookup/reverse.js.map +1 -0
  292. package/out/{types.d.ts → lookup/types.d.ts} +9 -0
  293. package/out/lookup/types.d.ts.map +1 -0
  294. package/out/lookup/types.js.map +1 -0
  295. package/out/lookup.d.ts +4 -4
  296. package/out/lookup.d.ts.map +1 -1
  297. package/out/lookup.js +14 -20
  298. package/out/lookup.js.map +1 -1
  299. package/out/poi/schema.d.ts +1 -1
  300. package/out/poi/schema.d.ts.map +1 -1
  301. package/out/ranking/name-score.d.ts.map +1 -0
  302. package/out/ranking/name-score.js.map +1 -0
  303. package/out/ranking/primary-preference.d.ts.map +1 -0
  304. package/out/{primary-preference.js → ranking/primary-preference.js} +4 -0
  305. package/out/ranking/primary-preference.js.map +1 -0
  306. package/out/ranking/proximity-rerank.d.ts.map +1 -0
  307. package/out/ranking/proximity-rerank.js.map +1 -0
  308. package/out/{ranking-weights.d.ts → ranking/weights.d.ts} +1 -1
  309. package/out/ranking/weights.d.ts.map +1 -0
  310. package/out/{ranking-weights.js → ranking/weights.js} +1 -1
  311. package/out/ranking/weights.js.map +1 -0
  312. package/out/schema/importance-source.d.ts.map +1 -0
  313. package/out/schema/importance-source.js.map +1 -0
  314. package/out/schema/overture-match.d.ts +53 -0
  315. package/out/schema/overture-match.d.ts.map +1 -0
  316. package/out/schema/overture-match.js +33 -0
  317. package/out/schema/overture-match.js.map +1 -0
  318. package/out/{place-importance-schema.d.ts → schema/place-importance.d.ts} +50 -1
  319. package/out/schema/place-importance.d.ts.map +1 -0
  320. package/out/{place-importance-schema.js → schema/place-importance.js} +34 -1
  321. package/out/schema/place-importance.js.map +1 -0
  322. package/out/{polygon-schema.d.ts → schema/polygon.d.ts} +1 -1
  323. package/out/schema/polygon.d.ts.map +1 -0
  324. package/out/{polygon-schema.js → schema/polygon.js} +1 -1
  325. package/out/schema/polygon.js.map +1 -0
  326. package/out/{unified-schema.d.ts → schema/unified.d.ts} +1 -1
  327. package/out/schema/unified.d.ts.map +1 -0
  328. package/out/{unified-schema.js → schema/unified.js} +1 -1
  329. package/out/schema/unified.js.map +1 -0
  330. package/out/schema.d.ts +3 -3
  331. package/out/sqlite/convention-source.js +1 -1
  332. package/out/sqlite/convention-source.js.map +1 -1
  333. package/out/uprn/existence.d.ts.map +1 -1
  334. package/out/uprn/existence.js +2 -0
  335. package/out/uprn/existence.js.map +1 -1
  336. package/out/{weights-overlay-linker.d.ts → weights/overlay-linker.d.ts} +43 -24
  337. package/out/weights/overlay-linker.d.ts.map +1 -0
  338. package/out/{weights-overlay-linker.js → weights/overlay-linker.js} +182 -66
  339. package/out/weights/overlay-linker.js.map +1 -0
  340. package/package.json +12 -32
  341. package/lib/postal.ts +0 -6
  342. package/lib/street/locale.ts +0 -64
  343. package/lib/street.ts +0 -11
  344. package/out/candidate/extract-fold.d.ts.map +0 -1
  345. package/out/candidate/extract-fold.js.map +0 -1
  346. package/out/capital-schema.d.ts.map +0 -1
  347. package/out/capital-schema.js.map +0 -1
  348. package/out/capitals.d.ts.map +0 -1
  349. package/out/capitals.js.map +0 -1
  350. package/out/coverage-manifest-schema.d.ts.map +0 -1
  351. package/out/coverage-manifest-schema.js.map +0 -1
  352. package/out/exact-match.d.ts.map +0 -1
  353. package/out/exact-match.js.map +0 -1
  354. package/out/extracts.d.ts.map +0 -1
  355. package/out/extracts.js.map +0 -1
  356. package/out/importance-source.d.ts.map +0 -1
  357. package/out/importance-source.js.map +0 -1
  358. package/out/interpolation.d.ts.map +0 -1
  359. package/out/interpolation.js.map +0 -1
  360. package/out/name-score.d.ts.map +0 -1
  361. package/out/name-score.js.map +0 -1
  362. package/out/place-importance-schema.d.ts.map +0 -1
  363. package/out/place-importance-schema.js.map +0 -1
  364. package/out/polygon-schema.d.ts.map +0 -1
  365. package/out/polygon-schema.js.map +0 -1
  366. package/out/postal/city/alias/lookup.d.ts.map +0 -1
  367. package/out/postal/city/alias/lookup.js.map +0 -1
  368. package/out/postal/city/alias/schema.d.ts.map +0 -1
  369. package/out/postal/city/alias/schema.js.map +0 -1
  370. package/out/postal/city/candidate-schema.d.ts.map +0 -1
  371. package/out/postal/city/candidate-schema.js.map +0 -1
  372. package/out/postal.d.ts +0 -4
  373. package/out/postal.d.ts.map +0 -1
  374. package/out/postal.js +0 -6
  375. package/out/postal.js.map +0 -1
  376. package/out/postcode-point-lookup.d.ts.map +0 -1
  377. package/out/postcode-point-lookup.js.map +0 -1
  378. package/out/primary-preference.d.ts.map +0 -1
  379. package/out/primary-preference.js.map +0 -1
  380. package/out/proximity-rerank.d.ts.map +0 -1
  381. package/out/proximity-rerank.js.map +0 -1
  382. package/out/ranking-weights.d.ts.map +0 -1
  383. package/out/ranking-weights.js.map +0 -1
  384. package/out/region-keys.js.map +0 -1
  385. package/out/reverse.d.ts.map +0 -1
  386. package/out/reverse.js.map +0 -1
  387. package/out/search-fetch.d.ts.map +0 -1
  388. package/out/search-fetch.js.map +0 -1
  389. package/out/street/centroid/schema.d.ts.map +0 -1
  390. package/out/street/centroid/schema.js.map +0 -1
  391. package/out/street/centroid.d.ts.map +0 -1
  392. package/out/street/centroid.js.map +0 -1
  393. package/out/street/locale.d.ts +0 -12
  394. package/out/street/locale.d.ts.map +0 -1
  395. package/out/street/locale.js +0 -54
  396. package/out/street/locale.js.map +0 -1
  397. package/out/street/morphology/fst/builder.d.ts.map +0 -1
  398. package/out/street/morphology/fst/builder.js.map +0 -1
  399. package/out/street/morphology/fst/loader.d.ts.map +0 -1
  400. package/out/street/morphology/fst/loader.js.map +0 -1
  401. package/out/street/name-lookup.d.ts.map +0 -1
  402. package/out/street/name-lookup.js.map +0 -1
  403. package/out/street/normalize.d.ts +0 -130
  404. package/out/street/normalize.d.ts.map +0 -1
  405. package/out/street/normalize.js.map +0 -1
  406. package/out/street/segment-schema.d.ts.map +0 -1
  407. package/out/street/segment-schema.js.map +0 -1
  408. package/out/street/table.d.ts.map +0 -1
  409. package/out/street/table.js.map +0 -1
  410. package/out/street.d.ts +0 -9
  411. package/out/street.d.ts.map +0 -1
  412. package/out/street.js +0 -11
  413. package/out/street.js.map +0 -1
  414. package/out/types.d.ts.map +0 -1
  415. package/out/types.js.map +0 -1
  416. package/out/unified-schema.d.ts.map +0 -1
  417. package/out/unified-schema.js.map +0 -1
  418. package/out/weights-overlay-linker.d.ts.map +0 -1
  419. package/out/weights-overlay-linker.js.map +0 -1
  420. /package/lib/{coverage-manifest-schema.ts → candidate/coverage-manifest.ts} +0 -0
  421. /package/lib/{postal/city → labels/locality/postal-city}/alias/schema.ts +0 -0
  422. /package/lib/{street → labels/street}/morphology/fst/builder.ts +0 -0
  423. /package/lib/{exact-match.ts → lookup/exact-match.ts} +0 -0
  424. /package/lib/{name-score.ts → ranking/name-score.ts} +0 -0
  425. /package/lib/{proximity-rerank.ts → ranking/proximity-rerank.ts} +0 -0
  426. /package/lib/{ranking-weights.ts → ranking/weights.ts} +0 -0
  427. /package/lib/{importance-source.ts → schema/importance-source.ts} +0 -0
  428. /package/lib/{polygon-schema.ts → schema/polygon.ts} +0 -0
  429. /package/lib/{unified-schema.ts → schema/unified.ts} +0 -0
  430. /package/out/{capitals.d.ts → candidate/capitals.d.ts} +0 -0
  431. /package/out/{search-fetch.js → fts/search-fetch.js} +0 -0
  432. /package/out/{postal/city → labels/locality/postal-city}/alias/lookup.js +0 -0
  433. /package/out/{postal/city → labels/locality/postal-city}/alias/schema.d.ts +0 -0
  434. /package/out/{postal/city → labels/locality/postal-city}/alias/schema.js +0 -0
  435. /package/out/{postal/city → labels/locality/postal-city}/candidate-schema.js +0 -0
  436. /package/out/{street → labels/street}/centroid/schema.js +0 -0
  437. /package/out/{street → labels/street}/morphology/fst/builder.d.ts +0 -0
  438. /package/out/{street → labels/street}/morphology/fst/builder.js +0 -0
  439. /package/out/{street → labels/street}/morphology/fst/loader.d.ts +0 -0
  440. /package/out/{street → labels/street}/name-lookup.d.ts +0 -0
  441. /package/out/{street → labels/street}/segment-schema.js +0 -0
  442. /package/out/{street → labels/street}/table.d.ts +0 -0
  443. /package/out/{exact-match.d.ts → lookup/exact-match.d.ts} +0 -0
  444. /package/out/{exact-match.js → lookup/exact-match.js} +0 -0
  445. /package/out/{extracts.d.ts → lookup/extracts.d.ts} +0 -0
  446. /package/out/{types.js → lookup/types.js} +0 -0
  447. /package/out/{name-score.d.ts → ranking/name-score.d.ts} +0 -0
  448. /package/out/{name-score.js → ranking/name-score.js} +0 -0
  449. /package/out/{primary-preference.d.ts → ranking/primary-preference.d.ts} +0 -0
  450. /package/out/{proximity-rerank.d.ts → ranking/proximity-rerank.d.ts} +0 -0
  451. /package/out/{proximity-rerank.js → ranking/proximity-rerank.js} +0 -0
  452. /package/out/{importance-source.d.ts → schema/importance-source.d.ts} +0 -0
  453. /package/out/{importance-source.js → schema/importance-source.js} +0 -0
@@ -0,0 +1,79 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * The `overture_wof_match` table: which Who's On First record each matched Overture division is.
6
+ *
7
+ * The admin gazetteer is a Collective Database.
8
+ * Its Overture Divisions part is ODbL-1.0, and the Overture step writes every division as its
9
+ * own row in the Overture id range rather than adding its names or Wikidata id to a WOF record.
10
+ *
11
+ * A lookup that returns each place once reads the match from this table
12
+ * instead of from an altered WOF row.
13
+ * The table is derived from Overture data, so it belongs to the Overture part
14
+ * and travels with that part's ODbL offer.
15
+ *
16
+ * The admin build writes it, the candidate build copies it into `candidate.db`,
17
+ * and the Overture part's offer file includes it.
18
+ */
19
+
20
+ import type { DatabaseClient } from "@mailwoman/sqlite/client"
21
+ import type { Kysely } from "kysely"
22
+
23
+ import { hasTable } from "#sqlite-utils"
24
+
25
+ /**
26
+ * The table name every writer and reader uses.
27
+ */
28
+ export const OVERTURE_WOF_MATCH_TABLE = "overture_wof_match"
29
+
30
+ /**
31
+ * One matched division: its Overture-part row and the WOF record it names.
32
+ */
33
+ export interface OvertureWOFMatchTable {
34
+ /**
35
+ * The division's row id, inside the Overture id range.
36
+ */
37
+ overture_id: number
38
+ /**
39
+ * The WOF record the division matched.
40
+ */
41
+ wof_id: number
42
+ /**
43
+ * The evidence that matched them: `country`, `wikidata`, `geonames` or `name`.
44
+ */
45
+ match_by: string
46
+ }
47
+
48
+ export interface OvertureWOFMatchDatabase {
49
+ overture_wof_match: OvertureWOFMatchTable
50
+ }
51
+
52
+ /**
53
+ * Create the table, keyed by the Overture row so each division records at most one match.
54
+ */
55
+ export async function createOvertureWOFMatchTable<DB extends OvertureWOFMatchDatabase>(db: Kysely<DB>): Promise<void> {
56
+ await db.schema
57
+ .createTable(OVERTURE_WOF_MATCH_TABLE)
58
+ .ifNotExists()
59
+ .addColumn("overture_id", "integer", (c) => c.primaryKey())
60
+ .addColumn("wof_id", "integer", (c) => c.notNull())
61
+ .addColumn("match_by", "text", (c) => c.notNull())
62
+ .execute()
63
+ }
64
+
65
+ /**
66
+ * Every recorded match, or `null` when the database predates the table.
67
+ *
68
+ * A database without the table was built before the Overture rows became an independent part,
69
+ * when a matched division wrote no row of its own, so its matches are unrecorded rather than zero.
70
+ */
71
+ export function readOvertureWOFMatches<DB>(db: DatabaseClient<DB>): OvertureWOFMatchTable[] | null {
72
+ if (!hasTable(db, OVERTURE_WOF_MATCH_TABLE)) return null
73
+
74
+ return (
75
+ db
76
+ .prepare(`SELECT overture_id, wof_id, match_by FROM ${OVERTURE_WOF_MATCH_TABLE} ORDER BY overture_id`)
77
+ .all() as Array<{ overture_id: number; wof_id: number; match_by: string }>
78
+ ).map((row) => ({ overture_id: Number(row.overture_id), wof_id: Number(row.wof_id), match_by: String(row.match_by) }))
79
+ }
@@ -1,6 +1,11 @@
1
1
  // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
2
  // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
3
 
4
+ /**
5
+ * The `place_importance` table of an admin gazetteer: its columns, its DDL, the referential
6
+ * score derived from population, and the blend of that score with the encyclopedic one.
7
+ */
8
+
4
9
  import { referentialFromPopulation } from "@mailwoman/core/resolver"
5
10
  import { allRows } from "@mailwoman/core/utils"
6
11
  import type { DatabaseClient } from "@mailwoman/sqlite/client"
@@ -72,6 +77,87 @@ export async function createPlaceImportanceTable(db: Kysely<PlaceImportanceDatab
72
77
  .execute()
73
78
  }
74
79
 
80
+ /**
81
+ * Describes one row of the `place_population_estimate` table: a sub-locality's population estimated
82
+ * from the settlement that contains it, for a place the admin database records no population for.
83
+ *
84
+ * The estimate is the containing settlement's population divided by one more than the
85
+ * number of places of the same placetype that settlement contains.
86
+ * The `+ 1` keeps a share for the part of the settlement no recorded child covers,
87
+ * so an estimate is always smaller than its parent's population.
88
+ */
89
+ export interface PlacePopulationEstimateTable {
90
+ id: number
91
+
92
+ /**
93
+ * The point estimate.
94
+ */
95
+ population: number
96
+
97
+ /**
98
+ * The value the candidate table ranks the place by: the point estimate scaled by the lower decile
99
+ * of measured / estimated population over every sub-locality that has a measured population.
100
+ *
101
+ * A ranked estimate outranks a measured place only where nine in ten measured sub-localities would.
102
+ */
103
+ rank_population: number
104
+
105
+ /**
106
+ * The settlement whose population the estimate divides: the place's `parent_id`.
107
+ */
108
+ parent_id: number
109
+
110
+ /**
111
+ * The parent's current children with this place's placetype, the place included.
112
+ */
113
+ siblings: number
114
+ }
115
+
116
+ /**
117
+ * Types the `place_population_estimate` table of an importance database.
118
+ */
119
+ export interface PlacePopulationEstimateDatabase {
120
+ place_population_estimate: PlacePopulationEstimateTable
121
+ }
122
+
123
+ /**
124
+ * Drops and recreates the `place_population_estimate` table.
125
+ */
126
+ export async function createPlacePopulationEstimateTable(db: Kysely<PlacePopulationEstimateDatabase>): Promise<void> {
127
+ await db.schema.dropTable("place_population_estimate").ifExists().execute()
128
+
129
+ await db.schema
130
+ .createTable("place_population_estimate")
131
+ .addColumn("id", "integer", (c) => c.primaryKey())
132
+ .addColumn("population", "real", (c) => c.notNull())
133
+ .addColumn("rank_population", "real", (c) => c.notNull())
134
+ .addColumn("parent_id", "integer", (c) => c.notNull())
135
+ .addColumn("siblings", "integer", (c) => c.notNull())
136
+ .execute()
137
+ }
138
+
139
+ /**
140
+ * Reads every estimate's ranking population (`rank_population`) from an
141
+ * importance database, keyed by WOF id.
142
+ *
143
+ * @throws When the database has no `place_population_estimate` table, because the
144
+ * importance build that wrote it ran without sub-locality estimates.
145
+ */
146
+ export function loadPopulationEstimates<DB>(db: DatabaseClient<DB>): Map<number, number> {
147
+ if (!tableColumns(db, "place_population_estimate").has("rank_population")) {
148
+ throw new Error(
149
+ "place_population_estimate: the importance database has no estimates table. " +
150
+ "Rebuild it with `mailwoman gazetteer importance --sub-locality-estimates`."
151
+ )
152
+ }
153
+
154
+ const rows = allRows<{ id: number; rank_population: number }>(
155
+ db.prepare("SELECT id, rank_population FROM place_population_estimate")
156
+ )
157
+
158
+ return new Map(rows.map((row) => [Number(row.id), Number(row.rank_population)]))
159
+ }
160
+
75
161
  /**
76
162
  * Caps how far the encyclopedic score may raise a place's blended importance above its referential score.
77
163
  *
package/lib/schema.ts CHANGED
@@ -85,7 +85,7 @@ export interface SprTable {
85
85
  *
86
86
  * Real WOF dumps omit it.
87
87
  * These are the aliases eligible to join the name-exact tier.
88
- * See `unified-schema.ts` for the full interface.
88
+ * See `schema/unified.ts` for the full interface.
89
89
  */
90
90
  export interface NamesTable {
91
91
  id: number
@@ -102,7 +102,7 @@ export interface NamesTable {
102
102
  name: string
103
103
  lastmodified: number
104
104
  /**
105
- * The dataset the row came from, one of `ROW_SOURCES` in `unified-schema.ts`.
105
+ * The dataset the row came from, one of `ROW_SOURCES` in `schema/unified.ts`.
106
106
  *
107
107
  * Databases built before the column existed have no such column.
108
108
  */
@@ -177,7 +177,7 @@ export interface ConcordancesTable {
177
177
  other_source: string
178
178
  lastmodified: number
179
179
  /**
180
- * The dataset the row came from, one of `ROW_SOURCES` in `unified-schema.ts`.
180
+ * The dataset the row came from, one of `ROW_SOURCES` in `schema/unified.ts`.
181
181
  *
182
182
  * Databases built before the column existed have no such column.
183
183
  */
@@ -1,7 +1,7 @@
1
1
  // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
2
  // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
3
 
4
- import { tryParsingJSON } from "@mailwoman/core/json"
4
+ import { tryParsingJSON } from "@mailwoman/core/values/json"
5
5
  import type { DatabaseClient } from "@mailwoman/sqlite/client"
6
6
 
7
7
  import { ADDRESS_CONVENTION_TABLE, type Convention, type ConventionSource } from "#convention"
@@ -28,6 +28,8 @@ import { UPRN_COVERAGE_H3_RESOLUTION, UPRN_H3_RESOLUTION, uprnH3Cell } from "#up
28
28
  */
29
29
  export const UPRN_EXISTENCE_FOLD = foldIdentity((s) => s)
30
30
 
31
+ // country-branch: OS Open UPRN is Ordnance Survey's product, and its coverage is Great Britain.
32
+ // The countries recorded in the layer's manifest would replace the list.
31
33
  /**
32
34
  * The countries OS Open uprn covers.
33
35
  *