@mailwoman/resolver-wof-sqlite 11.2.0 → 11.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 (452) 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 +4 -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} +12 -4
  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 +242 -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 +1 -1
  93. package/out/address/number-forms.d.ts.map +1 -1
  94. package/out/address/number-forms.js +4 -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} +10 -8
  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/{street → labels/street}/normalize.d.ts +85 -27
  256. package/out/labels/street/normalize.d.ts.map +1 -0
  257. package/out/{street → labels/street}/normalize.js +162 -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.map +0 -1
  404. package/out/street/normalize.js.map +0 -1
  405. package/out/street/segment-schema.d.ts.map +0 -1
  406. package/out/street/segment-schema.js.map +0 -1
  407. package/out/street/table.d.ts.map +0 -1
  408. package/out/street/table.js.map +0 -1
  409. package/out/street.d.ts +0 -9
  410. package/out/street.d.ts.map +0 -1
  411. package/out/street.js +0 -11
  412. package/out/street.js.map +0 -1
  413. package/out/types.d.ts.map +0 -1
  414. package/out/types.js.map +0 -1
  415. package/out/unified-schema.d.ts.map +0 -1
  416. package/out/unified-schema.js.map +0 -1
  417. package/out/weights-overlay-linker.d.ts.map +0 -1
  418. package/out/weights-overlay-linker.js.map +0 -1
  419. /package/lib/{coverage-manifest-schema.ts → candidate/coverage-manifest.ts} +0 -0
  420. /package/lib/{postal/city → labels/locality/postal-city}/alias/schema.ts +0 -0
  421. /package/lib/{street → labels/street}/morphology/fst/builder.ts +0 -0
  422. /package/lib/{exact-match.ts → lookup/exact-match.ts} +0 -0
  423. /package/lib/{name-score.ts → ranking/name-score.ts} +0 -0
  424. /package/lib/{proximity-rerank.ts → ranking/proximity-rerank.ts} +0 -0
  425. /package/lib/{ranking-weights.ts → ranking/weights.ts} +0 -0
  426. /package/lib/{importance-source.ts → schema/importance-source.ts} +0 -0
  427. /package/lib/{polygon-schema.ts → schema/polygon.ts} +0 -0
  428. /package/lib/{unified-schema.ts → schema/unified.ts} +0 -0
  429. /package/out/{capitals.d.ts → candidate/capitals.d.ts} +0 -0
  430. /package/out/{search-fetch.js → fts/search-fetch.js} +0 -0
  431. /package/out/{postal/city → labels/locality/postal-city}/alias/lookup.js +0 -0
  432. /package/out/{postal/city → labels/locality/postal-city}/alias/schema.d.ts +0 -0
  433. /package/out/{postal/city → labels/locality/postal-city}/alias/schema.js +0 -0
  434. /package/out/{postal/city → labels/locality/postal-city}/candidate-schema.js +0 -0
  435. /package/out/{street → labels/street}/centroid/schema.js +0 -0
  436. /package/out/{street → labels/street}/morphology/fst/builder.d.ts +0 -0
  437. /package/out/{street → labels/street}/morphology/fst/builder.js +0 -0
  438. /package/out/{street → labels/street}/morphology/fst/loader.d.ts +0 -0
  439. /package/out/{street → labels/street}/name-lookup.d.ts +0 -0
  440. /package/out/{street → labels/street}/segment-schema.js +0 -0
  441. /package/out/{street → labels/street}/table.d.ts +0 -0
  442. /package/out/{exact-match.d.ts → lookup/exact-match.d.ts} +0 -0
  443. /package/out/{exact-match.js → lookup/exact-match.js} +0 -0
  444. /package/out/{extracts.d.ts → lookup/extracts.d.ts} +0 -0
  445. /package/out/{types.js → lookup/types.js} +0 -0
  446. /package/out/{name-score.d.ts → ranking/name-score.d.ts} +0 -0
  447. /package/out/{name-score.js → ranking/name-score.js} +0 -0
  448. /package/out/{primary-preference.d.ts → ranking/primary-preference.d.ts} +0 -0
  449. /package/out/{proximity-rerank.d.ts → ranking/proximity-rerank.d.ts} +0 -0
  450. /package/out/{proximity-rerank.js → ranking/proximity-rerank.js} +0 -0
  451. /package/out/{importance-source.d.ts → schema/importance-source.d.ts} +0 -0
  452. /package/out/{importance-source.js → schema/importance-source.js} +0 -0
@@ -4,8 +4,6 @@
4
4
  import { AbbreviationToDirectional, US_STREET_SUFFIX_LOOKUP } from "@mailwoman/codex/us"
5
5
  import type { Tagged } from "type-fest"
6
6
 
7
- import { streetLocaleForCountry } from "#street/locale"
8
-
9
7
  /**
10
8
  * A place name folded by {@link normalizeLocalityForKey}, minted only by calling the fold.
11
9
  */
@@ -142,58 +140,20 @@ export function normalizeStreetForKey(street: string): StreetKey {
142
140
  }
143
141
 
144
142
  /**
145
- * Names the rule set {@link normalizeStreetForKeyLocale} uses to fold a street
146
- * name into an address-point key.
147
- */
148
- export type StreetLocale = "us" | "en" | "es" | "fr" | "de" | "it" | "nl" | "pl" | "vn" | "id" | "zh" | "und"
149
-
150
- /**
151
- * Every locale {@link normalizeStreetForKeyLocale} keys streets under.
143
+ * The name of one row of {@link STREET_KEY_RULES}, the rules a database's street,
144
+ * locality and house-number keys are built under.
145
+ *
146
+ * Two functions produce one: `streetLocaleForCountry` in `#labels/street/locale`, for a country,
147
+ * and {@link parseStreetLocale}, for a spelling an artifact manifest records or a command line passes.
148
+ * A string literal is therefore refused where a street locale is expected,
149
+ * and code reads a locale's behavior from its row with {@link streetKeyRulesOf}.
152
150
  */
153
- export const STREET_LOCALES = [
154
- "us",
155
- "en",
156
- "es",
157
- "fr",
158
- "de",
159
- "it",
160
- "nl",
161
- "pl",
162
- "vn",
163
- "id",
164
- "zh",
165
- "und",
166
- ] as const satisfies readonly StreetLocale[]
151
+ export type StreetLocale = Tagged<string, "StreetLocale">
167
152
 
168
153
  function foldHan(input: string): string {
169
154
  return input.normalize("NFKC").replaceAll("臺", "台").replaceAll(/\s+/g, "").toLowerCase()
170
155
  }
171
156
 
172
- /**
173
- * Creates the street-locale lookup for one source's built databases.
174
- *
175
- * `localeFor` answers {@link streetLocaleForCountry} for a country in `countries`
176
- * and throws for any other, since that source has built no database there to fold a query for.
177
- * Every source therefore folds a country's streets under one locale.
178
- */
179
- export function createStreetLocaleRegistry(
180
- countries: readonly string[],
181
- label: string
182
- ): { localeFor: (countryCode: string) => StreetLocale; supported: () => string[] } {
183
- const built = new Set(countries.map((country) => country.toLowerCase()))
184
-
185
- return {
186
- localeFor: (countryCode) => {
187
- if (!built.has(countryCode.toLowerCase())) {
188
- throw new Error(`No database is registered for country "${countryCode}". ${label}`)
189
- }
190
-
191
- return streetLocaleForCountry(countryCode)
192
- },
193
- supported: () => [...built],
194
- }
195
- }
196
-
197
157
  const FR_STREET_ABBREV = new Map<string, string>([
198
158
  ["av", "avenue"],
199
159
  ["ave", "avenue"],
@@ -261,83 +221,241 @@ const ID_STREET_ABBREV = new Map<string, string>([
261
221
  ["gg", "gang"],
262
222
  ])
263
223
 
224
+ const FRENCH_LEAD_TYPE =
225
+ /^(?:rue|ruelle|av|ave|avenue|boul|bd|boulevard|ch|che|chemin|all[ée]e|imp|impasse|mont[ée]e|c[ôo]te|pl|place|prom|promenade|rang|rte|route|autoroute|carr[eé]|croissant|terrasse|sentier)(?=[\s.-]|$)/i
226
+
264
227
  /**
265
- * Normalizes a street name into an address-point key under the given locale, delegating `us`
266
- * and `en` to {@link normalizeStreetForKey}; the extract builder and the probe must both call it.
228
+ * The rules one street locale builds and probes keys under.
229
+ *
230
+ * A builder and a reader of one database read the same row, so they agree on every key.
267
231
  */
268
- export function normalizeStreetForKeyLocale(street: string, locale: StreetLocale): StreetKey {
269
- if (locale === "us" || locale === "en") return normalizeStreetForKey(street)
270
-
271
- if (locale === "zh") return foldHan(street) as StreetKey
232
+ export interface StreetKeyRules {
233
+ /**
234
+ * Builds the key a street name is stored and probed under.
235
+ */
236
+ streetKey: (street: string) => StreetKey
237
+ /**
238
+ * The streets keyed under another locale's rules: a street whose surface matches
239
+ * `pattern` is keyed under the row that `locale` spells.
240
+ *
241
+ * `null` keys every street under this row.
242
+ */
243
+ surfaceRoute: { pattern: RegExp; locale: string } | null
244
+ /**
245
+ * Whether a reader also probes the English respellings of a street: a doubled type word, a numbered
246
+ * street with and without its ordinal suffix, `Saint` for `St`, and a numbered route's designators.
247
+ */
248
+ englishRespellings: boolean
249
+ /**
250
+ * Builds the key a locality name is stored and probed under.
251
+ */
252
+ localityKey: (locality: string) => NameKey
253
+ /**
254
+ * Whether the stored locality keys are abbreviated or replaced by a parent place.
255
+ *
256
+ * A reader then lets a row's locality select a row and never reject one.
257
+ */
258
+ localityKeys: "abbreviated" | "full"
259
+ /**
260
+ * Whether a reader strips a trailing arrondissement designator from a query's locality key,
261
+ * because the builder keyed each arrondissement at its base city.
262
+ */
263
+ arrondissementAtBaseCity: boolean
264
+ /**
265
+ * Whether the stored locality key is the parse's `region` and `subregion` written together,
266
+ * for a register whose rows state neither postcode nor locality.
267
+ */
268
+ localityFromRegionAndSubregion: boolean
269
+ /**
270
+ * Builds the key a house number is stored and probed under.
271
+ */
272
+ houseNumberKey: (number: string) => string
273
+ /**
274
+ * Matches a house number written as a base number with joined sub-numbers, and captures the base.
275
+ * A reader probes the base after the written number misses.
276
+ *
277
+ * `null` when the locale writes no such number.
278
+ */
279
+ houseNumberBase: RegExp | null
280
+ }
272
281
 
273
- const tokens = fold(street)
282
+ /**
283
+ * The key of a street written in space-separated words: case folded, accents removed,
284
+ * `ß` written `ss`, hyphens read as spaces, and the words then passed to `rewrite`.
285
+ */
286
+ function wordStreetKey(street: string, rewrite?: (words: string[]) => void): StreetKey {
287
+ const words = fold(street)
274
288
  .replaceAll("ß", "ss")
275
289
  .replaceAll("-", " ")
276
290
  .split(/\s+/)
277
291
  .filter((value) => value.length)
278
292
 
279
- if (!tokens.length) return "" as StreetKey
293
+ if (!words.length) return "" as StreetKey
294
+
295
+ rewrite?.(words)
280
296
 
281
- switch (locale) {
282
- case "fr":
283
- for (let i = 0; i < tokens.length; i++) {
284
- tokens[i] = FR_STREET_ABBREV.get(tokens[i]!) ?? tokens[i]!
297
+ return words.join(" ") as StreetKey
298
+ }
299
+
300
+ /**
301
+ * Replaces every word that `expansions` lists.
302
+ */
303
+ function expandEveryWord(expansions: ReadonlyMap<string, string>): (words: string[]) => void {
304
+ return (words) => {
305
+ for (let i = 0; i < words.length; i++) {
306
+ words[i] = expansions.get(words[i]!) ?? words[i]!
307
+ }
308
+ }
309
+ }
310
+
311
+ /**
312
+ * Replaces the leading word that `expansions` lists, in a name of two or more words.
313
+ *
314
+ * The leading type is expanded and kept, because dropping it merges distinct streets
315
+ * that share a name: `Calle Mayor` and `Plaza Mayor` can share a municipio.
316
+ */
317
+ function expandLeadingWord(expansions: ReadonlyMap<string, string>): (words: string[]) => void {
318
+ return (words) => {
319
+ if (words.length > 1) {
320
+ words[0] = expansions.get(words[0]!) ?? words[0]!
321
+ }
322
+ }
323
+ }
324
+
325
+ /**
326
+ * Writes a word that ends in `str` with the full street word `full` in its place.
327
+ */
328
+ function expandStreetSuffix(full: string): (words: string[]) => void {
329
+ return (words) => {
330
+ for (let i = 0; i < words.length; i++) {
331
+ const word = words[i]!
332
+
333
+ if (word.endsWith("str") && !word.endsWith(full)) {
334
+ words[i] = word.replace(/str$/, full)
285
335
  }
286
- break
287
- case "de":
288
- for (let i = 0; i < tokens.length; i++) {
289
- const t = tokens[i]!
336
+ }
337
+ }
338
+ }
290
339
 
291
- if (t.endsWith("str") && !t.endsWith("strasse")) {
292
- tokens[i] = t.replace(/str$/, "strasse")
340
+ /**
341
+ * The rules every locale has unless its row states another.
342
+ */
343
+ const SHARED_KEY_RULES: StreetKeyRules = {
344
+ streetKey: (street) => wordStreetKey(street),
345
+ surfaceRoute: null,
346
+ englishRespellings: false,
347
+ localityKey: normalizeLocalityForKey,
348
+ localityKeys: "full",
349
+ arrondissementAtBaseCity: false,
350
+ localityFromRegionAndSubregion: false,
351
+ houseNumberKey: (number) => number.trim().toLowerCase(),
352
+ houseNumberBase: null,
353
+ }
354
+
355
+ /**
356
+ * The rules of each street locale, keyed by the spelling an artifact manifest records.
357
+ *
358
+ * A spelling is therefore renamed only with its artifacts rebuilt.
359
+ *
360
+ * - `es`, `fr`, `de`, `it`, `nl`, `pl` and `id` are ISO 639-1 language codes.
361
+ * - `vn` is Vietnamese, spelled with the country's code where the language's is `vi`.
362
+ * - `zh` is Han script, and the one database under it is the Taiwanese register's.
363
+ * - `en` and `us` build the same street key.
364
+ * `us` is the row of a database built without the surface route and with abbreviated
365
+ * locality keys, as the United States databases are.
366
+ * - `und` has the shared rules only, for a country whose official languages select no one row.
367
+ */
368
+ const STREET_KEY_RULES: Readonly<Record<string, StreetKeyRules>> = {
369
+ us: { ...SHARED_KEY_RULES, streetKey: normalizeStreetForKey, englishRespellings: true, localityKeys: "abbreviated" },
370
+ en: {
371
+ ...SHARED_KEY_RULES,
372
+ streetKey: normalizeStreetForKey,
373
+ // The route reads the surface and never the province, so a bilingual Canadian extract keys each street one way.
374
+ surfaceRoute: { pattern: FRENCH_LEAD_TYPE, locale: "fr" },
375
+ englishRespellings: true,
376
+ },
377
+ es: { ...SHARED_KEY_RULES, streetKey: (street) => wordStreetKey(street, expandLeadingWord(ES_STREET_TYPE_ABBREV)) },
378
+ fr: {
379
+ ...SHARED_KEY_RULES,
380
+ streetKey: (street) => wordStreetKey(street, expandEveryWord(FR_STREET_ABBREV)),
381
+ arrondissementAtBaseCity: true,
382
+ },
383
+ de: { ...SHARED_KEY_RULES, streetKey: (street) => wordStreetKey(street, expandStreetSuffix("strasse")) },
384
+ it: { ...SHARED_KEY_RULES, streetKey: (street) => wordStreetKey(street, expandLeadingWord(IT_STREET_TYPE_ABBREV)) },
385
+ nl: { ...SHARED_KEY_RULES, streetKey: (street) => wordStreetKey(street, expandStreetSuffix("straat")) },
386
+ pl: {
387
+ ...SHARED_KEY_RULES,
388
+ streetKey: (street) =>
389
+ wordStreetKey(street, (words) => {
390
+ for (let i = 0; i < words.length; i++) {
391
+ words[i] = words[i]!.replaceAll("ł", "l")
293
392
  }
294
- }
295
- break
296
- case "it":
297
- // The leading type is expanded and kept, unlike `pl`, because dropping it
298
- // merges distinct streets that share a name.
299
- if (tokens.length > 1) {
300
- tokens[0] = IT_STREET_TYPE_ABBREV.get(tokens[0]!) ?? tokens[0]!
301
- }
302
- break
303
- case "es":
304
- // Keep the leading type, as `it` does and more strongly, because `Calle Mayor`
305
- // and `Plaza Mayor` can share a municipio.
306
- if (tokens.length > 1) {
307
- tokens[0] = ES_STREET_TYPE_ABBREV.get(tokens[0]!) ?? tokens[0]!
308
- }
309
- break
310
- case "nl":
311
- for (let i = 0; i < tokens.length; i++) {
312
- const t = tokens[i]!
313
393
 
314
- if (t.endsWith("str") && !t.endsWith("straat")) {
315
- tokens[i] = t.replace(/str$/, "straat")
394
+ if (words.length > 1 && PL_LEADING_TYPE.has(words[0]!)) {
395
+ words.shift()
316
396
  }
317
- }
318
- break
319
- case "pl":
320
- for (let i = 0; i < tokens.length; i++) {
321
- tokens[i] = tokens[i]!.replaceAll("ł", "l")
322
- }
397
+ }),
398
+ },
399
+ vn: {
400
+ ...SHARED_KEY_RULES,
401
+ streetKey: (street) =>
402
+ wordStreetKey(street, (words) => {
403
+ for (let i = 0; i < words.length; i++) {
404
+ words[i] = words[i]!.replaceAll("đ", "d").replaceAll("ð", "d")
405
+ }
406
+ }),
407
+ },
408
+ id: { ...SHARED_KEY_RULES, streetKey: (street) => wordStreetKey(street, expandEveryWord(ID_STREET_ABBREV)) },
409
+ zh: {
410
+ ...SHARED_KEY_RULES,
411
+ // A Han street name has no spaces and no type-word abbreviations.
412
+ streetKey: (street) => foldHan(street) as StreetKey,
413
+ localityKey: (locality) => foldHan(locality) as NameKey,
414
+ localityFromRegionAndSubregion: true,
415
+ // A Taiwanese house number ends in 號 and may be written in full-width digits.
416
+ houseNumberKey: (number) =>
417
+ foldHan(number)
418
+ .replace(/^(\d+)號([之附]\d+)$/u, "$1$2")
419
+ .replace(/號$/u, ""),
420
+ // 之 and 附 join a sub-number to a base number, and the Taiwanese register stores the base.
421
+ houseNumberBase: /^(\d+)(?:[之附]\d+)+$/u,
422
+ },
423
+ und: SHARED_KEY_RULES,
424
+ }
323
425
 
324
- if (tokens.length > 1 && PL_LEADING_TYPE.has(tokens[0]!)) {
325
- tokens.shift()
326
- }
327
- break
328
- case "id":
329
- for (let i = 0; i < tokens.length; i++) {
330
- tokens[i] = ID_STREET_ABBREV.get(tokens[i]!) ?? tokens[i]!
331
- }
332
- break
333
- case "vn":
334
- for (let i = 0; i < tokens.length; i++) {
335
- tokens[i] = tokens[i]!.replaceAll("đ", "d").replaceAll("ð", "d")
336
- }
337
- break
426
+ /**
427
+ * The street locale a spelling names, for a spelling read from an artifact manifest or a command line.
428
+ *
429
+ * @throws For a spelling {@link STREET_KEY_RULES} has no row for.
430
+ */
431
+ export function parseStreetLocale(spelling: string): StreetLocale {
432
+ if (!Object.hasOwn(STREET_KEY_RULES, spelling)) {
433
+ throw new Error(
434
+ `"${spelling}" is no street locale. The street locales are ${Object.keys(STREET_KEY_RULES).join(", ")}.`
435
+ )
338
436
  }
339
437
 
340
- return tokens.join(" ") as StreetKey
438
+ return spelling as StreetLocale
439
+ }
440
+
441
+ /**
442
+ * Every street locale, in the order {@link STREET_KEY_RULES} lists them.
443
+ */
444
+ export const STREET_LOCALES: readonly StreetLocale[] = Object.keys(STREET_KEY_RULES).map(parseStreetLocale)
445
+
446
+ /**
447
+ * The rules a street locale builds and probes keys under.
448
+ */
449
+ export function streetKeyRulesOf(locale: StreetLocale): StreetKeyRules {
450
+ return STREET_KEY_RULES[locale]!
451
+ }
452
+
453
+ /**
454
+ * Builds a street name's address-point key under the given locale.
455
+ * The extract builder and the probe must both call it.
456
+ */
457
+ export function normalizeStreetForKeyLocale(street: string, locale: StreetLocale): StreetKey {
458
+ return streetKeyRulesOf(locale).streetKey(street)
341
459
  }
342
460
 
343
461
  /**
@@ -390,39 +508,29 @@ export function withArabicLetterVariantsFolded(key: NameKey): NameKey {
390
508
  }
391
509
 
392
510
  /**
393
- * Folds a locality name into a {@link NameKey} with the Han fold for `zh`
394
- * and {@link normalizeLocalityForKey} otherwise.
511
+ * Builds a locality name's {@link NameKey} under the given locale.
395
512
  *
396
- * The Han rule stays out of the shared fold so existing columns are not re-keyed.
513
+ * The Han rule is a row's own, so the columns of every other locale keep their keys.
397
514
  */
398
515
  export function normalizeLocalityForKeyLocale(locality: string, locale: StreetLocale): NameKey {
399
- return locale === "zh" ? (foldHan(locality) as NameKey) : normalizeLocalityForKey(locality)
516
+ return streetKeyRulesOf(locale).localityKey(locality)
400
517
  }
401
518
 
402
519
  /**
403
- * Folds a house number into an address-point key, additionally width-folding
404
- * and dropping the trailing 號 for `zh`.
520
+ * Builds a house number's address-point key under the given locale.
405
521
  */
406
522
  export function normalizeHouseNumberForKey(number: string, locale: StreetLocale): string {
407
- if (locale === "zh") {
408
- return foldHan(number)
409
- .replace(/^(\d+)號([之附]\d+)$/u, "$1$2")
410
- .replace(/號$/u, "")
411
- }
412
-
413
- return number.trim().toLowerCase()
523
+ return streetKeyRulesOf(locale).houseNumberKey(number)
414
524
  }
415
525
 
416
- const FRENCH_LEAD_TYPE =
417
- /^(?:rue|ruelle|av|ave|avenue|boul|bd|boulevard|ch|che|chemin|all[ée]e|imp|impasse|mont[ée]e|c[ôo]te|pl|place|prom|promenade|rang|rte|route|autoroute|carr[eé]|croissant|terrasse|sentier)(?=[\s.-]|$)/i
418
-
419
526
  /**
420
- * Routes an `en` street surface leading with a French type word to the `fr` locale
421
- * and returns any other base unchanged, routing on the surface rather than the province
422
- * so bilingual Canadian extracts fold consistently.
527
+ * The locale a street's key is built under: the one `base`'s surface route sends the street to,
528
+ * or `base` when the row has no route or the street doesn't match it.
423
529
  */
424
530
  export function streetLocaleForSurface(street: string, base: StreetLocale): StreetLocale {
425
- return base === "en" && FRENCH_LEAD_TYPE.test(street.trimStart()) ? "fr" : base
531
+ const route = streetKeyRulesOf(base).surfaceRoute
532
+
533
+ return route?.pattern.test(street.trimStart()) ? parseStreetLocale(route.locale) : base
426
534
  }
427
535
 
428
536
  /**
@@ -515,14 +623,15 @@ function ordinalOf(n: number): string {
515
623
  }
516
624
 
517
625
  /**
518
- * Lists the lookup keys to probe for a street span, most literal first, adding doubled-type
519
- * and Saint/St-swap recovery forms for `us` and `en`.
626
+ * Lists the lookup keys to probe for a street span, most literal first, adding the
627
+ * English respellings for a locale whose rules probe them.
520
628
  */
521
- export function streetKeyVariants(street: string, locale: StreetLocale = "us"): StreetKey[] {
522
- const primary = locale === "us" ? normalizeStreetForKey(street) : normalizeStreetForKeyLocale(street, locale)
629
+ export function streetKeyVariants(street: string, locale: StreetLocale): StreetKey[] {
630
+ const rules = streetKeyRulesOf(locale)
631
+ const primary = rules.streetKey(street)
523
632
  const variants: StreetKey[] = primary ? [primary] : []
524
633
 
525
- if (!primary || (locale !== "us" && locale !== "en")) return variants
634
+ if (!primary || !rules.englishRespellings) return variants
526
635
 
527
636
  const tokens = primary.split(" ")
528
637
  const last = tokens.at(-1)
@@ -19,7 +19,7 @@
19
19
 
20
20
  import { type Kysely, sql } from "kysely"
21
21
 
22
- import type { RouteKey } from "#street/normalize"
22
+ import type { RouteKey } from "#labels/street/normalize"
23
23
 
24
24
  /**
25
25
  * One tiger street-segment edge: a `(from_hn, to_hn)` house-number range on one `side`
@@ -11,7 +11,7 @@
11
11
  * A read clusters on the written name, so a range reader fetches one run of pages for each lookup.
12
12
  */
13
13
 
14
- import { normalizeStreetForKey } from "#street/normalize"
14
+ import { normalizeStreetForKey } from "#labels/street/normalize"
15
15
 
16
16
  /**
17
17
  * One merged street: road links with one name, joined through a shared node.
@@ -0,0 +1,11 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ export * from "#labels/street/centroid"
5
+ export * from "#labels/street/centroid/schema"
6
+ export * from "#labels/street/morphology/fst/builder"
7
+ export * from "#labels/street/morphology/fst/loader"
8
+ export * from "#labels/street/locale"
9
+ export * from "#labels/street/name-lookup"
10
+ export * from "#labels/street/normalize"
11
+ export * from "#labels/street/segment-schema"
@@ -9,7 +9,7 @@
9
9
 
10
10
  import type { LandmarkHit, LandmarkKind } from "@mailwoman/core/resolver"
11
11
 
12
- import { normalizeLocalityForKey } from "#street/normalize"
12
+ import { normalizeLocalityForKey } from "#labels/street/normalize"
13
13
 
14
14
  /**
15
15
  * One way of writing one place.