@finbheara/domain 0.37.0 → 0.38.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.
@@ -7404,12 +7404,28 @@ function inWebSpan(at, index) {
7404
7404
  return at.web.some(([start, end]) => index >= start && index < end);
7405
7405
  }
7406
7406
 
7407
+ var GENERIC_WORDS2 = {
7408
+ saint: "st",
7409
+ sainte: "ste",
7410
+ fort: "ft",
7411
+ mount: "mt"
7412
+ };
7413
+ var GENERIC_SHORT = new Set(Object.values(GENERIC_WORDS2));
7414
+ function genericKey2(folded) {
7415
+ const sp = folded.indexOf(" ");
7416
+ if (sp <= 0 || sp === folded.length - 1)
7417
+ return;
7418
+ const head = folded.slice(0, sp);
7419
+ const short = GENERIC_WORDS2[head] ?? (GENERIC_SHORT.has(head) ? head : undefined);
7420
+ return short === undefined ? undefined : `${short}${folded.slice(sp)}`;
7421
+ }
7407
7422
  var DEFAULT_PLACE_CAPACITY2 = 8192;
7408
7423
  var PLACE_CELL_SENTINELS = [...SHARED_ROW_SENTINELS2];
7409
7424
  var placeCellSentinelOf = sentinelIn2(PLACE_CELL_SENTINELS);
7410
7425
  function createPlaceReader2(options = {}) {
7411
7426
  const nodes = options.tree ?? PLACE_NODES;
7412
7427
  const withinTable = options.within ?? PLACE_WITHIN;
7428
+ const generic = options.generic === true;
7413
7429
  let index;
7414
7430
  const given = options.refusals;
7415
7431
  const refusals = given === undefined ? () => {
@@ -7484,7 +7500,14 @@ function createPlaceReader2(options = {}) {
7484
7500
  const listedPhrases = new Set;
7485
7501
  const byHeading = new Map;
7486
7502
  const byRunPrint = new Map;
7503
+ const byGeneric = new Map;
7487
7504
  for (const n of source) {
7505
+ if (generic && n.kind === "city")
7506
+ for (const p of [n.name, ...n.prints]) {
7507
+ const k = genericKey2(fold(p));
7508
+ if (k !== undefined)
7509
+ push(byGeneric, k, n);
7510
+ }
7488
7511
  for (const h of n.headings ?? [])
7489
7512
  push(byHeading, fold(h), n);
7490
7513
  for (const r of n.runPrints ?? [])
@@ -7611,7 +7634,8 @@ function createPlaceReader2(options = {}) {
7611
7634
  phrases,
7612
7635
  listedPhrases,
7613
7636
  byHeading,
7614
- byRunPrint
7637
+ byRunPrint,
7638
+ byGeneric
7615
7639
  };
7616
7640
  }
7617
7641
  function idx() {
@@ -7834,7 +7858,13 @@ function createPlaceReader2(options = {}) {
7834
7858
  if (upper.length > 0)
7835
7859
  return { heads: upper, match: "code", truncated: false, refusal: null };
7836
7860
  }
7861
+ const gk = generic ? genericKey2(folded) : undefined;
7837
7862
  const asPrint = keep(i.byPrint.get(folded));
7863
+ if (gk !== undefined) {
7864
+ for (const n of i.byGeneric.get(gk) ?? [])
7865
+ if (!asPrint.includes(n))
7866
+ asPrint.push(n);
7867
+ }
7838
7868
  if (asPrint.length > 0) {
7839
7869
  const m = folded.includes(" ") ? "phrase" : "print";
7840
7870
  return { heads: asPrint, match: m, truncated: false, refusal: null };
@@ -8865,4 +8895,4 @@ function sameReading2(a, b) {
8865
8895
  return DEFAULT_PLACE_READER2.sameReading(a, b);
8866
8896
  }
8867
8897
 
8868
- export { PLACE_NODES, NEVER_NAME, printZones, opensLocation, DEFAULT_PLACE_CAPACITY2, createPlaceReader2, DEFAULT_PLACE_READER2, place2, isPlaceToken2, countryCodeOf2, areAllPlaceTokens2, placeFromId2, placeWindows2, placeParts2, oireachtasOfRegion2, regionOfOireachtas2, placeStats2, resetPlaceCache2, placeRelation2, placesRelation2, probablySamePlace2, sameReading2 };
8898
+ export { PLACE_NODES, NEVER_NAME, printZones, opensLocation, GENERIC_WORDS2, genericKey2, DEFAULT_PLACE_CAPACITY2, createPlaceReader2, DEFAULT_PLACE_READER2, place2, isPlaceToken2, countryCodeOf2, areAllPlaceTokens2, placeFromId2, placeWindows2, placeParts2, oireachtasOfRegion2, regionOfOireachtas2, placeStats2, resetPlaceCache2, placeRelation2, placesRelation2, probablySamePlace2, sameReading2 };