@mailwoman/resolver-wof-sqlite 9.1.0 → 9.3.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 (501) hide show
  1. package/README.md +36 -20
  2. package/lib/address/index.ts +9 -0
  3. package/{address-point-interpolation.ts → lib/address/point-interpolation.ts} +40 -28
  4. package/{address-point-schema.ts → lib/address/point-schema.ts} +34 -8
  5. package/lib/address/point.ts +280 -0
  6. package/{ancestry-backfill.ts → lib/ancestry/backfill.ts} +14 -19
  7. package/{ancestry.ts → lib/ancestry/index.ts} +13 -8
  8. package/{build-candidate.ts → lib/build-candidate.ts} +243 -199
  9. package/{build-slim.ts → lib/build-slim.ts} +153 -168
  10. package/lib/candidate/alias-bags.ts +56 -0
  11. package/lib/candidate/ancestors-sidecar.ts +204 -0
  12. package/lib/candidate/country-display-names.ts +79 -0
  13. package/lib/candidate/extract-fold.ts +138 -0
  14. package/lib/candidate/name-roles.ts +238 -0
  15. package/lib/candidate/own-name.ts +146 -0
  16. package/lib/candidate/place-attrs.ts +44 -0
  17. package/lib/candidate-ancestors-schema.ts +195 -0
  18. package/{candidate-fts.ts → lib/candidate-fts.ts} +7 -5
  19. package/{candidate-importance.ts → lib/candidate-importance.ts} +54 -57
  20. package/lib/candidate-lookup.ts +976 -0
  21. package/{candidate-schema.ts → lib/candidate-schema.ts} +34 -6
  22. package/lib/candidate-scoring.ts +261 -0
  23. package/lib/capital-schema.ts +89 -0
  24. package/lib/capitals.ts +148 -0
  25. package/{coincident-roles.ts → lib/coincident-roles.ts} +75 -19
  26. package/{convention.ts → lib/convention/index.ts} +5 -5
  27. package/lib/convention/schema.ts +72 -0
  28. package/{coverage-manifest-schema.ts → lib/coverage-manifest-schema.ts} +15 -16
  29. package/lib/currency-backfill.ts +334 -0
  30. package/lib/env.ts +50 -0
  31. package/lib/exact-match.ts +113 -0
  32. package/{sharding.ts → lib/extracts.ts} +63 -60
  33. package/lib/fst/autocomplete.ts +176 -0
  34. package/{fst-builder.ts → lib/fst/builder.ts} +30 -27
  35. package/{fst-deserialize-web.ts → lib/fst/deserialize-web.ts} +27 -87
  36. package/lib/fst/format.ts +106 -0
  37. package/{fst-freshness.ts → lib/fst/freshness.ts} +42 -75
  38. package/lib/fst/index.ts +14 -0
  39. package/{fst-matcher.ts → lib/fst/matcher.ts} +1 -1
  40. package/{fst-serialize.ts → lib/fst/serialize.ts} +37 -115
  41. package/{fst-types.ts → lib/fst/types.ts} +4 -2
  42. package/{fts.ts → lib/fts/index.ts} +28 -23
  43. package/{fts-query.ts → lib/fts/query.ts} +2 -2
  44. package/{geonames-aliases.ts → lib/geonames/aliases.ts} +13 -13
  45. package/lib/geonames/index.ts +8 -0
  46. package/{geonames-postal.ts → lib/geonames/postal.ts} +16 -15
  47. package/{index.ts → lib/index.ts} +52 -48
  48. package/{interpolation.ts → lib/interpolation.ts} +137 -41
  49. package/lib/lookup.ts +861 -0
  50. package/{name-score.ts → lib/name-score.ts} +6 -4
  51. package/lib/nsul/index.ts +8 -0
  52. package/lib/nsul/lookup.ts +144 -0
  53. package/lib/nsul/schema.ts +130 -0
  54. package/{place-importance-schema.ts → lib/place-importance-schema.ts} +70 -22
  55. package/lib/poi/index.ts +8 -0
  56. package/{poi-lookup.ts → lib/poi/lookup.ts} +32 -39
  57. package/{poi-schema.ts → lib/poi/schema.ts} +10 -6
  58. package/lib/polygon-schema.ts +47 -0
  59. package/{postal-city-alias-lookup.ts → lib/postal/city-alias-lookup.ts} +15 -21
  60. package/{postal-city-candidate-schema.ts → lib/postal/city-candidate-schema.ts} +4 -2
  61. package/lib/postal/index.ts +9 -0
  62. package/{postcode-point-lookup.ts → lib/postcode-point-lookup.ts} +17 -15
  63. package/lib/primary-preference.ts +226 -0
  64. package/lib/proximity-rerank.ts +120 -0
  65. package/{ranking-weights.ts → lib/ranking-weights.ts} +30 -4
  66. package/lib/region-keys.ts +144 -0
  67. package/{reverse.ts → lib/reverse.ts} +45 -56
  68. package/{schema.ts → lib/schema.ts} +11 -1
  69. package/lib/search-fetch.ts +257 -0
  70. package/{sqlite-convention-source.ts → lib/sqlite-convention-source.ts} +9 -10
  71. package/lib/sqlite-utils.ts +83 -0
  72. package/{street-centroid-schema.ts → lib/street/centroid-schema.ts} +12 -6
  73. package/{street-centroid.ts → lib/street/centroid.ts} +26 -28
  74. package/lib/street/index.ts +13 -0
  75. package/{street-morphology-fst-builder.ts → lib/street/morphology-fst-builder.ts} +24 -14
  76. package/{street-morphology-fst-loader.ts → lib/street/morphology-fst-loader.ts} +14 -12
  77. package/{street-name-lookup.ts → lib/street/name-lookup.ts} +14 -30
  78. package/lib/street/normalize.ts +572 -0
  79. package/{street-segment-schema.ts → lib/street/segment-schema.ts} +13 -8
  80. package/{types.ts → lib/types.ts} +49 -9
  81. package/{unified-schema.ts → lib/unified-schema.ts} +21 -25
  82. package/lib/uprn/existence.ts +84 -0
  83. package/lib/uprn/index.ts +9 -0
  84. package/lib/uprn/lookup.ts +206 -0
  85. package/lib/uprn/schema.ts +124 -0
  86. package/lib/weights-overlay-linker.ts +878 -0
  87. package/out/address/index.d.ts +9 -0
  88. package/out/address/index.d.ts.map +1 -0
  89. package/out/address/index.js +9 -0
  90. package/out/address/index.js.map +1 -0
  91. package/out/{address-point-interpolation.d.ts → address/point-interpolation.d.ts} +11 -10
  92. package/out/address/point-interpolation.d.ts.map +1 -0
  93. package/out/{address-point-interpolation.js → address/point-interpolation.js} +29 -23
  94. package/out/address/point-interpolation.js.map +1 -0
  95. package/out/{address-point-schema.d.ts → address/point-schema.d.ts} +30 -10
  96. package/out/address/point-schema.d.ts.map +1 -0
  97. package/out/{address-point-schema.js → address/point-schema.js} +7 -3
  98. package/out/address/point-schema.js.map +1 -0
  99. package/out/{address-point.d.ts → address/point.d.ts} +16 -8
  100. package/out/address/point.d.ts.map +1 -0
  101. package/out/address/point.js +191 -0
  102. package/out/address/point.js.map +1 -0
  103. package/out/{ancestry-backfill.d.ts → ancestry/backfill.d.ts} +7 -5
  104. package/out/ancestry/backfill.d.ts.map +1 -0
  105. package/out/{ancestry-backfill.js → ancestry/backfill.js} +12 -16
  106. package/out/ancestry/backfill.js.map +1 -0
  107. package/out/{ancestry.d.ts → ancestry/index.d.ts} +6 -5
  108. package/out/ancestry/index.d.ts.map +1 -0
  109. package/out/{ancestry.js → ancestry/index.js} +7 -7
  110. package/out/ancestry/index.js.map +1 -0
  111. package/out/build-candidate.d.ts +88 -7
  112. package/out/build-candidate.d.ts.map +1 -1
  113. package/out/build-candidate.js +145 -149
  114. package/out/build-candidate.js.map +1 -1
  115. package/out/build-slim.d.ts +5 -5
  116. package/out/build-slim.d.ts.map +1 -1
  117. package/out/build-slim.js +127 -142
  118. package/out/build-slim.js.map +1 -1
  119. package/out/candidate/alias-bags.d.ts +19 -0
  120. package/out/candidate/alias-bags.d.ts.map +1 -0
  121. package/out/candidate/alias-bags.js +39 -0
  122. package/out/candidate/alias-bags.js.map +1 -0
  123. package/out/candidate/ancestors-sidecar.d.ts +32 -0
  124. package/out/candidate/ancestors-sidecar.d.ts.map +1 -0
  125. package/out/candidate/ancestors-sidecar.js +140 -0
  126. package/out/candidate/ancestors-sidecar.js.map +1 -0
  127. package/out/candidate/country-display-names.d.ts +35 -0
  128. package/out/candidate/country-display-names.d.ts.map +1 -0
  129. package/out/candidate/country-display-names.js +59 -0
  130. package/out/candidate/country-display-names.js.map +1 -0
  131. package/out/candidate/extract-fold.d.ts +32 -0
  132. package/out/candidate/extract-fold.d.ts.map +1 -0
  133. package/out/candidate/extract-fold.js +104 -0
  134. package/out/candidate/extract-fold.js.map +1 -0
  135. package/out/candidate/name-roles.d.ts +57 -0
  136. package/out/candidate/name-roles.d.ts.map +1 -0
  137. package/out/candidate/name-roles.js +166 -0
  138. package/out/candidate/name-roles.js.map +1 -0
  139. package/out/candidate/own-name.d.ts +50 -0
  140. package/out/candidate/own-name.d.ts.map +1 -0
  141. package/out/candidate/own-name.js +132 -0
  142. package/out/candidate/own-name.js.map +1 -0
  143. package/out/candidate/place-attrs.d.ts +43 -0
  144. package/out/candidate/place-attrs.d.ts.map +1 -0
  145. package/out/candidate/place-attrs.js +15 -0
  146. package/out/candidate/place-attrs.js.map +1 -0
  147. package/out/candidate-ancestors-schema.d.ts +150 -0
  148. package/out/candidate-ancestors-schema.d.ts.map +1 -0
  149. package/out/candidate-ancestors-schema.js +123 -0
  150. package/out/candidate-ancestors-schema.js.map +1 -0
  151. package/out/candidate-fts.d.ts +7 -5
  152. package/out/candidate-fts.d.ts.map +1 -1
  153. package/out/candidate-fts.js +5 -3
  154. package/out/candidate-fts.js.map +1 -1
  155. package/out/candidate-importance.d.ts +16 -16
  156. package/out/candidate-importance.d.ts.map +1 -1
  157. package/out/candidate-importance.js +47 -52
  158. package/out/candidate-importance.js.map +1 -1
  159. package/out/candidate-lookup.d.ts +31 -52
  160. package/out/candidate-lookup.d.ts.map +1 -1
  161. package/out/candidate-lookup.js +380 -172
  162. package/out/candidate-lookup.js.map +1 -1
  163. package/out/candidate-schema.d.ts +31 -7
  164. package/out/candidate-schema.d.ts.map +1 -1
  165. package/out/candidate-schema.js +3 -0
  166. package/out/candidate-schema.js.map +1 -1
  167. package/out/candidate-scoring.d.ts +34 -0
  168. package/out/candidate-scoring.d.ts.map +1 -0
  169. package/out/candidate-scoring.js +196 -0
  170. package/out/candidate-scoring.js.map +1 -0
  171. package/out/capital-schema.d.ts +51 -0
  172. package/out/capital-schema.d.ts.map +1 -0
  173. package/out/capital-schema.js +63 -0
  174. package/out/capital-schema.js.map +1 -0
  175. package/out/capitals.d.ts +69 -0
  176. package/out/capitals.d.ts.map +1 -0
  177. package/out/capitals.js +98 -0
  178. package/out/capitals.js.map +1 -0
  179. package/out/coincident-roles.d.ts +12 -4
  180. package/out/coincident-roles.d.ts.map +1 -1
  181. package/out/coincident-roles.js +43 -11
  182. package/out/coincident-roles.js.map +1 -1
  183. package/out/{convention.d.ts → convention/index.d.ts} +5 -5
  184. package/out/convention/index.d.ts.map +1 -0
  185. package/out/{convention.js → convention/index.js} +4 -4
  186. package/out/convention/index.js.map +1 -0
  187. package/out/convention/schema.d.ts +51 -0
  188. package/out/convention/schema.d.ts.map +1 -0
  189. package/out/convention/schema.js +34 -0
  190. package/out/convention/schema.js.map +1 -0
  191. package/out/coverage-manifest-schema.d.ts +8 -8
  192. package/out/coverage-manifest-schema.d.ts.map +1 -1
  193. package/out/coverage-manifest-schema.js +6 -10
  194. package/out/coverage-manifest-schema.js.map +1 -1
  195. package/out/currency-backfill.d.ts +90 -0
  196. package/out/currency-backfill.d.ts.map +1 -0
  197. package/out/currency-backfill.js +196 -0
  198. package/out/currency-backfill.js.map +1 -0
  199. package/out/env.d.ts +43 -0
  200. package/out/env.d.ts.map +1 -0
  201. package/out/env.js +48 -0
  202. package/out/env.js.map +1 -0
  203. package/out/exact-match.d.ts +25 -0
  204. package/out/exact-match.d.ts.map +1 -0
  205. package/out/exact-match.js +88 -0
  206. package/out/exact-match.js.map +1 -0
  207. package/out/extracts.d.ts +114 -0
  208. package/out/extracts.d.ts.map +1 -0
  209. package/out/{sharding.js → extracts.js} +38 -38
  210. package/out/extracts.js.map +1 -0
  211. package/out/{fst-autocomplete.d.ts → fst/autocomplete.d.ts} +13 -13
  212. package/out/fst/autocomplete.d.ts.map +1 -0
  213. package/out/fst/autocomplete.js +113 -0
  214. package/out/fst/autocomplete.js.map +1 -0
  215. package/out/{fst-builder.d.ts → fst/builder.d.ts} +5 -5
  216. package/out/fst/builder.d.ts.map +1 -0
  217. package/out/{fst-builder.js → fst/builder.js} +24 -24
  218. package/out/fst/builder.js.map +1 -0
  219. package/out/{fst-deserialize-web.d.ts → fst/deserialize-web.d.ts} +3 -3
  220. package/out/fst/deserialize-web.d.ts.map +1 -0
  221. package/out/{fst-deserialize-web.js → fst/deserialize-web.js} +10 -74
  222. package/out/fst/deserialize-web.js.map +1 -0
  223. package/out/fst/format.d.ts +80 -0
  224. package/out/fst/format.d.ts.map +1 -0
  225. package/out/fst/format.js +91 -0
  226. package/out/fst/format.js.map +1 -0
  227. package/out/{fst-freshness.d.ts → fst/freshness.d.ts} +11 -14
  228. package/out/fst/freshness.d.ts.map +1 -0
  229. package/out/{fst-freshness.js → fst/freshness.js} +42 -74
  230. package/out/fst/freshness.js.map +1 -0
  231. package/out/fst/index.d.ts +14 -0
  232. package/out/fst/index.d.ts.map +1 -0
  233. package/out/fst/index.js +14 -0
  234. package/out/fst/index.js.map +1 -0
  235. package/out/{fst-matcher.d.ts → fst/matcher.d.ts} +2 -2
  236. package/out/fst/matcher.d.ts.map +1 -0
  237. package/out/{fst-matcher.js → fst/matcher.js} +1 -1
  238. package/out/fst/matcher.js.map +1 -0
  239. package/out/{fst-serialize.d.ts → fst/serialize.d.ts} +5 -10
  240. package/out/fst/serialize.d.ts.map +1 -0
  241. package/out/{fst-serialize.js → fst/serialize.js} +18 -98
  242. package/out/fst/serialize.js.map +1 -0
  243. package/out/{fst-types.d.ts → fst/types.d.ts} +4 -3
  244. package/out/fst/types.d.ts.map +1 -0
  245. package/out/{fst-types.js → fst/types.js} +1 -1
  246. package/out/fst/types.js.map +1 -0
  247. package/out/{fts.d.ts → fts/index.d.ts} +20 -13
  248. package/out/fts/index.d.ts.map +1 -0
  249. package/out/{fts.js → fts/index.js} +20 -15
  250. package/out/fts/index.js.map +1 -0
  251. package/out/{fts-query.d.ts → fts/query.d.ts} +2 -2
  252. package/out/fts/query.d.ts.map +1 -0
  253. package/out/{fts-query.js → fts/query.js} +2 -2
  254. package/out/fts/query.js.map +1 -0
  255. package/out/{geonames-aliases.d.ts → geonames/aliases.d.ts} +8 -6
  256. package/out/geonames/aliases.d.ts.map +1 -0
  257. package/out/{geonames-aliases.js → geonames/aliases.js} +7 -7
  258. package/out/geonames/aliases.js.map +1 -0
  259. package/out/geonames/index.d.ts +8 -0
  260. package/out/geonames/index.d.ts.map +1 -0
  261. package/out/geonames/index.js +8 -0
  262. package/out/geonames/index.js.map +1 -0
  263. package/out/{geonames-postal.d.ts → geonames/postal.d.ts} +12 -10
  264. package/out/geonames/postal.d.ts.map +1 -0
  265. package/out/{geonames-postal.js → geonames/postal.js} +11 -11
  266. package/out/geonames/postal.js.map +1 -0
  267. package/out/index.d.ts +32 -31
  268. package/out/index.d.ts.map +1 -1
  269. package/out/index.js +24 -24
  270. package/out/index.js.map +1 -1
  271. package/out/interpolation.d.ts +18 -9
  272. package/out/interpolation.d.ts.map +1 -1
  273. package/out/interpolation.js +108 -36
  274. package/out/interpolation.js.map +1 -1
  275. package/out/lookup.d.ts +25 -25
  276. package/out/lookup.d.ts.map +1 -1
  277. package/out/lookup.js +174 -558
  278. package/out/lookup.js.map +1 -1
  279. package/out/name-score.d.ts +0 -10
  280. package/out/name-score.d.ts.map +1 -1
  281. package/out/name-score.js +6 -4
  282. package/out/name-score.js.map +1 -1
  283. package/out/nsul/index.d.ts +8 -0
  284. package/out/nsul/index.d.ts.map +1 -0
  285. package/out/nsul/index.js +8 -0
  286. package/out/nsul/index.js.map +1 -0
  287. package/out/nsul/lookup.d.ts +83 -0
  288. package/out/nsul/lookup.d.ts.map +1 -0
  289. package/out/nsul/lookup.js +80 -0
  290. package/out/nsul/lookup.js.map +1 -0
  291. package/out/nsul/schema.d.ts +100 -0
  292. package/out/nsul/schema.d.ts.map +1 -0
  293. package/out/nsul/schema.js +78 -0
  294. package/out/nsul/schema.js.map +1 -0
  295. package/out/place-importance-schema.d.ts +47 -10
  296. package/out/place-importance-schema.d.ts.map +1 -1
  297. package/out/place-importance-schema.js +56 -10
  298. package/out/place-importance-schema.js.map +1 -1
  299. package/out/poi/index.d.ts +8 -0
  300. package/out/poi/index.d.ts.map +1 -0
  301. package/out/poi/index.js +8 -0
  302. package/out/poi/index.js.map +1 -0
  303. package/out/{poi-lookup.d.ts → poi/lookup.d.ts} +8 -10
  304. package/out/poi/lookup.d.ts.map +1 -0
  305. package/out/{poi-lookup.js → poi/lookup.js} +24 -29
  306. package/out/poi/lookup.js.map +1 -0
  307. package/out/{poi-schema.d.ts → poi/schema.d.ts} +10 -6
  308. package/out/poi/schema.d.ts.map +1 -0
  309. package/out/{poi-schema.js → poi/schema.js} +1 -1
  310. package/out/poi/schema.js.map +1 -0
  311. package/out/polygon-schema.d.ts +37 -0
  312. package/out/polygon-schema.d.ts.map +1 -0
  313. package/out/polygon-schema.js +23 -0
  314. package/out/polygon-schema.js.map +1 -0
  315. package/out/{postal-city-alias-lookup.d.ts → postal/city-alias-lookup.d.ts} +7 -6
  316. package/out/postal/city-alias-lookup.d.ts.map +1 -0
  317. package/out/{postal-city-alias-lookup.js → postal/city-alias-lookup.js} +12 -16
  318. package/out/postal/city-alias-lookup.js.map +1 -0
  319. package/out/{postal-city-alias-schema.d.ts → postal/city-alias-schema.d.ts} +1 -1
  320. package/out/{postal-city-alias-schema.d.ts.map → postal/city-alias-schema.d.ts.map} +1 -1
  321. package/out/{postal-city-alias-schema.js → postal/city-alias-schema.js} +1 -1
  322. package/out/{postal-city-alias-schema.js.map → postal/city-alias-schema.js.map} +1 -1
  323. package/out/{postal-city-candidate-schema.d.ts → postal/city-candidate-schema.d.ts} +4 -3
  324. package/out/postal/city-candidate-schema.d.ts.map +1 -0
  325. package/out/{postal-city-candidate-schema.js → postal/city-candidate-schema.js} +2 -2
  326. package/out/{postal-city-candidate-schema.js.map → postal/city-candidate-schema.js.map} +1 -1
  327. package/out/postal/index.d.ts +9 -0
  328. package/out/postal/index.d.ts.map +1 -0
  329. package/out/postal/index.js +9 -0
  330. package/out/postal/index.js.map +1 -0
  331. package/out/postcode-point-lookup.d.ts +10 -10
  332. package/out/postcode-point-lookup.d.ts.map +1 -1
  333. package/out/postcode-point-lookup.js +13 -13
  334. package/out/postcode-point-lookup.js.map +1 -1
  335. package/out/primary-preference.d.ts +133 -0
  336. package/out/primary-preference.d.ts.map +1 -0
  337. package/out/primary-preference.js +146 -0
  338. package/out/primary-preference.js.map +1 -0
  339. package/out/proximity-rerank.d.ts +77 -0
  340. package/out/proximity-rerank.d.ts.map +1 -0
  341. package/out/proximity-rerank.js +86 -0
  342. package/out/proximity-rerank.js.map +1 -0
  343. package/out/ranking-weights.d.ts +15 -3
  344. package/out/ranking-weights.d.ts.map +1 -1
  345. package/out/ranking-weights.js +21 -3
  346. package/out/ranking-weights.js.map +1 -1
  347. package/out/region-keys.d.ts +47 -0
  348. package/out/region-keys.d.ts.map +1 -0
  349. package/out/region-keys.js +121 -0
  350. package/out/region-keys.js.map +1 -0
  351. package/out/reverse.d.ts +6 -6
  352. package/out/reverse.d.ts.map +1 -1
  353. package/out/reverse.js +23 -35
  354. package/out/reverse.js.map +1 -1
  355. package/out/schema.d.ts +10 -1
  356. package/out/schema.d.ts.map +1 -1
  357. package/out/schema.js.map +1 -1
  358. package/out/search-fetch.d.ts +59 -0
  359. package/out/search-fetch.d.ts.map +1 -0
  360. package/out/search-fetch.js +184 -0
  361. package/out/search-fetch.js.map +1 -0
  362. package/out/sqlite-convention-source.d.ts +7 -7
  363. package/out/sqlite-convention-source.d.ts.map +1 -1
  364. package/out/sqlite-convention-source.js +5 -5
  365. package/out/sqlite-convention-source.js.map +1 -1
  366. package/out/sqlite-utils.d.ts +24 -6
  367. package/out/sqlite-utils.d.ts.map +1 -1
  368. package/out/sqlite-utils.js +24 -7
  369. package/out/sqlite-utils.js.map +1 -1
  370. package/out/{street-centroid-schema.d.ts → street/centroid-schema.d.ts} +12 -7
  371. package/out/street/centroid-schema.d.ts.map +1 -0
  372. package/out/{street-centroid-schema.js → street/centroid-schema.js} +5 -5
  373. package/out/{street-centroid-schema.js.map → street/centroid-schema.js.map} +1 -1
  374. package/out/{street-centroid.d.ts → street/centroid.d.ts} +6 -6
  375. package/out/street/centroid.d.ts.map +1 -0
  376. package/out/{street-centroid.js → street/centroid.js} +18 -24
  377. package/out/street/centroid.js.map +1 -0
  378. package/out/street/index.d.ts +13 -0
  379. package/out/street/index.d.ts.map +1 -0
  380. package/out/street/index.js +13 -0
  381. package/out/street/index.js.map +1 -0
  382. package/out/{street-morphology-fst-builder.d.ts → street/morphology-fst-builder.d.ts} +4 -4
  383. package/out/street/morphology-fst-builder.d.ts.map +1 -0
  384. package/out/{street-morphology-fst-builder.js → street/morphology-fst-builder.js} +18 -13
  385. package/out/street/morphology-fst-builder.js.map +1 -0
  386. package/out/{street-morphology-fst-loader.d.ts → street/morphology-fst-loader.d.ts} +5 -5
  387. package/out/street/morphology-fst-loader.d.ts.map +1 -0
  388. package/out/{street-morphology-fst-loader.js → street/morphology-fst-loader.js} +11 -10
  389. package/out/street/morphology-fst-loader.js.map +1 -0
  390. package/out/{street-name-lookup.d.ts → street/name-lookup.d.ts} +4 -7
  391. package/out/street/name-lookup.d.ts.map +1 -0
  392. package/out/{street-name-lookup.js → street/name-lookup.js} +9 -23
  393. package/out/street/name-lookup.js.map +1 -0
  394. package/out/street/normalize.d.ts +179 -0
  395. package/out/street/normalize.d.ts.map +1 -0
  396. package/out/street/normalize.js +457 -0
  397. package/out/street/normalize.js.map +1 -0
  398. package/out/{street-segment-schema.d.ts → street/segment-schema.d.ts} +13 -9
  399. package/out/street/segment-schema.d.ts.map +1 -0
  400. package/out/{street-segment-schema.js → street/segment-schema.js} +4 -4
  401. package/out/{street-segment-schema.js.map → street/segment-schema.js.map} +1 -1
  402. package/out/types.d.ts +49 -9
  403. package/out/types.d.ts.map +1 -1
  404. package/out/types.js.map +1 -1
  405. package/out/unified-schema.d.ts +6 -5
  406. package/out/unified-schema.d.ts.map +1 -1
  407. package/out/unified-schema.js +16 -19
  408. package/out/unified-schema.js.map +1 -1
  409. package/out/uprn/existence.d.ts +53 -0
  410. package/out/uprn/existence.d.ts.map +1 -0
  411. package/out/uprn/existence.js +61 -0
  412. package/out/uprn/existence.js.map +1 -0
  413. package/out/uprn/index.d.ts +9 -0
  414. package/out/uprn/index.d.ts.map +1 -0
  415. package/out/uprn/index.js +9 -0
  416. package/out/uprn/index.js.map +1 -0
  417. package/out/uprn/lookup.d.ts +85 -0
  418. package/out/uprn/lookup.d.ts.map +1 -0
  419. package/out/uprn/lookup.js +149 -0
  420. package/out/uprn/lookup.js.map +1 -0
  421. package/out/uprn/schema.d.ts +93 -0
  422. package/out/uprn/schema.d.ts.map +1 -0
  423. package/out/uprn/schema.js +78 -0
  424. package/out/uprn/schema.js.map +1 -0
  425. package/out/weights-overlay-linker.d.ts +299 -0
  426. package/out/weights-overlay-linker.d.ts.map +1 -0
  427. package/out/weights-overlay-linker.js +511 -0
  428. package/out/weights-overlay-linker.js.map +1 -0
  429. package/package.json +622 -154
  430. package/address-point.ts +0 -125
  431. package/candidate-lookup.ts +0 -720
  432. package/fst-autocomplete.ts +0 -204
  433. package/geo.ts +0 -121
  434. package/lookup.ts +0 -1354
  435. package/out/address-point-interpolation.d.ts.map +0 -1
  436. package/out/address-point-interpolation.js.map +0 -1
  437. package/out/address-point-schema.d.ts.map +0 -1
  438. package/out/address-point-schema.js.map +0 -1
  439. package/out/address-point.d.ts.map +0 -1
  440. package/out/address-point.js +0 -84
  441. package/out/address-point.js.map +0 -1
  442. package/out/ancestry-backfill.d.ts.map +0 -1
  443. package/out/ancestry-backfill.js.map +0 -1
  444. package/out/ancestry.d.ts.map +0 -1
  445. package/out/ancestry.js.map +0 -1
  446. package/out/convention.d.ts.map +0 -1
  447. package/out/convention.js.map +0 -1
  448. package/out/fst-autocomplete.d.ts.map +0 -1
  449. package/out/fst-autocomplete.js +0 -130
  450. package/out/fst-autocomplete.js.map +0 -1
  451. package/out/fst-builder.d.ts.map +0 -1
  452. package/out/fst-builder.js.map +0 -1
  453. package/out/fst-deserialize-web.d.ts.map +0 -1
  454. package/out/fst-deserialize-web.js.map +0 -1
  455. package/out/fst-freshness.d.ts.map +0 -1
  456. package/out/fst-freshness.js.map +0 -1
  457. package/out/fst-matcher.d.ts.map +0 -1
  458. package/out/fst-matcher.js.map +0 -1
  459. package/out/fst-serialize.d.ts.map +0 -1
  460. package/out/fst-serialize.js.map +0 -1
  461. package/out/fst-types.d.ts.map +0 -1
  462. package/out/fst-types.js.map +0 -1
  463. package/out/fts-query.d.ts.map +0 -1
  464. package/out/fts-query.js.map +0 -1
  465. package/out/fts.d.ts.map +0 -1
  466. package/out/fts.js.map +0 -1
  467. package/out/geo.d.ts +0 -74
  468. package/out/geo.d.ts.map +0 -1
  469. package/out/geo.js +0 -71
  470. package/out/geo.js.map +0 -1
  471. package/out/geonames-aliases.d.ts.map +0 -1
  472. package/out/geonames-aliases.js.map +0 -1
  473. package/out/geonames-postal.d.ts.map +0 -1
  474. package/out/geonames-postal.js.map +0 -1
  475. package/out/poi-lookup.d.ts.map +0 -1
  476. package/out/poi-lookup.js.map +0 -1
  477. package/out/poi-schema.d.ts.map +0 -1
  478. package/out/poi-schema.js.map +0 -1
  479. package/out/postal-city-alias-lookup.d.ts.map +0 -1
  480. package/out/postal-city-alias-lookup.js.map +0 -1
  481. package/out/postal-city-candidate-schema.d.ts.map +0 -1
  482. package/out/sharding.d.ts +0 -114
  483. package/out/sharding.d.ts.map +0 -1
  484. package/out/sharding.js.map +0 -1
  485. package/out/street-centroid-schema.d.ts.map +0 -1
  486. package/out/street-centroid.d.ts.map +0 -1
  487. package/out/street-centroid.js.map +0 -1
  488. package/out/street-morphology-fst-builder.d.ts.map +0 -1
  489. package/out/street-morphology-fst-builder.js.map +0 -1
  490. package/out/street-morphology-fst-loader.d.ts.map +0 -1
  491. package/out/street-morphology-fst-loader.js.map +0 -1
  492. package/out/street-name-lookup.d.ts.map +0 -1
  493. package/out/street-name-lookup.js.map +0 -1
  494. package/out/street-normalize.d.ts +0 -95
  495. package/out/street-normalize.d.ts.map +0 -1
  496. package/out/street-normalize.js +0 -272
  497. package/out/street-normalize.js.map +0 -1
  498. package/out/street-segment-schema.d.ts.map +0 -1
  499. package/sqlite-utils.ts +0 -46
  500. package/street-normalize.ts +0 -318
  501. /package/{postal-city-alias-schema.ts → lib/postal/city-alias-schema.ts} +0 -0
@@ -0,0 +1,140 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Pass 3b of the candidate build — the containment sidecar (closure rows + interval labels).
6
+ */
7
+ import { placetypeDepth } from "#ancestry/index";
8
+ import { CANDIDATE_ANCESTOR_COLUMNS, CANDIDATE_ANCESTOR_TABLE, CANDIDATE_INTERVAL_TABLE, createCandidateAncestorTable, createCandidateIntervalTable, MAX_ANCESTOR_DEPTH, } from "#candidate-ancestors-schema";
9
+ /**
10
+ * Pass 3b — the ancestors sidecar: closure rows + interval labels (candidate-ancestors-schema.ts owns the encoding
11
+ * decision and the DAG/absence semantics). Reads the same source `ancestors` table the region stamp reads,
12
+ * denormalizing each edge with the parent's name/key from `attrs`, streamed `ORDER BY id` so the clustered `(spr_id,
13
+ * depth)` insert is sorted — the contiguous-leaves discipline of the candidate table itself.
14
+ *
15
+ * Excluded by policy: self rows, and placetypes outside the containment ladder (continent, empire, …: `placetypeDepth` 0)
16
+ * — they discriminate nothing a consumer of this sidecar checks. An edge to a parent with no current `spr` row has no
17
+ * name to denormalize; it is dropped and counted rather than stored blind.
18
+ */
19
+ export async function buildAncestorsSidecar(ctx) {
20
+ const { src, out, attrs, ptID, progress } = ctx;
21
+ progress("ancestors", "building containment sidecar (closure rows + interval labels)");
22
+ await createCandidateAncestorTable(ctx.out);
23
+ await createCandidateIntervalTable(ctx.out);
24
+ const insAncestor = out.prepare(`INSERT INTO ${CANDIDATE_ANCESTOR_TABLE} VALUES (${CANDIDATE_ANCESTOR_COLUMNS.map(() => "?").join(", ")})`);
25
+ // The canonical-parent forest the interval labels are computed over. One parent per place — the
26
+ // depth-1 edge (finest containment tier, lowest ancestor id; the `regionOf` MIN-stability
27
+ // convention). ALL parents stay in the closure rows; only the interval tree canonicalizes.
28
+ const canonicalParentOf = new Map();
29
+ const childrenOf = new Map();
30
+ const forest = new Set();
31
+ let ancestorRows = 0;
32
+ let ancestorPlaces = 0;
33
+ let droppedParents = 0;
34
+ // Per-child edge buffer; the stream below is grouped by child id, so each flush owns one place.
35
+ let childID = -1;
36
+ let edges = [];
37
+ const flush = () => {
38
+ if (childID < 0 || !edges.length)
39
+ return;
40
+ // Deterministic nearest-first: containment depth descending, then ancestor id ascending —
41
+ // the FTS backend's `ancestorLineage` ordering, made stable across rebuilds.
42
+ edges.sort((a, b) => placetypeDepth(b.apt) - placetypeDepth(a.apt) || a.aid - b.aid);
43
+ if (edges.length > MAX_ANCESTOR_DEPTH) {
44
+ edges = edges.slice(0, MAX_ANCESTOR_DEPTH);
45
+ }
46
+ ancestorPlaces++;
47
+ for (const [i, edge] of edges.entries()) {
48
+ const parent = attrs.get(edge.aid);
49
+ insAncestor.run(childID, i + 1, edge.aid, ptID(edge.apt), parent.name, parent.pkey);
50
+ ancestorRows++;
51
+ }
52
+ const canonical = edges[0].aid;
53
+ canonicalParentOf.set(childID, canonical);
54
+ const siblings = childrenOf.get(canonical);
55
+ if (siblings) {
56
+ siblings.push(childID);
57
+ }
58
+ else {
59
+ childrenOf.set(canonical, [childID]);
60
+ }
61
+ forest.add(childID);
62
+ forest.add(canonical);
63
+ };
64
+ out.exec("BEGIN");
65
+ for (const r of src
66
+ .prepare("SELECT id, ancestor_id, ancestor_placetype FROM ancestors WHERE ancestor_id != id ORDER BY id")
67
+ .iterate()) {
68
+ const id = Number(r.id);
69
+ if (id !== childID) {
70
+ flush();
71
+ childID = id;
72
+ edges = [];
73
+ }
74
+ if (!attrs.has(id))
75
+ continue;
76
+ const apt = String(r.ancestor_placetype ?? "");
77
+ if (placetypeDepth(apt) === 0)
78
+ continue;
79
+ const aid = Number(r.ancestor_id);
80
+ if (!attrs.has(aid)) {
81
+ droppedParents++;
82
+ continue;
83
+ }
84
+ edges.push({ aid, apt });
85
+ }
86
+ flush();
87
+ out.exec("COMMIT");
88
+ // Interval labels: pre/post-order DFS over the canonical-parent forest. Root order and child
89
+ // order are id-ascending so the labels are stable across rebuilds of the same source.
90
+ const preOf = new Map();
91
+ const postOf = new Map();
92
+ for (const kids of childrenOf.values()) {
93
+ // oxlint-disable-next-line unicorn/no-array-sort -- sorts an array this pass just built
94
+ kids.sort((a, b) => a - b);
95
+ }
96
+ const roots = [...forest].filter((id) => !canonicalParentOf.has(id));
97
+ // oxlint-disable-next-line unicorn/no-array-sort -- sorts an array this pass just built
98
+ roots.sort((a, b) => a - b);
99
+ let counter = 0;
100
+ for (const root of roots) {
101
+ preOf.set(root, counter++);
102
+ const stack = [{ id: root, next: 0 }];
103
+ while (stack.length) {
104
+ const top = stack.at(-1);
105
+ const kids = childrenOf.get(top.id);
106
+ if (kids && top.next < kids.length) {
107
+ const kid = kids[top.next++];
108
+ // Each child holds exactly one canonical parent, so a labeled node here means the
109
+ // grouping upstream broke — skip rather than corrupt the numbering.
110
+ if (preOf.has(kid))
111
+ continue;
112
+ preOf.set(kid, counter++);
113
+ stack.push({ id: kid, next: 0 });
114
+ }
115
+ else {
116
+ postOf.set(top.id, counter++);
117
+ stack.pop();
118
+ }
119
+ }
120
+ }
121
+ // A canonical-parent CYCLE (corrupt source ancestry) leaves its members unreachable from any
122
+ // root: they simply receive no label, and containment against them reads unverifiable — the
123
+ // absence semantics the schema module states. Counted so a jump is visible across rebuilds.
124
+ const cycleSkipped = forest.size - preOf.size;
125
+ const insInterval = out.prepare(`INSERT INTO ${CANDIDATE_INTERVAL_TABLE} VALUES (?, ?, ?)`);
126
+ const labeled = [...preOf.keys()];
127
+ // oxlint-disable-next-line unicorn/no-array-sort -- sorts an array this pass just built
128
+ labeled.sort((a, b) => a - b);
129
+ out.exec("BEGIN");
130
+ for (const id of labeled) {
131
+ insInterval.run(id, preOf.get(id), postOf.get(id));
132
+ }
133
+ out.exec("COMMIT");
134
+ progress("ancestors", `${ancestorRows.toLocaleString()} closure rows across ${ancestorPlaces.toLocaleString()} places; ` +
135
+ `${preOf.size.toLocaleString()} interval labels` +
136
+ (droppedParents ? `; ${droppedParents.toLocaleString()} edges dropped (parent has no current spr row)` : "") +
137
+ (cycleSkipped ? `; ${cycleSkipped.toLocaleString()} places skipped (canonical-parent cycle)` : ""));
138
+ return { ancestorRows, ancestorPlaces, intervalPlaces: preOf.size };
139
+ }
140
+ //# sourceMappingURL=ancestors-sidecar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ancestors-sidecar.js","sourceRoot":"","sources":["../../lib/candidate/ancestors-sidecar.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EACN,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,4BAA4B,EAC5B,4BAA4B,EAC5B,kBAAkB,GAClB,MAAM,6BAA6B,CAAA;AAKpC;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,GAM3C;IACA,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAA;IAE/C,QAAQ,CAAC,WAAW,EAAE,+DAA+D,CAAC,CAAA;IACtF,MAAM,4BAA4B,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC3C,MAAM,4BAA4B,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAE3C,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAC9B,eAAe,wBAAwB,YAAY,0BAA0B,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC1G,CAAA;IAED,gGAAgG;IAChG,0FAA0F;IAC1F,2FAA2F;IAC3F,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAkB,CAAA;IACnD,MAAM,UAAU,GAAG,IAAI,GAAG,EAAoB,CAAA;IAC9C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAA;IAEhC,IAAI,YAAY,GAAG,CAAC,CAAA;IACpB,IAAI,cAAc,GAAG,CAAC,CAAA;IACtB,IAAI,cAAc,GAAG,CAAC,CAAA;IAEtB,gGAAgG;IAChG,IAAI,OAAO,GAAG,CAAC,CAAC,CAAA;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CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,cAAc,EAAE,0CAA0C,CAAC,CAAC,CAAC,EAAE,CAAC,CACnG,CAAA;IAED,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,CAAC,IAAI,EAAE,CAAA;AACpE,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Pass 1b of the candidate build — fold ICU's country display names onto the country rows.
6
+ */
7
+ import type { PlaceAttrs, StageRow } from "#candidate/place-attrs";
8
+ /**
9
+ * Fold every country surface ICU knows onto that country's candidate row (#1678 thread 1).
10
+ *
11
+ * A bare `格鲁吉亚` (Georgia the country) resolved to NOTHING while `佐治亚州` (Georgia the US state) resolved correctly, and
12
+ * the model gave both the same wrong `locality` tag — so the tag was never the variable. Measured 2026-08-15: 140 of
13
+ * 237 country rows are synthetic and carry a canonical English name and nothing else; WOF holds no Chinese country
14
+ * names at all; and the GeoNames alias fold filters through a Latin-script regex, so neither existing source could ever
15
+ * supply them.
16
+ *
17
+ * `Intl.DisplayNames` already knows every one — ~280 regions, ~5,244 surfaces, from the same ICU the runtime uses for
18
+ * every other locale-sensitive operation. No download, no vendored corpus, no snapshot to drift.
19
+ *
20
+ * `is_primary = 0`: these are NAMES THE WORLD USES, not the country's canonical name. The display `name` stays whatever
21
+ * the gazetteer already had, so resolving `格鲁吉亚` answers with the Georgia country row rather than renaming it.
22
+ *
23
+ * Returns the row count so the caller can report it — a zero means ICU supplied nothing, which is a different fact from
24
+ * the pass not having run.
25
+ */
26
+ export declare function stageCountryDisplayNames(ctx: {
27
+ attrs: Map<number, PlaceAttrs>;
28
+ iso2ByID: Map<number, string>;
29
+ countryPtID: number;
30
+ stageRow: StageRow;
31
+ tx: {
32
+ exec(sql: string): void;
33
+ };
34
+ }): number;
35
+ //# sourceMappingURL=country-display-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country-display-names.d.ts","sourceRoot":"","sources":["../../lib/candidate/country-display-names.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAGlE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE;IAC7C,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAC9B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,QAAQ,CAAA;IAClB,EAAE,EAAE;QAAE,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;CAC/B,GAAG,MAAM,CA0CT"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Pass 1b of the candidate build — fold ICU's country display names onto the country rows.
6
+ */
7
+ import { enumerateCountryDisplayNames } from "@mailwoman/codex/country";
8
+ import { normalizeLocalityForKey } from "#street/normalize";
9
+ /**
10
+ * Fold every country surface ICU knows onto that country's candidate row (#1678 thread 1).
11
+ *
12
+ * A bare `格鲁吉亚` (Georgia the country) resolved to NOTHING while `佐治亚州` (Georgia the US state) resolved correctly, and
13
+ * the model gave both the same wrong `locality` tag — so the tag was never the variable. Measured 2026-08-15: 140 of
14
+ * 237 country rows are synthetic and carry a canonical English name and nothing else; WOF holds no Chinese country
15
+ * names at all; and the GeoNames alias fold filters through a Latin-script regex, so neither existing source could ever
16
+ * supply them.
17
+ *
18
+ * `Intl.DisplayNames` already knows every one — ~280 regions, ~5,244 surfaces, from the same ICU the runtime uses for
19
+ * every other locale-sensitive operation. No download, no vendored corpus, no snapshot to drift.
20
+ *
21
+ * `is_primary = 0`: these are NAMES THE WORLD USES, not the country's canonical name. The display `name` stays whatever
22
+ * the gazetteer already had, so resolving `格鲁吉亚` answers with the Georgia country row rather than renaming it.
23
+ *
24
+ * Returns the row count so the caller can report it — a zero means ICU supplied nothing, which is a different fact from
25
+ * the pass not having run.
26
+ */
27
+ export function stageCountryDisplayNames(ctx) {
28
+ // One country row per ISO2. Where a code has several (historic rows surviving the is_current filter), the most
29
+ // populous wins — the same tiebreak the ranking uses everywhere else.
30
+ const countryByISO2 = new Map();
31
+ for (const [sid, a] of ctx.attrs) {
32
+ if (a.ptid !== ctx.countryPtID)
33
+ continue;
34
+ const iso2 = ctx.iso2ByID.get(a.cid);
35
+ if (!iso2 || iso2 === "??")
36
+ continue;
37
+ const held = countryByISO2.get(iso2);
38
+ if (!held || a.pop > held.a.pop) {
39
+ countryByISO2.set(iso2, { sid, a });
40
+ }
41
+ }
42
+ let staged = 0;
43
+ ctx.tx.exec("BEGIN");
44
+ for (const { iso2, name } of enumerateCountryDisplayNames()) {
45
+ const target = countryByISO2.get(iso2);
46
+ if (!target)
47
+ continue;
48
+ const k = normalizeLocalityForKey(name);
49
+ // The country's own key is already staged as its primary; INSERT OR IGNORE at materialization dedupes the
50
+ // rest, so this only skips the obvious self-alias.
51
+ if (!k || k === target.a.pkey)
52
+ continue;
53
+ ctx.stageRow(k, target.a, target.sid, 0);
54
+ staged++;
55
+ }
56
+ ctx.tx.exec("COMMIT");
57
+ return staged;
58
+ }
59
+ //# sourceMappingURL=country-display-names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country-display-names.js","sourceRoot":"","sources":["../../lib/candidate/country-display-names.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAA;AAGvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAE3D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAMxC;IACA,+GAA+G;IAC/G,sEAAsE;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ED,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAErB,OAAO,MAAM,CAAA;AACd,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Pass 4 of the candidate build — fold a postcode or locality extract into the staging table.
6
+ */
7
+ import { DatabaseClient } from "@mailwoman/sqlite/client";
8
+ import type { CandidateDatabase } from "#candidate-schema";
9
+ import type { StageRow } from "#candidate/place-attrs";
10
+ /**
11
+ * Fold ONE extract (`spr` rows at `extractPlacetype` carrying real coordinates) in, then pass 4b: the alias names
12
+ * hanging off that same extract's `names` table.
13
+ *
14
+ * Self-contained by construction — it shares only the staging statement and the code dictionaries with the admin passes
15
+ * above it, and nothing downstream reads anything it produces except the two counters it returns.
16
+ */
17
+ export declare function foldExtract(ctx: {
18
+ /**
19
+ * The staging connection. The extract itself is opened read-only here and closed before returning.
20
+ */
21
+ out: DatabaseClient<CandidateDatabase>;
22
+ extractPath: string;
23
+ extractPlacetype: "postalcode" | "locality";
24
+ ccID: (code: string | null) => number;
25
+ ptID: (pt: string | null) => number;
26
+ stageRow: StageRow;
27
+ progress: (phase: string, message: string) => void;
28
+ }): {
29
+ primaries: number;
30
+ aliases: number;
31
+ };
32
+ //# sourceMappingURL=extract-fold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-fold.d.ts","sourceRoot":"","sources":["../../lib/candidate/extract-fold.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAGzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,KAAK,EAAc,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAIlE;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE;IAChC;;OAEG;IACH,GAAG,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,YAAY,GAAG,UAAU,CAAA;IAC3C,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAAA;IACrC,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAAA;IACnC,QAAQ,EAAE,QAAQ,CAAA;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAClD,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAwGzC"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Pass 4 of the candidate build — fold a postcode or locality extract into the staging table.
6
+ */
7
+ import { DatabaseClient } from "@mailwoman/sqlite/client";
8
+ import { tableExists } from "@mailwoman/sqlite/introspection";
9
+ import { normalizeLocalityForKey } from "#street/normalize";
10
+ /**
11
+ * Fold ONE extract (`spr` rows at `extractPlacetype` carrying real coordinates) in, then pass 4b: the alias names
12
+ * hanging off that same extract's `names` table.
13
+ *
14
+ * Self-contained by construction — it shares only the staging statement and the code dictionaries with the admin passes
15
+ * above it, and nothing downstream reads anything it produces except the two counters it returns.
16
+ */
17
+ export function foldExtract(ctx) {
18
+ const { out, extractPath, extractPlacetype, ccID, ptID, stageRow, progress } = ctx;
19
+ progress(extractPlacetype === "postalcode" ? "postcodes" : "localities", `reading ${extractPath}`);
20
+ using pc = new DatabaseClient(extractPath, { readOnly: true });
21
+ const pcPtid = ptID(extractPlacetype);
22
+ // Per-extract, not the admin `attrs` map: pass 1 only ever sees the admin DB, so the alias pass
23
+ // below has nothing to join against unless this primary loop records what it staged.
24
+ const pcAttrs = new Map();
25
+ let primaries = 0;
26
+ let aliases = 0;
27
+ out.exec("BEGIN");
28
+ for (const r of pc
29
+ .prepare(`SELECT id, name, country, latitude, longitude,
30
+ min_latitude AS mnlat, min_longitude AS mnlon, max_latitude AS mxlat, max_longitude AS mxlon
31
+ FROM spr WHERE placetype = ? AND latitude != 0 AND longitude != 0`)
32
+ .iterate(extractPlacetype)) {
33
+ const name = String(r.name ?? "");
34
+ const key = normalizeLocalityForKey(name);
35
+ if (!key)
36
+ continue;
37
+ const lat = r.latitude;
38
+ const lon = r.longitude;
39
+ // region_id 0 (a postcode is unique by name+country — no same-name disambiguation); neg_rank 0
40
+ // (no population). bbox = the postcode's own min/max (falls back to the centroid point).
41
+ const a = {
42
+ cid: ccID(r.country),
43
+ rid: 0,
44
+ ptid: pcPtid,
45
+ name,
46
+ lat,
47
+ lon,
48
+ mnLat: r.mnlat || lat,
49
+ mnLon: r.mnlon || lon,
50
+ mxLat: r.mxlat || lat,
51
+ mxLon: r.mxlon || lon,
52
+ pop: 0,
53
+ neg: 0,
54
+ pkey: key,
55
+ // A postcode has no toponym fame — nobody writes an encyclopedia article about SW1A 2AA — and
56
+ // the score source carries no `postalcode` rows to join against anyway. NULL is the truthful
57
+ // value: unmeasured, so the ranking key leaves postcode rows exactly where they were.
58
+ imp: null,
59
+ };
60
+ pcAttrs.set(Number(r.id), a);
61
+ stageRow(key, a, Number(r.id), 1);
62
+ primaries++;
63
+ }
64
+ out.exec("COMMIT");
65
+ // --- pass 4b: postcode ALIAS names (#1495) ---
66
+ //
67
+ // The delivery-city names GeoNames supplies for a ZIP ("Brooklyn" for 11201) are written into
68
+ // the extract's `names` table by `postcode/centroid-fills.ts`'s `geonamesNameFill`. Everything
69
+ // downstream of `names` picked them up EXCEPT this build: `fts.ts` unions `spr.name` with every
70
+ // `names` row into `place_search.alt_names`, so the FTS backend resolved "Brooklyn" → 11201
71
+ // while the candidate backend — whose every row IS an exact-tier row — had no key for it at
72
+ // all. Pass 2 does the equivalent fold for admin places, but reads the ADMIN `place_search`,
73
+ // and `attrs` holds admin ids only, so a postcode extract could never reach it.
74
+ //
75
+ // Same discipline as pass 2: `is_primary = 0` (so `rankByPrimaryPreference` treats it as an
76
+ // alias, not a canonical postcode name), the row stays denormalized onto the POSTCODE's own
77
+ // spr_id/coords/bbox, and the display `name` stays the postcode — resolving "brooklyn" answers
78
+ // with place 11201, it does not rename the place to its delivery city.
79
+ const hasNames = tableExists(pc, "names");
80
+ if (hasNames) {
81
+ out.exec("BEGIN");
82
+ for (const r of pc.prepare("SELECT id, name FROM names").iterate()) {
83
+ const a = pcAttrs.get(Number(r.id));
84
+ if (!a)
85
+ continue;
86
+ const k = normalizeLocalityForKey(String(r.name ?? ""));
87
+ // The postcode's own key is already staged as the primary; `INSERT OR IGNORE` at
88
+ // materialization dedupes repeats, so this only skips the obvious self-alias.
89
+ if (!k || k === a.pkey)
90
+ continue;
91
+ stageRow(k, a, Number(r.id), 0);
92
+ aliases++;
93
+ }
94
+ out.exec("COMMIT");
95
+ }
96
+ else {
97
+ // Never a silent zero: real extracts come from `createUnifiedSchema`, which always creates
98
+ // `names`. A extract without it has no alias surface to lose, but say so rather than reporting
99
+ // "0 aliases" from a table that was never read.
100
+ progress("postcode-aliases", `${extractPath} has no \`names\` table — no delivery-city aliases to fold`);
101
+ }
102
+ return { primaries, aliases };
103
+ }
104
+ //# sourceMappingURL=extract-fold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-fold.js","sourceRoot":"","sources":["../../lib/candidate/extract-fold.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAK7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAE3D;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,GAW3B;IACA,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,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AAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI;gBAAE,SAAQ;YAEhC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;YAE/B,OAAO,EAAE,CAAA;QACV,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACnB,CAAC;SAAM,CAAC;QACP,2FAA2F;QAC3F,+FAA+F;QAC/F,gDAAgD;QAChD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,WAAW,4DAA4D,CAAC,CAAA;IACzG,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAA;AAC9B,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Pass 3c of the candidate build — the `name_role` detectors and the thresholds they are judged by.
6
+ */
7
+ import type { DatabaseClient } from "@mailwoman/sqlite/client";
8
+ import type { CandidateDatabase } from "#candidate-schema";
9
+ import type { PlaceAttrs } from "#candidate/place-attrs";
10
+ import type { WOFDatabase } from "#schema";
11
+ /**
12
+ * Key-count threshold for the gloss anomaly detector (#1730) — the sweep's own boundary: 4,000 places carried >= 50
13
+ * keys, and a legitimate famous place at that count (New York, 176 keys) is separated by the PROMINENCE check, never by
14
+ * this number alone.
15
+ */
16
+ export declare const GLOSS_KEY_THRESHOLD = 50;
17
+ /**
18
+ * Placetypes the gloss detector never flags. A country or region legitimately carries a name in every language — that
19
+ * is what an exonym set IS — so key volume discriminates nothing there. The detector's population is the non-admin
20
+ * tail, where a place named by a common noun ("Poisson", "Sunday") accumulating 200+ translations is a
21
+ * machine-translated gloss set, not fame.
22
+ */
23
+ export declare const GLOSS_EXCLUDED_PLACETYPES: ReadonlySet<string>;
24
+ /**
25
+ * Pass 3c — the #1730 name-role prototype: two independent detectors over the staged rows, WRITE-ONLY in this
26
+ * generation (no ranking consumer; the rank penalty is its own D-rule-conditional step with the `gloss_key` board as
27
+ * regression check). Both stamp `is_primary = 0` rows only — a place's canonical name and the `place_abbr` region
28
+ * abbreviations are never a gloss or a variant.
29
+ *
30
+ * - `gloss` is ANOMALY-based, and stamps only the certain core: key volume at/over the threshold + a non-admin placetype
31
+ *
32
+ * - NO measured prominence (population absent AND importance unmeasured). Provenance cannot separate a gloss from an
33
+ * exonym — WOF imported both as `x_preferred` — and prominence is what rescues New York/Paris.
34
+ * - `abbr` is PROVENANCE-based — the #936 signal: a WOF `variant` name in one of the country's official languages (or
35
+ * English), measured there at a 13× key-collision rate. A source without a `names` table (fixture-scale admin DBs)
36
+ * skips this detector loudly.
37
+ *
38
+ * Returns the stamp counts plus the census the prototype exists to report: how much of the ≥-threshold key tail carries
39
+ * any role.
40
+ */
41
+ export declare function stampNameRoles(ctx: {
42
+ src: DatabaseClient<WOFDatabase>;
43
+ out: DatabaseClient<CandidateDatabase>;
44
+ attrs: Map<number, PlaceAttrs>;
45
+ keyCounts: Map<number, number>;
46
+ glossThreshold: number;
47
+ ptcodes: Map<string, number>;
48
+ ccodes: Map<string, number>;
49
+ progress: (phase: string, message: string) => void;
50
+ }): {
51
+ roleGloss: number;
52
+ roleAbbr: number;
53
+ roleVariant: number;
54
+ keyTailPlaces: number;
55
+ keyTailWithRole: number;
56
+ };
57
+ //# sourceMappingURL=name-roles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"name-roles.d.ts","sourceRoot":"","sources":["../../lib/candidate/name-roles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAG9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,MAAM,CASxD,CAAA;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE;IACnC,GAAG,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;IAChC,GAAG,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;IACtC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAC9B,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAClD,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CA0K/G"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ * @file Pass 3c of the candidate build — the `name_role` detectors and the thresholds they are judged by.
6
+ */
7
+ import { isOfficialLanguage } from "@mailwoman/codex/country";
8
+ import { tableExists } from "@mailwoman/sqlite/introspection";
9
+ import { isOwnNameVariant } from "#candidate/own-name";
10
+ import { normalizeLocalityForKey } from "#street/normalize";
11
+ /**
12
+ * Key-count threshold for the gloss anomaly detector (#1730) — the sweep's own boundary: 4,000 places carried >= 50
13
+ * keys, and a legitimate famous place at that count (New York, 176 keys) is separated by the PROMINENCE check, never by
14
+ * this number alone.
15
+ */
16
+ export const GLOSS_KEY_THRESHOLD = 50;
17
+ /**
18
+ * Placetypes the gloss detector never flags. A country or region legitimately carries a name in every language — that
19
+ * is what an exonym set IS — so key volume discriminates nothing there. The detector's population is the non-admin
20
+ * tail, where a place named by a common noun ("Poisson", "Sunday") accumulating 200+ translations is a
21
+ * machine-translated gloss set, not fame.
22
+ */
23
+ export const GLOSS_EXCLUDED_PLACETYPES = new Set([
24
+ "country",
25
+ "dependency",
26
+ "disputed",
27
+ "empire",
28
+ "macroregion",
29
+ "region",
30
+ "macrocounty",
31
+ "county",
32
+ ]);
33
+ /**
34
+ * Pass 3c — the #1730 name-role prototype: two independent detectors over the staged rows, WRITE-ONLY in this
35
+ * generation (no ranking consumer; the rank penalty is its own D-rule-conditional step with the `gloss_key` board as
36
+ * regression check). Both stamp `is_primary = 0` rows only — a place's canonical name and the `place_abbr` region
37
+ * abbreviations are never a gloss or a variant.
38
+ *
39
+ * - `gloss` is ANOMALY-based, and stamps only the certain core: key volume at/over the threshold + a non-admin placetype
40
+ *
41
+ * - NO measured prominence (population absent AND importance unmeasured). Provenance cannot separate a gloss from an
42
+ * exonym — WOF imported both as `x_preferred` — and prominence is what rescues New York/Paris.
43
+ * - `abbr` is PROVENANCE-based — the #936 signal: a WOF `variant` name in one of the country's official languages (or
44
+ * English), measured there at a 13× key-collision rate. A source without a `names` table (fixture-scale admin DBs)
45
+ * skips this detector loudly.
46
+ *
47
+ * Returns the stamp counts plus the census the prototype exists to report: how much of the ≥-threshold key tail carries
48
+ * any role.
49
+ */
50
+ export function stampNameRoles(ctx) {
51
+ const { src, out, attrs, keyCounts, glossThreshold, progress } = ctx;
52
+ progress("roles", "stamping name roles (gloss anomaly + abbr provenance)");
53
+ const ptNameByID = new Map([...ctx.ptcodes].map(([placetype, id]) => [id, placetype]));
54
+ const iso2ByCID = new Map([...ctx.ccodes].map(([code, id]) => [id, code]));
55
+ let keyTailPlaces = 0;
56
+ const glossSids = [];
57
+ for (const [sid, count] of keyCounts) {
58
+ if (count < glossThreshold)
59
+ continue;
60
+ keyTailPlaces++;
61
+ const a = attrs.get(sid);
62
+ if (!a)
63
+ continue;
64
+ if (GLOSS_EXCLUDED_PLACETYPES.has(ptNameByID.get(a.ptid) ?? ""))
65
+ continue;
66
+ if (a.pop > 0 || a.imp != null)
67
+ continue;
68
+ glossSids.push(sid);
69
+ }
70
+ out.exec("CREATE TEMP TABLE role_key (spr_id INTEGER NOT NULL, name_key TEXT NOT NULL, PRIMARY KEY (spr_id, name_key)) WITHOUT ROWID");
71
+ const insRoleKey = out.prepare("INSERT OR IGNORE INTO role_key VALUES (?, ?)");
72
+ // Zero abbr stamps from a skipped detector is a different fact from zero variants found.
73
+ const hasSourceNames = tableExists(src, "names");
74
+ if (hasSourceNames) {
75
+ out.exec("BEGIN");
76
+ // Two provenance routes into the same stamp: WOF's abbreviation/short name KINDS arrive in the
77
+ // LANGUAGE column ('abbr'/'short' — 280 rows, measured 2026-08-18, Toledo's 'TO' among them) and
78
+ // qualify by kind alone; everything else qualifies as a variant in an official language.
79
+ for (const r of src
80
+ .prepare("SELECT id, name, language FROM names WHERE privateuse = 'variant' OR language IN ('abbr', 'short')")
81
+ .iterate()) {
82
+ const a = attrs.get(Number(r.id));
83
+ if (!a)
84
+ continue;
85
+ const language = String(r.language ?? "");
86
+ if (language !== "abbr" && language !== "short") {
87
+ const iso2 = iso2ByCID.get(a.cid) ?? "??";
88
+ if (language !== "eng" && !isOfficialLanguage(iso2, language))
89
+ continue;
90
+ }
91
+ const k = normalizeLocalityForKey(String(r.name ?? ""));
92
+ if (!k || k === a.pkey)
93
+ continue;
94
+ insRoleKey.run(Number(r.id), k);
95
+ }
96
+ out.exec("COMMIT");
97
+ }
98
+ else {
99
+ progress("roles", "source carries no `names` table — abbr detector skipped (gloss still runs)");
100
+ }
101
+ // Stamp order is precedence: the provenance-based abbr first, then the own-name variant verdict,
102
+ // then gloss fills what neither claimed.
103
+ const roleAbbr = Number(out
104
+ .prepare(`UPDATE cand_stage SET name_role = 'abbr'
105
+ WHERE is_primary = 0 AND EXISTS (
106
+ SELECT 1 FROM role_key rk WHERE rk.spr_id = cand_stage.spr_id AND rk.name_key = cand_stage.name_key)`)
107
+ .run().changes);
108
+ // --- variant detector (#1882): the alias surface is the holder's OWN primary name in another
109
+ // orthography — romanization, spacing/diacritic variant, or abbreviation expansion. The verdict
110
+ // is per (alias key, primary key) pair, so it runs in JS over the still-unstamped alias rows;
111
+ // an uncovered script answers no-verdict and stamps nothing (own-name.ts owns the predicate and
112
+ // its measured threshold). Runs BEFORE gloss on purpose: a surface that IS the place's own name
113
+ // is not a translation, whatever the key volume says.
114
+ out.exec("CREATE TEMP TABLE variant_key (spr_id INTEGER NOT NULL, name_key TEXT NOT NULL, PRIMARY KEY (spr_id, name_key)) WITHOUT ROWID");
115
+ const insVariantKey = out.prepare("INSERT OR IGNORE INTO variant_key VALUES (?, ?)");
116
+ let variantScanned = 0;
117
+ out.exec("BEGIN");
118
+ for (const r of out
119
+ .prepare("SELECT DISTINCT spr_id, name_key FROM cand_stage WHERE is_primary = 0 AND name_role IS NULL")
120
+ .iterate()) {
121
+ variantScanned++;
122
+ const a = attrs.get(Number(r.spr_id));
123
+ if (!a?.pkey)
124
+ continue;
125
+ if (isOwnNameVariant(String(a.pkey), String(r.name_key))) {
126
+ insVariantKey.run(Number(r.spr_id), String(r.name_key));
127
+ }
128
+ }
129
+ out.exec("COMMIT");
130
+ const roleVariant = Number(out
131
+ .prepare(`UPDATE cand_stage SET name_role = 'variant'
132
+ WHERE is_primary = 0 AND name_role IS NULL AND EXISTS (
133
+ SELECT 1 FROM variant_key vk WHERE vk.spr_id = cand_stage.spr_id AND vk.name_key = cand_stage.name_key)`)
134
+ .run().changes);
135
+ out.exec("DROP TABLE variant_key");
136
+ progress("roles", `variant: ${roleVariant.toLocaleString()} of ${variantScanned.toLocaleString()} unstamped alias keys are own-name variants`);
137
+ out.exec("CREATE TEMP TABLE role_place (spr_id INTEGER PRIMARY KEY) WITHOUT ROWID");
138
+ out.exec("CREATE TEMP TABLE key_tail (spr_id INTEGER PRIMARY KEY) WITHOUT ROWID");
139
+ const insRolePlace = out.prepare("INSERT OR IGNORE INTO role_place VALUES (?)");
140
+ const insKeyTail = out.prepare("INSERT OR IGNORE INTO key_tail VALUES (?)");
141
+ out.exec("BEGIN");
142
+ for (const sid of glossSids) {
143
+ insRolePlace.run(sid);
144
+ }
145
+ for (const [sid, count] of keyCounts) {
146
+ if (count >= glossThreshold) {
147
+ insKeyTail.run(sid);
148
+ }
149
+ }
150
+ out.exec("COMMIT");
151
+ const roleGloss = Number(out
152
+ .prepare(`UPDATE cand_stage SET name_role = 'gloss'
153
+ WHERE is_primary = 0 AND name_role IS NULL AND spr_id IN (SELECT spr_id FROM role_place)`)
154
+ .run().changes);
155
+ const keyTailWithRole = Number(out
156
+ .prepare(`SELECT count(DISTINCT spr_id) AS n FROM cand_stage
157
+ WHERE name_role IS NOT NULL AND spr_id IN (SELECT spr_id FROM key_tail)`)
158
+ .get()["n"]);
159
+ out.exec("DROP TABLE role_key");
160
+ out.exec("DROP TABLE role_place");
161
+ out.exec("DROP TABLE key_tail");
162
+ progress("roles", `${roleAbbr.toLocaleString()} abbr + ${roleGloss.toLocaleString()} gloss rows stamped; ` +
163
+ `key tail (>= ${glossThreshold} keys): ${keyTailWithRole.toLocaleString()} of ${keyTailPlaces.toLocaleString()} places carry a role`);
164
+ return { roleGloss, roleAbbr, roleVariant, keyTailPlaces, keyTailWithRole };
165
+ }
166
+ //# sourceMappingURL=name-roles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"name-roles.js","sourceRoot":"","sources":["../../lib/candidate/name-roles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAG7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,q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