@mailwoman/corpus 10.5.0 → 10.7.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 (232) hide show
  1. package/data/PROVENANCE.md +24 -0
  2. package/data/address-source-register.json +18948 -8757
  3. package/data/corpus-source-inputs.json +4756 -0
  4. package/data/license-decisions.json +7260 -0
  5. package/data/licenses/whosonfirst-licenses.md +3 -2
  6. package/data/reviewed-ve-postcode-tuples.json +5 -72
  7. package/data/source-additions.json +2450 -0
  8. package/data/source-resolutions.json +87 -0
  9. package/data/training-manifests/v0.7.10-gb-county.effective.json +2335 -0
  10. package/data/training-manifests/v0.7.10-gb-county.json +1132 -0
  11. package/data/training-manifests/v0.7.2-address-systems.effective.json +3 -2
  12. package/data/training-manifests/v0.7.7-no-ppd.json +550 -0
  13. package/data/training-manifests/v0.7.8-rights-clean.json +538 -0
  14. package/data/training-manifests/v0.7.9-country-gap.json +1132 -0
  15. package/data/us-situs-sources.json +128 -0
  16. package/lib/adapters/cordis/adapter.ts +1 -1
  17. package/lib/adapters/libpostal-dictionary.ts +23 -3
  18. package/lib/adapters/osm/adapter.ts +42 -11
  19. package/lib/adapters.ts +14 -0
  20. package/lib/az/adapters/opendata/adapter.ts +389 -0
  21. package/lib/bs/adapters/gbpa/adapter.ts +248 -0
  22. package/lib/build/types.ts +16 -0
  23. package/lib/build.ts +21 -0
  24. package/lib/ee/adapters/ads/adapter.ts +18 -0
  25. package/lib/fo/adapters/adressur/adapter.ts +242 -0
  26. package/lib/gb/adapters/os-open/adapter.ts +14 -2
  27. package/lib/gb/county.ts +59 -0
  28. package/lib/gb/os-open/{open-names.ts → open/names.ts} +41 -0
  29. package/lib/gu/adapters/bsp/adapter.ts +434 -0
  30. package/lib/im/adapters/land-registry/adapter.ts +340 -0
  31. package/lib/international/recipes/locale.ts +164 -19
  32. package/lib/li/adapters/llv/adapter.ts +246 -0
  33. package/lib/recipes/bare/postcode.ts +10 -34
  34. package/lib/recipes/country-balanced.ts +95 -78
  35. package/lib/recipes/intersection.ts +22 -30
  36. package/lib/recipes/po/box/cedex/recipe.ts +8 -5
  37. package/lib/recipes/po/box/cedex/sources.ts +2 -23
  38. package/lib/recipes/scaffold.ts +28 -3
  39. package/lib/recipes/sources.ts +112 -1
  40. package/lib/recipes/street/affix.ts +17 -29
  41. package/lib/recipes/sub/venue/context.ts +33 -9
  42. package/lib/recipes/sub/venue/sources.ts +54 -13
  43. package/lib/recipes/sub/venue.ts +68 -23
  44. package/lib/recipes/unit.ts +20 -7
  45. package/lib/registers.ts +33 -0
  46. package/lib/source-register/corpus-inputs.ts +528 -0
  47. package/lib/source-register/effective-manifest.ts +37 -5
  48. package/lib/source-register/types.ts +20 -0
  49. package/lib/south-asia/recipes/register.ts +1 -1
  50. package/lib/tools/overlay/manifest.ts +109 -1
  51. package/lib/tools/source-register/build.ts +47 -1
  52. package/lib/tools/variety-sample.ts +633 -0
  53. package/lib/us/adapters/usgov/nad/adapter.ts +39 -10
  54. package/lib/us/recipes/skeleton-sources.ts +156 -0
  55. package/lib/us/tools/nad-skeletons.ts +395 -0
  56. package/lib/uy/adapters/ide/adapter.ts +275 -0
  57. package/lib/ve/recipes/reviewed-postcode-tail.ts +29 -6
  58. package/out/adapters/cordis/adapter.d.ts +1 -1
  59. package/out/adapters/cordis/adapter.js +1 -1
  60. package/out/adapters/libpostal-dictionary.d.ts +9 -0
  61. package/out/adapters/libpostal-dictionary.d.ts.map +1 -1
  62. package/out/adapters/libpostal-dictionary.js +19 -3
  63. package/out/adapters/libpostal-dictionary.js.map +1 -1
  64. package/out/adapters/osm/adapter.d.ts +12 -1
  65. package/out/adapters/osm/adapter.d.ts.map +1 -1
  66. package/out/adapters/osm/adapter.js +30 -13
  67. package/out/adapters/osm/adapter.js.map +1 -1
  68. package/out/adapters.d.ts.map +1 -1
  69. package/out/adapters.js +14 -0
  70. package/out/adapters.js.map +1 -1
  71. package/out/az/adapters/opendata/adapter.d.ts +88 -0
  72. package/out/az/adapters/opendata/adapter.d.ts.map +1 -0
  73. package/out/az/adapters/opendata/adapter.js +282 -0
  74. package/out/az/adapters/opendata/adapter.js.map +1 -0
  75. package/out/bs/adapters/gbpa/adapter.d.ts +64 -0
  76. package/out/bs/adapters/gbpa/adapter.d.ts.map +1 -0
  77. package/out/bs/adapters/gbpa/adapter.js +187 -0
  78. package/out/bs/adapters/gbpa/adapter.js.map +1 -0
  79. package/out/build/types.d.ts +15 -0
  80. package/out/build/types.d.ts.map +1 -1
  81. package/out/build/types.js.map +1 -1
  82. package/out/build.d.ts.map +1 -1
  83. package/out/build.js +17 -0
  84. package/out/build.js.map +1 -1
  85. package/out/ee/adapters/ads/adapter.d.ts +6 -0
  86. package/out/ee/adapters/ads/adapter.d.ts.map +1 -1
  87. package/out/ee/adapters/ads/adapter.js +16 -0
  88. package/out/ee/adapters/ads/adapter.js.map +1 -1
  89. package/out/fo/adapters/adressur/adapter.d.ts +63 -0
  90. package/out/fo/adapters/adressur/adapter.d.ts.map +1 -0
  91. package/out/fo/adapters/adressur/adapter.js +177 -0
  92. package/out/fo/adapters/adressur/adapter.js.map +1 -0
  93. package/out/gb/adapters/os-open/adapter.d.ts +10 -2
  94. package/out/gb/adapters/os-open/adapter.d.ts.map +1 -1
  95. package/out/gb/adapters/os-open/adapter.js +13 -2
  96. package/out/gb/adapters/os-open/adapter.js.map +1 -1
  97. package/out/gb/county.d.ts +30 -0
  98. package/out/gb/county.d.ts.map +1 -0
  99. package/out/gb/county.js +51 -0
  100. package/out/gb/county.js.map +1 -0
  101. package/out/gb/os-open/{open-names.d.ts → open/names.d.ts} +18 -1
  102. package/out/gb/os-open/open/names.d.ts.map +1 -0
  103. package/out/gb/os-open/{open-names.js → open/names.js} +20 -1
  104. package/out/gb/os-open/open/names.js.map +1 -0
  105. package/out/gb/os-open/{open-roads.d.ts → open/roads.d.ts} +1 -1
  106. package/out/gb/os-open/open/roads.d.ts.map +1 -0
  107. package/out/gb/os-open/{open-roads.js → open/roads.js} +1 -1
  108. package/out/gb/os-open/open/roads.js.map +1 -0
  109. package/out/gu/adapters/bsp/adapter.d.ts +83 -0
  110. package/out/gu/adapters/bsp/adapter.d.ts.map +1 -0
  111. package/out/gu/adapters/bsp/adapter.js +346 -0
  112. package/out/gu/adapters/bsp/adapter.js.map +1 -0
  113. package/out/im/adapters/land-registry/adapter.d.ts +68 -0
  114. package/out/im/adapters/land-registry/adapter.d.ts.map +1 -0
  115. package/out/im/adapters/land-registry/adapter.js +261 -0
  116. package/out/im/adapters/land-registry/adapter.js.map +1 -0
  117. package/out/international/recipes/locale.d.ts +24 -4
  118. package/out/international/recipes/locale.d.ts.map +1 -1
  119. package/out/international/recipes/locale.js +107 -15
  120. package/out/international/recipes/locale.js.map +1 -1
  121. package/out/li/adapters/llv/adapter.d.ts +69 -0
  122. package/out/li/adapters/llv/adapter.d.ts.map +1 -0
  123. package/out/li/adapters/llv/adapter.js +181 -0
  124. package/out/li/adapters/llv/adapter.js.map +1 -0
  125. package/out/recipes/bare/postcode.d.ts.map +1 -1
  126. package/out/recipes/bare/postcode.js +9 -30
  127. package/out/recipes/bare/postcode.js.map +1 -1
  128. package/out/recipes/country-balanced.d.ts.map +1 -1
  129. package/out/recipes/country-balanced.js +82 -73
  130. package/out/recipes/country-balanced.js.map +1 -1
  131. package/out/recipes/intersection.d.ts +3 -2
  132. package/out/recipes/intersection.d.ts.map +1 -1
  133. package/out/recipes/intersection.js +20 -26
  134. package/out/recipes/intersection.js.map +1 -1
  135. package/out/recipes/po/box/cedex/recipe.d.ts.map +1 -1
  136. package/out/recipes/po/box/cedex/recipe.js +5 -4
  137. package/out/recipes/po/box/cedex/recipe.js.map +1 -1
  138. package/out/recipes/po/box/cedex/sources.d.ts +2 -45
  139. package/out/recipes/po/box/cedex/sources.d.ts.map +1 -1
  140. package/out/recipes/po/box/cedex/sources.js +0 -20
  141. package/out/recipes/po/box/cedex/sources.js.map +1 -1
  142. package/out/recipes/scaffold.d.ts +15 -2
  143. package/out/recipes/scaffold.d.ts.map +1 -1
  144. package/out/recipes/scaffold.js +21 -1
  145. package/out/recipes/scaffold.js.map +1 -1
  146. package/out/recipes/sources.d.ts.map +1 -1
  147. package/out/recipes/sources.js +112 -1
  148. package/out/recipes/sources.js.map +1 -1
  149. package/out/recipes/street/affix.d.ts.map +1 -1
  150. package/out/recipes/street/affix.js +8 -20
  151. package/out/recipes/street/affix.js.map +1 -1
  152. package/out/recipes/sub/venue/context.d.ts +14 -3
  153. package/out/recipes/sub/venue/context.d.ts.map +1 -1
  154. package/out/recipes/sub/venue/context.js +29 -9
  155. package/out/recipes/sub/venue/context.js.map +1 -1
  156. package/out/recipes/sub/venue/sources.d.ts +41 -8
  157. package/out/recipes/sub/venue/sources.d.ts.map +1 -1
  158. package/out/recipes/sub/venue/sources.js +26 -7
  159. package/out/recipes/sub/venue/sources.js.map +1 -1
  160. package/out/recipes/sub/venue.d.ts.map +1 -1
  161. package/out/recipes/sub/venue.js +35 -14
  162. package/out/recipes/sub/venue.js.map +1 -1
  163. package/out/recipes/unit.d.ts +4 -0
  164. package/out/recipes/unit.d.ts.map +1 -1
  165. package/out/recipes/unit.js +7 -6
  166. package/out/recipes/unit.js.map +1 -1
  167. package/out/registers.d.ts +33 -0
  168. package/out/registers.d.ts.map +1 -1
  169. package/out/registers.js +33 -0
  170. package/out/registers.js.map +1 -1
  171. package/out/source-register/corpus-inputs.d.ts +240 -0
  172. package/out/source-register/corpus-inputs.d.ts.map +1 -0
  173. package/out/source-register/corpus-inputs.js +275 -0
  174. package/out/source-register/corpus-inputs.js.map +1 -0
  175. package/out/source-register/effective-manifest.d.ts +2 -0
  176. package/out/source-register/effective-manifest.d.ts.map +1 -1
  177. package/out/source-register/effective-manifest.js +33 -4
  178. package/out/source-register/effective-manifest.js.map +1 -1
  179. package/out/source-register/types.d.ts +21 -1
  180. package/out/source-register/types.d.ts.map +1 -1
  181. package/out/source-register/types.js +20 -0
  182. package/out/source-register/types.js.map +1 -1
  183. package/out/south-asia/recipes/register.js +1 -1
  184. package/out/south-asia/recipes/register.js.map +1 -1
  185. package/out/tools/overlay/manifest.d.ts +7 -0
  186. package/out/tools/overlay/manifest.d.ts.map +1 -1
  187. package/out/tools/overlay/manifest.js +72 -1
  188. package/out/tools/overlay/manifest.js.map +1 -1
  189. package/out/tools/source-register/build.d.ts +9 -0
  190. package/out/tools/source-register/build.d.ts.map +1 -1
  191. package/out/tools/source-register/build.js +25 -3
  192. package/out/tools/source-register/build.js.map +1 -1
  193. package/out/tools/variety-sample.d.ts +196 -0
  194. package/out/tools/variety-sample.d.ts.map +1 -0
  195. package/out/tools/variety-sample.js +417 -0
  196. package/out/tools/variety-sample.js.map +1 -0
  197. package/out/us/adapters/usgov/nad/adapter.d.ts +80 -0
  198. package/out/us/adapters/usgov/nad/adapter.d.ts.map +1 -1
  199. package/out/us/adapters/usgov/nad/adapter.js +27 -8
  200. package/out/us/adapters/usgov/nad/adapter.js.map +1 -1
  201. package/out/us/recipes/skeleton-sources.d.ts +92 -0
  202. package/out/us/recipes/skeleton-sources.d.ts.map +1 -0
  203. package/out/us/recipes/skeleton-sources.js +121 -0
  204. package/out/us/recipes/skeleton-sources.js.map +1 -0
  205. package/out/us/tools/nad-skeletons.d.ts +120 -0
  206. package/out/us/tools/nad-skeletons.d.ts.map +1 -0
  207. package/out/us/tools/nad-skeletons.js +262 -0
  208. package/out/us/tools/nad-skeletons.js.map +1 -0
  209. package/out/uy/adapters/ide/adapter.d.ts +64 -0
  210. package/out/uy/adapters/ide/adapter.d.ts.map +1 -0
  211. package/out/uy/adapters/ide/adapter.js +206 -0
  212. package/out/uy/adapters/ide/adapter.js.map +1 -0
  213. package/out/ve/recipes/reviewed-postcode-tail.d.ts +6 -2
  214. package/out/ve/recipes/reviewed-postcode-tail.d.ts.map +1 -1
  215. package/out/ve/recipes/reviewed-postcode-tail.js +16 -5
  216. package/out/ve/recipes/reviewed-postcode-tail.js.map +1 -1
  217. package/package.json +14 -14
  218. package/lib/recipes/unit/sources.ts +0 -44
  219. package/lib/tools/fetch/ppd.ts +0 -121
  220. package/out/gb/os-open/open-names.d.ts.map +0 -1
  221. package/out/gb/os-open/open-names.js.map +0 -1
  222. package/out/gb/os-open/open-roads.d.ts.map +0 -1
  223. package/out/gb/os-open/open-roads.js.map +0 -1
  224. package/out/recipes/unit/sources.d.ts +0 -28
  225. package/out/recipes/unit/sources.d.ts.map +0 -1
  226. package/out/recipes/unit/sources.js +0 -30
  227. package/out/recipes/unit/sources.js.map +0 -1
  228. package/out/tools/fetch/ppd.d.ts +0 -15
  229. package/out/tools/fetch/ppd.d.ts.map +0 -1
  230. package/out/tools/fetch/ppd.js +0 -86
  231. package/out/tools/fetch/ppd.js.map +0 -1
  232. /package/lib/gb/os-open/{open-roads.ts → open/roads.ts} +0 -0
@@ -25,6 +25,7 @@ import {
25
25
  type IdentifierModel,
26
26
  type LegPools,
27
27
  mergeNamePools,
28
+ NameSource,
28
29
  type PoolQuery,
29
30
  type PromotedSurface,
30
31
  promotedSurfacesFor,
@@ -404,7 +405,7 @@ export interface SubVenueLegStats {
404
405
 
405
406
  const LICENSE =
406
407
  "Synthetic — OpenStreetMap venue + sub-venue names (ODbL, © OpenStreetMap contributors) and Overture Places names " +
407
- "(CDLA-Permissive-2.0) over OpenAddresses / HM Land Registry Price Paid Data address skeletons"
408
+ "(CDLA-Permissive-2.0) over OpenAddresses / BAN / US situs / OS OpenData (OGL-UK-3.0) address skeletons"
408
409
 
409
410
  const CORPUS_VERSION = "0.16.0"
410
411
 
@@ -424,10 +425,23 @@ interface EmitContext {
424
425
  counters: { emitted: number; skipped: number; contaminated: number }
425
426
  }
426
427
 
428
+ /**
429
+ * The distinct sources of a row's pooled names, sorted, or an empty list for a row that carries none.
430
+ */
431
+ function rowNameSources(...sources: Array<NameSource | null>): NameSource[] {
432
+ return [...new Set(sources.filter((source) => source != null))].toSorted()
433
+ }
434
+
427
435
  /**
428
436
  * Renders and aligns one row.
429
437
  * Writes the row and returns whether the write succeeded.
430
438
  *
439
+ * The row's `name_sources` field lists the publications its pooled names were read from.
440
+ * The corpus schema has no such column.
441
+ *
442
+ * `jsonlToParquet` projects a row onto that schema, so the field reaches the
443
+ * recipe output and not a corpus parquet file.
444
+ *
431
445
  * The function drops rows that contain an eval-board surface or fail alignment.
432
446
  */
433
447
  function emitRow(
@@ -437,7 +451,8 @@ function emitRow(
437
451
  groups: Group[],
438
452
  register: Register,
439
453
  synthMethod: string,
440
- disambiguator: Record<string, string>
454
+ disambiguator: Record<string, string>,
455
+ nameSources: NameSource[]
441
456
  ): boolean {
442
457
  const { raw, components } = renderGroups(groups, register)
443
458
 
@@ -464,7 +479,9 @@ function emitRow(
464
479
  return false
465
480
  }
466
481
 
467
- context.write(stringifyJSON({ ...aligned.row, synth_method: synthMethod, synth_base_id: null }))
482
+ context.write(
483
+ stringifyJSON({ ...aligned.row, synth_method: synthMethod, synth_base_id: null, name_sources: nameSources })
484
+ )
468
485
 
469
486
  context.counters.emitted++
470
487
  bump(stats.byRegister, register)
@@ -503,7 +520,7 @@ function emitPositives(
503
520
  }
504
521
 
505
522
  const tuple = sample(pools.context, random)
506
- const venue = sample(pools.venues, random)
523
+ const { name: venue, source: venueSource } = sample(pools.venues, random)
507
524
 
508
525
  // Alignment cannot place two spans when one contains the other, so the loop redraws.
509
526
  const lowVenue = venue.toLowerCase()
@@ -523,11 +540,23 @@ function emitPositives(
523
540
  // Real mail uses both "Terminal 5, Heathrow" and "Heathrow, Terminal 5".
524
541
  const groups = r < SUBVENUE_FIRST_CUTOFF ? [subGroup, venueGroup, ...body] : [venueGroup, subGroup, ...body]
525
542
 
526
- const ok = emitRow(context, leg, stats, groups, register, `sub-venue:${form.form}`, {
527
- leg: leg.locale,
528
- form: form.form,
529
- v: String(produced),
530
- })
543
+ // An attested sub-venue string is an OpenStreetMap name, as `LegPools.attested` states.
544
+ const nameSources = rowNameSources(venueSource, form.form === "attested" ? NameSource.OpenStreetMap : null)
545
+
546
+ const ok = emitRow(
547
+ context,
548
+ leg,
549
+ stats,
550
+ groups,
551
+ register,
552
+ `sub-venue:${form.form}`,
553
+ {
554
+ leg: leg.locale,
555
+ form: form.form,
556
+ v: String(produced),
557
+ },
558
+ nameSources
559
+ )
531
560
 
532
561
  if (!ok) continue
533
562
 
@@ -563,6 +592,8 @@ function emitNegatives(
563
592
  const negativeClass = sample(available, random)
564
593
  const register = sampleRegister(random)
565
594
  let groups: Group[]
595
+ // A street negative carries no pooled name.
596
+ let nameSource: NameSource | null = null
566
597
 
567
598
  if (negativeClass === NegativeClass.DesignatorStreet) {
568
599
  groups = addressGroups(leg.country, pickTuple(streets.designator, random), true)
@@ -571,14 +602,19 @@ function emitNegatives(
571
602
  } else if (negativeClass === NegativeClass.GateSuffixStreet) {
572
603
  groups = addressGroups(leg.country, pickTuple(streets.gateSuffix, random), true)
573
604
  } else {
574
- const pool =
575
- negativeClass === NegativeClass.RejectedVenue
576
- ? pools.rejectedVenues
577
- : negativeClass === NegativeClass.LongerName
578
- ? pools.longerNames
579
- : pools.unpromotedShapes
580
-
581
- const name = sample(pool, random)
605
+ let name: string
606
+
607
+ if (negativeClass === NegativeClass.UnpromotedShape) {
608
+ name = sample(pools.unpromotedShapes, random)
609
+ nameSource = NameSource.OpenStreetMap
610
+ } else {
611
+ const pool = negativeClass === NegativeClass.RejectedVenue ? pools.rejectedVenues : pools.longerNames
612
+ const drawn = sample(pool, random)
613
+
614
+ name = drawn.name
615
+ nameSource = drawn.source
616
+ }
617
+
582
618
  const tuple = sample(pools.context, random)
583
619
 
584
620
  groups = [
@@ -591,11 +627,20 @@ function emitNegatives(
591
627
  // This happens when no layout covers the country.
592
628
  if (!groups.length || groups.every((group) => group.every((piece) => piece.tag === "venue"))) continue
593
629
 
594
- const ok = emitRow(context, leg, stats, groups, register, `sub-venue-negative:${negativeClass}`, {
595
- leg: leg.locale,
596
- negative: negativeClass,
597
- v: String(produced),
598
- })
630
+ const ok = emitRow(
631
+ context,
632
+ leg,
633
+ stats,
634
+ groups,
635
+ register,
636
+ `sub-venue-negative:${negativeClass}`,
637
+ {
638
+ leg: leg.locale,
639
+ negative: negativeClass,
640
+ v: String(produced),
641
+ },
642
+ rowNameSources(nameSource)
643
+ )
599
644
 
600
645
  if (!ok) continue
601
646
 
@@ -721,7 +766,7 @@ export const subVenueRecipe: CorpusRecipe = {
721
766
  const negativeFraction = opts.negativeFraction ?? DEFAULT_NEGATIVE_FRACTION
722
767
  const extractsDir = opts.extractsDir ?? dataRootPath("sub-venue", "extracts")
723
768
  const venueNames = opts.venueNames ?? DEFAULT_VENUE_NAMES
724
- const tuplesPath = opts.subVenueTuples ?? dataRootPath("corpus", "intermediate", "house-venue-tuples-v3.jsonl")
769
+ const tuplesPath = opts.subVenueTuples ?? dataRootPath("corpus", "intermediate", "house-venue-tuples-v6.jsonl")
725
770
  const lexicon: SubVenueLexiconTable = await readSubVenueLexicon(opts.lexicon ?? defaultLexiconPath())
726
771
 
727
772
  const context: EmitContext = {
@@ -20,9 +20,14 @@ import { mulberry32 as makeMulberry32 } from "@mailwoman/core/utils"
20
20
  import { stableSourceID } from "#adapters/source-id"
21
21
  import { readOATuples, requireRegister, type CorpusRecipe } from "#recipes/scaffold"
22
22
  import { defaultRecipeSource } from "#recipes/sources"
23
- import { EVAL_SOURCE, TRAIN_SOURCES, type UnitSource } from "#recipes/unit/sources"
24
23
  import { SurfaceOrigin } from "#types"
25
24
  import type { CanonicalRow } from "#types"
25
+ import {
26
+ NAD_SKELETON_DIRECTORY,
27
+ US_SKELETON_EVAL_SOURCE,
28
+ US_SKELETON_TRAIN_SOURCES,
29
+ type USSkeletonSource,
30
+ } from "#us/recipes/skeleton-sources"
26
31
  import { alignRow } from "#utils"
27
32
 
28
33
  /**
@@ -75,11 +80,15 @@ export interface UnitTuple {
75
80
  region: string
76
81
  postcode: string
77
82
  oaUnit: string
83
+ /**
84
+ * The register the skeleton came from, stamped on the row in place of the invocation's `--register`.
85
+ */
86
+ register?: string
78
87
  }
79
88
 
80
- async function readTuples(source: UnitSource): Promise<UnitTuple[]> {
89
+ async function readTuples(source: USSkeletonSource): Promise<UnitTuple[]> {
81
90
  return readOATuples(source, {
82
- extra: (fields, row) => ({ ...fields, region: source.region, oaUnit: row.unit ?? "" }),
91
+ extra: (fields, row) => ({ ...fields, region: source.region, oaUnit: row.unit ?? "", register: source.register }),
83
92
  })
84
93
  }
85
94
 
@@ -232,7 +241,7 @@ export const unitRecipe: CorpusRecipe = {
232
241
  const count = opts.count
233
242
  const random = makeMulberry32(opts.seed)
234
243
  const source = opts.sourceName ?? defaultRecipeSource("synth-unit")
235
- const sources = opts.golden ? [EVAL_SOURCE] : TRAIN_SOURCES
244
+ const sources = opts.golden ? [US_SKELETON_EVAL_SOURCE] : US_SKELETON_TRAIN_SOURCES
236
245
 
237
246
  const pool: UnitTuple[] = []
238
247
 
@@ -247,7 +256,10 @@ export const unitRecipe: CorpusRecipe = {
247
256
  }
248
257
 
249
258
  if (!pool.length) {
250
- throw new Error(`No US tuples found — are the cached OA zips present in ${dataRootPath("oa-cache")}?`)
259
+ throw new Error(
260
+ `No US tuples found — are the cached OA zips present in ${dataRootPath("oa-cache")} and the NAD ` +
261
+ `skeletons in ${dataRootPath(NAD_SKELETON_DIRECTORY)}?`
262
+ )
251
263
  }
252
264
 
253
265
  let emitted = 0
@@ -287,7 +299,8 @@ export const unitRecipe: CorpusRecipe = {
287
299
  source,
288
300
  source_id: stableSourceID(source, components),
289
301
  corpus_version: "0.4.0",
290
- license: "OpenAddresses US (non-VT) skeletons + injected USPS Pub-28 C2 unit designators",
302
+ license:
303
+ "OpenAddresses and National Address Database US (non-VT) skeletons + injected USPS Pub-28 C2 unit designators",
291
304
  }
292
305
 
293
306
  const aligned = alignRow(canonical)
@@ -303,7 +316,7 @@ export const unitRecipe: CorpusRecipe = {
303
316
  ...aligned.row,
304
317
  recipe: "unit",
305
318
  base_source_id: null,
306
- register: requireRegister(opts, "unit"),
319
+ register: base.register ?? requireRegister(opts, "unit"),
307
320
  surface: SurfaceOrigin.Composed,
308
321
  })
309
322
  )
package/lib/registers.ts CHANGED
@@ -54,6 +54,39 @@ export const SourceRegister = {
54
54
  * covers Svalbard beside the mainland.
55
55
  */
56
56
  MatrikkelenAdresse: "no-matrikkelen-adresse",
57
+ /**
58
+ * `Direcciones Geográficas del Uruguay`, the national address points the Infraestructura
59
+ * de Datos Espaciales publishes as one CSV per department on catalogodatos.gub.uy.
60
+ */
61
+ UruguayIDEDirecciones: "uy-ide-direcciones",
62
+ /**
63
+ * The `Verzeichnis der Gebäudeadressen`, Liechtenstein's official building-address index,
64
+ * which the Landesverwaltung publishes on service.geo.llv.li under its ABI/OGD license.
65
+ */
66
+ LiechtensteinGebaeudeadressen: "li-llv-gebaeudeadressen",
67
+ /**
68
+ * `Adressur í Føroyum`, the Faroese national address register Umhvørvisstovan serves from gis.us.fo.
69
+ */
70
+ FaroeAdressur: "fo-us-adressur",
71
+ /**
72
+ * The Isle of Man Land Registry's `Land transactions` file, one row per registered sale,
73
+ * published under the Isle of Man Open Government Licence.
74
+ */
75
+ IsleOfManLandTransactions: "im-land-registry-transactions",
76
+ /**
77
+ * The Grand Bahama Port Authority's Freeport address points, published on GitHub under CC BY 4.0.
78
+ */
79
+ GrandBahamaPortAuthorityAddresses: "bs-gbpa-addresses",
80
+ /**
81
+ * `Azərbaycanda obyektlər və məkanlar`, the objects-and-places points the Ministry
82
+ * of Ecology and Natural Resources publishes on opendata.az under CC BY.
83
+ */
84
+ AzerbaijanObjectsAndPlaces: "az-opendata-obyektler",
85
+ /**
86
+ * The Government of Guam GISWEB Portal's `Address_Point_(Public_View)` layer,
87
+ * from the Bureau of Statistics & Plans GIS.
88
+ */
89
+ GuamAddressPoints: "gu-bsp-address-points",
57
90
  /**
58
91
  * The INSPIRE Addresses theme of the Czech Office for Surveying, Mapping and Cadastre.
59
92
  *