@finbheara/domain 0.11.0 → 0.13.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/README.md +7 -3
- package/dist/chunks/{place-tv86hmps.js → place-17e26rga.js} +137 -10
- package/dist/person.js +7 -0
- package/dist/place.js +6 -1
- package/dist/school.js +69 -8
- package/dist/types/person.d.ts +2 -0
- package/dist/types/place.d.ts +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ ESM, Node ≥ 22 or Bun ≥ 1.4.2. MIT. Not affiliated with or endorsed by any d
|
|
|
43
43
|
| `@finbheara/domain/noun-index` | `createIndex`, `indexSchema`, `personEncoder`, and the `SqlHandle`/`NounEncoder` types: a database-backed name map (below) |
|
|
44
44
|
| `@finbheara/domain/dance-types` | `danceTypes()`, `DANCE_TYPES`, `rhythmOfTime`, and the shared `DanceMatch`/`DanceRelation`/`SetRhythm`/`TimeSignature` types |
|
|
45
45
|
| `@finbheara/domain/promotion` | `samePromotedRow`, `samePromotedSchool`, `samePromotedHeir`, `samePromotedName`, `questionMarksRead`, `foldCharSynonyms`: is a row the same row after a promotion (below) |
|
|
46
|
-
| `@finbheara/domain/person` | `seatName`, `dancerName`, `teacherName`, `roleName`, `roleSentinelOf`, the role lists and `SHARED_ROW_SENTINELS`: a person's print read in its role (below) |
|
|
46
|
+
| `@finbheara/domain/person` | `seatName`, `dancerName`, `teacherName`, `roleName`, `roleSentinelOf`, `rolePrintsNoName`, `dancerPrintsNoName`, the role lists and `SHARED_ROW_SENTINELS`: a person's print read in its role (below) |
|
|
47
47
|
|
|
48
48
|
The library does no I/O and installs nothing process-wide. Every reader has a default and a
|
|
49
49
|
factory: build your own with options when the default is not what you want.
|
|
@@ -105,7 +105,7 @@ A `Place` is one of four arms: `resolved`, `plural` (a print naming more than on
|
|
|
105
105
|
says they cannot be one place; `same`, `contains` and `overlaps` do not.
|
|
106
106
|
|
|
107
107
|
A print that is clearly not a place is refused, with its reason: a placeholder
|
|
108
|
-
(`[address withheld]`, `
|
|
108
|
+
(`[address withheld]`, `TBA`), a URL anywhere in the print (`web`), an online event in the
|
|
109
109
|
venue field (`online`), a change-of-venue notice (`notice`), or a replacement character where
|
|
110
110
|
the source lost bytes (`damaged`). These are asked only where the store reads nothing, so a
|
|
111
111
|
refusal never takes a reading away. Mojibake that can be decoded back is not refused: repair it
|
|
@@ -171,7 +171,8 @@ compareSchoolNames("Ardvarna Academy", "Ardvarna Academy (Ontario)", reader);
|
|
|
171
171
|
### Your own garbage
|
|
172
172
|
|
|
173
173
|
The shipped refusals are generic: a card number, keyboard filler, a run with no letter in it,
|
|
174
|
-
|
|
174
|
+
what a school cell prints where no school was entered (`N/A`, `No School`, `-- Choose One --`,
|
|
175
|
+
...). What YOUR data
|
|
175
176
|
prints in a school field and is not a school, such as an entry system's own "school not
|
|
176
177
|
listed" instruction, a test entry, or a note typed into the wrong field, is yours to declare.
|
|
177
178
|
Pass it as `garbage`, the same idea as `phraseClassifier(lexicon, { garbageVocab })` in
|
|
@@ -482,6 +483,9 @@ seatName("Aoife Mhaolvarna").nn2; // "Mhaolvarna<<Aoife": nam
|
|
|
482
483
|
and the school cell's (`SCHOOL_CELL_SENTINELS` on `/school`, asked by the school reader before
|
|
483
484
|
its own register), so a sentinel a whole row prints has one definition.
|
|
484
485
|
- Each row is the folded print (`foldNameKey`), what it stands for, and where it was seen.
|
|
486
|
+
- **The print alone** has the same answer: `rolePrintsNoName(role, print)` (and
|
|
487
|
+
`dancerPrintsNoName(print)`) is `roleName(role, print).printsNoName()` without the parse, for
|
|
488
|
+
a walk that parses no name. Names' `isNoNamePrint` alone misses a role's own sentinel.
|
|
485
489
|
|
|
486
490
|
## Known gaps
|
|
487
491
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SHARED_ROW_SENTINELS2,
|
|
3
|
+
sentinelIn2
|
|
4
|
+
} from "./place-tcgfvemw.js";
|
|
1
5
|
import {
|
|
2
6
|
validity
|
|
3
7
|
} from "./place-q9kwsmzd.js";
|
|
4
8
|
|
|
5
|
-
import { isPlaceholderPrint } from "@finbheara/names/normalize";
|
|
6
|
-
|
|
7
9
|
var PLACE_NODES = [
|
|
8
10
|
{
|
|
9
11
|
id: "world",
|
|
@@ -205,6 +207,8 @@ var PLACE_NODES = [
|
|
|
205
207
|
"mid america region",
|
|
206
208
|
"mid america region usa",
|
|
207
209
|
"mid american region",
|
|
210
|
+
"middle america",
|
|
211
|
+
"middle america us",
|
|
208
212
|
"reigiun lar meiricea",
|
|
209
213
|
"usa mid america region"
|
|
210
214
|
],
|
|
@@ -234,7 +238,13 @@ var PLACE_NODES = [
|
|
|
234
238
|
name: "New England Region USA",
|
|
235
239
|
geo: "USA",
|
|
236
240
|
admin: "IDTANA",
|
|
237
|
-
prints: [
|
|
241
|
+
prints: [
|
|
242
|
+
"new england",
|
|
243
|
+
"new england region",
|
|
244
|
+
"new england region usa",
|
|
245
|
+
"new england us",
|
|
246
|
+
"reigiun sasana nua"
|
|
247
|
+
],
|
|
238
248
|
codes: ["NERO"],
|
|
239
249
|
oireachtas: "NERO"
|
|
240
250
|
},
|
|
@@ -251,6 +261,7 @@ var PLACE_NODES = [
|
|
|
251
261
|
"so usa",
|
|
252
262
|
"southern region",
|
|
253
263
|
"southern region usa",
|
|
264
|
+
"southern us",
|
|
254
265
|
"southern usa",
|
|
255
266
|
"usa southern region"
|
|
256
267
|
],
|
|
@@ -3965,7 +3976,7 @@ var PLACE_NODES = [
|
|
|
3965
3976
|
name: "District of Columbia",
|
|
3966
3977
|
geo: "USA",
|
|
3967
3978
|
admin: "IDTANA-SRO",
|
|
3968
|
-
prints: ["district of columbia"],
|
|
3979
|
+
prints: ["d c", "district of columbia", "washington d c", "washington dc"],
|
|
3969
3980
|
codes: ["DC", "DC-USA", "US-DC", "USA-DC"]
|
|
3970
3981
|
},
|
|
3971
3982
|
{
|
|
@@ -6478,6 +6489,15 @@ var PLACE_NODES = [
|
|
|
6478
6489
|
prints: ["salt lake city"],
|
|
6479
6490
|
codes: []
|
|
6480
6491
|
},
|
|
6492
|
+
{
|
|
6493
|
+
id: "USA-VA/dulles",
|
|
6494
|
+
kind: "city",
|
|
6495
|
+
name: "Dulles",
|
|
6496
|
+
geo: "USA-VA",
|
|
6497
|
+
admin: "IDTANA-SRO",
|
|
6498
|
+
prints: ["dulles", "washington dulles"],
|
|
6499
|
+
codes: []
|
|
6500
|
+
},
|
|
6481
6501
|
{
|
|
6482
6502
|
id: "USA-VA/leesburg",
|
|
6483
6503
|
kind: "city",
|
|
@@ -6763,6 +6783,8 @@ function inWebSpan(at, index) {
|
|
|
6763
6783
|
}
|
|
6764
6784
|
|
|
6765
6785
|
var DEFAULT_PLACE_CAPACITY2 = 8192;
|
|
6786
|
+
var PLACE_CELL_SENTINELS = [...SHARED_ROW_SENTINELS2];
|
|
6787
|
+
var placeCellSentinelOf = sentinelIn2(PLACE_CELL_SENTINELS);
|
|
6766
6788
|
function createPlaceReader2(options = {}) {
|
|
6767
6789
|
const nodes = options.tree ?? PLACE_NODES;
|
|
6768
6790
|
let index;
|
|
@@ -6804,7 +6826,7 @@ function createPlaceReader2(options = {}) {
|
|
|
6804
6826
|
return "online";
|
|
6805
6827
|
if (folded === NOTICE || folded.startsWith(`${NOTICE} `))
|
|
6806
6828
|
return "notice";
|
|
6807
|
-
if (
|
|
6829
|
+
if (placeCellSentinelOf(raw) !== undefined)
|
|
6808
6830
|
return "placeholder";
|
|
6809
6831
|
return;
|
|
6810
6832
|
}
|
|
@@ -7397,6 +7419,24 @@ function createPlaceReader2(options = {}) {
|
|
|
7397
7419
|
}
|
|
7398
7420
|
return;
|
|
7399
7421
|
}
|
|
7422
|
+
function taggedHead(core, declared) {
|
|
7423
|
+
const m = /^(.*\S)\s*(?:\(([^()[\]{}]*)\)|\[([^()[\]{}]*)\])$/su.exec(core);
|
|
7424
|
+
if (m === null)
|
|
7425
|
+
return;
|
|
7426
|
+
const head = m[1];
|
|
7427
|
+
const tag = (m[2] ?? m[3] ?? "").trim();
|
|
7428
|
+
if (fold(head) === "" || fold(tag) === "")
|
|
7429
|
+
return;
|
|
7430
|
+
const h = read(head, declared);
|
|
7431
|
+
const t = read(tag, declared);
|
|
7432
|
+
if (h.refusal !== null || t.refusal !== null || h.heads.length === 0 || t.heads.length === 0)
|
|
7433
|
+
return;
|
|
7434
|
+
const held = (n) => t.heads.some((x) => isAncestor(x, n));
|
|
7435
|
+
if (h.members !== undefined)
|
|
7436
|
+
return h.members.every(held) ? h : undefined;
|
|
7437
|
+
const kept = h.heads.filter(held);
|
|
7438
|
+
return kept.length === 0 ? undefined : { ...h, heads: kept };
|
|
7439
|
+
}
|
|
7400
7440
|
function pieced(left, country) {
|
|
7401
7441
|
if (namedInside(left, country).length > 0)
|
|
7402
7442
|
return [left];
|
|
@@ -7551,7 +7591,7 @@ function createPlaceReader2(options = {}) {
|
|
|
7551
7591
|
}
|
|
7552
7592
|
const first = sane[0];
|
|
7553
7593
|
if (first === undefined)
|
|
7554
|
-
return (smushed ? desmush(core, declared) : undefined) ?? NOTHING;
|
|
7594
|
+
return taggedHead(core, declared) ?? (smushed ? desmush(core, declared) : undefined) ?? NOTHING;
|
|
7555
7595
|
if (sane.length === 1)
|
|
7556
7596
|
return first;
|
|
7557
7597
|
const heads = [];
|
|
@@ -7847,10 +7887,89 @@ function createPlaceReader2(options = {}) {
|
|
|
7847
7887
|
return made;
|
|
7848
7888
|
}
|
|
7849
7889
|
function placeFromId(id) {
|
|
7850
|
-
const
|
|
7851
|
-
if (
|
|
7890
|
+
const key = id.trim();
|
|
7891
|
+
if (key.includes("+"))
|
|
7892
|
+
return pluralFromId(id, key);
|
|
7893
|
+
const n = idx().byId.get(key);
|
|
7894
|
+
if (n !== undefined)
|
|
7895
|
+
return build(id, [chainOf(n)], { heads: [n], match: "id", truncated: false, refusal: null }, []);
|
|
7896
|
+
for (let at = key.lastIndexOf("/");at > 0; at = key.lastIndexOf("/", at - 1)) {
|
|
7897
|
+
const above = idx().byId.get(key.slice(0, at));
|
|
7898
|
+
if (above !== undefined)
|
|
7899
|
+
return build(id, [chainOf(above)], { heads: [above], match: "id", truncated: true, refusal: null }, []);
|
|
7900
|
+
}
|
|
7901
|
+
return build(id, [], NOTHING, []);
|
|
7902
|
+
}
|
|
7903
|
+
function pluralFromId(id, key) {
|
|
7904
|
+
const members = [];
|
|
7905
|
+
for (const part of key.split("+")) {
|
|
7906
|
+
const n = idx().byId.get(part);
|
|
7907
|
+
if (n === undefined || members.some((m) => m.id === n.id))
|
|
7908
|
+
return build(id, [], NOTHING, []);
|
|
7909
|
+
members.push(n);
|
|
7910
|
+
}
|
|
7911
|
+
if (members.length < 2)
|
|
7852
7912
|
return build(id, [], NOTHING, []);
|
|
7853
|
-
|
|
7913
|
+
for (let a = 0;a < members.length; a++)
|
|
7914
|
+
for (let b = a + 1;b < members.length; b++)
|
|
7915
|
+
if (!twoPlaces(members[a], members[b]))
|
|
7916
|
+
return build(id, [], NOTHING, []);
|
|
7917
|
+
members.sort((x, y) => x.id.localeCompare(y.id));
|
|
7918
|
+
return build(id, chainsFor(members), {
|
|
7919
|
+
heads: members,
|
|
7920
|
+
match: "id",
|
|
7921
|
+
truncated: false,
|
|
7922
|
+
refusal: null,
|
|
7923
|
+
members
|
|
7924
|
+
}, []);
|
|
7925
|
+
}
|
|
7926
|
+
const MAX_WINDOW = 6;
|
|
7927
|
+
function segmentsOf(text) {
|
|
7928
|
+
return text.split(/[;:()[\]{}|]+/).map((seg) => seg.split(/[\s,\u2013\u2014]+|\s-\s|-(?=\p{Lu})/u).filter((t) => t !== "" && t !== "-")).filter((seg) => seg.length > 0);
|
|
7929
|
+
}
|
|
7930
|
+
function placeWindows(text, ctx) {
|
|
7931
|
+
const found = [];
|
|
7932
|
+
for (const tokens of segmentsOf(text)) {
|
|
7933
|
+
const taken = new Array(tokens.length).fill(false);
|
|
7934
|
+
const here = [];
|
|
7935
|
+
for (let w = Math.min(MAX_WINDOW, tokens.length);w >= 1; w--)
|
|
7936
|
+
for (let i = 0;i + w <= tokens.length; i++) {
|
|
7937
|
+
if (taken.slice(i, i + w).some((x) => x))
|
|
7938
|
+
continue;
|
|
7939
|
+
const span = tokens.slice(i, i + w);
|
|
7940
|
+
const p = place(span.join(" "), ctx);
|
|
7941
|
+
if (!p.isPlace() || p.truncated)
|
|
7942
|
+
continue;
|
|
7943
|
+
for (let k = i;k < i + w; k++)
|
|
7944
|
+
taken[k] = true;
|
|
7945
|
+
here.push({ at: i, r: { p, tokens: span } });
|
|
7946
|
+
}
|
|
7947
|
+
here.sort((a, b) => a.at - b.at);
|
|
7948
|
+
for (const [k, h] of here.entries()) {
|
|
7949
|
+
const n = here[k + 1];
|
|
7950
|
+
if (n !== undefined && n.at === h.at + h.r.tokens.length)
|
|
7951
|
+
h.r.next = n.r;
|
|
7952
|
+
}
|
|
7953
|
+
found.push(...here.map((f) => f.r));
|
|
7954
|
+
}
|
|
7955
|
+
return found;
|
|
7956
|
+
}
|
|
7957
|
+
function placeParts(print) {
|
|
7958
|
+
const core = unbracket(repair(print));
|
|
7959
|
+
const { tokens, seps } = cut(core);
|
|
7960
|
+
const pieces = [];
|
|
7961
|
+
let run = tokens[0] ?? "";
|
|
7962
|
+
for (let i = 0;i < seps.length; i++) {
|
|
7963
|
+
const next = tokens[i + 1] ?? "";
|
|
7964
|
+
if (seps[i] === "space")
|
|
7965
|
+
run = `${run} ${next}`;
|
|
7966
|
+
else {
|
|
7967
|
+
pieces.push(run);
|
|
7968
|
+
run = next;
|
|
7969
|
+
}
|
|
7970
|
+
}
|
|
7971
|
+
pieces.push(run);
|
|
7972
|
+
return pieces.filter((p) => p.trim() !== "").map((p) => place(p));
|
|
7854
7973
|
}
|
|
7855
7974
|
function oireachtasOfRegion(regionId) {
|
|
7856
7975
|
if (regionId === undefined)
|
|
@@ -7945,6 +8064,8 @@ function createPlaceReader2(options = {}) {
|
|
|
7945
8064
|
countryCodeOf,
|
|
7946
8065
|
areAllPlaceTokens,
|
|
7947
8066
|
placeFromId,
|
|
8067
|
+
placeParts,
|
|
8068
|
+
placeWindows,
|
|
7948
8069
|
oireachtasOfRegion,
|
|
7949
8070
|
regionOfOireachtas,
|
|
7950
8071
|
placeStats,
|
|
@@ -7971,6 +8092,12 @@ function areAllPlaceTokens2(tokens, off = 0, declared = false) {
|
|
|
7971
8092
|
function placeFromId2(id) {
|
|
7972
8093
|
return DEFAULT_PLACE_READER2.placeFromId(id);
|
|
7973
8094
|
}
|
|
8095
|
+
function placeWindows2(text, ctx) {
|
|
8096
|
+
return DEFAULT_PLACE_READER2.placeWindows(text, ctx);
|
|
8097
|
+
}
|
|
8098
|
+
function placeParts2(print) {
|
|
8099
|
+
return DEFAULT_PLACE_READER2.placeParts(print);
|
|
8100
|
+
}
|
|
7974
8101
|
function oireachtasOfRegion2(regionId) {
|
|
7975
8102
|
return DEFAULT_PLACE_READER2.oireachtasOfRegion(regionId);
|
|
7976
8103
|
}
|
|
@@ -7996,4 +8123,4 @@ function sameReading2(a, b) {
|
|
|
7996
8123
|
return DEFAULT_PLACE_READER2.sameReading(a, b);
|
|
7997
8124
|
}
|
|
7998
8125
|
|
|
7999
|
-
export { NEVER_NAME, printZones, opensLocation, DEFAULT_PLACE_CAPACITY2, createPlaceReader2, DEFAULT_PLACE_READER2, place2, isPlaceToken2, countryCodeOf2, areAllPlaceTokens2, placeFromId2, oireachtasOfRegion2, regionOfOireachtas2, placeStats2, resetPlaceCache2, placeRelation2, placesRelation2, probablySamePlace2, sameReading2 };
|
|
8126
|
+
export { 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 };
|
package/dist/person.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
NAME_REFUSED,
|
|
8
|
+
isNoNamePrint,
|
|
8
9
|
personName
|
|
9
10
|
} from "@finbheara/names/normalize";
|
|
10
11
|
var ADJUDICATOR_SENTINELS = [
|
|
@@ -110,6 +111,10 @@ function roleName(role, print, order) {
|
|
|
110
111
|
const sentinel = MATCHERS[role](print);
|
|
111
112
|
return sentinel === undefined ? read : new RoleRefusedName(read, role, sentinel);
|
|
112
113
|
}
|
|
114
|
+
function rolePrintsNoName(role, print) {
|
|
115
|
+
return MATCHERS[role](print) !== undefined || isNoNamePrint(print);
|
|
116
|
+
}
|
|
117
|
+
var dancerPrintsNoName = (print) => rolePrintsNoName("dancer", print);
|
|
113
118
|
var seatName = (print) => roleName("adjudicator", print, "given-first");
|
|
114
119
|
var dancerName = (print, order) => roleName("dancer", print, order);
|
|
115
120
|
var teacherName = (print, order) => roleName("teacher", print, order);
|
|
@@ -120,7 +125,9 @@ export {
|
|
|
120
125
|
SHARED_ROW_SENTINELS2 as SHARED_ROW_SENTINELS,
|
|
121
126
|
TEACHER_SENTINELS,
|
|
122
127
|
dancerName,
|
|
128
|
+
dancerPrintsNoName,
|
|
123
129
|
roleName,
|
|
130
|
+
rolePrintsNoName,
|
|
124
131
|
roleSentinelOf,
|
|
125
132
|
seatName,
|
|
126
133
|
sentinelIn2 as sentinelIn,
|
package/dist/place.js
CHANGED
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
countryCodeOf2,
|
|
8
8
|
areAllPlaceTokens2,
|
|
9
9
|
placeFromId2,
|
|
10
|
+
placeWindows2,
|
|
11
|
+
placeParts2,
|
|
10
12
|
oireachtasOfRegion2,
|
|
11
13
|
regionOfOireachtas2,
|
|
12
14
|
placeStats2,
|
|
@@ -15,7 +17,8 @@ import {
|
|
|
15
17
|
placesRelation2,
|
|
16
18
|
probablySamePlace2,
|
|
17
19
|
sameReading2
|
|
18
|
-
} from "./chunks/place-
|
|
20
|
+
} from "./chunks/place-17e26rga.js";
|
|
21
|
+
import"./chunks/place-tcgfvemw.js";
|
|
19
22
|
export {
|
|
20
23
|
DEFAULT_PLACE_CAPACITY2 as DEFAULT_PLACE_CAPACITY,
|
|
21
24
|
DEFAULT_PLACE_READER2 as DEFAULT_PLACE_READER,
|
|
@@ -26,8 +29,10 @@ export {
|
|
|
26
29
|
oireachtasOfRegion2 as oireachtasOfRegion,
|
|
27
30
|
place2 as place,
|
|
28
31
|
placeFromId2 as placeFromId,
|
|
32
|
+
placeParts2 as placeParts,
|
|
29
33
|
placeRelation2 as placeRelation,
|
|
30
34
|
placeStats2 as placeStats,
|
|
35
|
+
placeWindows2 as placeWindows,
|
|
31
36
|
placesRelation2 as placesRelation,
|
|
32
37
|
probablySamePlace2 as probablySamePlace,
|
|
33
38
|
regionOfOireachtas2 as regionOfOireachtas,
|
package/dist/school.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SHARED_ROW_SENTINELS2,
|
|
3
|
+
sentinelIn2
|
|
4
|
+
} from "./chunks/place-tcgfvemw.js";
|
|
1
5
|
import {
|
|
2
6
|
NEVER_NAME,
|
|
3
7
|
printZones,
|
|
@@ -8,11 +12,7 @@ import {
|
|
|
8
12
|
areAllPlaceTokens2,
|
|
9
13
|
placeRelation2,
|
|
10
14
|
sameReading2
|
|
11
|
-
} from "./chunks/place-
|
|
12
|
-
import {
|
|
13
|
-
SHARED_ROW_SENTINELS2,
|
|
14
|
-
sentinelIn2
|
|
15
|
-
} from "./chunks/place-tcgfvemw.js";
|
|
15
|
+
} from "./chunks/place-17e26rga.js";
|
|
16
16
|
import {
|
|
17
17
|
validity
|
|
18
18
|
} from "./chunks/place-q9kwsmzd.js";
|
|
@@ -21,8 +21,6 @@ import { normalizeApostrophes as normalizeApostrophes2 } from "@finbheara/names/
|
|
|
21
21
|
import { SURNAME_SEPARATOR, lexiconKey, titleCaseNamePart } from "@finbheara/names/normalize";
|
|
22
22
|
import { personName } from "@finbheara/names/normalize";
|
|
23
23
|
|
|
24
|
-
import { placeholderOf } from "@finbheara/names/normalize";
|
|
25
|
-
|
|
26
24
|
var SCHOOL_CELL_OWN_SENTINELS = [
|
|
27
25
|
{
|
|
28
26
|
print: "no school",
|
|
@@ -35,6 +33,69 @@ var SCHOOL_CELL_OWN_SENTINELS = [
|
|
|
35
33
|
{
|
|
36
34
|
print: "independent dancer",
|
|
37
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
|
+
{ print: "not applicable", authority: "`Not applicable`: a school print, no school entered" },
|
|
77
|
+
{
|
|
78
|
+
print: "no school judge",
|
|
79
|
+
authority: "`No School - Judge`: an entry form's option for an adjudicator"
|
|
80
|
+
},
|
|
81
|
+
{ print: "no dance school", authority: "`No Dance School`: an entry form's option" },
|
|
82
|
+
{ print: "unknown music school", authority: "`Unknown Music School`: an entry form's option" },
|
|
83
|
+
{ print: "school deleted", authority: "`---SCHOOL DELETED`: an entry form's option" },
|
|
84
|
+
{ print: "select school", authority: "`--Select School--`: an entry form's unchosen option" },
|
|
85
|
+
{ print: "school other", authority: "`School Other`: an entry form's option" },
|
|
86
|
+
{ print: "non", authority: "`Non`: an entry form's option, the truncation of `Non-dancer`" },
|
|
87
|
+
{
|
|
88
|
+
print: "x closed select new school",
|
|
89
|
+
authority: "`X - CLOSED - Select New School`: an entry form's option for a closed school"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
print: "x school closed please select another school",
|
|
93
|
+
authority: "`X -SCHOOL CLOSED - Please select another school`: an entry form's option"
|
|
94
|
+
},
|
|
95
|
+
{ print: "default school", authority: "`Default School`: an entry form's default" },
|
|
96
|
+
{
|
|
97
|
+
print: "my school of irish dance",
|
|
98
|
+
authority: "`My School of Irish Dance`: an entry form's example text"
|
|
38
99
|
}
|
|
39
100
|
];
|
|
40
101
|
var SCHOOL_CELL_SENTINELS = [
|
|
@@ -282,7 +343,7 @@ function notASchoolIn(rows) {
|
|
|
282
343
|
const text = normalizeForRefusal(print);
|
|
283
344
|
if (text === "")
|
|
284
345
|
return;
|
|
285
|
-
const placeholder = schoolCellSentinelOf(text)
|
|
346
|
+
const placeholder = schoolCellSentinelOf(text);
|
|
286
347
|
if (placeholder !== undefined)
|
|
287
348
|
return placeholderRow(placeholder);
|
|
288
349
|
for (const row of rows) {
|
package/dist/types/person.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export declare const TEACHER_SENTINELS: readonly RowSentinel[];
|
|
|
9
9
|
export declare const ROLE_SENTINELS: Readonly<Record<PersonRole, readonly RowSentinel[]>>;
|
|
10
10
|
export declare function roleSentinelOf(role: PersonRole, print: string): RowSentinel | undefined;
|
|
11
11
|
export declare function roleName(role: PersonRole, print: string, order?: ParseOrder): PersonName;
|
|
12
|
+
export declare function rolePrintsNoName(role: PersonRole, print: string): boolean;
|
|
13
|
+
export declare const dancerPrintsNoName: (print: string) => boolean;
|
|
12
14
|
export declare const seatName: (print: string) => PersonName;
|
|
13
15
|
export declare const dancerName: (print: string, order?: ParseOrder) => PersonName;
|
|
14
16
|
export declare const teacherName: (print: string, order?: ParseOrder) => PersonName;
|
package/dist/types/place.d.ts
CHANGED
|
@@ -51,6 +51,11 @@ export interface UnreadPlace extends AbstractPlace {
|
|
|
51
51
|
readonly arm: "unread";
|
|
52
52
|
}
|
|
53
53
|
export type Place = ResolvedPlace | PluralPlaces | AmbiguousPlace | UnreadPlace;
|
|
54
|
+
export interface PlaceWindow {
|
|
55
|
+
readonly p: Place;
|
|
56
|
+
readonly tokens: readonly string[];
|
|
57
|
+
next?: PlaceWindow;
|
|
58
|
+
}
|
|
54
59
|
export type PlaceRefusals = (print: string) => PlaceRefusal | undefined;
|
|
55
60
|
export interface PlaceReaderOptions {
|
|
56
61
|
readonly tree?: readonly PlaceNode[];
|
|
@@ -64,6 +69,8 @@ export declare function createPlaceReader(options?: PlaceReaderOptions): {
|
|
|
64
69
|
countryCodeOf: (token: string) => string | undefined;
|
|
65
70
|
areAllPlaceTokens: (tokens: readonly string[], off?: number, declared?: boolean) => boolean;
|
|
66
71
|
placeFromId: (id: string) => Place;
|
|
72
|
+
placeParts: (print: string) => Place[];
|
|
73
|
+
placeWindows: (text: string, ctx?: string | PlaceContext) => PlaceWindow[];
|
|
67
74
|
oireachtasOfRegion: (regionId: string | undefined) => string | undefined;
|
|
68
75
|
regionOfOireachtas: (code: string) => Place;
|
|
69
76
|
placeStats: () => {
|
|
@@ -84,6 +91,8 @@ export declare function isPlaceToken(token: string, cut?: boolean, declared?: bo
|
|
|
84
91
|
export declare function countryCodeOf(token: string): string | undefined;
|
|
85
92
|
export declare function areAllPlaceTokens(tokens: readonly string[], off?: number, declared?: boolean): boolean;
|
|
86
93
|
export declare function placeFromId(id: string): Place;
|
|
94
|
+
export declare function placeWindows(text: string, ctx?: string | PlaceContext): PlaceWindow[];
|
|
95
|
+
export declare function placeParts(print: string): Place[];
|
|
87
96
|
export declare function oireachtasOfRegion(regionId: string | undefined): string | undefined;
|
|
88
97
|
export declare function regionOfOireachtas(code: string): Place;
|
|
89
98
|
export declare function placeStats(): {
|
package/package.json
CHANGED