@finbheara/names 0.9.2 → 0.10.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 +38 -1
- package/dist/chunks/{index-knrkej0f.js → index-7sppf1vh.js} +72 -8
- package/dist/chunks/{index-knrkej0f.js.map → index-7sppf1vh.js.map} +5 -3
- package/dist/chunks/{index-0qptxnwh.js → index-7vvt5hhy.js} +13 -2
- package/dist/chunks/{index-0qptxnwh.js.map → index-7vvt5hhy.js.map} +2 -2
- package/dist/chunks/index-ebebeamh.js +446 -0
- package/dist/chunks/index-ebebeamh.js.map +10 -0
- package/dist/chunks/{index-fzzq5txh.js → index-khxa4qjy.js} +2 -2
- package/dist/chunks/{index-2fsdvhaf.js → index-kw6gbrnq.js} +2 -2
- package/dist/chunks/{index-d4wr471g.js → index-pncn9y2r.js} +2 -2
- package/dist/chunks/index-qsznkk4s.js +3 -0
- package/dist/chunks/index-qsznkk4s.js.map +9 -0
- package/dist/chunks/{index-852w8w1s.js → index-r5fp3znj.js} +3 -3
- package/dist/chunks/{index-0vg56t5v.js → index-yq8hsd1f.js} +3 -3
- package/dist/chunks/phrase-672g18kw.js +11 -0
- package/dist/classifier/index.js +3 -3
- package/dist/cli/census.js +4 -4
- package/dist/index.js +25 -8
- package/dist/index.js.map +1 -1
- package/dist/lexicon/index.js +1 -1
- package/dist/measure/index.js +4 -4
- package/dist/normalize/index.js +17 -5
- package/dist/normalize/index.js.map +1 -1
- package/dist/phonetic/index.js +10 -0
- package/dist/phonetic/index.js.map +9 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/normalize/block-keys.d.ts +53 -0
- package/dist/types/normalize/index.d.ts +2 -0
- package/dist/types/normalize/name-columns.d.ts +51 -0
- package/dist/types/phonetic/double-metaphone.d.ts +25 -0
- package/dist/types/phonetic/index.d.ts +11 -0
- package/names.txt +11 -0
- package/package.json +8 -2
- package/dist/chunks/phrase-dczgr4vs.js +0 -11
- /package/dist/chunks/{index-fzzq5txh.js.map → index-khxa4qjy.js.map} +0 -0
- /package/dist/chunks/{index-2fsdvhaf.js.map → index-kw6gbrnq.js.map} +0 -0
- /package/dist/chunks/{index-d4wr471g.js.map → index-pncn9y2r.js.map} +0 -0
- /package/dist/chunks/{index-852w8w1s.js.map → index-r5fp3znj.js.map} +0 -0
- /package/dist/chunks/{index-0vg56t5v.js.map → index-yq8hsd1f.js.map} +0 -0
- /package/dist/chunks/{phrase-dczgr4vs.js.map → phrase-672g18kw.js.map} +0 -0
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ ESM, Node ≥ 22 or Bun ≥ 1.4.2. MIT.
|
|
|
26
26
|
|
|
27
27
|
## Entry points
|
|
28
28
|
|
|
29
|
-
Import only what you use; `/lexicon`, `/particles` and `/
|
|
29
|
+
Import only what you use; `/lexicon`, `/particles`, `/normalize` and `/phonetic` never load the
|
|
30
30
|
classifier's bloom tables.
|
|
31
31
|
|
|
32
32
|
| import | what |
|
|
@@ -35,6 +35,7 @@ classifier's bloom tables.
|
|
|
35
35
|
| `@finbheara/names/lexicon` | `names.txt` parsed: flags, multi-word phrases, spellings, roles |
|
|
36
36
|
| `@finbheara/names/particles` | the particle vocabulary |
|
|
37
37
|
| `@finbheara/names/classifier` | person / school / location classification and segmentation |
|
|
38
|
+
| `@finbheara/names/phonetic` | Double Metaphone: how a word sounds, as a key |
|
|
38
39
|
| `@finbheara/names/measure` | the census and the classifier evaluation |
|
|
39
40
|
| `@finbheara/names` | all of the above |
|
|
40
41
|
| `@finbheara/names/names.txt` | the raw lexicon |
|
|
@@ -141,6 +142,42 @@ The verdict is a declaration the caller makes about a document; grouping rows in
|
|
|
141
142
|
documents is the caller's. `bun run names order <file>` prints the same for a file of
|
|
142
143
|
name cells, one per line. The specification is `docs/NAME-NORMALIZATION.md`.
|
|
143
144
|
|
|
145
|
+
## Phonetic and blocking keys
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
import { doubleMetaphone } from "@finbheara/names/phonetic";
|
|
149
|
+
import { initialsBlock, metaphoneBlocks, personName, surnameBlock } from "@finbheara/names/normalize";
|
|
150
|
+
|
|
151
|
+
doubleMetaphone("SMITH"); // ["SM0", "XMT"] primary, secondary
|
|
152
|
+
doubleMetaphone("KAVANAGH"); // ["KFNK", "KFNK"]
|
|
153
|
+
|
|
154
|
+
const n = personName("Moira O'Rervton");
|
|
155
|
+
surnameBlock(n.surnameKey()); // "ORERVTON" A-Z letters only
|
|
156
|
+
metaphoneBlocks(n.surnameKey()); // ["ARRF"]
|
|
157
|
+
initialsBlock(n.givenFields()[0] ?? "", n.surnameKey()); // "MO"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`doubleMetaphone` is a general phonetic key: a printed name and a transcribed spoken
|
|
161
|
+
word are asked the same question. The three block keys bucket names that are worth
|
|
162
|
+
comparing and decide nothing; each answers `null` (or `[]`) where there is nothing to
|
|
163
|
+
bucket on, so a self-join never pools the blanks.
|
|
164
|
+
|
|
165
|
+
### A name as database columns
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
import { NAME_COLUMNS, nameColumns, personName } from "@finbheara/names/normalize";
|
|
169
|
+
|
|
170
|
+
NAME_COLUMNS; // ["nn0", …, "nn4", "surname_key", "given_key", "blk_surname", "blk_initials",
|
|
171
|
+
// "blk_metaphone", "blk_metaphone_alt"]
|
|
172
|
+
nameColumns(personName("Moira O'Rervton"));
|
|
173
|
+
// { nn0: "Moira O'Rervton", …, nn3: "ORERVTON<<MOIRA", surname_key: "ORERVTON",
|
|
174
|
+
// given_key: "MOIRA", blk_surname: "ORERVTON", blk_initials: "MO", blk_metaphone: "ARRF", … }
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
One encoder for every key a store indexes, with no database dependency. A level column
|
|
178
|
+
is the slot `createNameMap` files a name under, `null` for a print that names no person,
|
|
179
|
+
so a map lookup at a level is one equality on one column.
|
|
180
|
+
|
|
144
181
|
## The lexicon
|
|
145
182
|
|
|
146
183
|
```ts
|
|
@@ -3,7 +3,13 @@ import {
|
|
|
3
3
|
isGiven2,
|
|
4
4
|
isAmbiguous2,
|
|
5
5
|
Lexicon2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-7vvt5hhy.js";
|
|
7
|
+
import {
|
|
8
|
+
isPlaceWordFlags
|
|
9
|
+
} from "./index-kw6gbrnq.js";
|
|
10
|
+
import {
|
|
11
|
+
doubleMetaphone2
|
|
12
|
+
} from "./index-ebebeamh.js";
|
|
7
13
|
import {
|
|
8
14
|
nameFold2,
|
|
9
15
|
isPlaceholderPrint2,
|
|
@@ -13,10 +19,7 @@ import {
|
|
|
13
19
|
commaReading2,
|
|
14
20
|
levelOf2,
|
|
15
21
|
defaultPersonNameFactory2
|
|
16
|
-
} from "./index-
|
|
17
|
-
import {
|
|
18
|
-
isPlaceWordFlags
|
|
19
|
-
} from "./index-2fsdvhaf.js";
|
|
22
|
+
} from "./index-khxa4qjy.js";
|
|
20
23
|
import {
|
|
21
24
|
isTeamPrint2
|
|
22
25
|
} from "./index-0phgwy52.js";
|
|
@@ -969,6 +972,67 @@ function personList2(print, factory = defaultPersonNameFactory2()) {
|
|
|
969
972
|
}
|
|
970
973
|
return out;
|
|
971
974
|
}
|
|
975
|
+
// src/normalize/block-keys.ts
|
|
976
|
+
function blockLetters(surname) {
|
|
977
|
+
return surname.toUpperCase().replace(/[^A-Z]/g, "");
|
|
978
|
+
}
|
|
979
|
+
function firstLetter(s) {
|
|
980
|
+
const m = s.match(/[A-Za-z]/);
|
|
981
|
+
return m ? m[0].toUpperCase() : null;
|
|
982
|
+
}
|
|
983
|
+
function surnameBlock2(surname) {
|
|
984
|
+
return blockLetters(surname) || null;
|
|
985
|
+
}
|
|
986
|
+
function initialsBlock2(given, surname) {
|
|
987
|
+
const first = firstLetter(given);
|
|
988
|
+
const last = firstLetter(blockLetters(surname));
|
|
989
|
+
return first && last ? first + last : null;
|
|
990
|
+
}
|
|
991
|
+
function metaphoneBlocks2(surname) {
|
|
992
|
+
const letters = blockLetters(surname);
|
|
993
|
+
if (!letters)
|
|
994
|
+
return [];
|
|
995
|
+
const [primary, secondary] = doubleMetaphone2(letters);
|
|
996
|
+
if (!primary)
|
|
997
|
+
return [];
|
|
998
|
+
return secondary && secondary !== primary ? [primary, secondary] : [primary];
|
|
999
|
+
}
|
|
1000
|
+
// src/normalize/name-columns.ts
|
|
1001
|
+
var NAME_LEVEL_COLUMNS2 = [
|
|
1002
|
+
"nn0",
|
|
1003
|
+
"nn1",
|
|
1004
|
+
"nn2",
|
|
1005
|
+
"nn3",
|
|
1006
|
+
"nn4"
|
|
1007
|
+
];
|
|
1008
|
+
var NAME_COLUMNS2 = [
|
|
1009
|
+
...NAME_LEVEL_COLUMNS2,
|
|
1010
|
+
"surname_key",
|
|
1011
|
+
"given_key",
|
|
1012
|
+
"blk_surname",
|
|
1013
|
+
"blk_initials",
|
|
1014
|
+
"blk_metaphone",
|
|
1015
|
+
"blk_metaphone_alt"
|
|
1016
|
+
];
|
|
1017
|
+
function nameColumns2(name) {
|
|
1018
|
+
const person = name.isPerson();
|
|
1019
|
+
const level = (dop) => person ? name[dop] : null;
|
|
1020
|
+
const surname = person ? name.surnameKey() : "";
|
|
1021
|
+
const [metaphone, metaphoneAlt] = metaphoneBlocks2(surname);
|
|
1022
|
+
return {
|
|
1023
|
+
nn0: level("nn0"),
|
|
1024
|
+
nn1: level("nn1"),
|
|
1025
|
+
nn2: level("nn2"),
|
|
1026
|
+
nn3: level("nn3"),
|
|
1027
|
+
nn4: level("nn4"),
|
|
1028
|
+
surname_key: surname || null,
|
|
1029
|
+
given_key: person && name.givenName() || null,
|
|
1030
|
+
blk_surname: surnameBlock2(surname),
|
|
1031
|
+
blk_initials: person ? initialsBlock2(name.givenFields()[0] ?? "", surname) : null,
|
|
1032
|
+
blk_metaphone: metaphone ?? null,
|
|
1033
|
+
blk_metaphone_alt: metaphoneAlt ?? null
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
972
1036
|
// src/normalize/name-format.ts
|
|
973
1037
|
var NAME_FORMATS2 = ["First Last", "Last, First", "Last First"];
|
|
974
1038
|
function nameFormatOrder2(verdict) {
|
|
@@ -1356,7 +1420,7 @@ function deriveNameFormat2(prints, options = {}) {
|
|
|
1356
1420
|
return first;
|
|
1357
1421
|
return scoreReadings(cells.map((c) => readNameCell2(c, { ...options, placeColumn: true })), NAME_FORMAT_MODEL, threshold, schoolRead);
|
|
1358
1422
|
}
|
|
1359
|
-
export { repairMojibake2, sameGivenFamily2, comparePosition2, nameRelation2, nameCompare2, probablySame2, createNameSet2, createNameMap2, createNameClusters2, MAX_READINGS2, surnameParts2, printAttestsOrder2, nameReadings2, meetReading2, refinesReading2, sameReading2, chooseReadingPair2, composeReadings2, composeNames2, meetReadings2, nameMeet2, showReading2, blockKeysOfReadings2, nameBlockKeys2, namesFeasible2, INFEASIBLE_CLASSES2, editDistance2, nearSpelling2, compoundGiven2, middleForm2, infeasibleClass2, isListJoiner2, personList2, NAME_FORMATS2, nameFormatOrder2, ORDER_READINGS2, readNameCell2, DEFAULT_NAME_FORMAT_THRESHOLD2, deriveNameFormat2 };
|
|
1423
|
+
export { repairMojibake2, sameGivenFamily2, comparePosition2, nameRelation2, nameCompare2, probablySame2, createNameSet2, createNameMap2, createNameClusters2, MAX_READINGS2, surnameParts2, printAttestsOrder2, nameReadings2, meetReading2, refinesReading2, sameReading2, chooseReadingPair2, composeReadings2, composeNames2, meetReadings2, nameMeet2, showReading2, blockKeysOfReadings2, nameBlockKeys2, namesFeasible2, INFEASIBLE_CLASSES2, editDistance2, nearSpelling2, compoundGiven2, middleForm2, infeasibleClass2, isListJoiner2, personList2, surnameBlock2, initialsBlock2, metaphoneBlocks2, NAME_LEVEL_COLUMNS2, NAME_COLUMNS2, nameColumns2, NAME_FORMATS2, nameFormatOrder2, ORDER_READINGS2, readNameCell2, DEFAULT_NAME_FORMAT_THRESHOLD2, deriveNameFormat2 };
|
|
1360
1424
|
|
|
1361
|
-
//# debugId=
|
|
1362
|
-
//# sourceMappingURL=index-
|
|
1425
|
+
//# debugId=A39684B9543A024164756E2164756E21
|
|
1426
|
+
//# sourceMappingURL=index-7sppf1vh.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/normalize/name-mojibake.ts", "../src/normalize/given-diminutives.ts", "../src/normalize/name-middle.ts", "../src/normalize/name-compare.ts", "../src/normalize/name-compose.ts", "../src/normalize/name-infeasible.ts", "../src/normalize/person-list.ts", "../src/normalize/name-format.ts"],
|
|
3
|
+
"sources": ["../src/normalize/name-mojibake.ts", "../src/normalize/given-diminutives.ts", "../src/normalize/name-middle.ts", "../src/normalize/name-compare.ts", "../src/normalize/name-compose.ts", "../src/normalize/name-infeasible.ts", "../src/normalize/person-list.ts", "../src/normalize/block-keys.ts", "../src/normalize/name-columns.ts", "../src/normalize/name-format.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * name-mojibake.ts — `repairMojibake`, UTF-8 read as Windows-1252, undone.\n *\n * Some captures decode a UTF-8 page a byte at a time as Windows-1252, so `Ramane`\n * arrives as `Róise`, and some then flatten the no-break space that decode\n * produces, so `Bràch` (`à` is C3 A0) arrives as `Brà ch`. This reads such a\n * value back.\n *\n * ## It is a layer-1 repair, and no level calls it\n *\n * Mojibake is a renderer defect (`docs/NAME-NORMALIZATION.md` § *What causes the\n * edge cases*, cause 2), and D7 forbids the normalizer to repair it: the strict key\n * exists to surface it. `./name-scrub.ts` does not call this and neither does any\n * `PersonName` level. A caller that knows its capture was mis-decoded applies it to\n * the print before the normalizer sees it, or uses it to tell a clean reading of a\n * value from a garbled one (`repairMojibake(v) === v`).\n */\n\n/** Windows-1252's 0x80-0x9F, by the character it decodes to. */\nconst CP1252: ReadonlyMap<string, number> = new Map(\n\t[\n\t\t[0x20ac, 0x80],\n\t\t[0x201a, 0x82],\n\t\t[0x0192, 0x83],\n\t\t[0x201e, 0x84],\n\t\t[0x2026, 0x85],\n\t\t[0x2020, 0x86],\n\t\t[0x2021, 0x87],\n\t\t[0x02c6, 0x88],\n\t\t[0x2030, 0x89],\n\t\t[0x0160, 0x8a],\n\t\t[0x2039, 0x8b],\n\t\t[0x0152, 0x8c],\n\t\t[0x017d, 0x8e],\n\t\t[0x2018, 0x91],\n\t\t[0x2019, 0x92],\n\t\t[0x201c, 0x93],\n\t\t[0x201d, 0x94],\n\t\t[0x2022, 0x95],\n\t\t[0x2013, 0x96],\n\t\t[0x2014, 0x97],\n\t\t[0x02dc, 0x98],\n\t\t[0x2122, 0x99],\n\t\t[0x0161, 0x9a],\n\t\t[0x203a, 0x9b],\n\t\t[0x0153, 0x9c],\n\t\t[0x017e, 0x9e],\n\t\t[0x0178, 0x9f],\n\t].map(([c, b]) => [String.fromCharCode(c as number), b as number]),\n);\n/** Fatal and never streamed, so one decode carries nothing into the next. */\nconst UTF8 = new TextDecoder(\"utf-8\", { fatal: true });\n\n/**\n * THE LEAD BYTES A FLATTENED NO-BREAK SPACE MAY FOLLOW: `Â` to `Å`, C2 to C5, whose pair\n * with A0 is a character of the Latin-1 Supplement or Latin Extended-A (U+00A0 to U+0160), the\n * letters a Latin print carries. `É` (C9) and `Ó` (D3) are not among them: `C9 A0` is UTF-8 for\n * `ɠ` and `D3 A0` for the Cyrillic `Ӡ`, and no print carries either.\n */\nconst A0_LEAD = /^[Â-Å]$/u;\n\n/**\n * UTF-8 READ AS WINDOWS-1252, UNDONE, or the value unchanged. `Róise` is `Ramane`'s bytes read a\n * byte at a time. The value is re-encoded as Windows-1252 and decoded as UTF-8; where that fails\n * (a character 1252 cannot hold, or bytes that are not UTF-8) or changes nothing, the value is\n * what was printed.\n *\n * A no-break space the capture flattened to a space after a lead byte (`Brà ch`, `à` = C3 A0) is\n * read back as A0, ONLY where the lead is one of `A0_LEAD` and stands INSIDE a word: an\n * accented capital followed by a space at a word's start is an INITIAL (`É Mailtina`) or the Irish\n * particle (`Aoife Ó Dornáin`), and reading its space as A0 eats the space and the letter\n * (`ɠMailtina`, `Aoife ӠBriain`).\n *\n * A REPAIR ROUND-TRIPS: every printed character stands for exactly one byte (its Windows-1252\n * byte, or its own code where the capture read the byte as Latin-1, `O` U+0080 U+0099 `Brien`\n * for `O’Brien`), the decode is fatal, and the one byte not printed as itself is an A0 a\n * word-internal space stands for. So the repaired value, encoded as UTF-8 and read a byte at a\n * time, is the print. A STRICT Windows-1252 round trip is deliberately not enforced: the Latin-1\n * readings above are good repairs, and a strict check refuses them.\n */\nexport function repairMojibake(v: string): string {\n\tif (!/[Â-ô]/u.test(v)) return v;\n\tconst bytes: number[] = [];\n\tconst cs = [...v];\n\tfor (let i = 0; i < cs.length; i++) {\n\t\tconst c = cs[i] as string;\n\t\tconst code = c.codePointAt(0) as number;\n\t\tconst mapped = CP1252.get(c);\n\t\tif (mapped !== undefined) bytes.push(mapped);\n\t\telse if (\n\t\t\tcode === 0x20 &&\n\t\t\ti > 1 &&\n\t\t\tA0_LEAD.test(cs[i - 1] as string) &&\n\t\t\t/\\S/u.test(cs[i - 2] as string)\n\t\t) {\n\t\t\tbytes.push(0xa0);\n\t\t} else if (code < 0x100) bytes.push(code);\n\t\telse return v;\n\t}\n\ttry {\n\t\treturn UTF8.decode(new Uint8Array(bytes));\n\t} catch {\n\t\treturn v;\n\t}\n}\n",
|
|
6
6
|
"/**\n * given-diminutives.ts — ONE GIVEN-NAME DIMINUTIVE TABLE, read by the TypeScript side.\n *\n * `./given-diminutives.json` is the table and this file is its reader. A Python linkage\n * lane reads the same JSON for its `givenRoot` comparison level, so the two languages\n * share one copy and no second one exists. An earlier adjudicator carried a `FAMILIAR`\n * map of eight entries and said *\"the name primitives are where it belongs once a second\n * consumer wants one\"*; the teachers-directory gate is that second consumer, and the eight\n * entries are in the table.\n *\n * A RELATION OF A PAIR AND NEVER A KEY. Nothing here rewrites a given name: a stored key,\n * a filing key and every rendering keep the print's own spelling. A caller asks whether\n * TWO given names are one family, at the moment it compares them, and nowhere else, so the\n * root never leaves this module: `sameGivenFamily` is the one export, for that reason.\n *\n * THE GATE READS LESS THAN THE LANE. `families` is the Python lane's table, first root\n * wins, and the lane reads every form in it as evidence below an exact match. A GATE that\n * admits a pair is a stronger claim than a comparison level, so `sameGivenFamily` refuses\n * any pair through a form in `notAtGate`: a name in its own right (`Megan`, `Grace`), a\n * translation (`Sean`, `Padraig`) or another gender's name (`Michelle`, `Patricia`).\n * `Tom` and `Thomas`, `Jenny` and `Jennifer`, `Annie` and `Ann` meet; `Sean` and `John` do\n * not.\n */\n\nimport table from \"./given-diminutives.json\";\n\ninterface Table {\n\tfamilies: Record<string, readonly string[]>;\n\tnotAtGate: readonly string[];\n}\n\nconst TABLE = table as unknown as Table;\n\n/** surface form -> root, each root mapping to itself; the first root a form appears under wins. */\nconst ROOT: ReadonlyMap<string, string> = (() => {\n\tconst out = new Map<string, string>();\n\tfor (const [root, forms] of Object.entries(TABLE.families)) {\n\t\tout.set(root, root);\n\t\tfor (const f of forms) if (!out.has(f)) out.set(f, root);\n\t}\n\treturn out;\n})();\n\nconst NOT_AT_GATE: ReadonlySet<string> = new Set(TABLE.notAtGate);\n\n/**\n * Do two DIFFERENT given names (NN3, letters only) stand for one another at a gate?\n *\n * True exactly when both are in the table, share a root, and neither is a `notAtGate`\n * form. Two equal names answer `false`: equality is the caller's own test and this is the\n * tolerance past it, so a caller can tell which one admitted a pair.\n */\nexport function sameGivenFamily(a: string, b: string): boolean {\n\tif (a === b || NOT_AT_GATE.has(a) || NOT_AT_GATE.has(b)) return false;\n\tconst ra = ROOT.get(a);\n\treturn ra !== undefined && ra === ROOT.get(b);\n}\n",
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
"/**\n * name-compose.ts — COMPOSITIONAL NAMES: readings, slot refinement, and the meet.\n *\n * `docs/NAME-NORMALIZATION.md` § *Compositional names — the relation and the meet* is the\n * specification. The idea in one sentence: *\"Locations are compositional, and names have to\n * be as well. Jane M Doe contains Jane Mary Doe, but not Jane Sally Doe. And Jane Doe\n * contains them all.\"*\n *\n * ## WHY THIS FILE DOES NOT SAY `NameReading`\n *\n * `./name-middle.ts` already owns that word, and it means something else there: NN5's\n * VERDICT about a pair, a relation with the rule that produced it. Here a reading is a way\n * of reading ONE PRINT — the four slots a reader recovered from it. Two different things\n * cannot share one name in one package, and the file that had the word first keeps it, so\n * the record below is a `PrintReading`. Nothing is renamed in `name-middle.ts`; its rule\n * table and its three values are untouched by this file and are DELEGATED to, not forked\n * (`comparePosition`, exported there for exactly this).\n *\n * ## IT IS A RELATION OF A PAIR AND NEVER A FILING KEY\n *\n * Same rule, same reason as NN5's: no row is ever filed under a key; a row is filed for one\n * or more addresses. A composition is not a\n * level, it is not transitive in the way a level must be, and the type-level assertions at\n * the foot of this file are what go red the day somebody tries to key a `NameSet` with one.\n *\n * ## THE VOCABULARY IS THE PLACE RELATION'S, VERBATIM\n *\n * A place relation answers `same | contains | overlaps | conflict | silent` over a set of\n * location chains, and a name is the same shape of object: a set of READINGS, one of which\n * the print meant. So the five words and their reasons are copied rather than re-invented —\n * see `composeReadings` for what was taken and what was not. **Only `conflict` is a veto.\n * Two prints that can be read as one name are never held apart.**\n *\n * ## WHAT IT IS NOT ABOUT\n *\n * Spelling (`Nils`/`Nilo`), nicknames (`Katie`/`Kathleen`) and transliteration are OUT OF\n * SCOPE on purpose. Composition is about what a print LEFT OUT or left ambiguous, never\n * about what it got wrong; those stay the distance and vocabulary levels the linker\n * already has.\n */\n\nimport { isStandaloneNameParticle } from \"../particles/particle-vocabulary.ts\";\nimport type { createNameSet } from \"./name-compare.ts\";\nimport { nameFold } from \"./name-fold.ts\";\nimport { comparePosition } from \"./name-middle.ts\";\nimport type { NamePart, PersonName, TransitiveLevel } from \"./person-name.ts\";\n\n// ─── the types ────────────────────────────────────────────────────────────────\n\n/**\n * Which reader produced a reading. A CLOSED UNION: a reader that is not one of these three\n * does not exist, and adding one is a change to the bound below.\n */\nexport type NameReader = \"as-parsed\" | \"boundary\" | \"order\";\n\n/**\n * What two names say about each other. FIVE ANSWERS, the place relation's own, and only\n * `conflict` is a veto.\n */\nexport type NameComposition = \"same\" | \"contains\" | \"overlaps\" | \"conflict\" | \"silent\";\n\n/**\n * Which side is the LESS SPECIFIC one when the answer is `contains`. `null` for every\n * other answer, since there is no direction to report.\n *\n * `a-contains-b` reads *a is Jane Doe and b is Jane Mary Doe* — the container is the print\n * that left more out, exactly as a country contains a city.\n */\nexport type NameDirection = \"a-contains-b\" | \"b-contains-a\";\n\n/**\n * WHAT THE ANSWER NEEDED. A closed union of the two readers that are not `as-parsed` and\n * the three slot rules that tolerate something. `via` is what a consumer turns into levels;\n * an answer that needed nothing carries an empty list, which is the `same` of two prints\n * that already agreed.\n */\nexport type NameVia = \"middle-absent\" | \"initial\" | \"surname-part\" | \"boundary\" | \"order\";\n\n/** How tolerant each reader is, least first. The meet of two readings takes the last of them. */\nconst READER_RANK: readonly NameReader[] = [\"as-parsed\", \"boundary\", \"order\"];\n\n/** The fixed order `via` is reported in, so two runs print one string. */\nconst VIA_ORDER: readonly NameVia[] = [\n\t\"boundary\",\n\t\"order\",\n\t\"middle-absent\",\n\t\"initial\",\n\t\"surname-part\",\n];\n\n/**\n * ONE READING OF ONE PRINT: the four slots, at the fold NN3 compares at.\n *\n * `surname` is the parts in print order (`[WALTER, ORESKARARD]`), and a hyphen and a space\n * between two parts are THE SAME THING here — see `surnameParts`. `first` is a token, an\n * initial (one letter, which is NN5's own test) or `null` for unknown. `middles` is a list\n * of tokens and initials or `null` for UNPRINTED, which is distinct from \"printed none\":\n * no sheet can say that, so it does not exist and the empty list is never used. `suffixes`\n * are NN2's trailing given fields, compared for equality and never tolerated away.\n */\nexport interface PrintReading {\n\treadonly reader: NameReader;\n\treadonly surname: readonly string[];\n\treadonly first: string | null;\n\treadonly middles: readonly string[] | null;\n\treadonly suffixes: readonly string[];\n}\n\n/** What `composeNames` answers: the relation, the direction, and what it needed. */\nexport interface NameCompositionResult {\n\treadonly composition: NameComposition;\n\treadonly direction: NameDirection | null;\n\treadonly via: readonly NameVia[];\n}\n\n/**\n * What a caller knows about ONE print that the parse does not retain.\n *\n * `orderAttested` is the only one, and it is a parameter because `PersonName` DOES NOT\n * CARRY IT. `personName(print, order)` memoizes on the pair, so the order reached the\n * parse, but the object exposes no member for it and this module does not widen the type —\n * adding one would put another member on the central record for one reader's sake.\n *\n * TWO THINGS ATTEST AN ORDER and a caller may hold either. A COMMA in the print is\n * self-attesting and needs nobody (`printAttestsOrder` below reads it, in the one directory\n * that may look at a separator). A SOURCE that declared its `nameFormat` attests it for\n * every print on that sheet — a declared `\"Last, First\"` or `\"First Last\"` is an order,\n * and `\"unknown\"` is a sheet that declared nothing. The caller holding the sheet's\n * metadata passes it; everyone else gets the comma.\n */\nexport interface ReadingOptions {\n\treadonly orderAttested: boolean;\n}\n\n/** The per-side options `composeNames` and `nameMeet` take. Each side defaults on its own. */\nexport interface ComposeOptions {\n\treadonly a?: ReadingOptions;\n\treadonly b?: ReadingOptions;\n}\n\n/**\n * THE BOUND ON A PRINT'S READINGS, asserted here and measured over a large results\n * corpus. Three readers, and `boundary` and `order` cannot\n * both fire on one print (one wants a middle field, the other wants none), so the reachable\n * maximum is 2 and the ceiling is stated at 4. A reader that pushed a print past\n * it would make the pairwise comparison below quadratic in something unbounded.\n */\nexport const MAX_READINGS = 4;\n\n// ─── the slots ────────────────────────────────────────────────────────────────\n\n/** An NN3-grade fold of one span: what `renderNn3` does to a field, on a span with no separator. */\nconst fold = (s: string): string => nameFold(s).toLocaleUpperCase();\n\n/** An NN3 field standing for a name rather than spelling one. NN5's test, unchanged. */\nconst isInitial = (field: string): boolean => field.length === 1;\n\n/**\n * THE SURNAME AS ITS PARTS, at NN3's fold, in print order.\n *\n * `NamePart.parts` decomposes a root joined by a HYPHEN OR A SPACE, which is the\n * rule for this relation — *a hyphen and a space between parts are the same thing*\n * — held by the type itself, so this reads the leaves and splits nothing of its own.\n *\n * THE PARTICLES GLUE TO THE FIRST PART, which is what NN3 does with them: `de Varra` folds\n * to `DEBURCA` whole. `normalize-name-compose.spec.ts` pins the invariant that says so —\n * `surnameParts(p).join(\"\") === p.surnameKey()` — so this cannot drift into a second fold.\n *\n * A PART THAT IS A PARTICLE GLUES TO THE PART AFTER IT, for the same reason. A hyphen cuts a\n * particle into a part of its own (`El-Varoun` is the parts `El` and `Varoun`), and the particle\n * still governs what follows it, so `El-Varoun`, `El Varoun` and `ElVaroun` all read `[ELVAROUN]` and\n * `De-Ste-Varne` reads `[DESTE, VARNE]`, as `De Ste-Varne` does. A particle part with\n * nothing after it governs nothing and stays a part.\n */\nexport function surnameParts(p: PersonName): readonly string[] {\n\tconst flat = (part: NamePart): string[] =>\n\t\tpart.parts.length > 0 ? part.parts.flatMap(flat) : [part.base];\n\tconst leaves = flat(p.surname);\n\tconst glued: string[] = [];\n\tlet held = \"\";\n\tfor (let i = 0; i < leaves.length; i++) {\n\t\tconst leaf = leaves[i] as string;\n\t\tif (i + 1 < leaves.length && isStandaloneNameParticle(leaf)) {\n\t\t\theld += leaf;\n\t\t\tcontinue;\n\t\t}\n\t\tglued.push(held + leaf);\n\t\theld = \"\";\n\t}\n\tconst tail = glued.map(fold).filter((s) => s !== \"\");\n\tconst head = fold(p.surname.particles.join(\"\"));\n\tif (head === \"\") return tail;\n\treturn tail.length === 0 ? [head] : [head + (tail[0] as string), ...tail.slice(1)];\n}\n\n/** Where the given fields stop being middle names and start being suffixes. NN5's own cut. */\nconst suffixCut = (p: PersonName): number =>\n\tMath.max(1, p.givenFields().length - p.suffixes.length);\n\n/**\n * Does the PRINT itself say which order it is in?\n *\n * A COMMA IS THE SOURCE'S OWN DECLARATION — `name-split.ts` reads it as the order separator\n * and `personName(print, \"surname-first\")` is what a caller holding one does. This asks\n * NN1, the print with only never-information repaired, because NN2 has already moved the\n * fields into their slots and dropped the comma with them.\n *\n * It is the FALLBACK, not the whole answer: a sheet that declared its `nameFormat` attests\n * the order of every print on it, comma or none, and that caller passes `orderAttested`\n * rather than asking here.\n */\nexport function printAttestsOrder(p: PersonName): boolean {\n\treturn /,/.test(p.nn1);\n}\n\n// ─── the readers ──────────────────────────────────────────────────────────────\n\n/**\n * EVERY READING OF ONE PRINT, `as-parsed` first, deterministic, at most `MAX_READINGS`.\n *\n * Each reader is named, is a total function of the parse, and only ever ADDS. Nothing here\n * touches a name separator: every slot is recombined from `PersonName`'s own accessors —\n * `surname.parts`, `givenFields()`, `suffixes` — which is what those accessors exist for.\n *\n * | reader | fires when | what it reads |\n * |---|---|---|\n * | `as-parsed` | always | today's `PersonName`, field for field |\n * | `boundary` | a one-part surname, at least one middle field, the last of them not an initial, no suffix, and no comma in the print | the last middle field joins the FRONT of the surname: `Emily Thuvyrvow Rythham` also reads `{Emily, sur [Thuvyrvow, Rythham]}` |\n * | `order` | exactly one given field, a one-part surname, no suffix, and `orderAttested` false | the two fields swapped: `Jane Doe` also reads `{Doe, sur [Jane]}` |\n *\n * A NON-PERSON HAS NO READINGS AT ALL, and that is what makes it `silent` below rather\n * than equal to every other refusal: every refused print renders one identical NN3, so a\n * relation that read the rendering would make a card number and a regional council one\n * dancer (`./name-middle.ts`, § *a non-person is `different`*).\n *\n * `boundary` FIRES ON A SURNAME-FIRST PRINT TOO where the sheet printed no comma, because\n * `orderAttested` says whether the order is known and not WHICH order it is, and the\n * signature is fixed at that. `KUNDAILLUE BERVMORE LIANA` read surname-first therefore also reads\n * `{Bervmore, sur [Liana, Kundaillue]}`, which no sheet supports. It costs nothing: a reading\n * only ever ADDS a meet, so a junk reading can turn a `conflict` into an `overlaps` and can\n * never turn an agreement into a veto — and measured over a results corpus, that costs zero.\n *\n * THE INITIAL EXCLUSION ON `boundary` IS A DECISION AND NOT AN OVERSIGHT. An initial stands\n * for a given name and no surname is one letter, so promoting the `M` of `SINEAD M MCBIVTON`\n * to the surname manufactures a reading no sheet supports. It costs nothing the motivating\n * examples need — `Thuvyrvow`, `Walter` and `Tunenn` are all full tokens — and it keeps the\n * junk out of the measured price.\n */\nexport function nameReadings(p: PersonName, opts: ReadingOptions): readonly PrintReading[] {\n\tif (!p.isPerson()) return [];\n\tconst given = p.givenFields();\n\tconst cut = suffixCut(p);\n\tconst middles = given.slice(1, cut);\n\tconst suffixes = given.slice(cut);\n\tconst surname = surnameParts(p);\n\tconst first = given[0] ?? null;\n\tconst asParsed: PrintReading = {\n\t\treader: \"as-parsed\",\n\t\tsurname,\n\t\tfirst,\n\t\tmiddles: middles.length === 0 ? null : middles,\n\t\tsuffixes,\n\t};\n\tif (surname.length === 0 && first === null) return [];\n\tconst out: PrintReading[] = [asParsed];\n\n\tconst last = middles[middles.length - 1];\n\tif (\n\t\tsurname.length === 1 &&\n\t\tsuffixes.length === 0 &&\n\t\tlast !== undefined &&\n\t\t!isInitial(last) &&\n\t\t!printAttestsOrder(p)\n\t) {\n\t\tconst kept = middles.slice(0, -1);\n\t\tout.push({\n\t\t\treader: \"boundary\",\n\t\t\tsurname: [last, ...surname],\n\t\t\tfirst,\n\t\t\tmiddles: kept.length === 0 ? null : kept,\n\t\t\tsuffixes,\n\t\t});\n\t}\n\n\tif (\n\t\t!opts.orderAttested &&\n\t\t!printAttestsOrder(p) &&\n\t\tsurname.length === 1 &&\n\t\tsuffixes.length === 0 &&\n\t\tmiddles.length === 0 &&\n\t\tfirst !== null\n\t) {\n\t\tout.push({\n\t\t\treader: \"order\",\n\t\t\tsurname: [first],\n\t\t\tfirst: surname[0] as string,\n\t\t\tmiddles: null,\n\t\t\tsuffixes,\n\t\t});\n\t}\n\n\treturn out.slice(0, MAX_READINGS);\n}\n\n/** `nameReadings` with the comma as the default attestation. */\nconst readingsOf = (p: PersonName, o: ReadingOptions | undefined): readonly PrintReading[] =>\n\tnameReadings(p, o ?? { orderAttested: printAttestsOrder(p) });\n\n// ─── the slot lattice ─────────────────────────────────────────────────────────\n\n/**\n * THE MEET OF TWO `first` SLOTS, or `undefined` where there is none.\n *\n * `unknown ⊒ initial(L) ⊒ token(T)` iff `T` starts with `L`, which is the initial rule and\n * is `comparePosition`'s initial test read as an order rather than as a verdict.\n */\nfunction meetFirst(x: string | null, y: string | null): string | null | undefined {\n\tif (x === null) return y;\n\tif (y === null) return x;\n\treturn comparePosition(x, y) === null ? (x.length >= y.length ? x : y) : undefined;\n}\n\n/**\n * THE MEET OF TWO `middles` SLOTS. `null` (UNPRINTED) meets anything; two printed lists are\n * NN5'S TABLE, position for position and all or nothing, DELEGATED and not forked.\n */\nfunction meetMiddles(\n\tx: readonly string[] | null,\n\ty: readonly string[] | null,\n): readonly string[] | null | undefined {\n\tif (x === null) return y;\n\tif (y === null) return x;\n\tif (x.length !== y.length) return undefined;\n\tconst out: string[] = [];\n\tfor (let i = 0; i < x.length; i++) {\n\t\tconst a = x[i] as string;\n\t\tconst b = y[i] as string;\n\t\tif (comparePosition(a, b) !== null) return undefined;\n\t\tout.push(a.length >= b.length ? a : b);\n\t}\n\treturn out;\n}\n\n/** Is `outer` a sub-multiset of `inner`? `[Walter] ⊒ [Walter, Oreskarard]`. */\nfunction subMultiset(outer: readonly string[], inner: readonly string[]): boolean {\n\tconst left = [...inner];\n\tfor (const part of outer) {\n\t\tconst at = left.indexOf(part);\n\t\tif (at < 0) return false;\n\t\tleft.splice(at, 1);\n\t}\n\treturn true;\n}\n\n/**\n * THE MEET OF TWO SURNAMES: the one with MORE parts, where the other's parts are a\n * sub-multiset of it. An added surname part is relative-or-same and never a conflict\n * (a married or family name adds a part to a surname), so the direction is fixed and only\n * an incomparable pair — `[Walter]` against `[Miller]` — has no meet.\n */\nfunction meetSurname(x: readonly string[], y: readonly string[]): readonly string[] | undefined {\n\tif (subMultiset(x, y)) return y;\n\tif (subMultiset(y, x)) return x;\n\treturn undefined;\n}\n\n/**\n * THE MEET OF TWO READINGS: the most specific reading both prints support, slot by slot, or\n * `null` where some slot has none. Suffixes are EQUALITY and are not a lattice: `Jr` exists\n * to tell two people apart, so a print that carries one and a print that does not are not\n * one print being terse (`./name-middle.ts`, § *a suffix is not a middle name*).\n */\nexport function meetReading(x: PrintReading, y: PrintReading): PrintReading | null {\n\tif (x.suffixes.length !== y.suffixes.length) return null;\n\tif (!x.suffixes.every((s, i) => s === y.suffixes[i])) return null;\n\tconst surname = meetSurname(x.surname, y.surname);\n\tif (surname === undefined) return null;\n\tconst first = meetFirst(x.first, y.first);\n\tif (first === undefined) return null;\n\tconst middles = meetMiddles(x.middles, y.middles);\n\tif (middles === undefined) return null;\n\treturn {\n\t\t// THE MEET INHERITS THE MORE TOLERANT READER, so a meet fed back in still says what\n\t\t// it took to get there. It is read off a fixed RANK and not off the argument order,\n\t\t// because the meet is commutative and a field that flipped with the arguments would\n\t\t// make two equal meets print differently.\n\t\treader: READER_RANK.indexOf(x.reader) >= READER_RANK.indexOf(y.reader) ? x.reader : y.reader,\n\t\tsurname,\n\t\tfirst,\n\t\tmiddles,\n\t\tsuffixes: x.suffixes,\n\t};\n}\n\n/**\n * Is `outer` at least as unspecific as `inner` — does `outer ⊒ inner` hold?\n *\n * EXPORTED so that a measurement can print the SUPERSEDED both-halves quantifier beside\n * the current answer without a second copy of the order.\n */\nexport function refinesReading(outer: PrintReading, inner: PrintReading): boolean {\n\tconst m = meetReading(outer, inner);\n\treturn m !== null && sameReading(m, inner);\n}\n\n/** Two readings are the same reading when every slot is equal. The reader is not a slot. */\nexport function sameReading(x: PrintReading, y: PrintReading): boolean {\n\tconst list = (a: readonly string[] | null, b: readonly string[] | null): boolean =>\n\t\ta === null || b === null ? a === b : a.length === b.length && a.every((v, i) => v === b[i]);\n\treturn (\n\t\tx.first === y.first &&\n\t\tlist(x.surname, y.surname) &&\n\t\tlist(x.middles, y.middles) &&\n\t\tlist(x.suffixes, y.suffixes)\n\t);\n}\n\n// ─── the relation ─────────────────────────────────────────────────────────────\n\n/**\n * WHAT ONE COMPARISON NEEDED: the readers the chosen pair used, and the slot rules it\n * exercised. `via` is what the consumers turn into levels, which is why \"contains via\n * `boundary`\" has to be distinguishable from a plain `contains` — they are two different\n * levels for the linker to estimate m and u on, not two spellings of one.\n */\nfunction viaOf(x: PrintReading, y: PrintReading): NameVia[] {\n\tconst out: NameVia[] = [];\n\tif (x.reader !== \"as-parsed\") out.push(x.reader);\n\tif (y.reader !== \"as-parsed\") out.push(y.reader);\n\tif ((x.middles === null) !== (y.middles === null)) out.push(\"middle-absent\");\n\tconst pairs: [string | null, string | null][] = [[x.first, y.first]];\n\tif (x.middles !== null && y.middles !== null && x.middles.length === y.middles.length) {\n\t\tfor (let i = 0; i < x.middles.length; i++) {\n\t\t\tpairs.push([x.middles[i] as string, y.middles[i] as string]);\n\t\t}\n\t}\n\tfor (const [l, r] of pairs) {\n\t\tif (l === null || r === null) continue;\n\t\tif (l !== r && (isInitial(l) || isInitial(r))) out.push(\"initial\");\n\t}\n\tif (x.surname.length !== y.surname.length) out.push(\"surname-part\");\n\treturn out;\n}\n\nconst orderVia = (found: ReadonlySet<NameVia>): readonly NameVia[] =>\n\tVIA_ORDER.filter((v) => found.has(v));\n\n/** The ladder, best first. `silent` is not on it: it is the answer when there is no pair at all. */\nconst LADDER: readonly Exclude<NameComposition, \"silent\">[] = [\n\t\"same\",\n\t\"contains\",\n\t\"overlaps\",\n\t\"conflict\",\n];\n\n/** One pair of readings, and everything the answer is read off it. */\nexport interface ReadingPair {\n\treadonly a: PrintReading;\n\treadonly b: PrintReading;\n\treadonly composition: Exclude<NameComposition, \"silent\">;\n\treadonly direction: NameDirection | null;\n\t/** the most specific reading both sides of THIS pair support; `null` iff `conflict` */\n\treadonly meet: PrintReading | null;\n}\n\n/** What ONE pair of readings says. The four-way ladder, on two readings and nothing else. */\nfunction relateOnePair(x: PrintReading, y: PrintReading): ReadingPair {\n\tconst meet = meetReading(x, y);\n\tif (meet === null) return { a: x, b: y, composition: \"conflict\", direction: null, meet };\n\tif (sameReading(x, y)) return { a: x, b: y, composition: \"same\", direction: null, meet };\n\tif (sameReading(meet, y)) {\n\t\treturn { a: x, b: y, composition: \"contains\", direction: \"a-contains-b\", meet };\n\t}\n\tif (sameReading(meet, x)) {\n\t\treturn { a: x, b: y, composition: \"contains\", direction: \"b-contains-a\", meet };\n\t}\n\treturn { a: x, b: y, composition: \"overlaps\", direction: null, meet };\n}\n\n/** How many readers a pair had to invoke. Zero is `as-parsed` against `as-parsed`. */\nconst readersUsed = (p: ReadingPair): number =>\n\t(p.a.reader === \"as-parsed\" ? 0 : 1) + (p.b.reader === \"as-parsed\" ? 0 : 1);\n\n/**\n * THE ANSWER COMES FROM ONE CHOSEN PAIR OF READINGS.\n *\n * ## WHAT WAS TAKEN FROM THE PLACE RELATION AND WHAT WAS NOT\n *\n * TAKEN: the five words — `same | contains | overlaps | conflict | silent`; **only\n * `conflict` is a veto, and two prints that can be read as one name are never held apart**;\n * and `silent` for a side that names no person, which is NOT reflexive, because every\n * refused print renders one identical NN3 and a relation that read the rendering would make\n * a card number and a regional council one dancer.\n *\n * NOT TAKEN: the BOTH-HALVES containment quantifier. Place needs it\n * because the place relation VETOES — an ambiguous side that also holds a conflicting chain\n * must not report the stronger relation, or a gate lets through what a chain of it denies.\n * This relation does not veto. It is a LEVEL, and the ambiguity Place has to guard against\n * is already CARRIED, by name, in `via`: `contains` via `boundary` says in the answer that a\n * reader had to be invoked to reach it, so a consumer estimating m and u sees the two cases\n * apart instead of having them collapsed into one weaker word.\n *\n * The quantifier cost the motivating sentence. *\"Jane M Doe contains Jane Mary Doe, but not\n * Jane Sally Doe. And Jane Doe contains them all.\"* Under both halves the first of those is\n * `overlaps`, because `Jane Mary Doe` carries a `boundary` reading that `Jane M Doe` — whose\n * only middle is an initial — has nothing to put under it. Under this rule it is `contains`,\n * and `Jane Sally Doe` still is not.\n *\n * ## THE CHOICE, AND WHY IT IS DETERMINISTIC\n *\n * Every pair of readings is evaluated, and the BEST by the ladder wins: `same` beats\n * `contains` beats `overlaps` beats `conflict`. `conflict` therefore still means EVERY pair\n * conflicts, which is what keeps the veto exactly where it was.\n *\n * Ties are broken in this order, and every step of it is symmetric in the two sides, so\n * `composeReadings(a, b)` and `composeReadings(b, a)` choose the SAME pair:\n *\n * 1. FEWEST READERS USED. Zero is `as-parsed` against `as-parsed`, so \"prefer the two\n * prints as they were parsed\" is the first clause rather than a separate one.\n * 2. THE RENDERED READINGS, sorted and compared as an unordered pair. It is a total order\n * on the pair and not on the arguments, which is what makes the choice symmetric.\n */\nexport function chooseReadingPair(\n\tra: readonly PrintReading[],\n\trb: readonly PrintReading[],\n): ReadingPair | null {\n\tlet best: ReadingPair | null = null;\n\tlet bestScore: [number, number, string, string] | null = null;\n\tfor (const x of ra) {\n\t\tfor (const y of rb) {\n\t\t\tconst pair = relateOnePair(x, y);\n\t\t\tconst keys = [showReading(x), showReading(y)].sort();\n\t\t\tconst score: [number, number, string, string] = [\n\t\t\t\tLADDER.indexOf(pair.composition),\n\t\t\t\treadersUsed(pair),\n\t\t\t\tkeys[0] as string,\n\t\t\t\tkeys[1] as string,\n\t\t\t];\n\t\t\tif (bestScore === null || less(score, bestScore)) {\n\t\t\t\tbest = pair;\n\t\t\t\tbestScore = score;\n\t\t\t}\n\t\t}\n\t}\n\treturn best;\n}\n\n/** Lexicographic, on the four-part score above. Lower wins. */\nfunction less(x: [number, number, string, string], y: [number, number, string, string]): boolean {\n\tfor (let i = 0; i < 4; i++) {\n\t\tif (x[i] === y[i]) continue;\n\t\treturn (x[i] as number | string) < (y[i] as number | string);\n\t}\n\treturn false;\n}\n\n/**\n * THE RELATION BETWEEN TWO SETS OF READINGS, from the one pair `chooseReadingPair` picks.\n *\n * `silent` where either side has no reading at all. `via` is empty on a `conflict`: nothing\n * was tolerated, because nothing agreed.\n */\nexport function composeReadings(\n\tra: readonly PrintReading[],\n\trb: readonly PrintReading[],\n): NameCompositionResult {\n\tconst pair = chooseReadingPair(ra, rb);\n\tif (pair === null) return { composition: \"silent\", direction: null, via: [] };\n\tif (pair.composition === \"conflict\") {\n\t\treturn { composition: \"conflict\", direction: null, via: [] };\n\t}\n\treturn {\n\t\tcomposition: pair.composition,\n\t\tdirection: pair.direction,\n\t\tvia: orderVia(new Set(viaOf(pair.a, pair.b))),\n\t};\n}\n\n/**\n * WHAT TWO PRINTS SAY ABOUT EACH OTHER.\n *\n * `silent` where either names no person, AND A NON-PERSON IS NOT REFLEXIVE: a refusal\n * against itself is `silent`, never `same`.\n */\nexport function composeNames(\n\ta: PersonName,\n\tb: PersonName,\n\topts?: ComposeOptions,\n): NameCompositionResult {\n\treturn composeReadings(readingsOf(a, opts?.a), readingsOf(b, opts?.b));\n}\n\n// ─── the meet ─────────────────────────────────────────────────────────────────\n\n/**\n * THE MOST SPECIFIC NAME BOTH PRINTS SUPPORT, `null` exactly when the relation is\n * `conflict`. It is the meet OF THE CHOSEN PAIR, so the relation, the direction, `via` and\n * the meet are all read off one pair of readings and cannot disagree about which reading of\n * each print the answer was about.\n *\n * IT IS A LIST OF ONE. The shape is kept because a caller holds readings, not readings-or-a-\n * reading, and because the day a tie is resolved by carrying both alternatives forward is a\n * change to this function and not to every caller's type.\n *\n * THIS IS WHAT FIXES NN5'S NON-TRANSITIVITY WITHOUT A KEY, for a PAIR. For a SET — an\n * identity — the binary meet is the wrong tool and `namesFeasible` below is the right one;\n * see its docblock, and the named test in `normalize-name-compose.spec.ts` that pins why.\n */\nexport function meetReadings(\n\tra: readonly PrintReading[],\n\trb: readonly PrintReading[],\n): readonly PrintReading[] | null {\n\tconst pair = chooseReadingPair(ra, rb);\n\tif (pair === null || pair.meet === null) return null;\n\treturn [pair.meet];\n}\n\n/** `meetReadings` over two prints. `null` exactly when `composeNames` says `conflict`. */\nexport function nameMeet(\n\ta: PersonName,\n\tb: PersonName,\n\topts?: ComposeOptions,\n): readonly PrintReading[] | null {\n\treturn meetReadings(readingsOf(a, opts?.a), readingsOf(b, opts?.b));\n}\n\n/** One reading as a citable string, for a measurement line and a failure message. Never a key. */\nexport function showReading(r: PrintReading): string {\n\tconst mid = r.middles === null ? \"-\" : r.middles.join(\"<\");\n\tconst suf = r.suffixes.length === 0 ? \"\" : `<${r.suffixes.join(\"<\")}`;\n\treturn `${r.surname.join(\"-\")}<<${r.first ?? \"?\"}|${mid}${suf}[${r.reader}]`;\n}\n\n/* ─── the candidate keys ────────────────────────────────────────────────────── */\n\n/**\n * THE SEPARATOR INSIDE ONE CANDIDATE KEY, and it is not one of the three a hand split\n * would cut on. `<`, `<<` and `,` partition a STORED NAME and only `./name-split.ts`\n * may read them; this character joins two things that were never one string, is never read\n * back, and exists so that `MAILTINA` with an `A` cannot collide with `SMITHA` with nothing.\n */\nconst BLOCK_KEY_JOIN = \"|\";\n\n/**\n * ONE CANDIDATE KEY PER (SURNAME PART, FIRST-GIVEN INITIAL) PER READING.\n *\n * A BLOCKING KEY GENERATES CANDIDATES AND NEVER MATCHES, so this is not\n * a fold, not a filing key and not an answer: two prints that share a key are two prints a\n * linker may now compare, and `composeNames` is what then says whether they compose.\n *\n * IT IS EXACTLY THE NECESSARY CONDITION FOR A NON-CONFLICT, which is why it is this pair of\n * things and not some other pair. `meetSurname` needs one side's parts to be a sub-multiset\n * of the other's, so two names that do not conflict SHARE A SURNAME PART unless one of them\n * has none; and `meetFirst` needs the two `first` slots to refine, which for two printed\n * tokens means one is an initial of the other and therefore that THE FIRST LETTER AGREES.\n * So every pair this key set misses is a pair `composeNames` would have called `conflict`,\n * and the generator and the comparison cannot disagree about which pairs are worth asking\n * about.\n *\n * `first` UNKNOWN KEYS ON THE PART ALONE. A reading with no given field at all refines with\n * every initial, and one key cannot equal all of them; the empty initial is what it gets,\n * which reaches the other prints that also printed no given field.\n *\n * Deduplicated and sorted, so two runs write one list and a DuckDB `list_has_any` reads a\n * stable one.\n */\nexport function blockKeysOfReadings(readings: readonly PrintReading[]): string[] {\n\tconst out = new Set<string>();\n\tfor (const r of readings) {\n\t\tconst initial = r.first === null ? \"\" : (r.first[0] as string);\n\t\tfor (const part of r.surname) out.add(`${part}${BLOCK_KEY_JOIN}${initial}`);\n\t}\n\treturn [...out].sort();\n}\n\n/** `blockKeysOfReadings` over one print. `[]` for a print that names no person. */\nexport function nameBlockKeys(p: PersonName, opts?: ReadingOptions): readonly string[] {\n\treturn blockKeysOfReadings(readingsOf(p, opts));\n}\n\n// ─── feasibility of a SET of prints ───────────────────────────────────────────\n\n/**\n * Which readings may ATTEST the surname a set of prints folds to.\n *\n * `as-parsed` — THE DEFAULT — means the compound must have been PRINTED: `Annika\n * Walter-Oreskarard` carries its hyphen, so the bridge is a fact about a sheet. `any` lets a\n * `boundary` reading bridge too, which is what the rule says literally.\n *\n * THE TWO SETTINGS ANSWER TWO OF THE FOUR LAWS DIFFERENTLY, and neither setting\n * answers both. Under `any`, feasibility for a PAIR is exactly `relation !== \"conflict\"` —\n * and `{Emma Mailtina, Emma Jane Mailtina, Emma Kate Mailtina}` comes out FEASIBLE, because the\n * boundary reader reads `Emma Jane Mailtina` as `Emma Jane-Mailtina` and that manufactured compound\n * bridges `Kate` in. Under `as-parsed` the triple is infeasible, as it must be, and the\n * pair equivalence weakens to one direction: feasible still implies the relation is not a\n * conflict, but `{Jane M Doe, Jane Sally Doe}` is `overlaps` and infeasible.\n *\n * `as-parsed` IS THE DEFAULT BECAUSE THIS IS A GATE AND NOT A LEVEL. A gate vetoes; the cost\n * of a guessed bridge is a false merge, which is the thing that triple names. A level\n * may be generous because the stats sort it out, and `composeNames` stays generous. Both\n * settings are kept so both can be counted over known identities, because a measurement is\n * the only thing that can settle whether the gate can ever be a veto.\n */\nexport type Attester = \"any\" | \"as-parsed\";\n\nexport interface FeasibilityOptions {\n\t/** default `as-parsed` (a surname part is attested only by an as-parsed reading); `any` is the rule as first written, kept so a measurement can count both */\n\treadonly attester?: Attester;\n\t/** per-print reading options, in `names` order; each defaults to the comma */\n\treadonly readings?: readonly ReadingOptions[];\n}\n\n/** Which print attested the folded surname, and with which reader. */\nexport interface Bridge {\n\t/** index into the `names` argument */\n\treadonly index: number;\n\treadonly reader: NameReader;\n\treadonly surname: readonly string[];\n}\n\nexport interface Feasibility {\n\treadonly feasible: boolean;\n\t/** the identity's name, where one exists: the attested surname over the folded slots */\n\treadonly name: PrintReading | null;\n\treadonly bridge: Bridge | null;\n\t/** the prints that carried no reading at all, by index — they take no part */\n\treadonly silent: readonly number[];\n}\n\n/** The three slots that DO form a meet-semilattice, folded across a set. */\ninterface Slots {\n\treadonly first: string | null;\n\treadonly middles: readonly string[] | null;\n\treadonly suffixes: readonly string[];\n}\n\nconst slotsOf = (r: PrintReading): Slots => ({\n\tfirst: r.first,\n\tmiddles: r.middles,\n\tsuffixes: r.suffixes,\n});\n\nconst slotKey = (s: Slots): string =>\n\t`${s.first ?? \"?\"}|${s.middles === null ? \"-\" : s.middles.join(\"<\")}|${s.suffixes.join(\"<\")}`;\n\n/** The meet of two slot triples, or `undefined` where they have none. */\nfunction meetSlots(x: Slots, y: Slots): Slots | undefined {\n\tif (x.suffixes.length !== y.suffixes.length) return undefined;\n\tif (!x.suffixes.every((v, i) => v === y.suffixes[i])) return undefined;\n\tconst first = meetFirst(x.first, y.first);\n\tif (first === undefined) return undefined;\n\tconst middles = meetMiddles(x.middles, y.middles);\n\tif (middles === undefined) return undefined;\n\treturn { first, middles, suffixes: x.suffixes };\n}\n\n/**\n * COULD THESE PRINTS ALL BE ONE DANCER?\n *\n * ## THE BINARY MEET IS THE WRONG TOOL FOR AN IDENTITY, AND THIS IS WHY\n *\n * `nameMeet` is PARTIAL ON SURNAMES and therefore not associative: `[Walter]` and\n * `[Oreskarard]` are incomparable under sub-multiset inclusion and this file rules an\n * incomparable pair a CONFLICT, though both sit above `[Walter, Oreskarard]`. So folding a\n * set pairwise gives an answer that depends on the order it was folded in, and\n * `normalize-name-compose.spec.ts` pins that as a named test rather than as a failing law.\n * **Feasibility of a SET is a predicate over the set, not a fold of its pairs.**\n *\n * The domain fact it has to get right: `Annika Walter`, `Annika Oreskarard` and `Annika\n * Walter-Oreskarard` are ONE dancer; `Walter` against `Oreskarard` alone must still conflict;\n * and the compound print is the BRIDGE that makes the three feasible together.\n *\n * ## THE RULE\n *\n * A set is feasible iff there is a choice of ONE READING PER PRINT such that\n *\n * 1. the UNION of the chosen surname parts is ATTESTED — it equals the surname of at least\n * one chosen reading (see `Attester` for which readings may do the attesting); and\n * 2. the `first`, `middles` and `suffix` slots of the chosen readings have a COMMON\n * REFINEMENT, which they do or do not because those three ARE a meet-semilattice and\n * may simply be folded.\n *\n * ATTESTED-UNION IS ORDER-INDEPENDENT BY CONSTRUCTION: the union is a set operation and the\n * attester is an existential over the same choice, so no permutation of `names` can change\n * the answer. That is the property the binary fold could not have.\n *\n * ## THE SEARCH IS BOUNDED AND IS NOT A PRODUCT OVER PRINTS\n *\n * The union must EQUAL some chosen reading's surname, so the candidate unions are exactly\n * the readings in play — at most `MAX_READINGS` per print, and measured over a results\n * corpus no print reaches three. For each candidate surname `S`, every print keeps only its\n * readings whose surname is a sub-multiset of `S`, and the three folding slots are carried\n * forward as a DEDUPLICATED set of partial folds. Distinct prints are folded once. So the cost is\n * linear in the prints times the small number of distinct partial folds, and a 200-print\n * identity is not 4^200 anything.\n *\n * NOTHING IS WIRED TO IT. This is the function a cluster gate would call, and a gate vetoes\n * where a level does not, so it does not become one until a measurement says the veto costs\n * nothing.\n */\nexport function namesFeasible(\n\tnames: readonly PersonName[],\n\topts?: FeasibilityOptions,\n): Feasibility {\n\tconst attester: Attester = opts?.attester ?? \"as-parsed\";\n\tconst silent: number[] = [];\n\tconst perPrint: { index: number; readings: readonly PrintReading[] }[] = [];\n\tconst seen = new Map<string, number>();\n\tfor (let i = 0; i < names.length; i++) {\n\t\tconst p = names[i] as PersonName;\n\t\tconst rs = readingsOf(p, opts?.readings?.[i]);\n\t\tif (rs.length === 0) {\n\t\t\tsilent.push(i);\n\t\t\tcontinue;\n\t\t}\n\t\t// DISTINCT PRINTS ONLY. Two rows printing one name are one constraint, and an identity\n\t\t// is mostly one name printed many times.\n\t\tconst key = rs.map(showReading).join(\"\\u0000\");\n\t\tconst at = seen.get(key);\n\t\tif (at !== undefined) continue;\n\t\tseen.set(key, i);\n\t\tperPrint.push({ index: i, readings: rs });\n\t}\n\tif (perPrint.length === 0) {\n\t\treturn { feasible: false, name: null, bridge: null, silent };\n\t}\n\n\tconst mayAttest = (r: PrintReading): boolean => attester === \"any\" || r.reader === \"as-parsed\";\n\n\tlet bestBridge: Bridge | null = null;\n\tlet bestName: PrintReading | null = null;\n\tfor (const cand of perPrint) {\n\t\tfor (const r of cand.readings) {\n\t\t\tif (!mayAttest(r)) continue;\n\t\t\tconst folded = foldUnder(perPrint, r.surname);\n\t\t\tif (folded === null) continue;\n\t\t\tconst bridge: Bridge = { index: cand.index, reader: r.reader, surname: r.surname };\n\t\t\t// THE FIRST BRIDGE IN A DETERMINISTIC ORDER, and `as-parsed` beats a reader, so the\n\t\t\t// answer names the least speculative bridge that works.\n\t\t\tif (bestBridge === null || rank(bridge) < rank(bestBridge)) {\n\t\t\t\tbestBridge = bridge;\n\t\t\t\tbestName = { reader: r.reader, surname: r.surname, ...folded };\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tfeasible: bestBridge !== null,\n\t\tname: bestName,\n\t\tbridge: bestBridge,\n\t\tsilent,\n\t};\n}\n\nconst rank = (b: Bridge): number => (b.reader === \"as-parsed\" ? 0 : 1) * 1e9 + b.index;\n\n/**\n * Fold every print under one candidate surname, or `null` where some print cannot join.\n *\n * Each print keeps the readings whose surname is a sub-multiset of `S` — anything else would\n * put a part in the union that `S` does not carry, and then `S` is not the union. The three\n * lattice slots are folded as a SET of partial results, deduplicated on their rendering, so\n * two readings that agree on the three slots cost nothing.\n */\nfunction foldUnder(\n\tprints: readonly { index: number; readings: readonly PrintReading[] }[],\n\tsurname: readonly string[],\n): Slots | null {\n\tlet states: Map<string, Slots> | null = null;\n\tlet covered = false;\n\tfor (const p of prints) {\n\t\tconst usable = p.readings.filter((r) => subMultiset(r.surname, surname));\n\t\tif (usable.length === 0) return null;\n\t\tif (usable.some((r) => r.surname.length === surname.length)) covered = true;\n\t\tconst next = new Map<string, Slots>();\n\t\tfor (const r of usable) {\n\t\t\tconst s = slotsOf(r);\n\t\t\tif (states === null) {\n\t\t\t\tnext.set(slotKey(s), s);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (const prev of states.values()) {\n\t\t\t\tconst m = meetSlots(prev, s);\n\t\t\t\tif (m !== undefined) next.set(slotKey(m), m);\n\t\t\t}\n\t\t}\n\t\tif (next.size === 0) return null;\n\t\tstates = next;\n\t}\n\t// THE UNION MUST BE THE CANDIDATE AND NOT A SUBSET OF IT: some chosen reading has to\n\t// actually carry every part of `S`, which is the attester itself, so a candidate no print\n\t// can reach in full is not a union of anything.\n\tif (states === null || !covered) return null;\n\t// THE FOLD REPORTED IS A WITNESS AND THERE MAY BE SEVERAL, so it is the one that CLAIMS\n\t// THE LEAST — fewest middle fields first, then the rendering — rather than whichever the\n\t// map happened to hold first. Feasibility does not depend on the choice; the name printed\n\t// beside it does.\n\treturn [...states.values()].sort((x, y) => {\n\t\tconst mx = x.middles === null ? -1 : x.middles.length;\n\t\tconst my = y.middles === null ? -1 : y.middles.length;\n\t\treturn mx - my || (slotKey(x) < slotKey(y) ? -1 : 1);\n\t})[0] as Slots;\n}\n\n// ─── the rule, asserted in typechecked source ─────────────────────────────────\n\n/**\n * THE RULE, ASSERTED IN TYPECHECKED SOURCE, in NN5's style and for NN5's reason.\n *\n * No row is ever filed under a key; a row is filed for one or more addresses. A composition\n * is an answer about a PAIR. `bun run typecheck` reads these and no spec file in this repo is\n * wired to; they are exported because an unexported alias nothing references is one\n * `noUnusedLocals` away from being deleted as dead.\n */\ntype AssertTrue<T extends true> = T;\n\n/** A composition is not one of the levels equality partitions the corpus at. */\nexport type CompositionIsNotATransitiveLevel = AssertTrue<\n\tNameComposition extends TransitiveLevel ? false : true\n>;\n\n/** ...and so it cannot be handed to the hash structures, which take a `TransitiveLevel`. */\nexport type CompositionCannotKeyANameSet = AssertTrue<\n\tNameComposition extends Parameters<typeof createNameSet>[0] ? false : true\n>;\n\n/** A composition is a relation between two parses, so no parse carries one. */\nexport type CompositionIsNotAMemberOfAParse = AssertTrue<\n\t\"composition\" extends keyof PersonName ? false : true\n>;\n\n/** Nor is a reading: a print's readings are derived on demand and never stored on it. */\nexport type ReadingsAreNotAMemberOfAParse = AssertTrue<\n\t\"readings\" extends keyof PersonName ? false : true\n>;\n",
|
|
10
10
|
"/**\n * name-infeasible.ts — WHICH OF THREE THINGS AN INFEASIBLE SET OF PRINTS IS.\n *\n * The four functions below were first written and measured in a census over a large results\n * corpus. A linkage evaluator wants the same counts over a run's own identities, and two copies\n * of one classification drift apart, so there is exactly one and both import it.\n * `test/normalize-name-infeasible.spec.ts` pins one planted row per branch.\n *\n * WHY IT IS HERE AND NOT BESIDE `namesFeasible`. `./name-compose.ts` is about what a print\n * LEFT OUT, and it says so: spelling, nicknames and transliteration are out of its scope on\n * purpose. This file is the OTHER side of that line — it exists to say *this refusal is a\n * spelling question and composition was never going to answer it* — so it reaches for an\n * edit distance, which `name-compose.ts` must not. It is in `src/normalize/` because\n * `middleForm` renders a `<`-joined middle form, and this is the one directory that may.\n *\n * IT CLASSIFIES AND IT DECIDES NOTHING. `namesFeasible` is not a veto, and neither is\n * this: the linkage evaluator REPORTS these counts and no clustering step reads them.\n */\n\nimport { surnameParts } from \"./name-compose.ts\";\nimport type { PersonName } from \"./person-name.ts\";\n\n/**\n * The three things an infeasible set is, and only the first argues for a veto.\n *\n * `merge?` two names that are not one name: a gate would have caught a false merge\n * `spelling` one name misspelt, which is OUT OF SCOPE on purpose — the distance\n * and vocabulary levels the linker already has are what answer those\n * `rule-gap` a shape the readers do not reach. The one the census finds is the\n * HYPHENATED GIVEN NAME: `Torva-Quessa Fairrow` beside `Torva Fairrow` needs a reader\n * that splits a compound FORENAME the way `boundary` splits a compound surname,\n * and there is none.\n */\nexport type InfeasibleClass = \"merge?\" | \"spelling\" | \"rule-gap\";\n\nexport const INFEASIBLE_CLASSES = [\"merge?\", \"spelling\", \"rule-gap\"] as const;\n\n/** Levenshtein, bounded by the strings it is given — these are name fields, not documents. */\nexport function editDistance(a: string, b: string): number {\n\tconst prev: number[] = Array.from({ length: b.length + 1 }, (_, i) => i);\n\tconst cur: number[] = new Array(b.length + 1).fill(0);\n\tfor (let i = 1; i <= a.length; i++) {\n\t\tcur[0] = i;\n\t\tfor (let j = 1; j <= b.length; j++) {\n\t\t\tconst sub = (prev[j - 1] as number) + (a[i - 1] === b[j - 1] ? 0 : 1);\n\t\t\tcur[j] = Math.min(sub, (prev[j] as number) + 1, (cur[j - 1] as number) + 1);\n\t\t}\n\t\tfor (let j = 0; j <= b.length; j++) prev[j] = cur[j] as number;\n\t}\n\treturn prev[b.length] as number;\n}\n\n/**\n * ARE THESE TWO FIELDS THE SAME NAME MISSPELT? One edit on a short field, two on a longer\n * one, and the first letter has to hold — `KESTROM`/`KESTRON` and `TORVEN`/`TORRVEN` are\n * spellings, `MIA`/`MILLIE` is not.\n */\nexport function nearSpelling(a: string, b: string): boolean {\n\tif (a[0] !== b[0]) return false;\n\tconst budget = Math.max(a.length, b.length) >= 6 ? 2 : 1;\n\treturn editDistance(a, b) <= budget;\n}\n\n/** Is the longer field the shorter one plus a whole second given name? `FREYA` -> `FREYARAE`. */\nexport const compoundGiven = (a: string, b: string): boolean => {\n\tconst [short, long] = a.length <= b.length ? [a, b] : [b, a];\n\treturn long.startsWith(short) && long.length - short.length >= 3;\n};\n\n/** The NN3 middle form of a parse, suffixes excluded — the middle-name census's own cut. */\nexport function middleForm(p: PersonName): string {\n\tconst given = p.givenFields();\n\treturn given.slice(1, Math.max(1, given.length - p.suffixes.length)).join(\"<\");\n}\n\nconst allPairs = (xs: readonly string[], f: (a: string, b: string) => boolean): boolean => {\n\tfor (let i = 0; i < xs.length; i++) {\n\t\tfor (let j = i + 1; j < xs.length; j++) {\n\t\t\tif (!f(xs[i] as string, xs[j] as string)) return false;\n\t\t}\n\t}\n\treturn true;\n};\n\nconst anyPair = (xs: readonly string[], f: (a: string, b: string) => boolean): boolean => {\n\tfor (let i = 0; i < xs.length; i++) {\n\t\tfor (let j = i + 1; j < xs.length; j++) {\n\t\t\tif (f(xs[i] as string, xs[j] as string)) return true;\n\t\t}\n\t}\n\treturn false;\n};\n\n/**\n * WHICH OF THE THREE AN INFEASIBLE SET IS, decided mechanically off the prints.\n *\n * The first given decides first, because a set that cannot agree on it is not a set of one\n * dancer's prints whatever its surnames do. Then the surnames. Then, with one surname and\n * one first given, the refusal is in the MIDDLE fields: a misspelt middle\n * (`CORVAN`/`CORVANN`) is a spelling, and two different middle names on prints already filed as\n * one dancer (`Ruth Eleanor Selvage` / `Ruth Tunenn Selvage`) is a rule gap, because the\n * boundary reader reaches it only when the surname has one part to grow.\n */\nexport function infeasibleClass(names: readonly PersonName[]): InfeasibleClass {\n\tconst surnames = [...new Set(names.map((p) => surnameParts(p).join(\"-\")))];\n\tconst firsts = [...new Set(names.map((p) => p.givenFields()[0] ?? \"\"))];\n\tif (firsts.length > 1) {\n\t\tif (anyPair(firsts, compoundGiven)) return \"rule-gap\";\n\t\tif (allPairs(firsts, nearSpelling)) return \"spelling\";\n\t\treturn \"merge?\";\n\t}\n\tif (surnames.length > 1) {\n\t\tif (allPairs(surnames, nearSpelling)) return \"spelling\";\n\t\treturn \"merge?\";\n\t}\n\tconst middles = [...new Set(names.map(middleForm))].filter((f) => f !== \"\");\n\tif (middles.length > 1 && allPairs(middles, nearSpelling)) return \"spelling\";\n\treturn \"rule-gap\";\n}\n",
|
|
11
11
|
"/**\n * person-list.ts — THE PEOPLE A PRINTED TEACHER LIST NAMES, each one a `PersonName`.\n *\n * A directory prints its teachers as one value more often than as one value per person:\n * `Kate & Katie Mailtina`, `Julie Mailtina, TCRG & Fiona Lillick, TCRG`, `Kevin, Helena, Leona\n * ADCRG, Sinead Corrbeg TCRG`. Handed to `personName` whole, such a value parses as ONE\n * person, and every name after the first lands in the middles: `Kate & Anthony Mailtina`\n * reads `Mailtina<<Kate<&<Anthony`, whose first given is `Kate` and whose middle is `Anthony`.\n * A gate that forgives a middle one side prints then meets `Mailtina, Kate` through a\n * middle name that is really a second person. This reader is the fix at the source: the\n * value is read into its people first, and each person is parsed on its own (`personName`\n * once per person), so no second name is ever a middle.\n *\n * IT IS A GIVEN-FIRST READER, and the order is not a parameter. The comma in a directory's\n * teacher value separates people or precedes letters (`Julie Mailtina, TCRG`); measured over a\n * large results corpus, 0 of 3,371 teacher mentions prints `Surname, Given`.\n * A caller holding a surname-first cell reads it with `personName(print, \"surname-first\")`\n * and never with this.\n *\n * WHAT SEPARATES TWO PEOPLE: `&`, a spaced `and`, a comma, a semicolon and a spaced slash.\n *\n * WHAT IS NOT A PERSON: letters. A member is cut at its first LETTERS token, which is a\n * credential or a degree (`TCRG`, `ADCRG/TCRG`, `A.D.C.R.G.`, `Ph.D.`, `Esq.`), an\n * all-capitals token after the name has begun in a print that is not itself all capitals,\n * or a token carrying a digit (a phone number). What follows the letters is not the name\n * either (`Kate O'Kysko, TCRG Bristol`), and a member that is only letters names nobody.\n * A caption before the name (`Teacher:`) and a style (`Dr.`) are not the name either.\n *\n * A SHARED SURNAME IS READ, NEVER GUESSED. A member of one name token (`Kate`, `Leona`) is\n * a given name whose surname the list prints once, on the next member that has one:\n * `Kate & Katie Mailtina` is Kate Mailtina and Katie Mailtina, and `Kevin, Helena, Leona ADCRG,\n * Sinead Corrbeg TCRG` is four Corrbegs. The surname is the donor's own parsed surname,\n * particles and all, so `Livia & Ann De Histow` lends `De Histow` and not `Histow`. A lone given\n * name with no full name after it (`Carole, Patricia, Conor`) names nobody this reader\n * can read, and is dropped rather than parsed as a surname.\n *\n * A VALUE THAT IS NOT A LIST IS ONE VALUE. Where any member runs past four name tokens the\n * value is prose (idm prints paragraphs), and it is returned as the one person the producer\n * delimited, exactly as `personName(print, \"given-first\")` reads it. Cutting a paragraph at\n * its commas would mint a person out of every clause.\n */\n\nimport { type PersonName, type PersonNameFactory, defaultPersonNameFactory } from \"./factory.ts\";\n\n/** One person a list names. */\nexport interface ListedPerson {\n\t/** the member as printed, letters cut off: a verbatim slice of the value */\n\tprinted: string;\n\t/** the member parsed, with the list's shared surname where it borrowed one */\n\tname: PersonName;\n\t/** the surname borrowed from a later member, as that member printed it, or `null` */\n\tsurnameFrom: string | null;\n}\n\n/** The tokens that join two people in a list, standing alone as a name field. */\nconst JOINERS: ReadonlySet<string> = new Set([\"&\", \"and\", \"+\"]);\n\n/**\n * Is this printed name field a list joiner (`&`, `and`, `+`)? A parsed name that carries\n * one as a given field is two people read as one, and `personList` is how to read it.\n */\nexport function isListJoiner(field: string): boolean {\n\treturn JOINERS.has(field.trim().toLocaleLowerCase());\n}\n\n/** Where one person ends and the next begins. */\nconst SEPARATOR = /\\s*[&;,]\\s*|\\s+\\/\\s+|\\s+and\\s+|\\s+\\+\\s+/giu;\n\n/**\n * Letters that name nobody wherever they stand, dots removed, lower case: the CLRG\n * credentials the directories print (with the spellings they print them in), and degrees.\n */\nconst LETTERS: ReadonlySet<string> = new Set([\n\t\"adcrg\",\n\t\"adcg\",\n\t\"adcrn\",\n\t\"bg\",\n\t\"bgcrg\",\n\t\"odcrn\",\n\t\"sdcrg\",\n\t\"tcg\",\n\t\"tcrg\",\n\t\"tmcrn\",\n\t\"tmrf\",\n\t\"phd\",\n\t\"esq\",\n\t\"jd\",\n]);\n\n/** A style printed before a name, which is not a given name. Dots removed, lower case. */\nconst TITLES: ReadonlySet<string> = new Set([\"dr\", \"mr\", \"mrs\", \"ms\", \"miss\"]);\n\n/** The most name tokens a member of a list carries before the value reads as prose. */\nconst MAX_NAME_TOKENS = 4;\n\nconst EDGE = /^[(\"“'‘[]+|[)\"”'’\\].:]+$/gu;\n\n/** A token's letters, edges and dots removed; for `ADCRG/TCRG` the first piece. */\nconst bareOf = (token: string): string =>\n\t(token.replace(EDGE, \"\").split(\"/\")[0] as string).replace(/\\./gu, \"\");\n\n/**\n * Is this token letters (a credential, a degree, a phone number) rather than a name? A\n * known credential is letters anywhere; any other all-capitals token only after a name has\n * begun, so `JR Nirnirvo` and `KT Quellane` keep their initials.\n */\nfunction isLetters(token: string, begun: boolean, allCaps: boolean): boolean {\n\tif (/\\p{N}/u.test(token)) return true;\n\tconst bare = bareOf(token);\n\tif (bare === \"\" || LETTERS.has(bare.toLocaleLowerCase())) return true;\n\treturn begun && !allCaps && bare.length >= 2 && /^\\p{Lu}+$/u.test(bare);\n}\n\n/**\n * A member's name tokens: everything before its first letters token, after any caption\n * (`Teacher:`, `TCRG's:`) and any leading style (`Dr.`).\n */\nfunction nameTokens(member: string, allCaps: boolean): string[] {\n\tlet out: string[] = [];\n\tfor (const t of member.split(/\\s+/u)) {\n\t\tif (t === \"\") continue;\n\t\tif (t.endsWith(\":\")) {\n\t\t\tout = [];\n\t\t\tcontinue;\n\t\t}\n\t\tif (isLetters(t, out.length > 0, allCaps)) {\n\t\t\tif (out.length > 0) break;\n\t\t\tcontinue;\n\t\t}\n\t\tif (out.length === 0 && TITLES.has(bareOf(t).toLocaleLowerCase())) continue;\n\t\tout.push(t);\n\t}\n\treturn out;\n}\n\n/** The surname a parsed name prints, particles included, as one string. */\nconst surnamePrint = (p: PersonName): string =>\n\t[...p.surname.particles, p.surname.base].filter((s) => s !== \"\").join(\" \");\n\n/**\n * The people a given-first teacher value names, in print order. See the module docblock\n * for what separates them, what is cut as letters and how a shared surname is read.\n */\nexport function personList(\n\tprint: string,\n\tfactory: PersonNameFactory = defaultPersonNameFactory(),\n): ListedPerson[] {\n\tconst allCaps = !/\\p{Ll}/u.test(print);\n\tconst members = print\n\t\t.split(SEPARATOR)\n\t\t.map((m) => nameTokens(m, allCaps))\n\t\t.filter((tokens) => tokens.length > 0);\n\tif (members.length === 0) return [];\n\tconst whole = (): ListedPerson[] => [\n\t\t{ printed: print.trim(), name: factory.parse(print, \"given-first\"), surnameFrom: null },\n\t];\n\tif (members.some((tokens) => tokens.length > MAX_NAME_TOKENS)) return whole();\n\n\tconst out: ListedPerson[] = [];\n\tlet pending: string[] = [];\n\tfor (const tokens of members) {\n\t\tconst printed = tokens.join(\" \");\n\t\tif (tokens.length === 1) {\n\t\t\tpending.push(printed);\n\t\t\tcontinue;\n\t\t}\n\t\tconst name = factory.parse(printed, \"given-first\");\n\t\tconst surname = name.isPerson() ? surnamePrint(name) : \"\";\n\t\tif (surname !== \"\")\n\t\t\tfor (const given of pending)\n\t\t\t\tout.push({\n\t\t\t\t\tprinted: given,\n\t\t\t\t\tname: factory.parse(`${given} ${surname}`, \"given-first\"),\n\t\t\t\t\tsurnameFrom: surname,\n\t\t\t\t});\n\t\tpending = [];\n\t\tout.push({ printed, name, surnameFrom: null });\n\t}\n\treturn out;\n}\n",
|
|
12
|
+
"/**\n * The three surname BLOCKING keys, in one place.\n *\n * A blocking key buckets names that are *worth comparing*; it decides nothing\n * about identity. Each is derived from the halves of a parsed name, normally a\n * `PersonName`'s `surnameKey()` and its first given name.\n *\n * | key | buckets on | asks |\n * |---|---|---|\n * | `surnameBlock` | the surname's A-Z letters | is the surname spelt alike? |\n * | `metaphoneBlocks` | the surname's Double Metaphone codes | does the surname sound alike? |\n * | `initialsBlock` | first given initial + surname initial | could these be one name at all? |\n *\n * They are not `surnameKey()`. That is the NN3 field, which keeps every letter and\n * digit in every script; a block key keeps A-Z only, so a stray digit or an\n * unfolded letter never splits a bucket and a key with no A-Z letter is no bucket.\n *\n * They are not `nameBlockKeys` (`./name-compose.ts`) either. That family keys each\n * surname PART with the first initial, so a compound surname meets either of its\n * halves, and it is the candidate generator for `composeNames`. These key the WHOLE\n * surname key, by spelling, by sound or by initials, and know nothing of parts.\n *\n * ## One implementation, every caller\n *\n * A stored key that re-implemented one of these would be a second copy that can\n * silently disagree with the first, and the disagreement is invisible: a self-join\n * on the two simply returns different pairs. A store that bakes these keys and a\n * reader that blocks live rows ask the same functions.\n *\n * ## An EMPTY key means \"not blockable\", never \"matches other empty keys\"\n *\n * Every function here returns `null` (or `[]`) for a blank surname, a name with no\n * A-Z letter, or a surname Double Metaphone declines to encode. A caller skips\n * those rather than pooling them into one enormous `\"\"` bucket, and `null` carries\n * that through SQL for free: no equality join matches NULL.\n *\n * Pure and I/O-free; `../phonetic` is the only import.\n */\n\nimport { doubleMetaphone } from \"../phonetic/double-metaphone.ts\";\n\n/**\n * The surname as every block key compares it: upper case, A-Z only, so hyphens,\n * spaces in double-barrelled names, apostrophes and digits all drop to one bare\n * token.\n */\nfunction blockLetters(surname: string): string {\n\treturn surname.toUpperCase().replace(/[^A-Z]/g, \"\");\n}\n\n/** First A-Z letter of the string, uppercased, or null if none. */\nfunction firstLetter(s: string): string | null {\n\tconst m = s.match(/[A-Za-z]/);\n\treturn m ? m[0].toUpperCase() : null;\n}\n\n/** The surname's A-Z letters, or null when there are none. */\nexport function surnameBlock(surname: string): string | null {\n\treturn blockLetters(surname) || null;\n}\n\n/**\n * First given initial + surname initial, the coarsest of the three. Null unless\n * BOTH letters exist: a name missing either is skipped, not filed under a\n * one-letter key.\n */\nexport function initialsBlock(given: string, surname: string): string | null {\n\tconst first = firstLetter(given);\n\tconst last = firstLetter(blockLetters(surname));\n\treturn first && last ? first + last : null;\n}\n\n/**\n * The surname's Double Metaphone codes: primary first, then the secondary WHEN\n * IT DIFFERS. A name is filed under every code returned here, which is the\n * standard double-filing recall trick (it lets an `X…`-secondary spelling meet an\n * `S…`-primary one). Empty when the surname yields no primary code.\n */\nexport function metaphoneBlocks(surname: string): string[] {\n\tconst letters = blockLetters(surname);\n\tif (!letters) return [];\n\tconst [primary, secondary] = doubleMetaphone(letters);\n\tif (!primary) return [];\n\treturn secondary && secondary !== primary ? [primary, secondary] : [primary];\n}\n",
|
|
13
|
+
"/**\n * A `PersonName` as database columns: the keys a store indexes, encoded once.\n *\n * A store that holds many prints and answers \"which rows hold this name?\" wants\n * the parse's keys as plain columns, so the question is an equality lookup on an\n * index rather than a parse per row. `nameColumns` is the one encoder of those\n * keys, so a store that bakes them and a reader that parses a probe live cannot\n * disagree about a key. It depends on no database: a row is a plain object of\n * strings and nulls, and `NAME_COLUMNS` is its declared column order.\n *\n * | column | holds | answers |\n * |---|---|---|\n * | `nn0`-`nn4` | the transitive levels (`PersonName.nn0`…`nn4`) | a `NameMap`/`NameSet` lookup at that level |\n * | `surname_key` | `surnameKey()` | do two prints agree on the surname? |\n * | `given_key` | `givenName()` | do two prints agree on the given names? |\n * | `blk_surname` | `surnameBlock(surnameKey())` | is the surname spelt alike? |\n * | `blk_initials` | `initialsBlock(givenFields()[0], surnameKey())` | could these be one name at all? |\n * | `blk_metaphone` | the first of `metaphoneBlocks(surnameKey())` | does the surname sound alike? |\n * | `blk_metaphone_alt` | the second, when it differs | the same, under the alternate code |\n *\n * ## A level lookup is one equality\n *\n * `createNameMap(dop)` files a person under `name[dop]` and never finds a print\n * that names no person. The level columns are exactly that slot: the level for a\n * person, `null` otherwise. So `map.get(probe)` at level `dop` is\n *\n * SELECT … WHERE <dop> = nameColumns(probe)[dop]\n *\n * and a non-person probe carries `null`, which no equality matches, as the map\n * answers `undefined` for it. NN5 is a distance and has no column, as it has no map.\n *\n * ## Null means \"no key\", never \"an empty key\"\n *\n * Every column is `null` where its key is empty or does not apply: a refused or\n * empty print, a name with no given name, a surname with no A-Z letter. Two rows\n * that both lack a key are not thereby alike, and `null` carries that through SQL\n * for free. The metaphone pair is two columns because a name is filed under both\n * codes; a row's code set is `{blk_metaphone} ∪ {blk_metaphone_alt}`.\n */\n\nimport { initialsBlock, metaphoneBlocks, surnameBlock } from \"./block-keys.ts\";\nimport type { PersonName, TransitiveLevel } from \"./person-name.ts\";\n\n/** The level columns, one per transitive level, named as the level is. */\nexport const NAME_LEVEL_COLUMNS = [\n\t\"nn0\",\n\t\"nn1\",\n\t\"nn2\",\n\t\"nn3\",\n\t\"nn4\",\n] as const satisfies readonly TransitiveLevel[];\n\n/** Every column `nameColumns` fills, in declared order. */\nexport const NAME_COLUMNS = [\n\t...NAME_LEVEL_COLUMNS,\n\t\"surname_key\",\n\t\"given_key\",\n\t\"blk_surname\",\n\t\"blk_initials\",\n\t\"blk_metaphone\",\n\t\"blk_metaphone_alt\",\n] as const;\n\nexport type NameColumn = (typeof NAME_COLUMNS)[number];\n\n/** One name's row: every column a string or `null`. */\nexport type NameColumns = { readonly [C in NameColumn]: string | null };\n\n/** The keys of one parsed name, as columns. See the module header for each. */\nexport function nameColumns(name: PersonName): NameColumns {\n\tconst person = name.isPerson();\n\tconst level = (dop: TransitiveLevel): string | null => (person ? name[dop] : null);\n\tconst surname = person ? name.surnameKey() : \"\";\n\tconst [metaphone, metaphoneAlt] = metaphoneBlocks(surname);\n\treturn {\n\t\tnn0: level(\"nn0\"),\n\t\tnn1: level(\"nn1\"),\n\t\tnn2: level(\"nn2\"),\n\t\tnn3: level(\"nn3\"),\n\t\tnn4: level(\"nn4\"),\n\t\tsurname_key: surname || null,\n\t\tgiven_key: (person && name.givenName()) || null,\n\t\tblk_surname: surnameBlock(surname),\n\t\tblk_initials: person ? initialsBlock(name.givenFields()[0] ?? \"\", surname) : null,\n\t\tblk_metaphone: metaphone ?? null,\n\t\tblk_metaphone_alt: metaphoneAlt ?? null,\n\t};\n}\n",
|
|
12
14
|
"/**\n * name-format.ts — which order a COLLECTION of printed names uses, and whether its name\n * cells also carry a school or a place, as probabilities.\n *\n * ## One print, then many\n *\n * `readNameCell` reads one printed name cell: which part is the name, which part (if\n * any) is a school or a place, how its comma reads, and which order the lexicon reads\n * its name part in. `deriveNameFormat` scores those readings over a collection, and\n * `deriveNameFormat([print])` is the one-print answer in the same shape.\n *\n * The collection is a DOCUMENT: one results sheet, one roster, one column. Deciding\n * what a document is (grouping rows by source, by event, by year), corroborating a\n * reading across documents, and hand-written declarations stay with the caller. A\n * derived format is a declaration the caller makes about a document, never a guess\n * about one print: hand it to `splitPersonName` (via `nameFormatOrder`) and to the\n * classifier as the document's order.\n *\n * ## The three formats\n *\n * - `First Last`: given-first (`Zelvine Quorrish`);\n * - `Last, First`: surname-first with a separator comma (`Quorrish, Zelvine`);\n * - `Last First`: surname-first with no comma (`QUORRISH ZELVINE`).\n *\n * `inferNameOrder` reads one print by its comma, so it reads `Last First` as\n * given-first. The token-position reading below is the only signal that sees it.\n *\n * ## How a print's commas are read\n *\n * A comma may be an order separator (`Quorrish, Zelvine`), a place delimiter\n * (`Zelvine Quorrish, Zandrel`), school glue (`Zelvine Quorrish, Quorrish Academy`), a\n * suffix delimiter (`Ydris Vantrell, Jr.`) or stray punctuation. The place and the\n * school are cut off first, each consuming the comma before it, and the comma that is\n * left is read by `commaReading`, the rule `inferNameOrder` reads one print with. A\n * print with a separator comma is not also read for token position.\n *\n * - A PLACE is a trailing field after a spaced dash, a comma (after a name of two or\n * more tokens), or inside a trailing parenthesis, every word of which the lexicon\n * flags as a place (`isPlaceWordFlags`, the classifier's place-phrase rule). After a\n * `:` (the name + school + region glue), the tail's trailing place fields are the\n * place and whatever precedes them is a school.\n * - A SCHOOL is the part after a `:` that is not a place, the row's own school cell\n * where the name cell prints it again at its end, or what the injected segmenter\n * (`createSegmenter` from `@finbheara/names/classifier`, built on the same lexicon\n * as `options.lexicon`) reads after the person span. This module never imports the\n * classifier; with neither a segmenter nor a row school, `hasSchool` is `null`.\n *\n * ## Token position against the lexicon\n *\n * A two-token name part with no separator comma is read against `names.txt`: a token\n * is GIVEN-ONLY (`F`/`M`/`N`, no `L`/`A`) or SURNAME-ONLY (`L`, no `F`/`M`/`N`/`A`),\n * and the print reads given-first or surname-first where one of each sits at either\n * end. Where one token is settled and the other is absent from the lexicon, the\n * settled token orients the print alone: the ONE-TOKEN reading, its own class because\n * it is noisier. A token the lexicon does not settle contributes nothing. The lexicon\n * is keyed case-insensitively, so `QUORRISH ZELVINE` and `Quorrish Zelvine` read the\n * same.\n *\n * ## Probabilistic, not a vote\n *\n * Each read print is scored independently under each format: whether it carries a\n * separator comma, and, for a lexicon reading, which way it points GIVEN its class.\n * The class itself is not scored, because how many prints the lexicon can read is a\n * fact about its coverage, not about order; so each print consistent with a format\n * can only raise that format. Smoothing keeps a small collection near uniform. Because\n * the prints are scored independently, a large collection is confident even when it\n * prints both orders; the separate MIXED test (a binomial test of the dissent count\n * against the dissent rate documents of the leading format show) turns such a\n * collection `unknown` and sets `mixed`. `hasSchool` and `hasLocation` are the\n * probability that MOST cells carry the part, given the reader's recall and false-read\n * rate. Every rate is fitted by `training/fit-name-format.ts`; the threshold and the\n * mixed test's level are decided, and the pull request that set them records both.\n */\n\nimport { isAmbiguous, isGiven, isSurname } from \"../lexicon/flags.ts\";\nimport { Lexicon } from \"../lexicon/index.ts\";\nimport { isPlaceWordFlags } from \"../lexicon/place.ts\";\nimport { isNoNamePrint, isPlaceholderPrint } from \"./name-placeholder.ts\";\nimport {\n\ttype CommaReading,\n\ttype NameOrder,\n\tcommaReading,\n\tisNameSuffix,\n\ttokenize,\n} from \"./name-split.ts\";\nimport { isTeamPrint } from \"./team-name.ts\";\n\n/** A printed-name order, as a document prints it. */\nexport type NameFormat = \"First Last\" | \"Last, First\" | \"Last First\";\n\n/** The three formats, in the order every vector below is laid out. */\nexport const NAME_FORMATS: readonly NameFormat[] = [\"First Last\", \"Last, First\", \"Last First\"];\n\n/** A collection's verdict: a format, or `\"unknown\"` where none clears the threshold. */\nexport type NameFormatVerdict = NameFormat | \"unknown\";\n\n/**\n * The `NameOrder` a verdict declares: `First Last` is given-first, both surname-first\n * forms are surname-first, and `unknown` stays `unknown`.\n */\nexport function nameFormatOrder(verdict: NameFormatVerdict): NameOrder {\n\tif (verdict === \"unknown\") return \"unknown\";\n\treturn verdict === \"First Last\" ? \"given-first\" : \"surname-first\";\n}\n\n/**\n * What one print says about order. `comma` is a separator comma; the others are the\n * lexicon's token-position readings, two tokens settled or one.\n */\nexport type OrderReading =\n\t| \"comma\"\n\t| \"given-first:two-token\"\n\t| \"surname-first:two-token\"\n\t| \"given-first:one-token\"\n\t| \"surname-first:one-token\";\n\n/** The order readings, in the order every count vector below is laid out. */\nexport const ORDER_READINGS: readonly OrderReading[] = [\n\t\"comma\",\n\t\"given-first:two-token\",\n\t\"surname-first:two-token\",\n\t\"given-first:one-token\",\n\t\"surname-first:one-token\",\n];\n\n/** Why a print was not read at all: it names nobody, or it is a team designation. */\nexport type SkipReason = \"empty\" | \"no-name\" | \"team\";\n\n/** How a print's comma was read, `place` where it delimited a trailing place. */\nexport type CommaClass = CommaReading | \"place\";\n\n/** One printed name cell, read. */\nexport interface NameCellReading {\n\t/** The print, verbatim. */\n\tprint: string;\n\t/** Set where the print was not read; every other field is then empty. */\n\tskipped?: SkipReason;\n\t/**\n\t * The name part: the print with its school and place cut off, whitespace collapsed.\n\t * Hand it to the splitter in place of the print.\n\t */\n\tname: string;\n\t/** The school part, where the segmenter read one. */\n\tschool?: string;\n\t/** The place part, where a delimited place was read. */\n\tlocation?: string;\n\t/**\n\t * How the print's commas read. `place` and `glue` are commas the place or school\n\t * reading consumed; the rest are `commaReading` of the name part.\n\t */\n\tcommas: readonly CommaClass[];\n\t/** The order reading, or `undefined` where the name part orients nothing. */\n\torder?: OrderReading;\n\t/** The order the reading points to; `undefined` where there is none. */\n\torderPoints?: \"given-first\" | \"surname-first\";\n\t/** Name tokens read (suffixes and punctuation-only tokens set aside). */\n\ttokens: number;\n}\n\n/** The counts behind a verdict. */\nexport interface NameFormatEvidence {\n\t/** Every print given. */\n\tprints: number;\n\t/** Prints not read, by reason. */\n\tskipped: Record<SkipReason, number>;\n\t/** Prints carrying a separator comma. */\n\tseparatorCommas: number;\n\t/** Commas that were not order separators, by class. */\n\tdiscountedCommas: Record<Exclude<CommaClass, \"none\" | \"separator\">, number>;\n\t/** Prints oriented by the lexicon, by reading. */\n\tlexicon: Record<Exclude<OrderReading, \"comma\">, number>;\n\t/** Read prints that orient nothing. */\n\tunread: number;\n\t/** Read prints carrying a school; `null` where no segmenter was given. */\n\tschool: number | null;\n\t/** Read prints carrying a place. */\n\tlocation: number;\n}\n\n/** A collection's answer. One print's answer has the same shape. */\nexport interface NameFormatResult {\n\t/** Over the three formats, summing to 1. */\n\tprobabilities: Record<NameFormat, number>;\n\t/** The format whose probability clears the threshold, else `\"unknown\"`. */\n\tverdict: NameFormatVerdict;\n\t/** The probability that the name cells carry a school; `null` without a segmenter. */\n\thasSchool: number | null;\n\t/** The probability that the name cells carry a place. */\n\thasLocation: number;\n\t/**\n\t * True where the dissent is too large for the leading format to have printed it: the\n\t * collection prints both orders, and the verdict is `unknown`.\n\t */\n\tmixed: boolean;\n\tevidence: NameFormatEvidence;\n\t/**\n\t * The readings that point to the order the verdict does not: given-first readings\n\t * under a surname-first verdict and the reverse. Where the verdict is `\"unknown\"`,\n\t * against the most probable format.\n\t */\n\tdissent: NameCellReading[];\n\t/** Every print's reading, in input order. */\n\treadings: NameCellReading[];\n}\n\n/** What the segmenter returns that is read here; the classifier's `SegmentResult` is one. */\nexport interface CellSegmentation {\n\treadonly person: readonly string[];\n\treadonly school: readonly string[];\n\treadonly location: readonly string[];\n}\n\n/** The segmenter as read here; the classifier's `createSegmenter(lexicon)` is one. */\nexport interface CellSegmenter {\n\tsegmentTokens(tokens: string[]): CellSegmentation;\n}\n\nexport interface NameCellOptions {\n\t/** The lexicon read for token position and places. Default: `Lexicon.default()`. */\n\tlexicon?: Lexicon;\n\t/** Reads the school part. Without one, no school is read. */\n\tsegmenter?: CellSegmenter | null;\n\t/** Read delimited places. Default true; `false` reads every comma by `commaReading`. */\n\treadLocation?: boolean;\n\t/**\n\t * The document's cells carry places (`deriveNameFormat` sets it where `hasLocation`\n\t * passes 0.5 on a first reading): a comma after a name of two or more tokens that no\n\t * given name follows is read as a place delimiter, so a place the lexicon does not\n\t * know is not read as `Last, First`.\n\t */\n\tplaceColumn?: boolean;\n}\n\nexport interface NameFormatOptions extends NameCellOptions {\n\t/** The probability a format must reach to be the verdict. Default `DEFAULT_NAME_FORMAT_THRESHOLD`. */\n\tthreshold?: number;\n}\n\n/**\n * A print given as its name cell, or as the cell and its row's own school cell. Where\n * the name cell prints that school again at its end, the school is cut off there.\n */\nexport type PrintedNameCell = string | { name: string; school?: string };\n\n// ─── one print ──────────────────────────────────────────────────────────────\n\nconst HAS_LETTER = /\\p{L}/u;\nconst SPACED_DASH = /\\s[-–—]\\s/gu;\n\n/** A field every word of which (split at `,` and `/`) is a place word. */\nfunction isPlaceField(field: string, flagsOf: (t: string) => string | null): boolean {\n\tconst words = field\n\t\t.split(/[\\s,/]+/u)\n\t\t.map((w) => w.replace(/^[.(]+|[.)]+$/gu, \"\"))\n\t\t.filter((w) => w !== \"\");\n\treturn words.length > 0 && words.every((w) => isPlaceWordFlags(flagsOf(w) ?? \"\"));\n}\n\nfunction givenOnly(flags: string | null): boolean {\n\treturn flags !== null && isGiven(flags) && !isSurname(flags) && !isAmbiguous(flags);\n}\n\nfunction surnameOnly(flags: string | null): boolean {\n\treturn flags !== null && isSurname(flags) && !isGiven(flags) && !isAmbiguous(flags);\n}\n\n/** Two tokens, read against the lexicon. */\nfunction tokenOrder(a: string | null, b: string | null): OrderReading | undefined {\n\tif (givenOnly(a) && surnameOnly(b)) return \"given-first:two-token\";\n\tif (surnameOnly(a) && givenOnly(b)) return \"surname-first:two-token\";\n\tif (a !== null && b !== null) return undefined;\n\tif (b === null && givenOnly(a)) return \"given-first:one-token\";\n\tif (a === null && surnameOnly(b)) return \"given-first:one-token\";\n\tif (b === null && surnameOnly(a)) return \"surname-first:one-token\";\n\tif (a === null && givenOnly(b)) return \"surname-first:one-token\";\n\treturn undefined;\n}\n\n/** The order a reading points to. */\nexport function orderReadingPoints(r: OrderReading): \"given-first\" | \"surname-first\" {\n\treturn r === \"given-first:two-token\" || r === \"given-first:one-token\"\n\t\t? \"given-first\"\n\t\t: \"surname-first\";\n}\n\n/** A lexicon, its flag lookup bound once per lexicon. */\nconst flagLookups = new WeakMap<Lexicon, (t: string) => string | null>();\nfunction flagsOfLexicon(lexicon: Lexicon): (t: string) => string | null {\n\tlet f = flagLookups.get(lexicon);\n\tif (f === undefined) {\n\t\tf = (t) => lexicon.getNameFlags(t);\n\t\tflagLookups.set(lexicon, f);\n\t}\n\treturn f;\n}\n\n/**\n * Read one printed name cell: its name, school and place parts, how its commas read,\n * and the order its name part reads in.\n */\nexport function readNameCell(\n\tcell: PrintedNameCell,\n\toptions: NameCellOptions = {},\n): NameCellReading {\n\tconst print = typeof cell === \"string\" ? cell : cell.name;\n\tconst rowSchool =\n\t\ttypeof cell === \"string\" ? \"\" : (cell.school ?? \"\").replace(/\\s+/gu, \" \").trim();\n\tconst flagsOf = flagsOfLexicon(options.lexicon ?? Lexicon.default());\n\tconst readLocation = options.readLocation ?? true;\n\tconst skip = (skipped: SkipReason): NameCellReading => ({\n\t\tprint,\n\t\tskipped,\n\t\tname: \"\",\n\t\tcommas: [],\n\t\ttokens: 0,\n\t});\n\n\tlet s = print.replace(/\\s+/gu, \" \").trim();\n\tif (s === \"\") return skip(\"empty\");\n\tif (isNoNamePrint(s) || isPlaceholderPrint(s)) return skip(\"no-name\");\n\tif (isTeamPrint(s)) return skip(\"team\");\n\n\tconst places: string[] = [];\n\tconst commas: CommaClass[] = [];\n\tlet school: string | undefined;\n\tif (readLocation) {\n\t\t// After a colon: the glue of a name + school + region print. The tail's trailing\n\t\t// place fields are the place; whatever precedes them in the tail is a school.\n\t\tconst colon = s.indexOf(\":\");\n\t\tif (colon > 0) {\n\t\t\tlet tail = s.slice(colon + 1).trim();\n\t\t\ts = s.slice(0, colon).trim();\n\t\t\tconst tailPlaces: string[] = [];\n\t\t\tfor (;;) {\n\t\t\t\tif (isPlaceField(tail, flagsOf)) {\n\t\t\t\t\ttailPlaces.unshift(tail);\n\t\t\t\t\tfor (const _ of tail.matchAll(/,/gu)) commas.push(\"place\");\n\t\t\t\t\ttail = \"\";\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst at = tail.lastIndexOf(\",\");\n\t\t\t\tif (at <= 0) break;\n\t\t\t\tconst field = tail.slice(at + 1).trim();\n\t\t\t\tif (field === \"\" || !isPlaceField(field, flagsOf)) break;\n\t\t\t\ttailPlaces.unshift(field);\n\t\t\t\tcommas.push(\"place\");\n\t\t\t\ttail = tail.slice(0, at).trim();\n\t\t\t}\n\t\t\tif (tailPlaces.length > 0) places.unshift(tailPlaces.join(\", \"));\n\t\t\tif (HAS_LETTER.test(tail)) school = tail;\n\t\t}\n\t\t// A trailing parenthesis naming a place.\n\t\tconst paren = /\\s*\\(([^()]*)\\)\\s*$/u.exec(s);\n\t\tif (paren !== null && paren.index > 0 && isPlaceField(paren[1] as string, flagsOf)) {\n\t\t\tplaces.unshift((paren[1] as string).trim());\n\t\t\ts = s.slice(0, paren.index).trim();\n\t\t}\n\t\t// After each spaced dash from the end, while each tail is a place.\n\t\tfor (;;) {\n\t\t\tconst dashes = [...s.matchAll(SPACED_DASH)];\n\t\t\tconst dash = dashes[dashes.length - 1];\n\t\t\tif (dash === undefined || dash.index <= 0) break;\n\t\t\tconst tail = s.slice(dash.index + dash[0].length).trim();\n\t\t\tif (!isPlaceField(tail, flagsOf)) break;\n\t\t\tplaces.unshift(tail);\n\t\t\tfor (const _ of tail.matchAll(/,/gu)) commas.push(\"place\");\n\t\t\ts = s.slice(0, dash.index).trim();\n\t\t}\n\t\t// Comma fields from the end, while each is a place.\n\t\tfor (;;) {\n\t\t\tconst at = s.lastIndexOf(\",\");\n\t\t\tif (at <= 0) break;\n\t\t\tconst tail = s.slice(at + 1).trim();\n\t\t\tif (tail === \"\" || !isPlaceField(tail, flagsOf)) break;\n\t\t\tconst head = s.slice(0, at).trim();\n\t\t\t// A one-token head is a surname before its given name (`Ospindle, Lirabel`), and a\n\t\t\t// given name the lexicon also knows as a place is still a given name there.\n\t\t\tif (tokenize(head.replace(/,/gu, \" \")).filter((t) => HAS_LETTER.test(t)).length < 2) break;\n\t\t\tplaces.unshift(tail);\n\t\t\tcommas.push(\"place\");\n\t\t\ts = head;\n\t\t}\n\t}\n\t// Asides other than a place are not part of the name.\n\ts = s\n\t\t.replace(/\\([^()]*\\)/gu, \" \")\n\t\t.replace(/\\s+/gu, \" \")\n\t\t.trim();\n\tif (!HAS_LETTER.test(s)) {\n\t\tif (places.length === 0) return skip(\"no-name\");\n\t\ts = \"\";\n\t}\n\n\t// The row's own school cell, printed again at the end of the name cell.\n\tif (school === undefined && rowSchool !== \"\" && HAS_LETTER.test(rowSchool)) {\n\t\tconst at = s.toLocaleLowerCase().lastIndexOf(rowSchool.toLocaleLowerCase());\n\t\t// Only at a word boundary: `Zelvine QVarrow Hall` does not end with `Varrow Hall`.\n\t\tif (at > 0 && at + rowSchool.length === s.length && /[\\s,;:-]/u.test(s[at - 1] ?? \"\")) {\n\t\t\tconst head = s.slice(0, at);\n\t\t\tif (HAS_LETTER.test(head)) {\n\t\t\t\tschool = s.slice(at);\n\t\t\t\tif (/,\\s*$/u.test(head)) commas.push(\"glue\");\n\t\t\t\ts = head.replace(/[\\s,;:-]+$/u, \"\");\n\t\t\t}\n\t\t}\n\t}\n\tif (school === undefined && options.segmenter && s !== \"\") {\n\t\tconst words = s.split(\" \");\n\t\tconst kept: number[] = [];\n\t\tconst clean: string[] = [];\n\t\tfor (const [i, w] of words.entries()) {\n\t\t\tconst c = w.replace(/^[,;.]+|[,;.]+$/gu, \"\");\n\t\t\tif (!HAS_LETTER.test(c)) continue;\n\t\t\tkept.push(i);\n\t\t\tclean.push(c);\n\t\t}\n\t\tif (clean.length >= 2) {\n\t\t\tconst seg = options.segmenter.segmentTokens(clean);\n\t\t\tif (seg.person.length > 0 && seg.school.length > 0) {\n\t\t\t\tconst cut = kept[seg.person.length] as number;\n\t\t\t\tschool = seg.school.join(\" \");\n\t\t\t\tif (seg.location.length > 0) places.unshift(seg.location.join(\" \"));\n\t\t\t\tconst tail = words.slice(cut).join(\" \");\n\t\t\t\tfor (const _ of tail.matchAll(/,/gu)) commas.push(\"glue\");\n\t\t\t\ts = words\n\t\t\t\t\t.slice(0, cut)\n\t\t\t\t\t.join(\" \")\n\t\t\t\t\t.replace(/[\\s,;-]+$/u, \"\");\n\t\t\t\tif (/,\\s*$/u.test(words.slice(0, cut).join(\" \"))) commas.push(\"glue\");\n\t\t\t}\n\t\t}\n\t}\n\n\tlet comma = commaReading(s);\n\t// In a document whose cells carry places, a comma after a name of two or more\n\t// tokens, followed by no given name, delimits a place the lexicon does not know.\n\tif (comma === \"separator\" && readLocation && options.placeColumn) {\n\t\tconst at = s.lastIndexOf(\",\");\n\t\tconst head = s.slice(0, at).trim();\n\t\tconst tail = s.slice(at + 1).trim();\n\t\tconst headTokens = tokenize(head).filter((t) => HAS_LETTER.test(t));\n\t\tconst tailTokens = tokenize(tail).filter((t) => HAS_LETTER.test(t));\n\t\tconst givenInTail = tailTokens.some((t) => {\n\t\t\tconst f = flagsOf(t);\n\t\t\treturn f !== null && isGiven(f);\n\t\t});\n\t\tif (headTokens.length >= 2 && tailTokens.length > 0 && !givenInTail) {\n\t\t\tplaces.push(tail);\n\t\t\tcommas.push(\"place\");\n\t\t\ts = head;\n\t\t\tcomma = commaReading(s);\n\t\t}\n\t}\n\tif (comma !== \"none\") commas.push(comma);\n\tconst out: NameCellReading = {\n\t\tprint,\n\t\tname: s,\n\t\tcommas,\n\t\ttokens: 0,\n\t\t...(school !== undefined ? { school } : {}),\n\t\t...(places.length > 0 ? { location: places.join(\", \") } : {}),\n\t};\n\tconst tokens = tokenize(s.replace(/,/gu, \" \")).filter(\n\t\t(t) => HAS_LETTER.test(t) && !isNameSuffix(t),\n\t);\n\tout.tokens = tokens.length;\n\tif (comma === \"separator\") {\n\t\tout.order = \"comma\";\n\t} else if (comma !== \"glue\" && comma !== \"particle\" && tokens.length === 2) {\n\t\tconst order = tokenOrder(flagsOf(tokens[0] as string), flagsOf(tokens[1] as string));\n\t\tif (order !== undefined) out.order = order;\n\t}\n\tif (out.order !== undefined) out.orderPoints = orderReadingPoints(out.order);\n\treturn out;\n}\n\n// ─── many prints ────────────────────────────────────────────────────────────\n\n/** Natural log of the gamma function (Lanczos, g = 7), for positive arguments. */\nfunction logGamma(x: number): number {\n\tif (x < 0.5) return Math.log(Math.PI / Math.sin(Math.PI * x)) - logGamma(1 - x);\n\tconst c = [\n\t\t0.99999999999980993, 676.5203681218851, -1259.1392167224028, 771.32342877765313,\n\t\t-176.61502916214059, 12.507343278686905, -0.13857109526572012, 9.9843695780195716e-6,\n\t\t1.5056327351493116e-7,\n\t];\n\tconst z = x - 1;\n\tlet a = c[0] as number;\n\tconst t = z + 7.5;\n\tfor (let i = 1; i < 9; i++) a += (c[i] as number) / (z + i);\n\treturn 0.5 * Math.log(2 * Math.PI) + (z + 0.5) * Math.log(t) - t + Math.log(a);\n}\n\n/** `P(X >= k)` for `X` binomial over `n` trials with rate `p`. */\nexport function binomialTail(k: number, n: number, p: number): number {\n\tif (k <= 0) return 1;\n\tif (p <= 0) return 0;\n\tif (p >= 1) return 1;\n\tconst lp = Math.log(p);\n\tconst lq = Math.log1p(-p);\n\tlet tail = 0;\n\tfor (let j = k; j <= n; j++)\n\t\ttail += Math.exp(\n\t\t\tlogGamma(n + 1) - logGamma(j + 1) - logGamma(n - j + 1) + j * lp + (n - j) * lq,\n\t\t);\n\treturn Math.min(1, tail);\n}\n\n/** Posterior over hypotheses with a uniform prior: softmax of the log likelihoods. */\nfunction posterior(logs: readonly number[]): number[] {\n\tconst m = Math.max(...logs);\n\tconst e = logs.map((l) => Math.exp(l - m));\n\tconst z = e.reduce((x, y) => x + y, 0);\n\treturn e.map((x) => x / z);\n}\n\n/** How the reader sees a part (school or place): how often it reads one that is there, and one that is not. */\nexport interface PartReader {\n\t/** P(read | the cell carries one). */\n\trecall: number;\n\t/** P(read | the cell carries none). */\n\tfalseRate: number;\n}\n\n/**\n * The fitted model. Every print is read independently given the format:\n *\n * - `comma`: P(a read print carries a separator comma | format);\n * - `surnameFirst`: P(a lexicon reading points surname-first | its class, format).\n * The CLASS (two-token or one-token) is taken as given, not scored: how many prints\n * the lexicon can read at all is a fact about the lexicon's coverage, not about\n * order. So each consistent print can only raise the format it is consistent with.\n * - `dissent`: the share of oriented prints that point against a format's order in\n * documents of that format; the mixed-document test's bound.\n * - `school`, `location`: the reader's recall and false-read rate for each part.\n */\nexport interface NameFormatModel {\n\tcomma: Record<NameFormat, number>;\n\tsurnameFirst: Record<NameFormat, { twoToken: number; oneToken: number }>;\n\tdissent: Record<NameFormat, number>;\n\t/**\n\t * Uninformative pseudo-prints mixed into the order probabilities: with `n` oriented\n\t * prints, each probability is `(n·p + smoothing/3) / (n + smoothing)`, and each\n\t * part probability is `(n·p + smoothing/2) / (n + smoothing)` over `n` read prints,\n\t * so a small population stays near uniform whatever its likelihoods say.\n\t */\n\tsmoothing: number;\n\t/**\n\t * The mixed-document test's level: a collection whose dissent count is less\n\t * probable than this, binomially, at the leading format's `dissent` rate, prints\n\t * both orders; its verdict is `unknown` (`mixed`) however the probabilities fall.\n\t */\n\tmixedTail: number;\n\tschool: PartReader;\n\tlocation: PartReader;\n}\n\n/**\n * FITTED by `training/fit-name-format.ts` (and its selection of `smoothing`; the\n * threshold and `mixedTail` are decided, see the pull request). Provenance:\n *\n * corpus: corpus-v3.0.0-188, solo competitions, transcript and manifested halves\n * command: NAMES_CORPUS_DIR=<corpus-v3.0.0-188> bun training/fit-name-format.ts\n * split: 80/10/10 by event-year, `splitOf` (FNV-1a of the event-year, no seed)\n * date: 2026-10-02\n *\n * Refit when the readings above change.\n */\nexport const NAME_FORMAT_MODEL: NameFormatModel = {\n\tcomma: { \"First Last\": 0.00001237, \"Last, First\": 0.9989, \"Last First\": 0.0009921 },\n\tsurnameFirst: {\n\t\t\"First Last\": { twoToken: 0.0008603, oneToken: 0.02476 },\n\t\t\"Last, First\": { twoToken: 0.5, oneToken: 0.0625 },\n\t\t\"Last First\": { twoToken: 0.9972, oneToken: 0.9604 },\n\t},\n\tdissent: { \"First Last\": 0.004387, \"Last, First\": 0.0004406, \"Last First\": 0.01895 },\n\tsmoothing: 0.25,\n\tmixedTail: 0.01,\n\tschool: { recall: 0.9945, falseRate: 0.0248 },\n\tlocation: { recall: 0.6772, falseRate: 0.0001503 },\n};\n\n/** The default threshold (see `NAME_FORMAT_MODEL`). */\nexport const DEFAULT_NAME_FORMAT_THRESHOLD = 0.95;\n\n/** The order readings of a collection, counted in `ORDER_READINGS` order. */\nexport function orderCounts(readings: readonly NameCellReading[]): number[] {\n\tconst counts = ORDER_READINGS.map(() => 0);\n\tfor (const r of readings) if (r.order !== undefined) counts[ORDER_READINGS.indexOf(r.order)]!++;\n\treturn counts;\n}\n\n/** Log likelihood of a collection's readings under one format. */\nfunction orderLogLikelihood(\n\tcounts: readonly number[],\n\tread: number,\n\tmodel: NameFormatModel,\n\tf: NameFormat,\n): number {\n\tconst [comma, gf2, sf2, gf1, sf1] = counts as [number, number, number, number, number];\n\tconst k = model.comma[f];\n\tconst s = model.surnameFirst[f];\n\treturn (\n\t\tcomma * Math.log(k) +\n\t\t(read - comma) * Math.log1p(-k) +\n\t\tsf2 * Math.log(s.twoToken) +\n\t\tgf2 * Math.log1p(-s.twoToken) +\n\t\tsf1 * Math.log(s.oneToken) +\n\t\tgf1 * Math.log1p(-s.oneToken)\n\t);\n}\n\n/**\n * P(most cells carry the part | `k` of `n` read prints read one): the share `θ` of\n * cells carrying it is uniform a priori, each print reads one with probability\n * `θ·recall + (1 - θ)·falseRate`, and the answer is the posterior mass of `θ ≥ 1/2`.\n */\nexport function partProbability(k: number, n: number, reader: PartReader): number {\n\tif (n === 0) return 0.5;\n\tconst steps = 200;\n\tlet lo = 0;\n\tlet hi = 0;\n\tconst logs: number[] = [];\n\tfor (let i = 0; i < steps; i++) {\n\t\tconst theta = (i + 0.5) / steps;\n\t\tconst q = theta * reader.recall + (1 - theta) * reader.falseRate;\n\t\tlogs.push(k * Math.log(q) + (n - k) * Math.log1p(-q));\n\t}\n\tconst m = Math.max(...logs);\n\tfor (const [i, l] of logs.entries()) {\n\t\tconst w = Math.exp(l - m);\n\t\tif ((i + 0.5) / steps >= 0.5) hi += w;\n\t\telse lo += w;\n\t}\n\treturn hi / (lo + hi);\n}\n\n/** Score a collection's readings under a model. Exported for the fit; callers use `deriveNameFormat`. */\nexport function scoreReadings(\n\treadings: readonly NameCellReading[],\n\tmodel: NameFormatModel,\n\tthreshold: number,\n\tschoolRead: boolean,\n): NameFormatResult {\n\tconst evidence: NameFormatEvidence = {\n\t\tprints: readings.length,\n\t\tskipped: { empty: 0, \"no-name\": 0, team: 0 },\n\t\tseparatorCommas: 0,\n\t\tdiscountedCommas: { place: 0, glue: 0, trailing: 0, suffix: 0, particle: 0 },\n\t\tlexicon: {\n\t\t\t\"given-first:two-token\": 0,\n\t\t\t\"surname-first:two-token\": 0,\n\t\t\t\"given-first:one-token\": 0,\n\t\t\t\"surname-first:one-token\": 0,\n\t\t},\n\t\tunread: 0,\n\t\tschool: schoolRead ? 0 : null,\n\t\tlocation: 0,\n\t};\n\tlet read = 0;\n\tfor (const r of readings) {\n\t\tif (r.skipped !== undefined) {\n\t\t\tevidence.skipped[r.skipped]++;\n\t\t\tcontinue;\n\t\t}\n\t\tread++;\n\t\tfor (const c of r.commas) {\n\t\t\tif (c === \"separator\") evidence.separatorCommas++;\n\t\t\telse if (c !== \"none\") evidence.discountedCommas[c]++;\n\t\t}\n\t\tif (r.order === undefined) evidence.unread++;\n\t\telse if (r.order !== \"comma\") evidence.lexicon[r.order]++;\n\t\tif (r.school !== undefined && evidence.school !== null) evidence.school++;\n\t\tif (r.location !== undefined) evidence.location++;\n\t}\n\n\tconst counts = orderCounts(readings);\n\tconst oriented = counts.reduce((a, b) => a + b, 0);\n\tconst smooth = (x: number, n: number, k: number): number =>\n\t\tn + model.smoothing === 0 ? x : (n * x + model.smoothing / k) / (n + model.smoothing);\n\tconst p = posterior(NAME_FORMATS.map((f) => orderLogLikelihood(counts, read, model, f))).map(\n\t\t(x) => smooth(x, oriented, NAME_FORMATS.length),\n\t);\n\tconst probabilities = Object.fromEntries(\n\t\tNAME_FORMATS.map((f, i) => [f, p[i] as number]),\n\t) as Record<NameFormat, number>;\n\tlet best = 0;\n\tfor (let i = 1; i < p.length; i++) if ((p[i] as number) > (p[best] as number)) best = i;\n\tconst leading = NAME_FORMATS[best] as NameFormat;\n\tconst against = nameFormatOrder(leading) === \"given-first\" ? \"surname-first\" : \"given-first\";\n\tconst dissent = readings.filter((r) => r.orderPoints === against);\n\tconst mixed =\n\t\tdissent.length > 0 &&\n\t\tbinomialTail(dissent.length, oriented, model.dissent[leading]) < model.mixedTail;\n\tconst verdict: NameFormatVerdict =\n\t\t!mixed && (p[best] as number) >= threshold ? leading : \"unknown\";\n\n\treturn {\n\t\tprobabilities,\n\t\tverdict,\n\t\thasSchool:\n\t\t\tevidence.school === null\n\t\t\t\t? null\n\t\t\t\t: smooth(partProbability(evidence.school, read, model.school), read, 2),\n\t\thasLocation: smooth(partProbability(evidence.location, read, model.location), read, 2),\n\t\tmixed,\n\t\tevidence,\n\t\tdissent,\n\t\treadings: [...readings],\n\t};\n}\n\n/**\n * Which printed-name order one collection of name cells uses, and whether the cells\n * carry a school or a place. See the module comment.\n */\nexport function deriveNameFormat(\n\tprints: Iterable<PrintedNameCell>,\n\toptions: NameFormatOptions = {},\n): NameFormatResult {\n\tconst cells = [...prints];\n\tconst threshold = options.threshold ?? DEFAULT_NAME_FORMAT_THRESHOLD;\n\tconst schoolRead =\n\t\tBoolean(options.segmenter) || cells.some((c) => typeof c !== \"string\" && Boolean(c.school));\n\tconst first = scoreReadings(\n\t\tcells.map((c) => readNameCell(c, options)),\n\t\tNAME_FORMAT_MODEL,\n\t\tthreshold,\n\t\tschoolRead,\n\t);\n\tif (first.hasLocation <= 0.5 || options.readLocation === false || options.placeColumn)\n\t\treturn first;\n\treturn scoreReadings(\n\t\tcells.map((c) => readNameCell(c, { ...options, placeColumn: true })),\n\t\tNAME_FORMAT_MODEL,\n\t\tthreshold,\n\t\tschoolRead,\n\t);\n}\n"
|
|
13
15
|
],
|
|
14
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,IAAM,SAAsC,IAAI,IAC/C;AAAA,EACC,CAAC,MAAQ,GAAI;AAAA,EACb,CAAC,MAAQ,GAAI;AAAA,EACb,CAAC,KAAQ,GAAI;AAAA,EACb,CAAC,MAAQ,GAAI;AAAA,EACb,CAAC,MAAQ,GAAI;AAAA,EACb,CAAC,MAAQ,GAAI;AAAA,EACb,CAAC,MAAQ,GAAI;AAAA,E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