@finbheara/domain 0.37.0 → 0.39.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.
package/dist/age.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  printsUnderOpen2,
3
+ printsAdultCode2,
3
4
  TITLE_RANGE_MIN2,
4
5
  TITLE_RANGE_MAX2,
5
6
  ageTitleToken2,
7
+ readsSeniorAdult2,
6
8
  adultBeside2,
7
9
  YOUNGEST_FLOOR2,
8
10
  ADULT_FLOOR2,
@@ -37,7 +39,7 @@ import {
37
39
  youngFloor2,
38
40
  tooYoungForMajor2,
39
41
  tooYoungForFeis2
40
- } from "./chunks/place-3w1mr2vh.js";
42
+ } from "./chunks/place-mpeps8tn.js";
41
43
  export {
42
44
  ADULT_FLOOR2 as ADULT_FLOOR,
43
45
  AVERAGE_AGE_DECIMALS2 as AVERAGE_AGE_DECIMALS,
@@ -67,7 +69,9 @@ export {
67
69
  canOverlap2 as canOverlap,
68
70
  intersectBirthYears2 as intersectBirthYears,
69
71
  isAveraged2 as isAveraged,
72
+ printsAdultCode2 as printsAdultCode,
70
73
  printsUnderOpen2 as printsUnderOpen,
74
+ readsSeniorAdult2 as readsSeniorAdult,
71
75
  roundedMeanHundredths2 as roundedMeanHundredths,
72
76
  tooYoungForFeis2 as tooYoungForFeis,
73
77
  tooYoungForMajor2 as tooYoungForMajor,
@@ -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 };
@@ -26,6 +26,7 @@ var RANGE_DASH = String.raw`(?:\u00c2?[-\u0096–—]|\bto\b)`;
26
26
  var RANGE = new RegExp(String.raw`(?<![0-9])(?<![0-9][a-z]*)(?<!(?:^|[^a-z0-9])[a-z])(?:u\s*)?(\d{1,2})\s*${RANGE_DASH}\s*(\d{1,2})(?![a-z0-9])`, "i");
27
27
  var LEAD_RANGE = new RegExp(String.raw`^\s*([1-9]\d?)\s*${RANGE_DASH}\s*([1-9]\d?)(?![a-z0-9])(?!\s*[/&])`, "i");
28
28
  var ADULT_CODE = /^\s*a(?:(\d{1,2})(u|o|&o))?\s*$/i;
29
+ var printsAdultCode2 = (phrase) => ADULT_CODE.test(phrase);
29
30
  var ADULT = /(?<!non[\s-])(?<!-)\b(?:adults?|advanced\s+adults?|masters?)\b/i;
30
31
  var SENIOR = /(?<!-)\bseniors?\b/i;
31
32
  var TITLE_RANGE_MIN2 = 3;
@@ -151,6 +152,10 @@ function ageTitleToken2(title) {
151
152
  }
152
153
  var ADULT_UNDER_MIN = 18;
153
154
  var SENIOR_ADULT_OVER = /\bsenior\s+adult\b/i;
155
+ var SENIOR_ADULT_ENDS = new RegExp(`${SENIOR_ADULT_OVER.source}$`, "i");
156
+ function readsSeniorAdult2(title, span) {
157
+ return SENIOR_ADULT_ENDS.test(title.slice(0, span.end));
158
+ }
154
159
  function adultBeside2(band) {
155
160
  const b = band.trim().toLowerCase();
156
161
  if (b === "")
@@ -662,4 +667,4 @@ function youngFloor2(year, oldest) {
662
667
  var tooYoungForMajor2 = (year, oldest) => yearsSinceBirth2(year, oldest) < MIN_MAJOR_AGE2;
663
668
  var tooYoungForFeis2 = (year, oldest) => yearsSinceBirth2(year, oldest) < MIN_FEIS_AGE2;
664
669
 
665
- export { printsUnderOpen2, TITLE_RANGE_MIN2, TITLE_RANGE_MAX2, ageTitleToken2, adultBeside2, YOUNGEST_FLOOR2, ADULT_FLOOR2, MAJORS_FLOOR_YEARS2, UNDER_CAP2, UNDER_CAP_MAX_TOP2, YOUNG_FLOOR2, MIN_MAJOR_AGE2, MIN_FEIS_AGE2, YOUNGEST_BAND_TOP2, OLDEST_BAND_FLOOR2, YOB_RANGE2, DANCE_UP_YEARS2, ageOnJanuary12, yearsSinceBirth2, AgeMisuseError2, Age2, birthYearsOfInterval2, ageRelation2, canOverlap2, AVERAGE_AGE_DECIMALS2, roundedMeanHundredths2, isAveraged2, averageAge2, birthYearsDisjoint2, intersectBirthYears2, birthYearsMeet2, underCapApplies2, underCappedYears2, underCapRefuses2, validYOB2, youngFloor2, tooYoungForMajor2, tooYoungForFeis2 };
670
+ export { printsUnderOpen2, printsAdultCode2, TITLE_RANGE_MIN2, TITLE_RANGE_MAX2, ageTitleToken2, readsSeniorAdult2, adultBeside2, YOUNGEST_FLOOR2, ADULT_FLOOR2, MAJORS_FLOOR_YEARS2, UNDER_CAP2, UNDER_CAP_MAX_TOP2, YOUNG_FLOOR2, MIN_MAJOR_AGE2, MIN_FEIS_AGE2, YOUNGEST_BAND_TOP2, OLDEST_BAND_FLOOR2, YOB_RANGE2, DANCE_UP_YEARS2, ageOnJanuary12, yearsSinceBirth2, AgeMisuseError2, Age2, birthYearsOfInterval2, ageRelation2, canOverlap2, AVERAGE_AGE_DECIMALS2, roundedMeanHundredths2, isAveraged2, averageAge2, birthYearsDisjoint2, intersectBirthYears2, birthYearsMeet2, underCapApplies2, underCappedYears2, underCapRefuses2, validYOB2, youngFloor2, tooYoungForMajor2, tooYoungForFeis2 };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Age2,
3
3
  ageRelation2
4
- } from "./place-3w1mr2vh.js";
4
+ } from "./place-mpeps8tn.js";
5
5
  import {
6
6
  validity
7
7
  } from "./place-q9kwsmzd.js";