@finbheara/domain 0.57.2 → 0.59.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
@@ -40,7 +40,7 @@ import {
40
40
  youngFloor2,
41
41
  tooYoungForMajor2,
42
42
  tooYoungForFeis2
43
- } from "./chunks/place-w6d4xfzc.js";
43
+ } from "./chunks/place-mbtx4htf.js";
44
44
  export {
45
45
  ADULT_FLOOR2 as ADULT_FLOOR,
46
46
  AVERAGE_AGE_DECIMALS2 as AVERAGE_AGE_DECIMALS,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Age2,
3
3
  ageRelation2
4
- } from "./place-w6d4xfzc.js";
4
+ } from "./place-mbtx4htf.js";
5
5
  import {
6
6
  validity
7
7
  } from "./place-q9kwsmzd.js";
@@ -44,6 +44,7 @@ var AND_UNDER_RANGE = /(?<![a-z0-9])(\d{1,2})\s*(?:&|\band\b)\s*under\s*(\d{1,2}
44
44
  var AND_RANGE = /(?<![a-z0-9])(?<!\b(?:under|und|over|faoi|cionn|u|o)\.?\s*)(?<!\d\s*,\s*)(?<!\(\s*)(\d{1,2})\s*(?:&|\band\b)\s*(\d{1,2})(?![a-z0-9])(?!\s*-?\s*hand)(?!\s*(?:&|\+|\/|,|\)|\band\b|\bor\b))/i;
45
45
  var SLASH_RANGE = /(?<![a-z0-9/])(\d{1,2})\s*\/\s*(\d{1,2})(?=\s*(?:years?|yrs?|boys?|girls?|ladies|men)\b)/i;
46
46
  var AGE_N = /(?<!\b(?:under|over)\s*)\bage\s*(\d{1,2})(?![a-z0-9])(?!\s*-?\s*hand)/i;
47
+ var AGE_RANGE = /(?<!\b(?:under|over)\s*)\bage\s*(\d{1,2})\s+(\d{1,2})(?![a-z0-9])(?!\s*-?\s*hand)/i;
47
48
  var YEARS = /(?<![a-z0-9])(?<!\d\s*(?:&|\/|\band\b|[-\u0096–—]|\bto\b)\s*)(\d{1,2})\s*(?:years?|yrs?)(?![a-z0-9])(?!\s*(?:&|\+|\/|\band\b|\bor\b|old))/i;
48
49
  var RANGE_DASH = String.raw`(?:\u00c2?[-\u0096–—]|\bto\b)`;
49
50
  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");
@@ -126,6 +127,9 @@ function readAnchored(title, s, offset, adultWord, aside = false) {
126
127
  const r = RANGE.exec(stripped);
127
128
  if (r?.[1] !== undefined && r[2] !== undefined && inFence(r[1], r[2]))
128
129
  return at(title, offset + shift, r.index, r.index + r[0].length, `${Number(r[1])}-${Number(r[2])}`);
130
+ const ar = AGE_RANGE.exec(s);
131
+ if (ar?.[1] !== undefined && ar[2] !== undefined && inFence(ar[1], ar[2]))
132
+ return at(title, offset, ar.index, ar.index + ar[0].length, `${Number(ar[1])}-${Number(ar[2])}`);
129
133
  const au = AND_UNDER.exec(s);
130
134
  if (au?.[1] !== undefined)
131
135
  return at(title, offset, au.index, au.index + au[0].length, `u${Number(au[1]) + 1}`);
@@ -54,6 +54,10 @@ var DANCER_SENTINELS2 = [
54
54
  {
55
55
  print: "notlisted in entry",
56
56
  authority: "`(notlisted in entry)`: 4 name cells of one transcribed results sheet, its text layer's join of `not listed`, the sheet's note that the entry gave no name. Spaced, names' `not listed` row already refuses it"
57
+ },
58
+ {
59
+ print: "name hidden",
60
+ authority: "`(Name Hidden)`: 1,221 name cells of 8 registrant lists, the entry platform's print for a competitor who asked not to be published"
57
61
  }
58
62
  ];
59
63
  var TEACHER_SENTINELS2 = [];
package/dist/code.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  Age2
3
- } from "./chunks/place-w6d4xfzc.js";
3
+ } from "./chunks/place-mbtx4htf.js";
4
4
  import {
5
5
  populationIn2,
6
6
  compTitle2
7
- } from "./chunks/place-dn6qk21g.js";
7
+ } from "./chunks/place-00sx835a.js";
8
8
  import {
9
9
  validity
10
10
  } from "./chunks/place-q9kwsmzd.js";
@@ -1,7 +1,7 @@
1
1
  import"./chunks/place-tcgfvemw.js";
2
2
  import {
3
3
  roleName2
4
- } from "./chunks/place-w94m6e4w.js";
4
+ } from "./chunks/place-tajcx2n6.js";
5
5
 
6
6
  import {
7
7
  NAME_COLUMNS,
package/dist/person.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  seatName2,
11
11
  dancerName2,
12
12
  teacherName2
13
- } from "./chunks/place-w94m6e4w.js";
13
+ } from "./chunks/place-tajcx2n6.js";
14
14
  import {
15
15
  SHARED_ROW_SENTINELS2,
16
16
  sentinelIn2
package/dist/schedule.js CHANGED
@@ -1,8 +1,8 @@
1
- import"./chunks/place-w6d4xfzc.js";
1
+ import"./chunks/place-mbtx4htf.js";
2
2
  import {
3
3
  compTitle2,
4
4
  matchTitle2
5
- } from "./chunks/place-dn6qk21g.js";
5
+ } from "./chunks/place-00sx835a.js";
6
6
 
7
7
  function hallKey(hall) {
8
8
  return hall.normalize("NFKD").replace(/\p{M}/gu, "").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim();
package/dist/school.js CHANGED
@@ -73,6 +73,10 @@ var SCHOOL_CELL_OWN_SENTINELS = [
73
73
  authority: "`Unknown Irish Dancing School`: 1 school cell"
74
74
  },
75
75
  { print: "none inactive dancer", authority: "`None - Inactive Dancer`: 1 school cell" },
76
+ {
77
+ print: "school hidden",
78
+ authority: "`(School Hidden)`: 1,221 school cells of 8 registrant lists, the entry platform's print for a competitor who asked not to be published"
79
+ },
76
80
  { print: "not applicable", authority: "`Not applicable`: a school print, no school entered" },
77
81
  {
78
82
  print: "no school judge",
@@ -995,6 +999,48 @@ var MATCH_KEY_INSTITUTION_WORDS = [
995
999
  ].sort();
996
1000
 
997
1001
  import { normalizeApostrophes } from "@finbheara/names/lexicon";
1002
+
1003
+ var CP1252_HIGH = "€‚ƒ„…†‡ˆ‰Š‹Œ" + "Ž‘’“”•–—˜™š›" + "œžŸ";
1004
+ var BYTE_OF_CP1252 = new Map([...CP1252_HIGH].map((ch, i) => [ch.codePointAt(0), 128 + i]));
1005
+ var MOJIBAKE = /[Â-ßà-ï][€-¿‚-›ŒŠŽ]/u;
1006
+ var MOJIBAKE_ALL = new RegExp(MOJIBAKE.source, "gu");
1007
+ var FLATTENED_NBSP = /(?<=\S)[Â-Å] /u;
1008
+ function isNbspLead(code) {
1009
+ return code >= 194 && code <= 197;
1010
+ }
1011
+ var NON_LATIN_LETTER = /(?!\p{Script=Latin})\p{L}/u;
1012
+ function isRepair(before, after) {
1013
+ if (!NON_LATIN_LETTER.test(after))
1014
+ return true;
1015
+ return (before.match(MOJIBAKE_ALL)?.length ?? 0) >= 2;
1016
+ }
1017
+ function undoMojibake(s) {
1018
+ const bytes = new Uint8Array(s.length);
1019
+ for (let i = 0;i < s.length; i++) {
1020
+ const code = s.charCodeAt(i);
1021
+ const flattened = code === 32 && i > 1 && isNbspLead(s.charCodeAt(i - 1)) && /\S/u.test(s[i - 2]);
1022
+ const byte = flattened ? 160 : BYTE_OF_CP1252.get(code) ?? code;
1023
+ if (byte > 255)
1024
+ return;
1025
+ bytes[i] = byte;
1026
+ }
1027
+ try {
1028
+ return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
1029
+ } catch {
1030
+ return;
1031
+ }
1032
+ }
1033
+ function repairSchoolMojibake(print) {
1034
+ let s = print;
1035
+ for (let round = 0;round < 3 && (MOJIBAKE.test(s) || FLATTENED_NBSP.test(s)); round++) {
1036
+ const undone = undoMojibake(s);
1037
+ if (undone === undefined || undone === s || !isRepair(s, undone))
1038
+ return s;
1039
+ s = undone;
1040
+ }
1041
+ return s;
1042
+ }
1043
+
998
1044
  var SCHOOL_FLUFF_WORDS = new Set([
999
1045
  ...[...SCHOOL_FLUFF_VOCABULARY.values()].filter((entry) => entry.tokenFluff).map((entry) => entry.canonical),
1000
1046
  ...MATCH_KEY_INSTITUTION_WORDS
@@ -1035,7 +1081,7 @@ function distinctiveTokens(tokens) {
1035
1081
  return tokens.filter((t) => t.length > 2 && !SCHOOL_FLUFF_WORDS.has(t));
1036
1082
  }
1037
1083
  function foldSchoolName(raw) {
1038
- let s = raw.toLowerCase();
1084
+ let s = repairSchoolMojibake(raw).toLowerCase();
1039
1085
  s = s.normalize("NFD").replace(/[̀-ͯ]/g, "");
1040
1086
  s = s.replace(/ß/g, "ss").replace(/æ/g, "ae").replace(/œ/g, "oe").replace(/ø/g, "o");
1041
1087
  s = normalizeApostrophes(s);
@@ -1120,41 +1166,6 @@ function createSchoolNameReader(options = {}) {
1120
1166
  ...options.garbage ?? [],
1121
1167
  ...options.refusals ?? NOT_A_SCHOOL
1122
1168
  ]);
1123
- const CP1252_HIGH = "€‚ƒ„…†‡ˆ‰Š‹Œ" + "Ž‘’“”•–—˜™š›" + "œžŸ";
1124
- const BYTE_OF_CP1252 = new Map([...CP1252_HIGH].map((ch, i) => [ch.codePointAt(0), 128 + i]));
1125
- const MOJIBAKE = /[Â-ßà-ï][€-¿‚-›ŒŠŽ]/u;
1126
- const MOJIBAKE_ALL = new RegExp(MOJIBAKE.source, "gu");
1127
- const NON_LATIN_LETTER = /(?!\p{Script=Latin})\p{L}/u;
1128
- function isRepair(before, after) {
1129
- if (!NON_LATIN_LETTER.test(after))
1130
- return true;
1131
- return (before.match(MOJIBAKE_ALL)?.length ?? 0) >= 2;
1132
- }
1133
- function undoMojibake(s) {
1134
- const bytes = new Uint8Array(s.length);
1135
- for (let i = 0;i < s.length; i++) {
1136
- const code = s.charCodeAt(i);
1137
- const byte = BYTE_OF_CP1252.get(code) ?? code;
1138
- if (byte > 255)
1139
- return;
1140
- bytes[i] = byte;
1141
- }
1142
- try {
1143
- return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
1144
- } catch {
1145
- return;
1146
- }
1147
- }
1148
- function repairMojibake(print) {
1149
- let s = print;
1150
- for (let round = 0;round < 3 && MOJIBAKE.test(s); round++) {
1151
- const undone = undoMojibake(s);
1152
- if (undone === undefined || undone === s || !isRepair(s, undone))
1153
- return s;
1154
- s = undone;
1155
- }
1156
- return s;
1157
- }
1158
1169
  const SPACING_ACUTE_AFTER_VOWEL = /((?<=\p{L})[AEIOUaeiou]|[AEIUaeiu])[´ˊ](?![sS]\b)/gu;
1159
1170
  const SPACING_ACUTE = /[´ˊ]/gu;
1160
1171
  function readSpacingAcute(print) {
@@ -1162,7 +1173,7 @@ function createSchoolNameReader(options = {}) {
1162
1173
  }
1163
1174
  const INJECTED_LINK = /(?<=^|[\s([])(?:https?:\/\/|www\.)[^\s)\]]+/giu;
1164
1175
  function renderSn1(print) {
1165
- return normalizeApostrophes2(readSpacingAcute(repairMojibake(print)).normalize("NFKC")).replace(/\p{Cf}+/gu, "").replace(/\p{Cc}+/gu, " ").replace(INJECTED_LINK, " ").replace(/\s+/gu, " ").trim();
1176
+ return normalizeApostrophes2(readSpacingAcute(repairSchoolMojibake(print)).normalize("NFKC")).replace(/\p{Cf}+/gu, "").replace(/\p{Cc}+/gu, " ").replace(INJECTED_LINK, " ").replace(/\s+/gu, " ").trim();
1166
1177
  }
1167
1178
  const COMPOUND_OPENERS = new Set([
1168
1179
  "hyphen",
package/dist/title.js CHANGED
@@ -9,8 +9,8 @@ import {
9
9
  titleRelation2,
10
10
  ladderOf2,
11
11
  matchTitle2
12
- } from "./chunks/place-dn6qk21g.js";
13
- import"./chunks/place-w6d4xfzc.js";
12
+ } from "./chunks/place-00sx835a.js";
13
+ import"./chunks/place-mbtx4htf.js";
14
14
  export {
15
15
  codePopulation2 as codePopulation,
16
16
  compTitle2 as compTitle,
@@ -0,0 +1 @@
1
+ export declare function repairSchoolMojibake(print: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finbheara/domain",
3
- "version": "0.57.2",
3
+ "version": "0.59.0",
4
4
  "description": "Places, CLRG regions and events, school names and the links between schools, ages, dances, competition titles, codes and schedules, and a person's print in its role, as they are printed: read, compared and told apart",
5
5
  "keywords": [
6
6
  "places",