@finbheara/domain 0.60.0 → 0.62.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/school.js CHANGED
@@ -1,1118 +1,51 @@
1
1
  import {
2
- SHARED_ROW_SENTINELS2,
3
- sentinelIn2
2
+ SHARED_ROW_SENTINELS2
4
3
  } from "./chunks/place-tcgfvemw.js";
5
4
  import {
6
5
  NEVER_NAME,
7
- printZones,
8
- opensLocation,
6
+ printZones2,
7
+ opensLocation2,
9
8
  place2,
10
9
  isPlaceToken2,
11
10
  countryCodeOf2,
12
11
  areAllPlaceTokens2,
13
12
  placeRelation2,
14
13
  sameReading2
15
- } from "./chunks/place-yvcn0ngm.js";
14
+ } from "./chunks/place-c5g25pym.js";
15
+ import {
16
+ SCHOOL_CELL_OWN_SENTINELS2,
17
+ SCHOOL_CELL_SENTINELS2,
18
+ schoolCellSentinelOf2,
19
+ SCHOOL_NAME_EXCEPTIONS2,
20
+ NOT_A_SCHOOL2,
21
+ notASchoolIn2,
22
+ exceptionsByLength,
23
+ SCHOOL_FLUFF_VOCABULARY,
24
+ schoolFluff,
25
+ isFluffWord2,
26
+ trailingFluffRun2,
27
+ joinedPrefix2,
28
+ SCHOOL_INSTITUTION_VOCABULARY,
29
+ schoolInstitution,
30
+ isInstitutionWord2,
31
+ namesInstitution2,
32
+ institutionLabel,
33
+ INSTITUTION_PHRASES2,
34
+ GLUED_INSTITUTION_SUFFIXES2,
35
+ truncatedInstitution2,
36
+ repairSchoolMojibake,
37
+ hasSpecificToken2,
38
+ isFluffOrFragment2,
39
+ foldSchoolName2,
40
+ schoolKeyTokens2
41
+ } from "./chunks/place-1mpcshk8.js";
16
42
  import {
17
43
  validity
18
44
  } from "./chunks/place-q9kwsmzd.js";
19
45
 
20
- import { normalizeApostrophes as normalizeApostrophes2 } from "@finbheara/names/lexicon";
46
+ import { normalizeApostrophes } from "@finbheara/names/lexicon";
21
47
  import { SURNAME_SEPARATOR, lexiconKey, titleCaseNamePart } from "@finbheara/names/normalize";
22
48
  import { personName } from "@finbheara/names/normalize";
23
-
24
- var SCHOOL_CELL_OWN_SENTINELS = [
25
- {
26
- print: "no school",
27
- authority: "`No School`: 76 school cells, the dancer entered with no school"
28
- },
29
- {
30
- print: "independent",
31
- authority: "`Independent`, `independent`, `Independent?`: 5 school cells, no school by the dancer's own description"
32
- },
33
- {
34
- print: "independent dancer",
35
- authority: "`Independent Dancer`, `Independent dancer`, `Independent Dancer?`: 8 school cells"
36
- },
37
- {
38
- print: "non dancing",
39
- authority: "`Non-dancing`: 107 school cells, an entry form's option for a non-dancer"
40
- },
41
- {
42
- print: "school not selected",
43
- match: "prefix",
44
- authority: "`SCHOOL NOT SELECTED - update your ... profile`: 45 school cells, an entry form's instruction"
45
- },
46
- {
47
- print: "choose one",
48
- authority: "`-- Choose One --`: 41 school cells, an entry form's unchosen option"
49
- },
50
- {
51
- print: "no school selected",
52
- match: "prefix",
53
- authority: "`NO SCHOOL SELECTED - Please change your profile`: 16 school cells, an entry form's instruction"
54
- },
55
- {
56
- print: "no school associations",
57
- authority: "`No School Associations`: 13 school cells"
58
- },
59
- { print: "no lessons yet", authority: "`No lessons yet`: 5 school cells" },
60
- { print: "non dancer", authority: "`Non-dancer`: 4 school cells" },
61
- { print: "non dance competitions", authority: "`Non-Dance Competitions`: 3 school cells" },
62
- {
63
- print: "not listed",
64
- match: "prefix",
65
- authority: "`--Not Listed--`: 2 school cells, an entry form's option"
66
- },
67
- { print: "other", authority: "`Other`: 2 school cells, an entry form's option" },
68
- { print: "not certified", authority: "`Not Certified`: 1 school cell" },
69
- { print: "n e e d", authority: "`(n e e d ) ____`: 1 school cell, keyboard filler" },
70
- { print: "none", authority: "`None`: 1 school cell" },
71
- {
72
- print: "unknown irish dancing school",
73
- authority: "`Unknown Irish Dancing School`: 1 school cell"
74
- },
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
- },
80
- { print: "not applicable", authority: "`Not applicable`: a school print, no school entered" },
81
- {
82
- print: "no school judge",
83
- authority: "`No School - Judge`: an entry form's option for an adjudicator"
84
- },
85
- { print: "no dance school", authority: "`No Dance School`: an entry form's option" },
86
- { print: "unknown music school", authority: "`Unknown Music School`: an entry form's option" },
87
- { print: "school deleted", authority: "`---SCHOOL DELETED`: an entry form's option" },
88
- { print: "select school", authority: "`--Select School--`: an entry form's unchosen option" },
89
- { print: "school other", authority: "`School Other`: an entry form's option" },
90
- { print: "non", authority: "`Non`: an entry form's option, the truncation of `Non-dancer`" },
91
- {
92
- print: "x closed select new school",
93
- authority: "`X - CLOSED - Select New School`: an entry form's option for a closed school"
94
- },
95
- {
96
- print: "x school closed please select another school",
97
- authority: "`X -SCHOOL CLOSED - Please select another school`: an entry form's option"
98
- },
99
- { print: "default school", authority: "`Default School`: an entry form's default" },
100
- {
101
- print: "my school of irish dance",
102
- authority: "`My School of Irish Dance`: an entry form's example text"
103
- }
104
- ];
105
- var SCHOOL_CELL_SENTINELS = [
106
- ...SHARED_ROW_SENTINELS2,
107
- ...SCHOOL_CELL_OWN_SENTINELS
108
- ];
109
- var schoolCellSentinelOf = sentinelIn2(SCHOOL_CELL_SENTINELS);
110
-
111
- var SCHOOL_NAME_EXCEPTIONS = [
112
- {
113
- phrase: "the academy",
114
- scope: "label",
115
- as: "NAME_PART",
116
- token: "theacademy"
117
- },
118
- {
119
- phrase: "the academy irish dance co",
120
- scope: "label",
121
- as: "NAME_PART",
122
- token: "theacademy"
123
- },
124
- {
125
- phrase: "rhythm of ireland",
126
- scope: "phrase",
127
- as: "NAME_PART",
128
- token: "rhythmofireland"
129
- },
130
- {
131
- phrase: "irish dance center",
132
- scope: "label",
133
- as: "NAME_PART",
134
- token: "irishdancecenter"
135
- },
136
- {
137
- phrase: "the irish dance center",
138
- scope: "label",
139
- as: "NAME_PART",
140
- token: "irishdancecenter"
141
- },
142
- {
143
- phrase: "the irish dance academy",
144
- scope: "label",
145
- as: "NAME_PART",
146
- token: "theirishdanceacademy"
147
- },
148
- {
149
- phrase: "irish dance academy",
150
- scope: "label",
151
- as: "NAME_PART",
152
- token: "theirishdanceacademy"
153
- },
154
- {
155
- phrase: "the irish dance company",
156
- scope: "label",
157
- as: "NAME_PART",
158
- token: "theirishdancecompany"
159
- },
160
- {
161
- phrase: "gra na rince",
162
- scope: "phrase",
163
- as: "NAME_PART",
164
- token: "granarince"
165
- },
166
- {
167
- phrase: "clann na cara",
168
- scope: "phrase",
169
- as: "NAME_PART",
170
- token: "clannnacara"
171
- },
172
- {
173
- phrase: "rince academy",
174
- scope: "label",
175
- as: "NAME_PART",
176
- token: "rinceacademy"
177
- },
178
- {
179
- phrase: "i d a s",
180
- scope: "label",
181
- as: "NAME_PART",
182
- token: "idas"
183
- },
184
- {
185
- phrase: "ml dance academy",
186
- scope: "phrase",
187
- as: "NAME_PART",
188
- token: "mldanceacademy"
189
- },
190
- {
191
- phrase: "cm dance",
192
- scope: "label",
193
- as: "NAME_PART",
194
- token: "cmdance"
195
- },
196
- {
197
- phrase: "traditional irish dance academy",
198
- scope: "label",
199
- as: "NAME_PART",
200
- token: "traditionalirishdanceacademy"
201
- },
202
- {
203
- phrase: "irish dance centre",
204
- scope: "label",
205
- as: "NAME_PART",
206
- token: "irishdancecenter"
207
- },
208
- {
209
- phrase: "tj academy",
210
- scope: "phrase",
211
- as: "NAME_PART",
212
- token: "tjacademy"
213
- },
214
- {
215
- phrase: "m d l academy",
216
- scope: "label",
217
- as: "NAME_PART",
218
- token: "mdlacademy"
219
- },
220
- {
221
- phrase: "wa academy",
222
- scope: "phrase",
223
- as: "NAME_PART",
224
- token: "waacademy"
225
- },
226
- {
227
- phrase: "fd academy",
228
- scope: "phrase",
229
- as: "NAME_PART",
230
- token: "fdacademy"
231
- },
232
- {
233
- phrase: "em academy",
234
- scope: "label",
235
- as: "NAME_PART",
236
- token: "emacademy"
237
- },
238
- {
239
- phrase: "aoibhneas an rince",
240
- scope: "phrase",
241
- as: "NAME_PART",
242
- token: "aoibhneasanrince"
243
- },
244
- {
245
- phrase: "an rince mor",
246
- scope: "phrase",
247
- as: "NAME_PART",
248
- token: "anrincemor"
249
- },
250
- {
251
- phrase: "clan rince",
252
- scope: "phrase",
253
- as: "NAME_PART",
254
- token: "clanrince"
255
- },
256
- {
257
- phrase: "acadamh rince",
258
- scope: "phrase",
259
- as: "NAME_PART",
260
- token: "acadamhrince"
261
- },
262
- {
263
- phrase: "spreagadh na rince",
264
- scope: "phrase",
265
- as: "NAME_PART",
266
- token: "spreagadhnarince"
267
- },
268
- {
269
- phrase: "clann na rince",
270
- scope: "label",
271
- as: "NAME_PART",
272
- token: "clannnarince"
273
- },
274
- {
275
- phrase: "mise eire",
276
- scope: "phrase",
277
- as: "NAME_PART",
278
- token: "miseeire"
279
- },
280
- {
281
- phrase: "reel eire",
282
- scope: "phrase",
283
- as: "NAME_PART",
284
- token: "reeleire"
285
- }
286
- ];
287
- var EXCEPTIONS_BY_LENGTH = [
288
- ...SCHOOL_NAME_EXCEPTIONS
289
- ].sort((a, b) => b.phrase.length - a.phrase.length);
290
- var NOT_A_SCHOOL = [
291
- {
292
- pattern: "north west regional council",
293
- kind: "exact",
294
- reason: "organization"
295
- },
296
- {
297
- pattern: "^#\\s*\\d+$",
298
- kind: "regex",
299
- reason: "placeholder"
300
- },
301
- {
302
- pattern: "cce other",
303
- kind: "exact",
304
- reason: "placeholder"
305
- },
306
- {
307
- pattern: "^x{4,}$",
308
- kind: "regex",
309
- reason: "placeholder"
310
- },
311
- {
312
- pattern: "^.+['’]s team$",
313
- kind: "regex",
314
- reason: "not-a-name"
315
- },
316
- {
317
- pattern: "^\\d+(st|nd|rd|th) team up$",
318
- kind: "regex",
319
- reason: "not-a-name"
320
- },
321
- {
322
- pattern: "^[abc] team$",
323
- kind: "regex",
324
- reason: "not-a-name"
325
- },
326
- {
327
- pattern: "^[^\\p{L}]*$",
328
- kind: "regex",
329
- reason: "not-a-name"
330
- }
331
- ];
332
- var INVISIBLE = /[​‌‍ ]/g;
333
- var COMBINING = /[̀-ͯ]/g;
334
- function normalizeForRefusal(print) {
335
- return print.replace(INVISIBLE, " ").normalize("NFD").replace(COMBINING, "").toLowerCase().replace(/\s+/g, " ").trim();
336
- }
337
- var PLACEHOLDER_ROWS = new Map;
338
- function placeholderRow(p) {
339
- let row = PLACEHOLDER_ROWS.get(p);
340
- if (row === undefined)
341
- PLACEHOLDER_ROWS.set(p, row = { pattern: p.print, kind: p.match ?? "exact", reason: "placeholder" });
342
- return row;
343
- }
344
- function notASchoolIn(rows) {
345
- const regexes = new Map(rows.filter((row) => row.kind === "regex").map((row) => [row, new RegExp(row.pattern, "iu")]));
346
- return (print) => {
347
- const text = normalizeForRefusal(print);
348
- if (text === "")
349
- return;
350
- const placeholder = schoolCellSentinelOf(text);
351
- if (placeholder !== undefined)
352
- return placeholderRow(placeholder);
353
- for (const row of rows) {
354
- if (row.kind === "exact" && text === row.pattern)
355
- return row;
356
- if (row.kind === "prefix" && text.startsWith(row.pattern))
357
- return row;
358
- if (row.kind === "regex" && regexes.get(row)?.test(text))
359
- return row;
360
- }
361
- return;
362
- };
363
- }
364
- function exceptionsByLength(rows) {
365
- return [...rows].sort((a, b) => b.phrase.length - a.phrase.length);
366
- }
367
-
368
- var SCHOOL_FLUFF_VOCABULARY = new Map([
369
- [
370
- "irish",
371
- {
372
- canonical: "irish",
373
- kind: "word",
374
- lowerInside: false,
375
- descriptor: true,
376
- truncatable: true,
377
- tokenFluff: true
378
- }
379
- ],
380
- [
381
- "dance",
382
- {
383
- canonical: "dance",
384
- kind: "word",
385
- lowerInside: false,
386
- descriptor: true,
387
- truncatable: true,
388
- tokenFluff: true
389
- }
390
- ],
391
- [
392
- "dancing",
393
- {
394
- canonical: "dancing",
395
- kind: "word",
396
- lowerInside: false,
397
- descriptor: true,
398
- truncatable: true,
399
- tokenFluff: true
400
- }
401
- ],
402
- [
403
- "dancers",
404
- {
405
- canonical: "dancers",
406
- kind: "word",
407
- lowerInside: false,
408
- descriptor: true,
409
- truncatable: true,
410
- tokenFluff: true
411
- }
412
- ],
413
- [
414
- "traditional",
415
- {
416
- canonical: "traditional",
417
- kind: "word",
418
- lowerInside: false,
419
- descriptor: true,
420
- truncatable: true,
421
- tokenFluff: true
422
- }
423
- ],
424
- [
425
- "the",
426
- {
427
- canonical: "the",
428
- kind: "word",
429
- lowerInside: true,
430
- descriptor: true,
431
- truncatable: false,
432
- tokenFluff: true
433
- }
434
- ],
435
- [
436
- "of",
437
- {
438
- canonical: "of",
439
- kind: "word",
440
- lowerInside: true,
441
- descriptor: true,
442
- truncatable: false,
443
- tokenFluff: true
444
- }
445
- ],
446
- [
447
- "and",
448
- {
449
- canonical: "and",
450
- kind: "word",
451
- lowerInside: true,
452
- descriptor: true,
453
- truncatable: false,
454
- tokenFluff: true
455
- }
456
- ],
457
- [
458
- "na",
459
- {
460
- canonical: "na",
461
- kind: "word",
462
- lowerInside: true,
463
- descriptor: false,
464
- truncatable: false,
465
- tokenFluff: true
466
- }
467
- ],
468
- [
469
- "an",
470
- {
471
- canonical: "an",
472
- kind: "word",
473
- lowerInside: true,
474
- descriptor: false,
475
- truncatable: false,
476
- tokenFluff: true
477
- }
478
- ],
479
- [
480
- "a",
481
- {
482
- canonical: "a",
483
- kind: "word",
484
- lowerInside: true,
485
- descriptor: false,
486
- truncatable: false,
487
- tokenFluff: false
488
- }
489
- ],
490
- [
491
- "do",
492
- {
493
- canonical: "do",
494
- kind: "word",
495
- lowerInside: true,
496
- descriptor: false,
497
- truncatable: false,
498
- tokenFluff: false
499
- }
500
- ],
501
- [
502
- "irish dance",
503
- {
504
- canonical: "irish dance",
505
- kind: "phrase",
506
- lowerInside: false,
507
- descriptor: true,
508
- truncatable: true,
509
- tokenFluff: false
510
- }
511
- ],
512
- [
513
- "irish dancing",
514
- {
515
- canonical: "irish dancing",
516
- kind: "phrase",
517
- lowerInside: false,
518
- descriptor: true,
519
- truncatable: true,
520
- tokenFluff: false
521
- }
522
- ],
523
- [
524
- "of irish dance",
525
- {
526
- canonical: "of irish dance",
527
- kind: "phrase",
528
- lowerInside: false,
529
- descriptor: true,
530
- truncatable: true,
531
- tokenFluff: false
532
- }
533
- ],
534
- [
535
- "of irish dancing",
536
- {
537
- canonical: "of irish dancing",
538
- kind: "phrase",
539
- lowerInside: false,
540
- descriptor: true,
541
- truncatable: true,
542
- tokenFluff: false
543
- }
544
- ],
545
- [
546
- "school of irish dance",
547
- {
548
- canonical: "school of irish dance",
549
- kind: "phrase",
550
- lowerInside: false,
551
- descriptor: true,
552
- truncatable: true,
553
- tokenFluff: false
554
- }
555
- ],
556
- [
557
- "school of irish dancing",
558
- {
559
- canonical: "school of irish dancing",
560
- kind: "phrase",
561
- lowerInside: false,
562
- descriptor: true,
563
- truncatable: true,
564
- tokenFluff: false
565
- }
566
- ],
567
- [
568
- "school of dance",
569
- {
570
- canonical: "school of dance",
571
- kind: "phrase",
572
- lowerInside: false,
573
- descriptor: true,
574
- truncatable: true,
575
- tokenFluff: false
576
- }
577
- ],
578
- [
579
- "school of dancing",
580
- {
581
- canonical: "school of dancing",
582
- kind: "phrase",
583
- lowerInside: false,
584
- descriptor: true,
585
- truncatable: true,
586
- tokenFluff: false
587
- }
588
- ],
589
- [
590
- "irish dance school",
591
- {
592
- canonical: "irish dance school",
593
- kind: "phrase",
594
- lowerInside: false,
595
- descriptor: true,
596
- truncatable: true,
597
- tokenFluff: false
598
- }
599
- ],
600
- [
601
- "irish dancing school",
602
- {
603
- canonical: "irish dancing school",
604
- kind: "phrase",
605
- lowerInside: false,
606
- descriptor: true,
607
- truncatable: true,
608
- tokenFluff: false
609
- }
610
- ],
611
- [
612
- "irish dance academy",
613
- {
614
- canonical: "irish dance academy",
615
- kind: "phrase",
616
- lowerInside: false,
617
- descriptor: true,
618
- truncatable: true,
619
- tokenFluff: false
620
- }
621
- ],
622
- [
623
- "dance academy",
624
- {
625
- canonical: "dance academy",
626
- kind: "phrase",
627
- lowerInside: false,
628
- descriptor: true,
629
- truncatable: true,
630
- tokenFluff: false
631
- }
632
- ],
633
- [
634
- "irish step dance",
635
- {
636
- canonical: "irish step dance",
637
- kind: "phrase",
638
- lowerInside: false,
639
- descriptor: true,
640
- truncatable: true,
641
- tokenFluff: false
642
- }
643
- ],
644
- [
645
- "irish step dancing",
646
- {
647
- canonical: "irish step dancing",
648
- kind: "phrase",
649
- lowerInside: false,
650
- descriptor: true,
651
- truncatable: true,
652
- tokenFluff: false
653
- }
654
- ]
655
- ]);
656
- function schoolFluff(text) {
657
- return SCHOOL_FLUFF_VOCABULARY.get(text.toLocaleLowerCase());
658
- }
659
- function isFluffWord(token) {
660
- return schoolFluff(token)?.kind === "word";
661
- }
662
- function isTruncatedFluff(token) {
663
- const t = token.toLocaleLowerCase();
664
- if (t === "")
665
- return false;
666
- for (const entry of SCHOOL_FLUFF_VOCABULARY.values()) {
667
- if (entry.kind !== "word" || !entry.truncatable)
668
- continue;
669
- if (entry.canonical.length > t.length && entry.canonical.startsWith(t))
670
- return true;
671
- }
672
- return false;
673
- }
674
- var FLUFF_PHRASES = [...SCHOOL_FLUFF_VOCABULARY.values()].filter((entry) => entry.kind === "phrase").map((entry) => entry.canonical).sort((a, b) => b.length - a.length || a.localeCompare(b));
675
- function isFluffPhrasePrefix(text) {
676
- const t = text.toLocaleLowerCase();
677
- if (t === "")
678
- return false;
679
- return FLUFF_PHRASES.some((phrase) => phrase.startsWith(t));
680
- }
681
- function trailingFluffRun(tokens, distinctive) {
682
- let start = tokens.length;
683
- for (let i = tokens.length - 1;i >= 0; i -= 1) {
684
- if (!isFluffPhrasePrefix(tokens.slice(i).join(" ")))
685
- continue;
686
- if (!tokens.slice(0, i).some(distinctive))
687
- continue;
688
- start = i;
689
- }
690
- while (start > 0) {
691
- const token = tokens[start - 1] ?? "";
692
- if (!isFluffWord(token) && !isTruncatedFluff(token) && distinctive(token))
693
- break;
694
- if (!tokens.slice(0, start - 1).some(distinctive))
695
- break;
696
- start -= 1;
697
- }
698
- return start;
699
- }
700
-
701
- import { nameParticle } from "@finbheara/names/particles";
702
- var FUSED_PREFIXES = new Set(["O", "Mc", "Mac"]);
703
- function joinedPrefix(printed, next) {
704
- if (!/^\p{L}{2}/u.test(next))
705
- return;
706
- const particle = nameParticle(printed);
707
- if (particle === undefined || !particle.standalone)
708
- return;
709
- if (!FUSED_PREFIXES.has(particle.canonical))
710
- return;
711
- return particle.join === "apostrophe" ? `${particle.canonical}'${next}` : `${particle.canonical}${next}`;
712
- }
713
-
714
- var SCHOOL_INSTITUTION_VOCABULARY = new Map([
715
- [
716
- "academy",
717
- {
718
- canonical: "academy",
719
- label: "Academy",
720
- kind: "word",
721
- position: "suffix",
722
- truncatable: true,
723
- glued: true,
724
- matchKey: true
725
- }
726
- ],
727
- [
728
- "acadamy",
729
- {
730
- canonical: "academy",
731
- label: "Academy",
732
- kind: "word",
733
- position: "suffix",
734
- truncatable: false,
735
- glued: false,
736
- matchKey: false
737
- }
738
- ],
739
- [
740
- "acadamh",
741
- {
742
- canonical: "academy",
743
- label: "Academy",
744
- kind: "word",
745
- position: "suffix",
746
- truncatable: false,
747
- glued: false,
748
- matchKey: false
749
- }
750
- ],
751
- [
752
- "accademia",
753
- {
754
- canonical: "academy",
755
- label: "Academy",
756
- kind: "word",
757
- position: "suffix",
758
- truncatable: false,
759
- glued: false,
760
- matchKey: false
761
- }
762
- ],
763
- [
764
- "school",
765
- {
766
- canonical: "school",
767
- label: "School",
768
- kind: "word",
769
- position: "suffix",
770
- truncatable: true,
771
- glued: true,
772
- matchKey: true
773
- }
774
- ],
775
- [
776
- "schools",
777
- {
778
- canonical: "school",
779
- label: "School",
780
- kind: "word",
781
- position: "suffix",
782
- truncatable: false,
783
- glued: false,
784
- matchKey: false
785
- }
786
- ],
787
- [
788
- "sd",
789
- {
790
- canonical: "school",
791
- label: "School",
792
- kind: "word",
793
- position: "suffix",
794
- truncatable: false,
795
- glued: false,
796
- matchKey: false
797
- }
798
- ],
799
- [
800
- "s d",
801
- {
802
- canonical: "school",
803
- label: "School",
804
- kind: "phrase",
805
- position: "suffix",
806
- truncatable: false,
807
- glued: false,
808
- matchKey: false
809
- }
810
- ],
811
- [
812
- "ecole",
813
- {
814
- canonical: "school",
815
- label: "School",
816
- kind: "word",
817
- position: "prefix",
818
- truncatable: false,
819
- glued: false,
820
- matchKey: false
821
- }
822
- ],
823
- [
824
- "escuela",
825
- {
826
- canonical: "school",
827
- label: "School",
828
- kind: "word",
829
- position: "prefix",
830
- truncatable: false,
831
- glued: false,
832
- matchKey: false
833
- }
834
- ],
835
- [
836
- "scoil",
837
- {
838
- canonical: "scoilrince",
839
- label: "S.R.",
840
- kind: "word",
841
- position: "prefix",
842
- truncatable: false,
843
- glued: false,
844
- matchKey: true
845
- }
846
- ],
847
- [
848
- "scoil rince",
849
- {
850
- canonical: "scoilrince",
851
- label: "S.R.",
852
- kind: "phrase",
853
- position: "prefix",
854
- truncatable: false,
855
- glued: false,
856
- matchKey: true
857
- }
858
- ],
859
- [
860
- "s r",
861
- {
862
- canonical: "scoilrince",
863
- label: "S.R.",
864
- kind: "phrase",
865
- position: "prefix",
866
- truncatable: false,
867
- glued: false,
868
- matchKey: false
869
- }
870
- ],
871
- [
872
- "sr",
873
- {
874
- canonical: "scoilrince",
875
- label: "S.R.",
876
- kind: "word",
877
- position: "prefix",
878
- truncatable: false,
879
- glued: false,
880
- matchKey: false
881
- }
882
- ],
883
- [
884
- "studio",
885
- {
886
- canonical: "studio",
887
- label: "Studio",
888
- kind: "word",
889
- position: "suffix",
890
- truncatable: true,
891
- glued: false,
892
- matchKey: true
893
- }
894
- ],
895
- [
896
- "studios",
897
- {
898
- canonical: "studio",
899
- label: "Studio",
900
- kind: "word",
901
- position: "suffix",
902
- truncatable: false,
903
- glued: false,
904
- matchKey: false
905
- }
906
- ],
907
- [
908
- "company",
909
- {
910
- canonical: "company",
911
- label: "Company",
912
- kind: "word",
913
- position: "suffix",
914
- truncatable: true,
915
- glued: false,
916
- matchKey: true
917
- }
918
- ],
919
- [
920
- "institute",
921
- {
922
- canonical: "institute",
923
- label: "Institute",
924
- kind: "word",
925
- position: "suffix",
926
- truncatable: true,
927
- glued: false,
928
- matchKey: true
929
- }
930
- ],
931
- [
932
- "center",
933
- {
934
- canonical: "center",
935
- label: "Center",
936
- kind: "word",
937
- position: "suffix",
938
- truncatable: true,
939
- glued: false,
940
- matchKey: true
941
- }
942
- ],
943
- [
944
- "centre",
945
- {
946
- canonical: "center",
947
- label: "Center",
948
- kind: "word",
949
- position: "suffix",
950
- truncatable: false,
951
- glued: false,
952
- matchKey: true
953
- }
954
- ],
955
- [
956
- "club",
957
- {
958
- canonical: "club",
959
- label: "Club",
960
- kind: "word",
961
- position: "suffix",
962
- truncatable: false,
963
- glued: false,
964
- matchKey: false
965
- }
966
- ]
967
- ]);
968
- function foldText(text) {
969
- return text.toLocaleLowerCase().normalize("NFD").replace(/\p{M}/gu, "").replace(/[^a-z0-9]+/g, " ").trim();
970
- }
971
- function schoolInstitution(text) {
972
- return SCHOOL_INSTITUTION_VOCABULARY.get(foldText(text));
973
- }
974
- var LABEL_BY_TYPE = new Map([...SCHOOL_INSTITUTION_VOCABULARY.values()].map((v) => [v.canonical, v.label]));
975
- function institutionLabel(type) {
976
- return LABEL_BY_TYPE.get(type);
977
- }
978
- var INSTITUTION_TYPES = [...LABEL_BY_TYPE.keys()].sort();
979
- var INSTITUTION_PHRASES = [...SCHOOL_INSTITUTION_VOCABULARY].filter(([, v]) => v.kind === "phrase").map(([k]) => k).sort();
980
- var GLUED_INSTITUTION_SUFFIXES = [...SCHOOL_INSTITUTION_VOCABULARY].filter(([, v]) => v.glued).map(([k]) => k).sort();
981
- function truncatedInstitution(tail) {
982
- const folded = foldText(tail);
983
- if (folded === "")
984
- return;
985
- let found;
986
- for (const [key, entry] of SCHOOL_INSTITUTION_VOCABULARY) {
987
- if (!entry.truncatable)
988
- continue;
989
- if (key.length <= folded.length || !key.startsWith(folded))
990
- continue;
991
- if (found !== undefined && found.canonical !== entry.canonical)
992
- return;
993
- found ??= entry;
994
- }
995
- return found;
996
- }
997
- var MATCH_KEY_INSTITUTION_WORDS = [
998
- ...new Set([...SCHOOL_INSTITUTION_VOCABULARY].filter(([, v]) => v.matchKey).flatMap(([k]) => k.split(" ")))
999
- ].sort();
1000
-
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
-
1044
- var SCHOOL_FLUFF_WORDS = new Set([
1045
- ...[...SCHOOL_FLUFF_VOCABULARY.values()].filter((entry) => entry.tokenFluff).map((entry) => entry.canonical),
1046
- ...MATCH_KEY_INSTITUTION_WORDS
1047
- ]);
1048
- var SCHOOL_GENERIC_NAME_PARTS = new Set(["celtic", "clann"]);
1049
- function hasSpecificToken(tokens) {
1050
- for (const t of tokens)
1051
- if (!SCHOOL_GENERIC_NAME_PARTS.has(t))
1052
- return true;
1053
- return false;
1054
- }
1055
- var GLUED_FLUFF_SUFFIXES = ["academy", "school"];
1056
- function deglueToken(token) {
1057
- let t = token;
1058
- let changed = true;
1059
- while (changed) {
1060
- changed = false;
1061
- for (const suf of GLUED_FLUFF_SUFFIXES) {
1062
- if (t.length > suf.length + 2 && t.endsWith(suf)) {
1063
- t = t.slice(0, -suf.length);
1064
- changed = true;
1065
- }
1066
- }
1067
- }
1068
- return t;
1069
- }
1070
- function isTruncatedFluff2(token) {
1071
- for (const w of SCHOOL_FLUFF_WORDS) {
1072
- if (w.length > token.length && w.startsWith(token))
1073
- return true;
1074
- }
1075
- return false;
1076
- }
1077
- function isDiscardedAnyway(token) {
1078
- return token.length <= 2 || SCHOOL_FLUFF_WORDS.has(token);
1079
- }
1080
- function distinctiveTokens(tokens) {
1081
- return tokens.filter((t) => t.length > 2 && !SCHOOL_FLUFF_WORDS.has(t));
1082
- }
1083
- function foldSchoolName(raw) {
1084
- let s = repairSchoolMojibake(raw).toLowerCase();
1085
- s = s.normalize("NFD").replace(/[̀-ͯ]/g, "");
1086
- s = s.replace(/ß/g, "ss").replace(/æ/g, "ae").replace(/œ/g, "oe").replace(/ø/g, "o");
1087
- s = normalizeApostrophes(s);
1088
- s = s.replace(/'/g, "");
1089
- const words = [];
1090
- for (const word of s.split(/[^a-z0-9]+/)) {
1091
- if (word === "")
1092
- continue;
1093
- const prev = words[words.length - 1];
1094
- const joined = prev === undefined ? undefined : joinedPrefix(prev, word);
1095
- if (joined === undefined)
1096
- words.push(word);
1097
- else
1098
- words[words.length - 1] = joined.toLowerCase().replace(/'/g, "");
1099
- }
1100
- return words.join(" ");
1101
- }
1102
- function schoolKeyTokens(raw) {
1103
- const folded = foldSchoolName(raw).split(" ").filter((t) => t !== "").map(deglueToken);
1104
- let end = folded.length;
1105
- while (end > 0) {
1106
- const last = folded[end - 1];
1107
- if (!isTruncatedFluff2(last) && !isDiscardedAnyway(last))
1108
- break;
1109
- if (!hasSpecificToken(distinctiveTokens(folded.slice(0, end - 1))))
1110
- break;
1111
- end -= 1;
1112
- }
1113
- return [...new Set(distinctiveTokens(folded.slice(0, end)))];
1114
- }
1115
-
1116
49
  var SCHOOL_REFUSED = "!!!NOTASCHOOL";
1117
50
  var TITLE_CASE_STATE_CODES = new Set(["Nsw", "Qld", "Vic", "Tas"]);
1118
51
  function schoolInitials(name) {
@@ -1161,10 +94,10 @@ var REAL_WORDS = new WeakMap;
1161
94
  var DEFAULT_SCHOOL_NAME_CAPACITY = 16384;
1162
95
  function createSchoolNameReader(options = {}) {
1163
96
  const lexicon = options.lexicon;
1164
- const EXCEPTIONS_BY_LENGTH = exceptionsByLength(options.exceptions ?? SCHOOL_NAME_EXCEPTIONS);
1165
- const notASchool = notASchoolIn([
97
+ const EXCEPTIONS_BY_LENGTH = exceptionsByLength(options.exceptions ?? SCHOOL_NAME_EXCEPTIONS2);
98
+ const notASchool = notASchoolIn2([
1166
99
  ...options.garbage ?? [],
1167
- ...options.refusals ?? NOT_A_SCHOOL
100
+ ...options.refusals ?? NOT_A_SCHOOL2
1168
101
  ]);
1169
102
  const SPACING_ACUTE_AFTER_VOWEL = /((?<=\p{L})[AEIOUaeiou]|[AEIUaeiu])[´ˊ](?![sS]\b)/gu;
1170
103
  const SPACING_ACUTE = /[´ˊ]/gu;
@@ -1173,7 +106,7 @@ function createSchoolNameReader(options = {}) {
1173
106
  }
1174
107
  const INJECTED_LINK = /(?<=^|[\s([])(?:https?:\/\/|www\.)[^\s)\]]+/giu;
1175
108
  function renderSn1(print) {
1176
- return normalizeApostrophes2(readSpacingAcute(repairSchoolMojibake(print)).normalize("NFKC")).replace(/\p{Cf}+/gu, "").replace(/\p{Cc}+/gu, " ").replace(INJECTED_LINK, " ").replace(/\s+/gu, " ").trim();
109
+ return normalizeApostrophes(readSpacingAcute(repairSchoolMojibake(print)).normalize("NFKC")).replace(/\p{Cf}+/gu, "").replace(/\p{Cc}+/gu, " ").replace(INJECTED_LINK, " ").replace(/\s+/gu, " ").trim();
1177
110
  }
1178
111
  const COMPOUND_OPENERS = new Set([
1179
112
  "hyphen",
@@ -1205,7 +138,7 @@ function createSchoolNameReader(options = {}) {
1205
138
  if (text === "")
1206
139
  continue;
1207
140
  const prev = out[out.length - 1];
1208
- const joined = prev === undefined ? undefined : joinedPrefix(prev.printed, text);
141
+ const joined = prev === undefined ? undefined : joinedPrefix2(prev.printed, text);
1209
142
  if (prev !== undefined && joined !== undefined) {
1210
143
  prev.printed = joined;
1211
144
  continue;
@@ -1257,7 +190,7 @@ function createSchoolNameReader(options = {}) {
1257
190
  const token = tokens[i];
1258
191
  if (token === undefined || token.cls !== null)
1259
192
  continue;
1260
- const suffix = GLUED_INSTITUTION_SUFFIXES.find((s) => token.text.length > s.length + 2 && token.text.endsWith(s));
193
+ const suffix = GLUED_INSTITUTION_SUFFIXES2.find((s) => token.text.length > s.length + 2 && token.text.endsWith(s));
1261
194
  if (suffix === undefined)
1262
195
  continue;
1263
196
  const word = token.words[0];
@@ -1282,7 +215,7 @@ function createSchoolNameReader(options = {}) {
1282
215
  }
1283
216
  }
1284
217
  function applyInstitutionPhrases(tokens) {
1285
- for (const phrase of INSTITUTION_PHRASES) {
218
+ for (const phrase of INSTITUTION_PHRASES2) {
1286
219
  const words = phrase.split(" ");
1287
220
  for (;; ) {
1288
221
  const at = runAt(tokens, words);
@@ -1300,12 +233,16 @@ function createSchoolNameReader(options = {}) {
1300
233
  }
1301
234
  }
1302
235
  function applyPlaces(tokens, at, sn1) {
236
+ let failedOpen = -1;
1303
237
  for (let i = 1;i < tokens.length; i++) {
1304
238
  const token = tokens[i];
1305
239
  if (token.cls !== null)
1306
240
  continue;
1307
- if (!opensLocation(token.text, at, token.words[0]?.at))
241
+ if (!opensLocation2(token.text, at, token.words[0]?.at))
1308
242
  continue;
243
+ const before = tokens[i - 1];
244
+ const after = failedOpen === i - 1 && spaceJoined(sn1, before, token) && declaredQualifier(sn1, before.words[0]?.at);
245
+ failedOpen = i;
1309
246
  const tail = tokens.slice(i);
1310
247
  if (tail.some((t) => t.cls !== null))
1311
248
  continue;
@@ -1329,6 +266,8 @@ function createSchoolNameReader(options = {}) {
1329
266
  continue;
1330
267
  if (read.truncated && nameBeatsACut(printed))
1331
268
  continue;
269
+ if (read.truncated && after)
270
+ continue;
1332
271
  if (read.truncated && !survivesWithout(tokens, i, tail.length))
1333
272
  continue;
1334
273
  for (const t of tail) {
@@ -1340,6 +279,13 @@ function createSchoolNameReader(options = {}) {
1340
279
  }
1341
280
  return null;
1342
281
  }
282
+ function spaceJoined(sn1, before, token) {
283
+ const last = before.words[before.words.length - 1];
284
+ const first = token.words[0];
285
+ if (last === undefined || first === undefined)
286
+ return false;
287
+ return /^\s+$/u.test(sn1.slice(last.at + last.printed.length, first.at));
288
+ }
1343
289
  function punctuatedTail(sn1, tail) {
1344
290
  const first = tail[0]?.words[0];
1345
291
  const lastToken = tail[tail.length - 1];
@@ -1347,7 +293,7 @@ function createSchoolNameReader(options = {}) {
1347
293
  if (first === undefined || last === undefined)
1348
294
  return null;
1349
295
  const raw = sn1.slice(first.at, last.at + last.printed.length);
1350
- if (!/[,/;]/.test(raw) || /[()[\]]/.test(raw))
296
+ if (!/[,/;&+]/.test(raw) || /[()[\]]/.test(raw))
1351
297
  return null;
1352
298
  return raw;
1353
299
  }
@@ -1434,9 +380,9 @@ function createSchoolNameReader(options = {}) {
1434
380
  return false;
1435
381
  if (schoolInstitution(token.text) !== undefined)
1436
382
  return false;
1437
- if (truncatedInstitution(token.text) !== undefined)
383
+ if (truncatedInstitution2(token.text) !== undefined)
1438
384
  return false;
1439
- if (isFluffWord(token.text))
385
+ if (isFluffWord2(token.text))
1440
386
  return false;
1441
387
  const flags = flagsOf(token.words.map((w) => w.printed).join(" "));
1442
388
  if (flags === null || !flags.place)
@@ -1464,9 +410,9 @@ function createSchoolNameReader(options = {}) {
1464
410
  return false;
1465
411
  if (schoolInstitution(text) !== undefined)
1466
412
  return false;
1467
- if (truncatedInstitution(text) !== undefined)
413
+ if (truncatedInstitution2(text) !== undefined)
1468
414
  return false;
1469
- return !isFluffWord(text);
415
+ return !isFluffWord2(text);
1470
416
  }
1471
417
  function survivesWithout(tokens, at, width = 1) {
1472
418
  const off = (i) => i >= at && i < at + width;
@@ -1510,7 +456,7 @@ function createSchoolNameReader(options = {}) {
1510
456
  token.institution = inst.canonical;
1511
457
  continue;
1512
458
  }
1513
- if (isFluffWord(token.text)) {
459
+ if (isFluffWord2(token.text)) {
1514
460
  token.cls = "FLUFF";
1515
461
  continue;
1516
462
  }
@@ -1532,7 +478,7 @@ function createSchoolNameReader(options = {}) {
1532
478
  if (tokens.slice(i + 1).some((t) => t.cls === "NAME_PART"))
1533
479
  continue;
1534
480
  token.institution = undefined;
1535
- if (isFluffWord(token.text))
481
+ if (isFluffWord2(token.text))
1536
482
  token.cls = "FLUFF";
1537
483
  else if (token.text.length <= 2) {
1538
484
  token.cls = "FLUFF";
@@ -1554,12 +500,12 @@ function createSchoolNameReader(options = {}) {
1554
500
  if (tokens.slice(0, i).some(named) && !tokens.slice(i + 1).some(named))
1555
501
  continue;
1556
502
  const back = token.words.map((w) => ({
1557
- text: token.words.length === 1 ? token.text : foldSchoolName(w.printed),
503
+ text: token.words.length === 1 ? token.text : foldSchoolName2(w.printed),
1558
504
  words: [w],
1559
505
  cls: null
1560
506
  }));
1561
507
  for (const t of back) {
1562
- if (isFluffWord(t.text))
508
+ if (isFluffWord2(t.text))
1563
509
  t.cls = "FLUFF";
1564
510
  else if (t.text.length <= 2) {
1565
511
  t.cls = "FLUFF";
@@ -1574,12 +520,12 @@ function createSchoolNameReader(options = {}) {
1574
520
  function eatTruncatedTail(tokens) {
1575
521
  let ate = false;
1576
522
  const names = new Set(tokens.filter((t) => t.cls === "NAME_PART").map((t) => t.text));
1577
- const start = trailingFluffRun(tokens.map((t) => t.text), (text) => names.has(text));
523
+ const start = trailingFluffRun2(tokens.map((t) => t.text), (text) => names.has(text));
1578
524
  for (let i = start;i < tokens.length; i++) {
1579
525
  const token = tokens[i];
1580
526
  if (token === undefined || token.cls !== "NAME_PART")
1581
527
  continue;
1582
- const entry = truncatedInstitution(token.text);
528
+ const entry = truncatedInstitution2(token.text);
1583
529
  if (entry !== undefined) {
1584
530
  token.cls = "INSTITUTION_TYPE";
1585
531
  token.institution = entry.canonical;
@@ -1596,7 +542,7 @@ function createSchoolNameReader(options = {}) {
1596
542
  continue;
1597
543
  if (token.cls !== "NAME_PART")
1598
544
  break;
1599
- const entry = truncatedInstitution(token.text);
545
+ const entry = truncatedInstitution2(token.text);
1600
546
  if (entry === undefined)
1601
547
  break;
1602
548
  if (!tokens.slice(0, end - 1).some((t) => t.cls === "NAME_PART"))
@@ -1610,7 +556,7 @@ function createSchoolNameReader(options = {}) {
1610
556
  }
1611
557
  const CONNECTORS = new Set(["of", "and", "the", "na", "an", "a", "do", "de", "du", "la", "le"]);
1612
558
  function initialsOfWords(words) {
1613
- const folded = words.map((w) => foldSchoolName(w.printed)).filter((w) => /^[a-z]/.test(w));
559
+ const folded = words.map((w) => foldSchoolName2(w.printed)).filter((w) => /^[a-z]/.test(w));
1614
560
  const all = folded.map((w) => w[0]).join("");
1615
561
  const named = folded.filter((w) => !CONNECTORS.has(w)).map((w) => w[0]).join("");
1616
562
  return [...new Set([all, named])].filter((i) => i.length >= 3).map((i) => i.toUpperCase());
@@ -1751,7 +697,7 @@ function createSchoolNameReader(options = {}) {
1751
697
  return `${core}${type}${at === "" ? "" : ` (${at})`}`;
1752
698
  }
1753
699
  function nameWord(printed, first) {
1754
- const folded = foldSchoolName(printed);
700
+ const folded = foldSchoolName2(printed);
1755
701
  if (!first && schoolFluff(folded)?.lowerInside === true && printed !== printed.toLocaleUpperCase())
1756
702
  return printed.toLocaleLowerCase();
1757
703
  return titleCaseNamePart(printed);
@@ -1759,7 +705,7 @@ function createSchoolNameReader(options = {}) {
1759
705
  function renderException(token, first) {
1760
706
  const printed = token.words.map((w) => w.printed).join(" ");
1761
707
  const canonical = EXCEPTION_PHRASE.get(token.text);
1762
- const text = canonical !== undefined && foldSchoolName(printed) !== canonical ? canonical : printed;
708
+ const text = canonical !== undefined && foldSchoolName2(printed) !== canonical ? canonical : printed;
1763
709
  return text.split(" ").map((w, i) => nameWord(w, first && i === 0)).join(" ");
1764
710
  }
1765
711
  function renderPart(part, first) {
@@ -1885,7 +831,7 @@ function createSchoolNameReader(options = {}) {
1885
831
  }
1886
832
  const tokens = [];
1887
833
  for (const word of printedWords(sn1)) {
1888
- const text = foldSchoolName(word.printed);
834
+ const text = foldSchoolName2(word.printed);
1889
835
  if (text === "")
1890
836
  continue;
1891
837
  tokens.push({ text, words: [word], cls: null });
@@ -1895,7 +841,7 @@ function createSchoolNameReader(options = {}) {
1895
841
  deglueInstitutions(tokens);
1896
842
  applyPhraseExceptions(tokens);
1897
843
  applyInstitutionPhrases(tokens);
1898
- const positions = printZones(sn1);
844
+ const positions = printZones2(sn1);
1899
845
  const tail = applyPlaces(tokens, positions, sn1);
1900
846
  const read = tail?.read ?? null;
1901
847
  const cutPlace = read?.truncated === true;
@@ -2235,7 +1181,7 @@ function schoolEncoder(options = {}) {
2235
1181
  levels: SCHOOL_LEVEL_COLUMNS,
2236
1182
  indexed: [...SCHOOL_LEVEL_COLUMNS, "matchKey"],
2237
1183
  encode(x) {
2238
- const key = foldSchoolName(x.sn0);
1184
+ const key = foldSchoolName2(x.sn0);
2239
1185
  return { [printCol]: x.sn0, ...schoolColumns(x), matchKey: key === "" ? null : key };
2240
1186
  },
2241
1187
  key: (x, level) => schoolColumns(x)[level],
@@ -2280,34 +1226,41 @@ function compareSchools(a, b) {
2280
1226
  return { verdict: "CANDIDATE", reason: "truncated-print", sharesNameParts };
2281
1227
  return { verdict: "CANDIDATE", reason: "same-name-and-type", sharesNameParts };
2282
1228
  }
1229
+ function isSchoolVocabularyWord(token) {
1230
+ return isPlaceToken2(token) || isInstitutionWord2(token) || isFluffWord2(token.toLowerCase());
1231
+ }
2283
1232
  export {
2284
1233
  DEFAULT_SCHOOL_NAME_CAPACITY,
2285
1234
  DEFAULT_SCHOOL_NAME_READER,
2286
- NOT_A_SCHOOL,
2287
- SCHOOL_CELL_OWN_SENTINELS,
2288
- SCHOOL_CELL_SENTINELS,
1235
+ NOT_A_SCHOOL2 as NOT_A_SCHOOL,
1236
+ SCHOOL_CELL_OWN_SENTINELS2 as SCHOOL_CELL_OWN_SENTINELS,
1237
+ SCHOOL_CELL_SENTINELS2 as SCHOOL_CELL_SENTINELS,
2289
1238
  SCHOOL_LEVEL_COLUMNS,
2290
- SCHOOL_NAME_EXCEPTIONS,
1239
+ SCHOOL_NAME_EXCEPTIONS2 as SCHOOL_NAME_EXCEPTIONS,
2291
1240
  SHARED_ROW_SENTINELS2 as SHARED_ROW_SENTINELS,
2292
1241
  compareSchoolNames,
2293
1242
  compareSchools,
2294
1243
  createSchoolNameReader,
2295
- foldSchoolName,
2296
- hasSpecificToken,
1244
+ foldSchoolName2 as foldSchoolName,
1245
+ hasSpecificToken2 as hasSpecificToken,
2297
1246
  isColumnCutOf,
1247
+ isFluffOrFragment2 as isFluffOrFragment,
2298
1248
  isInitialismOf,
2299
1249
  isLadderLevel,
1250
+ isSchoolVocabularyWord,
2300
1251
  mapOfSchools,
1252
+ namesInstitution2 as namesInstitution,
1253
+ notASchoolIn2 as notASchoolIn,
2301
1254
  probablySameSchool,
2302
1255
  realWords,
2303
1256
  realWordsInPrintOrder,
2304
1257
  sameInEveryPart,
2305
- schoolCellSentinelOf,
1258
+ schoolCellSentinelOf2 as schoolCellSentinelOf,
2306
1259
  schoolColumns,
2307
1260
  schoolCompare,
2308
1261
  schoolEncoder,
2309
1262
  schoolInitials,
2310
- schoolKeyTokens,
1263
+ schoolKeyTokens2 as schoolKeyTokens,
2311
1264
  schoolPrintSplit,
2312
1265
  schoolTokensAt,
2313
1266
  setOfSchools