@finbheara/names 0.14.0 → 0.16.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 +12 -6
- package/data/bloom/MANIFEST.json +59 -13
- package/dist/chunks/{index-7vvt5hhy.js → index-0wpvbdgh.js} +2631 -1395
- package/dist/chunks/{index-7vvt5hhy.js.map → index-0wpvbdgh.js.map} +4 -4
- package/dist/chunks/{index-kw69ry3j.js → index-74fyytnh.js} +1333 -20
- package/dist/chunks/{index-kw69ry3j.js.map → index-74fyytnh.js.map} +5 -4
- package/dist/chunks/{index-pncn9y2r.js → index-a6f2y4aa.js} +2 -2
- package/dist/chunks/{index-r5fp3znj.js → index-ky754nsf.js} +7 -7
- package/dist/chunks/{index-r5fp3znj.js.map → index-ky754nsf.js.map} +3 -3
- package/dist/chunks/{index-ka8nzreg.js → index-tk01chxw.js} +2 -2
- package/dist/chunks/{index-kw6gbrnq.js → index-tqdbxd92.js} +2 -2
- package/dist/chunks/{index-a15g2gp6.js → index-ye6j60jn.js} +3 -3
- package/dist/chunks/phrase-2hj26asc.js +11 -0
- package/dist/classifier/index.js +3 -3
- package/dist/cli/census.js +4 -4
- package/dist/index.js +14 -8
- package/dist/index.js.map +1 -1
- package/dist/lexicon/index.js +4 -2
- package/dist/lexicon/index.js.map +1 -1
- package/dist/measure/index.js +4 -4
- package/dist/normalize/index.js +9 -5
- package/dist/normalize/index.js.map +1 -1
- package/dist/types/classifier/bf/filters.d.ts +8 -3
- package/dist/types/lexicon/flags.d.ts +13 -5
- package/dist/types/normalize/given-families.d.ts +48 -0
- package/dist/types/normalize/index.d.ts +1 -0
- package/dist/types/normalize/name-kinship.d.ts +12 -8
- package/docs/NAME-NORMALIZATION.md +36 -7
- package/names.txt +2624 -1389
- package/package.json +4 -2
- package/src/normalize/given-families.MANIFEST.json +46 -0
- package/dist/chunks/phrase-672g18kw.js +0 -11
- /package/dist/chunks/{index-pncn9y2r.js.map → index-a6f2y4aa.js.map} +0 -0
- /package/dist/chunks/{index-ka8nzreg.js.map → index-tk01chxw.js.map} +0 -0
- /package/dist/chunks/{index-kw6gbrnq.js.map → index-tqdbxd92.js.map} +0 -0
- /package/dist/chunks/{index-a15g2gp6.js.map → index-ye6j60jn.js.map} +0 -0
- /package/dist/chunks/{phrase-672g18kw.js.map → phrase-2hj26asc.js.map} +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/normalize/name-mojibake.ts", "../src/normalize/given-diminutives.ts", "../src/normalize/multiset.ts", "../src/normalize/name-middle.ts", "../src/normalize/name-compose.ts", "../src/normalize/name-kinship.ts", "../src/normalize/name-compare.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"],
|
|
3
|
+
"sources": ["../src/normalize/name-mojibake.ts", "../src/normalize/given-diminutives.ts", "../src/normalize/given-families.ts", "../src/normalize/multiset.ts", "../src/normalize/name-middle.ts", "../src/normalize/name-compose.ts", "../src/normalize/name-kinship.ts", "../src/normalize/name-compare.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` and `givenFamilyTable` answer about a\n * pair and neither returns a root, for that reason.\n *\n * SPELLINGS, FAMILIES AND THE GATE. Two different given names are related in one of three\n * ways, and the answer says which:\n *\n * - `given-variant`: two spellings of one name (`Connor` / `Conor`, `Sara` / `Sarah`). A\n * spelling is not a familiar form, so `variants` is its own table, and a gate admits it.\n * - `given-family`: after each spelling is read as its canonical, the two share a ROOT of\n * `families` (`Tom` / `Thomas`, `Kate` / `Katherine`), and a gate admits it.\n * - `given-family-not-gate`: they share a root, but only through a `notAtGate` form: a name in\n * its own right (`Megan`, `Grace`), a translation (`Sean`, `Padraig`), another gender's\n * name (`Michelle`, `Sam`) or a form of more than one root (`Ellie`, `Evie`). The lane\n * reads it as evidence below an exact match; a gate refuses it.\n *\n * EVERY ROOT, NEVER THE FIRST. A form under several roots meets each of them (`Evie` is\n * Evelyn's, Genevieve's, Eve's and Eva's), and every such form is `notAtGate`, because the\n * form alone cannot say which root its bearer carries. Sharing a root is not transitive:\n * `Eve` and `Eva` share none, though `Evie` meets both. A `notAtGate` form is refused AS A\n * FORM: where it is the root itself (`Caitlin` / `Cait`), its own forms meet it at a gate.\n */\n\nimport table from \"./given-diminutives.json\";\n\ninterface Table {\n\tvariants: Record<string, readonly string[]>;\n\tfamilies: Record<string, readonly string[]>;\n\tnotAtGate: readonly string[];\n}\n\nconst TABLE = table as unknown as Table;\n\n/** spelling -> its canonical spelling; a canonical maps to itself only by absence. */\nconst CANONICAL: ReadonlyMap<string, string> = (() => {\n\tconst out = new Map<string, string>();\n\tfor (const [canonical, spellings] of Object.entries(TABLE.variants))\n\t\tfor (const s of spellings) out.set(s, canonical);\n\treturn out;\n})();\n\n/** canonical name -> every root it belongs to: itself when it is a root, and each root it is a form of. */\nconst ROOTS: ReadonlyMap<string, ReadonlySet<string>> = (() => {\n\tconst out = new Map<string, Set<string>>();\n\tconst add = (form: string, root: string) => {\n\t\tlet roots = out.get(form);\n\t\tif (roots === undefined) out.set(form, (roots = new Set()));\n\t\troots.add(root);\n\t};\n\tfor (const [root, forms] of Object.entries(TABLE.families)) {\n\t\tadd(root, root);\n\t\tfor (const f of forms) add(f, root);\n\t}\n\treturn out;\n})();\n\nconst NOT_AT_GATE: ReadonlySet<string> = new Set(TABLE.notAtGate);\n\nconst canonical = (name: string): string => CANONICAL.get(name) ?? name;\n\n/** May `name` (canonical) meet the other side of a pair through `root` at a gate? */\nconst gateThrough = (name: string, root: string): boolean =>\n\tname === root || !NOT_AT_GATE.has(name);\n\n/**\n * Do two DIFFERENT given names (NN3, letters only) stand for one another at a gate?\n *\n * True exactly when `givenFamilyTable` relates them by a gate-safe answer: two spellings of\n * one name, or one family through no `notAtGate` form. Two equal names answer `false`:\n * equality is the caller's own test and this is the tolerance past it, so a caller can tell\n * which one admitted a pair.\n */\nexport function sameGivenFamily(a: string, b: string): boolean {\n\tconst via = givenFamilyTable(a, b);\n\treturn via === \"given-variant\" || via === \"given-family\";\n}\n\n/**\n * What the table says about two DIFFERENT given names (NN3, letters only), as a kinship\n * `via`: `given-variant` for two spellings of one name, `given-family` where the two share a\n * root and a gate admits the pair, `given-family-not-gate` where every root they share is\n * reached through a `notAtGate` form, and `null` where the table does not relate them. Two\n * equal names answer `null`, for `sameGivenFamily`'s reason.\n *\n * THE DEFAULT GIVEN-NAME PROVIDER of `createNameKinship` (`./name-kinship.ts`).\n * `sameGivenFamily` is defined as its gate-safe answers, so the gate and the tolerant relation\n * cannot disagree about a pair.\n */\nexport function givenFamilyTable(\n\ta: string,\n\tb: string,\n): \"given-variant\" | \"given-family\" | \"given-family-not-gate\" | null {\n\tif (a === b) return null;\n\tconst ca = canonical(a);\n\tconst cb = canonical(b);\n\tif (ca === cb) return \"given-variant\";\n\tconst ra = ROOTS.get(ca);\n\tconst rb = ROOTS.get(cb);\n\tif (ra === undefined || rb === undefined) return null;\n\tlet shared = false;\n\tfor (const root of ra) {\n\t\tif (!rb.has(root)) continue;\n\t\tif (gateThrough(ca, root) && gateThrough(cb, root)) return \"given-family\";\n\t\tshared = true;\n\t}\n\treturn shared ? \"given-family-not-gate\" : null;\n}\n",
|
|
7
|
+
"/**\n * given-families.ts — THE EXTENDED GIVEN-NAME FAMILY LIST, read by the TypeScript side.\n *\n * `./given-families.json` is the list and this file is its reader; `scripts/given-families.ts`\n * builds the list and `./given-families.MANIFEST.json` records its sources.\n *\n * TWO TIERS OF GIVEN-NAME KNOWLEDGE. `./given-diminutives.json` is the GATE tier: pairs this\n * package is sure of, curated by hand, some of them admitted at an identity gate. This list\n * is the EXTENDED tier: every family the sources record for English, Irish, Scottish, Welsh,\n * French, Italian, Spanish, German, Dutch and Polish usage, about 2,600 names. A pair it\n * relates MAY be one name, and the answer is `given-maybe`, which no gate admits.\n *\n * AN EXACT LIST, NOT A FILTER. A bloom filter of the same pairs at 8 KB answers about fifty\n * false partners for every given name it is asked about; the exact list is a few KB more\n * and answers none.\n *\n * A FAMILY IS CLOSED. Two names relate when they are a root and its form, or two forms of\n * one root (`Kate` / `Katie`, both Catherine's). A form under several roots meets each\n * root's family, and nothing is transitive across families: `Kit` meets Catherine's and\n * Christopher's, and `Kate` / `Chris` stay apart.\n *\n * A TIER BOUNDS HOW RARE A FORM MAY BE. Each form carries 1 (common), 2 (uncommon) or 3\n * (rare); a pair's tier is its rarer member's, the root counting as 1, and where two names\n * share several families the commonest counts. `maxTier` admits pairs up to that tier.\n */\n\nimport list from \"./given-families.json\";\n\n/** How common a form is: 1 common, 2 uncommon, 3 rare. */\nexport type GivenFamilyTier = 1 | 2 | 3;\n\nexport interface GivenFamilyListOptions {\n\t/** The rarest tier admitted. Default 3: every pair the list holds. */\n\treadonly maxTier?: GivenFamilyTier;\n\t/**\n\t * The families, one `ROOT,FORM:TIER,…` line each, NN3 upper case. Default: the shipped\n\t * `given-families.json`. A caller with its own list passes it here.\n\t */\n\treadonly families?: readonly string[];\n}\n\n/** A given-name provider over the extended list: `given-maybe` or `null`. */\nexport type GivenFamilyList = (a: string, b: string) => \"given-maybe\" | null;\n\n/** name -> root -> the name's tier in that root's family (a root's own is 1) */\ntype Memberships = ReadonlyMap<string, ReadonlyMap<string, number>>;\n\n/**\n * The lines, read. A malformed line throws: the list is data this package ships or a caller\n * supplies, and a line read wrong would relate names silently.\n */\nfunction parseFamilies(lines: readonly string[]): Memberships {\n\tconst out = new Map<string, Map<string, number>>();\n\tconst join = (name: string, root: string, tier: number) => {\n\t\tlet roots = out.get(name);\n\t\tif (roots === undefined) out.set(name, (roots = new Map()));\n\t\troots.set(root, Math.min(roots.get(root) ?? tier, tier));\n\t};\n\tfor (const line of lines) {\n\t\tconst [root, ...forms] = line.split(\",\");\n\t\tif (root === undefined || !/^[A-Z]+$/.test(root))\n\t\t\tthrow new Error(`given-families: bad root in \"${line}\"`);\n\t\tjoin(root, root, 1);\n\t\tfor (const entry of forms) {\n\t\t\tconst m = /^([A-Z]+):([123])$/.exec(entry);\n\t\t\tif (m === null) throw new Error(`given-families: bad form \"${entry}\" in \"${line}\"`);\n\t\t\tjoin(m[1] as string, root, Number(m[2]));\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n * The extended list as a `GivenProvider` for `createNameKinship`: `given-maybe` where two\n * DIFFERENT names (NN3) share a family within `maxTier`, `null` otherwise. Two equal names\n * answer `null`, as `givenFamilyTable`'s do.\n *\n * The list is parsed on the first question, once per provider.\n */\nexport function createGivenFamilyList(options: GivenFamilyListOptions = {}): GivenFamilyList {\n\tconst maxTier = options.maxTier ?? 3;\n\tconst lines = options.families ?? (list as { families: readonly string[] }).families;\n\tlet members: Memberships | undefined;\n\treturn (a, b) => {\n\t\tif (a === b) return null;\n\t\tmembers ??= parseFamilies(lines);\n\t\tconst ra = members.get(a);\n\t\tconst rb = members.get(b);\n\t\tif (ra === undefined || rb === undefined) return null;\n\t\tfor (const [root, ta] of ra) {\n\t\t\tconst tb = rb.get(root);\n\t\t\tif (tb !== undefined && Math.max(ta, tb) <= maxTier) return \"given-maybe\";\n\t\t}\n\t\treturn null;\n\t};\n}\n\n/** The shipped list, every tier: the second given-name provider of `nameKinship`. */\nexport const givenFamilyList: GivenFamilyList = createGivenFamilyList();\n",
|
|
7
8
|
"/**\n * multiset.ts — the one sub-multiset test over surname parts.\n *\n * MOVED HERE FROM `./name-compose.ts` so that `./name-kinship.ts` reads the same test the\n * meet of two surnames reads, without either file importing the other and without the test\n * joining the package's surface (`index.ts` re-exports `name-compose.ts` whole).\n */\n\n/** Is `outer` a sub-multiset of `inner`? `[Walter] ⊒ [Walter, Oreskarard]`. */\nexport function 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",
|
|
8
9
|
"/**\n * name-middle.ts — NN5, the middle-name relation.\n *\n * `docs/NAME-NORMALIZATION.md` § *The levels, by use case* is the specification\n * and § *NN5 — the middle-name relation* is this file's half of it.\n *\n * ## IT IS A RELATION BETWEEN TWO PARSES, NOT A LEVEL OF ONE\n *\n * There is no `nn5` string and there is never going to be one. No row is ever\n * filed under a key; a row is filed for one or more addresses. A level is a\n * total function of ONE parse, so equal level strings partition the corpus and a\n * row may be filed under the partition. This cannot be one, because the\n * tolerance it implements is NOT TRANSITIVE:\n *\n * Emma Jane Mailtina ~ Emma Mailtina ~ Emma Kate Mailtina\n * Emma Jane Mailtina ≁ Emma Kate Mailtina\n *\n * A string that made those three compare equal would have to make the first and\n * the third equal too. So NN5 answers a question about a PAIR, `levelOf` keeps\n * its `TransitiveLevel`, and `createNameSet(\"nn5\")` and `createNameMap(\"nn5\")`\n * still do not compile.\n *\n * ## IT BUILDS ON NN3, AND NN3 IS THE ONLY LEVEL IT COULD BUILD ON\n *\n * The surname and the FIRST given name must already agree before the middle\n * fields are looked at, so NN5 needs a level that still knows which field is\n * which. NN3 is that level: it has dropped case, accents and punctuation — which\n * is why `Emma J Mailtina` against `Emma J. Mailtina` needs nothing from this file —\n * and it has KEPT the field order, so \"the surname\" and \"the first given\" are\n * questions it can answer. NN4 sorted the fields together and can no longer tell\n * a surname from a middle name, so the question cannot be put to it.\n *\n * ORDER TOLERANCE IS THEREFORE NOT LAYERED IN. A caller that also needs the\n * `Mailtina Emma` / `Emma Mailtina` tolerance asks NN4 for it, separately and\n * knowingly. Stacking the two here would answer a wider question than either\n * level was asked, and under-fold beats over-fold: a false reject costs a judge\n * call, a false accept silently merges two dancers.\n *\n * ## WHAT IT IS FOR, MEASURED\n *\n * A middle-name census over a large results corpus: of the 41,041\n * distinct championship prints on the majors (T1-T3), 971 (surname, first-given)\n * groups carry more than one middle form. 930 of them have a print with no\n * middle beside one with a middle; 15 have an initial beside a full middle. No\n * level folds either shape today.\n *\n * THE COUNTS ARE A MEASUREMENT, NOT A CONSTANT. They move with the print\n * population, not with the method: four groupings (suffixes in, suffixes out,\n * suffix-bearing prints dropped, first middle field only) land at 968-972, so the\n * suffix decision does not drive them, and `initial beside a middle` is 15 either\n * way.\n */\n\nimport type { PersonName } from \"./person-name.ts\";\n\n/**\n * What NN5 answers about two parses.\n *\n * THREE VALUES AND NOT TWO, for the same reason `placeRelation` has five: the\n * caller that wants a veto and the caller that wants an identity are different\n * callers, and collapsing them makes one of the two re-derive the other. `same`\n * is \"NN3 already agreed and NN5 tolerated nothing\"; `candidate` is \"NN5\n * tolerated a middle name, and THE REST OF THE EVIDENCE DECIDES\"; `different` is\n * the veto.\n *\n * `candidate` IS NOT A MERGE. It says two prints MAY be one person. Nothing in\n * this package may act on it, and nothing downstream may act on it alone.\n */\nexport type NameRelation = \"same\" | \"candidate\" | \"different\";\n\n/** Why the relation came out the way it did. One value per branch of the rule table. */\nexport type NameRelationReason =\n\t/** one side names no person — a refusal, a team or an empty cell */\n\t| \"not-a-person\"\n\t/** the surname or the first given name disagree at NN3 */\n\t| \"head-differs\"\n\t/** the middle fields are equal, so the two prints already agreed at NN3 */\n\t| \"middles-equal\"\n\t/** one side carries no middle at all and the other carries one */\n\t| \"middle-absent\"\n\t/** an initial against a full middle whose first letter matches */\n\t| \"initial-agrees\"\n\t/** two initials that differ */\n\t| \"initials-differ\"\n\t/** an initial against a full middle whose first letter differs */\n\t| \"initial-differs-from-middle\"\n\t/** two full middles that differ */\n\t| \"middles-differ\"\n\t/** both sides carry middles and they are not the same number of fields */\n\t| \"middle-count-differs\"\n\t/** the generational or qualification suffixes disagree */\n\t| \"suffixes-differ\";\n\n/** NN5's answer: the relation, and the rule that produced it. */\nexport interface NameReading {\n\treadonly relation: NameRelation;\n\treadonly reason: NameRelationReason;\n}\n\n/**\n * Where the given fields stop being middle names and start being suffixes.\n *\n * NN2 WRITES A SUFFIX INTO THE TRAILING GIVEN SLOT (`Jyskock<<John<II`), so\n * `givenFields()` carries it and `suffixes` says how many of the trailing ones\n * it is. Reading the count off the parse rather than asking the vocabulary about\n * each field is deliberate: `isNameSuffix(\"v\")` is true, and `Victoria V Mailtina`\n * prints a middle INITIAL `V` that the splitter did not record as a suffix. The\n * parse already decided; this reads its decision instead of taking a second one.\n */\nfunction suffixCut(p: PersonName): number {\n\treturn Math.max(1, p.givenFields().length - p.suffixes.length);\n}\n\n/**\n * The middle fields: the NN3 given fields after the first, suffixes excluded.\n *\n * EXPORTED FOR AN ADJUDICATOR TABLE, which carries them as a column so the link's\n * model can tell `Mary Lou` from `Mary Ann` when both print `MARY` first. It is this file's\n * cut and not a second one: the suffix rule stays here.\n */\nexport function middleFields(p: PersonName): readonly string[] {\n\treturn p.givenFields().slice(1, suffixCut(p));\n}\n\n/** The suffix fields, at NN3 grade — the same fold the middles are compared at. */\nfunction suffixFields(p: PersonName): readonly string[] {\n\treturn p.givenFields().slice(suffixCut(p));\n}\n\nconst sameList = (x: readonly string[], y: readonly string[]): boolean =>\n\tx.length === y.length && x.every((v, i) => v === y[i]);\n\n/** An NN3 field standing for a name rather than spelling one. One letter, no more. */\nconst isInitial = (field: string): boolean => field.length === 1;\n\n/**\n * Two middle fields at one position, as one of the five outcomes.\n *\n * THIS IS A STRUCTURED COMPARISON OF PARSED FIELDS AND NOT A DISTANCE. An edit\n * distance would make `ANNE` and `ANNA` near and `J` and `JANE` far, which is\n * both of the answers this table exists to get right the other way round. The\n * only substring test here is the one the rule states: an initial is the first\n * letter of the name it stands for.\n *\n * EXPORTED FOR `./name-compose.ts` AND FOR NOTHING ELSE. The compositional\n * relation needs the middles slot compared position for position, and it must\n * delegate to the rule NN5 already implements rather than to\n * fork it: two tables deciding whether `J` stands for `Jane` is exactly the\n * disagreement this package exists to prevent. Exporting it widens nothing —\n * `nameRelation` is still the only verdict this file gives, and `null` here still\n * means *these two positions agree*.\n */\nexport function comparePosition(x: string, y: string): NameRelationReason | null {\n\tif (x === y) return null;\n\tif (isInitial(x) && isInitial(y)) return \"initials-differ\";\n\tif (isInitial(x)) return y.startsWith(x) ? null : \"initial-differs-from-middle\";\n\tif (isInitial(y)) return x.startsWith(y) ? null : \"initial-differs-from-middle\";\n\treturn \"middles-differ\";\n}\n\n/**\n * NN5 — do these two parses differ ONLY in a middle name?\n *\n * The rule table, in the order it is applied:\n *\n * | the two sides | relation |\n * |---|---|\n * | either names no person | `different` |\n * | surnames or first givens disagree at NN3 | `different` |\n * | suffix fields disagree | `different` |\n * | the middle fields are equal (both empty included) | `same` |\n * | one side has no middle, the other has one or more | `candidate` |\n * | both have middles, different numbers of them | `different` |\n * | position for position: an initial against a full middle whose first letter matches | `candidate` |\n * | position for position: two full middles that differ | `different` |\n * | position for position: two initials that differ | `different` |\n * | position for position: an initial against a full middle whose first letter differs | `different` |\n *\n * MULTIPLE MIDDLE FIELDS ARE COMPARED POSITIONALLY AND ALL OR NOTHING. Two\n * prints that both carry middles must carry the SAME NUMBER of them; a shorter\n * list is not read as a subsequence of a longer one. The measurement is what\n * decides it: 930 of the 971 contested groups are one print with no middle\n * beside one with a middle, which the `middle-absent` row already covers, and a\n * subsequence rule buys the remainder by making `Emma Jane Marie Mailtina` a\n * candidate for `Emma Marie Mailtina` — two DIFFERENT middle-name structures, which\n * is the shape the `middles-differ` row refuses when there is one field. The\n * evidence supports tolerating a middle that a sheet did not print. It does not\n * support tolerating one that a sheet printed differently.\n *\n * A NON-PERSON IS `different`, INCLUDING AGAINST ITSELF. This is the school\n * side's rule (`docs/NORMALIZATION.md` § *A refusal is not reflexive*) and the\n * reason is the same: every refused print renders one identical NN3, so a\n * relation that read the rendering would make a card number and a regional\n * council the same dancer. NN0-NN4 answer `true` for that pair today and this\n * file does not change them — that gap is recorded on the trinity page and is\n * not this issue's to close.\n */\nexport function nameRelation(a: PersonName, b: PersonName): NameReading {\n\tif (!a.isPerson() || !b.isPerson()) return { relation: \"different\", reason: \"not-a-person\" };\n\n\tconst ga = a.givenFields();\n\tconst gb = b.givenFields();\n\tif (a.surnameKey() !== b.surnameKey() || ga[0] !== gb[0] || ga[0] === undefined) {\n\t\treturn { relation: \"different\", reason: \"head-differs\" };\n\t}\n\treturn tailRelation(a, b);\n}\n\n/**\n * NN5's rule table BELOW THE HEAD: the suffix row and every middle-name row, for two\n * persons whose surname and first given name the CALLER has already accepted.\n *\n * MOVED OUT OF `nameRelation`, NOT FORKED. `nameRelation` checks the head by equality and\n * hands the rest here; `./name-kinship.ts` accepts the head through its own tolerances\n * (a given-name family, a surname part) and hands the rest here too, so the two relations\n * read one middle-name rule and cannot disagree about `J` and `Jane`. It is not on the\n * package's surface: a caller that has not decided the head has no business asking it.\n */\nexport function tailRelation(a: PersonName, b: PersonName): NameReading {\n\tif (!sameList(suffixFields(a), suffixFields(b))) {\n\t\treturn { relation: \"different\", reason: \"suffixes-differ\" };\n\t}\n\n\tconst ma = middleFields(a);\n\tconst mb = middleFields(b);\n\tif (sameList(ma, mb)) return { relation: \"same\", reason: \"middles-equal\" };\n\tif (ma.length === 0 || mb.length === 0) return { relation: \"candidate\", reason: \"middle-absent\" };\n\tif (ma.length !== mb.length) {\n\t\treturn { relation: \"different\", reason: \"middle-count-differs\" };\n\t}\n\tfor (let i = 0; i < ma.length; i++) {\n\t\tconst refused = comparePosition(ma[i] as string, mb[i] as string);\n\t\tif (refused !== null) return { relation: \"different\", reason: refused };\n\t}\n\treturn { relation: \"candidate\", reason: \"initial-agrees\" };\n}\n\n/**\n * THE OWNER'S RULE, ASSERTED IN TYPECHECKED SOURCE.\n *\n * 2026-09-21: *\"no row is ever to EVER be filed under a key. ever. A row is filed\n * for one or more addresses.\"* There is no `nn5` member on `PersonName` and this\n * is what goes red the day somebody adds one — `bun run typecheck` reads it,\n * which no spec file in this repo is wired to do. It is exported because an\n * unexported alias nothing references is one `noUnusedLocals` away from being\n * deleted as dead, and the whole point is that it is not.\n */\ntype AssertTrue<T extends true> = T;\n\n/** NN5 is a relation between two parses, so no parse carries one. */\nexport type Nn5IsNotAMemberOfAParse = AssertTrue<\"nn5\" extends keyof PersonName ? false : true>;\n",
|
|
9
10
|
"/**\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 { subMultiset } from \"./multiset.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/**\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
|
-
"/**\n * name-kinship.ts — THE TYPED, TOLERANT NAME RELATION.\n *\n * `docs/NAME-NORMALIZATION.md` § *Name kinship — the tolerant relation* is the specification.\n *\n * ## WHAT IT ADDS TO NN5\n *\n * `nameRelation` (`./name-middle.ts`) is the strict identity relation: the surname and the\n * first given name must agree at NN3, and only a middle name is tolerated. A different head\n * is rightly `different` there. The other tolerances already exist, one helper each —\n * `givenFamilyTable` / `sameGivenFamily` for a given name, `surnameParts` for a compound\n * surname — and a caller that wanted them had to compose them by hand. This is that\n * composition, done once, and it REPORTS WHICH TOLERANCES A PAIR PASSED THROUGH so that each\n * caller decides how much to accept:\n *\n * Kate Smith / Katherine Smith candidate via [given-family]\n * Connor Smith / Conor Smith candidate via [given-variant]\n * Mary Larson / Mary Conley-Larson candidate via [surname-part]\n * Kate M Smith / Katherine Conley-Smith\n * candidate via [surname-part, given-family, middle-absent]\n *\n * ## `via` IS A SET, NOT A KIND\n *\n * A pair can pass through several tolerances at once, one per field, and naming the\n * combinations (`both`) grows as the product of the fields. So `via` lists every tolerance\n * used, in the fixed order of `KINSHIP_VIAS`, and is empty for a pair NN3 already agreed on.\n *\n * ## `candidate` IS STILL NOT A MERGE\n *\n * The three values are `NameRelation`'s and mean what they mean there. Every tolerance here\n * is \"may be the same person, the rest of the evidence decides\". `gateSafe` says something\n * narrower: every tolerance used is one this package's own gate comparators already admit —\n * a middle name `probablySame(…, \"nn5\")` admits, a given-name family `sameGivenFamily`\n * admits, a compound the print itself carries. A table form that is a name in its own right\n * (`given-family-not-gate`) or a probabilistic source (`given-maybe`) is a lead for the rest\n * of the evidence and never a gate.\n *\n * ## THE GIVEN-NAME TOLERANCE IS INJECTED\n *\n * Which given names are one family is DATA, and the data will move: a probabilistic source\n * of diminutive pairs is expected beside the curated table, and the table may shrink. So the\n * relation asks an ordered list of `GivenProvider`s fixed by `createNameKinship`'s options,\n * and the core knows no table. A new provider is an option; a new kind of answer is one\n * line in `KINSHIP_VIAS`, which also carries its gate-safety, so no branch here changes.\n *\n * ## IT COMPOSES, IT DOES NOT FORK\n *\n * The middle-name and suffix rows are `tailRelation`, the half of `nameRelation` below the\n * head, so `J` against `Jane` is decided in one place. With no tolerance used this answers\n * exactly what `nameRelation` answers (`normalize-name-kinship.spec.ts` pins it), except that\n * it splits `head-differs` into the half that differed.\n */\n\nimport { givenFamilyTable } from \"./given-diminutives.ts\";\nimport { subMultiset } from \"./multiset.ts\";\nimport { surnameParts } from \"./name-compose.ts\";\nimport { type NameRelation, type NameRelationReason, tailRelation } from \"./name-middle.ts\";\nimport type { PersonName } from \"./person-name.ts\";\n\n/**\n * EVERY TOLERANCE THE RELATION CAN REPORT, IN THE ORDER IT REPORTS THEM, with the field it\n * tolerates and whether a gate may admit a pair through it. The one declaration: the\n * `KinshipVia`, `GivenVia` and `MiddleVia` types are read off it, so adding a kind is a\n * line here and nothing else in the core.\n */\nexport const KINSHIP_VIAS = Object.freeze({\n\t/** one surname is a whole hyphen- or space-joined part of the other's compound */\n\t\"surname-part\": Object.freeze({ field: \"surname\", gateSafe: true }),\n\t/** the two first given names are two spellings of one name (`Connor` / `Conor`) */\n\t\"given-variant\": Object.freeze({ field: \"given\", gateSafe: true }),\n\t/** the given-name table relates the two first given names, and the gate admits them */\n\t\"given-family\": Object.freeze({ field: \"given\", gateSafe: true }),\n\t/** the table relates them through a form that is a name in its own right */\n\t\"given-family-not-gate\": Object.freeze({ field: \"given\", gateSafe: false }),\n\t/** a probabilistic source says the two MAY be one family; reserved for one */\n\t\"given-maybe\": Object.freeze({ field: \"given\", gateSafe: false }),\n\t/** NN5's own: one side carries no middle name */\n\t\"middle-absent\": Object.freeze({ field: \"middle\", gateSafe: true }),\n\t/** NN5's own: an initial against a full middle whose first letter matches */\n\t\"initial-agrees\": Object.freeze({ field: \"middle\", gateSafe: true }),\n} as const);\n\n/** A tolerance a pair passed through. */\nexport type KinshipVia = keyof typeof KINSHIP_VIAS;\n\n/** The order `via` is reported in: `KINSHIP_VIAS`'s own, so two runs print one list. */\nconst VIA_ORDER: readonly KinshipVia[] = Object.freeze(Object.keys(KINSHIP_VIAS) as KinshipVia[]);\n\ntype ViaOfField<F extends string> = {\n\t[K in KinshipVia]: (typeof KINSHIP_VIAS)[K][\"field\"] extends F ? K : never;\n}[KinshipVia];\n\n/** The tolerances a `GivenProvider` may answer with. */\nexport type GivenVia = ViaOfField<\"given\">;\n\n/** The middle-name tolerances: NN5's two `candidate` reasons, by the same names. */\nexport type MiddleVia = ViaOfField<\"middle\">;\n\n/**\n * Why the relation came out the way it did. NN5's reasons, except that `head-differs` is\n * split into the half that differed, because this relation tolerates each half on its own.\n */\nexport type KinshipReason =\n\t| Exclude<NameRelationReason, \"head-differs\">\n\t/** the surnames are neither equal at NN3 nor one a whole part of the other */\n\t| \"surname-differs\"\n\t/** the first given names are neither equal at NN3 nor related by any provider (or one is missing) */\n\t| \"given-differs\";\n\n/** The tolerant relation's answer. */\nexport interface NameKinship {\n\t/** `NameRelation`'s three values, meaning what they mean there: `candidate` is never a merge */\n\treadonly relation: NameRelation;\n\t/** every tolerance used, in `KINSHIP_VIAS` order; empty for `same` and for `different` */\n\treadonly via: readonly KinshipVia[];\n\t/** the veto for `different`; NN5's middle-name reason otherwise */\n\treadonly reason: KinshipReason;\n\t/** true only when the pair is related and every `via` is gate-safe */\n\treadonly gateSafe: boolean;\n}\n\n/**\n * Might two DIFFERENT first given names (NN3 fields, so upper case and letters) be one\n * family, and by which tolerance? `null` is \"this provider does not relate them\".\n *\n * IT IS ASKED WITH `a < b` in code-unit order, once per pair, so a provider holding ordered\n * pairs needs to hold each pair one way only and the relation stays symmetric whatever the\n * provider does.\n */\nexport type GivenProvider = (a: string, b: string) => GivenVia | null;\n\nexport interface NameKinshipOptions {\n\t/**\n\t * The given-name tolerances, asked in order; THE FIRST NON-NULL ANSWER WINS, so a caller\n\t * lists its most trusted source first. Default `[givenFamilyTable]`; `[]` tolerates no\n\t * given name.\n\t */\n\treadonly given?: readonly GivenProvider[];\n}\n\n/** A tolerant relation with its providers fixed. */\nexport type NameKinshipRelation = (a: PersonName, b: PersonName) => NameKinship;\n\nconst different = (reason: KinshipReason): NameKinship => ({\n\trelation: \"different\",\n\tvia: [],\n\treason,\n\tgateSafe: false,\n});\n\n/**\n * Is one surname a WHOLE part of the other's compound? `[LARSON]` against `[CONLEY, LARSON]`\n * is; `[LARSON]` against `[CARLSON]` is not, because a part is compared whole and never as a\n * substring. Equal part counts never qualify: two different surnames with as many parts\n * as each other are two surnames, not one inside the other.\n */\nfunction surnamePartOf(a: PersonName, b: PersonName): boolean {\n\tconst pa = surnameParts(a);\n\tconst pb = surnameParts(b);\n\tif (pa.length === pb.length) return false;\n\tconst [short, long] = pa.length < pb.length ? [pa, pb] : [pb, pa];\n\treturn subMultiset(short, long);\n}\n\n/**\n * Make the tolerant relation over a fixed list of given-name providers.\n *\n * The rule table, in the order it is applied:\n *\n * | the two sides | relation |\n * |---|---|\n * | either names no person | `different`, `not-a-person` |\n * | surnames differ at NN3 and neither is a whole part of the other | `different`, `surname-differs` |\n * | first given names differ at NN3 (or one is missing) and no provider relates them | `different`, `given-differs` |\n * | NN5's suffix and middle rows (`tailRelation`) say `different` | `different`, NN5's reason |\n * | no tolerance used and the middles are equal | `same` |\n * | otherwise | `candidate`, via every tolerance used |\n */\nexport function createNameKinship(options: NameKinshipOptions = {}): NameKinshipRelation {\n\tconst providers: readonly GivenProvider[] = Object.freeze([\n\t\t...(options.given ?? [givenFamilyTable]),\n\t]);\n\tconst givenVia = (x: string, y: string): GivenVia | null => {\n\t\tconst [lo, hi] = x < y ? [x, y] : [y, x];\n\t\tfor (const provider of providers) {\n\t\t\tconst via = provider(lo, hi);\n\t\t\tif (via !== null) return via;\n\t\t}\n\t\treturn null;\n\t};\n\n\treturn (a, b) => {\n\t\tif (!a.isPerson() || !b.isPerson()) return different(\"not-a-person\");\n\t\tconst found = new Set<KinshipVia>();\n\n\t\tif (a.surnameKey() !== b.surnameKey()) {\n\t\t\tif (!surnamePartOf(a, b)) return different(\"surname-differs\");\n\t\t\tfound.add(\"surname-part\");\n\t\t}\n\n\t\tconst ga = a.givenFields()[0];\n\t\tconst gb = b.givenFields()[0];\n\t\tif (ga === undefined || gb === undefined) return different(\"given-differs\");\n\t\tif (ga !== gb) {\n\t\t\tconst via = givenVia(ga, gb);\n\t\t\tif (via === null) return different(\"given-differs\");\n\t\t\tfound.add(via);\n\t\t}\n\n\t\tconst tail = tailRelation(a, b);\n\t\tif (tail.relation === \"different\") return different(tail.reason as KinshipReason);\n\t\tif (tail.relation === \"candidate\") found.add(tail.reason as MiddleVia);\n\n\t\tconst via = VIA_ORDER.filter((v) => found.has(v));\n\t\treturn {\n\t\t\trelation: via.length === 0 ? \"same\" : \"candidate\",\n\t\t\tvia,\n\t\t\treason: tail.reason as KinshipReason,\n\t\t\tgateSafe: via.every((v) => KINSHIP_VIAS[v].gateSafe),\n\t\t};\n\t};\n}\n\n/** The tolerant relation over the curated given-name table, `givenFamilyTable`. */\nexport const nameKinship: NameKinshipRelation = createNameKinship();\n\n/**\n * THE MIDDLE VIAS ARE NN5'S CANDIDATE REASONS, ASSERTED IN TYPECHECKED SOURCE. A middle\n * `via` is `tailRelation`'s reason passed through, so the day either list moves without the\n * other, `bun run typecheck` goes red here. Exported for `Nn5IsNotAMemberOfAParse`'s reason.\n */\ntype AssertTrue<T extends true> = T;\n\n/** Every middle `via` is a reason NN5 can give. */\nexport type MiddleViasAreNn5Reasons = AssertTrue<\n\tMiddleVia extends NameRelationReason ? true : false\n>;\n",
|
|
11
|
+
"/**\n * name-kinship.ts — THE TYPED, TOLERANT NAME RELATION.\n *\n * `docs/NAME-NORMALIZATION.md` § *Name kinship — the tolerant relation* is the specification.\n *\n * ## WHAT IT ADDS TO NN5\n *\n * `nameRelation` (`./name-middle.ts`) is the strict identity relation: the surname and the\n * first given name must agree at NN3, and only a middle name is tolerated. A different head\n * is rightly `different` there. The other tolerances already exist, one helper each —\n * `givenFamilyTable` / `sameGivenFamily` for a given name, `surnameParts` for a compound\n * surname — and a caller that wanted them had to compose them by hand. This is that\n * composition, done once, and it REPORTS WHICH TOLERANCES A PAIR PASSED THROUGH so that each\n * caller decides how much to accept:\n *\n * Kate Smith / Katherine Smith candidate via [given-family]\n * Connor Smith / Conor Smith candidate via [given-variant]\n * Mary Larson / Mary Conley-Larson candidate via [surname-part]\n * Kate M Smith / Katherine Conley-Smith\n * candidate via [surname-part, given-family, middle-absent]\n *\n * ## `via` IS A SET, NOT A KIND\n *\n * A pair can pass through several tolerances at once, one per field, and naming the\n * combinations (`both`) grows as the product of the fields. So `via` lists every tolerance\n * used, in the fixed order of `KINSHIP_VIAS`, and is empty for a pair NN3 already agreed on.\n *\n * ## `candidate` IS STILL NOT A MERGE\n *\n * The three values are `NameRelation`'s and mean what they mean there. Every tolerance here\n * is \"may be the same person, the rest of the evidence decides\". `gateSafe` says something\n * narrower: every tolerance used is one this package's own gate comparators already admit —\n * a middle name `probablySame(…, \"nn5\")` admits, a given-name family `sameGivenFamily`\n * admits, a compound the print itself carries. A table form that is a name in its own right\n * (`given-family-not-gate`) or the extended family list (`given-maybe`) is a lead for the\n * rest of the evidence and never a gate.\n *\n * ## THE GIVEN-NAME TOLERANCE IS INJECTED\n *\n * Which given names are one family is DATA, and the data will move: the curated table\n * (`given-diminutives.json`) is the gate tier, the extended family list (`given-families.json`)\n * stands beside it, and either may grow or shrink. So the relation asks an ordered list of `GivenProvider`s fixed by `createNameKinship`'s options,\n * and the core knows no table. A new provider is an option; a new kind of answer is one\n * line in `KINSHIP_VIAS`, which also carries its gate-safety, so no branch here changes.\n *\n * ## IT COMPOSES, IT DOES NOT FORK\n *\n * The middle-name and suffix rows are `tailRelation`, the half of `nameRelation` below the\n * head, so `J` against `Jane` is decided in one place. With no tolerance used this answers\n * exactly what `nameRelation` answers (`normalize-name-kinship.spec.ts` pins it), except that\n * it splits `head-differs` into the half that differed.\n */\n\nimport { givenFamilyTable } from \"./given-diminutives.ts\";\nimport { givenFamilyList } from \"./given-families.ts\";\nimport { subMultiset } from \"./multiset.ts\";\nimport { surnameParts } from \"./name-compose.ts\";\nimport { type NameRelation, type NameRelationReason, tailRelation } from \"./name-middle.ts\";\nimport type { PersonName } from \"./person-name.ts\";\n\n/**\n * EVERY TOLERANCE THE RELATION CAN REPORT, IN THE ORDER IT REPORTS THEM, with the field it\n * tolerates and whether a gate may admit a pair through it. The one declaration: the\n * `KinshipVia`, `GivenVia` and `MiddleVia` types are read off it, so adding a kind is a\n * line here and nothing else in the core.\n */\nexport const KINSHIP_VIAS = Object.freeze({\n\t/** one surname is a whole hyphen- or space-joined part of the other's compound */\n\t\"surname-part\": Object.freeze({ field: \"surname\", gateSafe: true }),\n\t/** the two first given names are two spellings of one name (`Connor` / `Conor`) */\n\t\"given-variant\": Object.freeze({ field: \"given\", gateSafe: true }),\n\t/** the given-name table relates the two first given names, and the gate admits them */\n\t\"given-family\": Object.freeze({ field: \"given\", gateSafe: true }),\n\t/** the table relates them through a form that is a name in its own right */\n\t\"given-family-not-gate\": Object.freeze({ field: \"given\", gateSafe: false }),\n\t/** the extended family list says the two MAY be one family (`./given-families.ts`) */\n\t\"given-maybe\": Object.freeze({ field: \"given\", gateSafe: false }),\n\t/** NN5's own: one side carries no middle name */\n\t\"middle-absent\": Object.freeze({ field: \"middle\", gateSafe: true }),\n\t/** NN5's own: an initial against a full middle whose first letter matches */\n\t\"initial-agrees\": Object.freeze({ field: \"middle\", gateSafe: true }),\n} as const);\n\n/** A tolerance a pair passed through. */\nexport type KinshipVia = keyof typeof KINSHIP_VIAS;\n\n/** The order `via` is reported in: `KINSHIP_VIAS`'s own, so two runs print one list. */\nconst VIA_ORDER: readonly KinshipVia[] = Object.freeze(Object.keys(KINSHIP_VIAS) as KinshipVia[]);\n\ntype ViaOfField<F extends string> = {\n\t[K in KinshipVia]: (typeof KINSHIP_VIAS)[K][\"field\"] extends F ? K : never;\n}[KinshipVia];\n\n/** The tolerances a `GivenProvider` may answer with. */\nexport type GivenVia = ViaOfField<\"given\">;\n\n/** The middle-name tolerances: NN5's two `candidate` reasons, by the same names. */\nexport type MiddleVia = ViaOfField<\"middle\">;\n\n/**\n * Why the relation came out the way it did. NN5's reasons, except that `head-differs` is\n * split into the half that differed, because this relation tolerates each half on its own.\n */\nexport type KinshipReason =\n\t| Exclude<NameRelationReason, \"head-differs\">\n\t/** the surnames are neither equal at NN3 nor one a whole part of the other */\n\t| \"surname-differs\"\n\t/** the first given names are neither equal at NN3 nor related by any provider (or one is missing) */\n\t| \"given-differs\";\n\n/** The tolerant relation's answer. */\nexport interface NameKinship {\n\t/** `NameRelation`'s three values, meaning what they mean there: `candidate` is never a merge */\n\treadonly relation: NameRelation;\n\t/** every tolerance used, in `KINSHIP_VIAS` order; empty for `same` and for `different` */\n\treadonly via: readonly KinshipVia[];\n\t/** the veto for `different`; NN5's middle-name reason otherwise */\n\treadonly reason: KinshipReason;\n\t/** true only when the pair is related and every `via` is gate-safe */\n\treadonly gateSafe: boolean;\n}\n\n/**\n * Might two DIFFERENT first given names (NN3 fields, so upper case and letters) be one\n * family, and by which tolerance? `null` is \"this provider does not relate them\".\n *\n * IT IS ASKED WITH `a < b` in code-unit order, once per pair, so a provider holding ordered\n * pairs needs to hold each pair one way only and the relation stays symmetric whatever the\n * provider does.\n */\nexport type GivenProvider = (a: string, b: string) => GivenVia | null;\n\nexport interface NameKinshipOptions {\n\t/**\n\t * The given-name tolerances, asked in order; THE FIRST NON-NULL ANSWER WINS, so a caller\n\t * lists its most trusted source first. Default `[givenFamilyTable, givenFamilyList]`: the\n\t * curated table, then the extended list for what the table does not relate. `[]` tolerates no\n\t * given name.\n\t */\n\treadonly given?: readonly GivenProvider[];\n}\n\n/** A tolerant relation with its providers fixed. */\nexport type NameKinshipRelation = (a: PersonName, b: PersonName) => NameKinship;\n\nconst different = (reason: KinshipReason): NameKinship => ({\n\trelation: \"different\",\n\tvia: [],\n\treason,\n\tgateSafe: false,\n});\n\n/**\n * Is one surname a WHOLE part of the other's compound? `[LARSON]` against `[CONLEY, LARSON]`\n * is; `[LARSON]` against `[CARLSON]` is not, because a part is compared whole and never as a\n * substring. Equal part counts never qualify: two different surnames with as many parts\n * as each other are two surnames, not one inside the other.\n */\nfunction surnamePartOf(a: PersonName, b: PersonName): boolean {\n\tconst pa = surnameParts(a);\n\tconst pb = surnameParts(b);\n\tif (pa.length === pb.length) return false;\n\tconst [short, long] = pa.length < pb.length ? [pa, pb] : [pb, pa];\n\treturn subMultiset(short, long);\n}\n\n/**\n * Make the tolerant relation over a fixed list of given-name providers.\n *\n * The rule table, in the order it is applied:\n *\n * | the two sides | relation |\n * |---|---|\n * | either names no person | `different`, `not-a-person` |\n * | surnames differ at NN3 and neither is a whole part of the other | `different`, `surname-differs` |\n * | first given names differ at NN3 (or one is missing) and no provider relates them | `different`, `given-differs` |\n * | NN5's suffix and middle rows (`tailRelation`) say `different` | `different`, NN5's reason |\n * | no tolerance used and the middles are equal | `same` |\n * | otherwise | `candidate`, via every tolerance used |\n */\nexport function createNameKinship(options: NameKinshipOptions = {}): NameKinshipRelation {\n\tconst providers: readonly GivenProvider[] = Object.freeze([\n\t\t...(options.given ?? [givenFamilyTable, givenFamilyList]),\n\t]);\n\tconst givenVia = (x: string, y: string): GivenVia | null => {\n\t\tconst [lo, hi] = x < y ? [x, y] : [y, x];\n\t\tfor (const provider of providers) {\n\t\t\tconst via = provider(lo, hi);\n\t\t\tif (via !== null) return via;\n\t\t}\n\t\treturn null;\n\t};\n\n\treturn (a, b) => {\n\t\tif (!a.isPerson() || !b.isPerson()) return different(\"not-a-person\");\n\t\tconst found = new Set<KinshipVia>();\n\n\t\tif (a.surnameKey() !== b.surnameKey()) {\n\t\t\tif (!surnamePartOf(a, b)) return different(\"surname-differs\");\n\t\t\tfound.add(\"surname-part\");\n\t\t}\n\n\t\tconst ga = a.givenFields()[0];\n\t\tconst gb = b.givenFields()[0];\n\t\tif (ga === undefined || gb === undefined) return different(\"given-differs\");\n\t\tif (ga !== gb) {\n\t\t\tconst via = givenVia(ga, gb);\n\t\t\tif (via === null) return different(\"given-differs\");\n\t\t\tfound.add(via);\n\t\t}\n\n\t\tconst tail = tailRelation(a, b);\n\t\tif (tail.relation === \"different\") return different(tail.reason as KinshipReason);\n\t\tif (tail.relation === \"candidate\") found.add(tail.reason as MiddleVia);\n\n\t\tconst via = VIA_ORDER.filter((v) => found.has(v));\n\t\treturn {\n\t\t\trelation: via.length === 0 ? \"same\" : \"candidate\",\n\t\t\tvia,\n\t\t\treason: tail.reason as KinshipReason,\n\t\t\tgateSafe: via.every((v) => KINSHIP_VIAS[v].gateSafe),\n\t\t};\n\t};\n}\n\n/**\n * The tolerant relation over the curated given-name table, `givenFamilyTable`, then the\n * extended family list, `givenFamilyList`.\n */\nexport const nameKinship: NameKinshipRelation = createNameKinship();\n\n/**\n * THE MIDDLE VIAS ARE NN5'S CANDIDATE REASONS, ASSERTED IN TYPECHECKED SOURCE. A middle\n * `via` is `tailRelation`'s reason passed through, so the day either list moves without the\n * other, `bun run typecheck` goes red here. Exported for `Nn5IsNotAMemberOfAParse`'s reason.\n */\ntype AssertTrue<T extends true> = T;\n\n/** Every middle `via` is a reason NN5 can give. */\nexport type MiddleViasAreNn5Reasons = AssertTrue<\n\tMiddleVia extends NameRelationReason ? true : false\n>;\n",
|
|
11
12
|
"/**\n * name-compare.ts — comparing parsed names, and the structures that may hold\n * them.\n *\n * `docs/NAME-NORMALIZATION.md` § *The API* is the specification.\n *\n * ## THE TYPE SPLIT IS THE WHOLE POINT OF THIS FILE\n *\n * NN0-NN4 are total functions, so equal level strings form an EQUIVALENCE\n * RELATION and a hash-backed set or map over them is well defined. NN5 is a\n * DISTANCE, so `probablySame(a,b) ∧ probablySame(b,c) ⇏ probablySame(a,c)` and\n * any structure over it is a CLUSTERING whose contents depend on insertion order\n * and on a declared linkage.\n *\n * That boundary belongs in the types, not in a docblock, so `nameCompare` and\n * the hash structures take `TransitiveLevel` and the compiler is where a\n * similarity level keying a map is refused. `createNameClusters` is the one\n * function that takes the wider `Level`, because a clustering is what NN5 can\n * legally produce.\n *\n * ## A caller declares its precision instead of comparing strings\n *\n * NEVER COMPARE TWO LEVEL STRINGS WITH `===`. This is the floating-point\n * discipline, and it is the actual fix for duplicated name processing — not one\n * function, but removing the reason a caller ever writes a second one. The `dop`\n * argument at the call site IS the justification, inline and readable, which is\n * why no catalog of imports is owed.\n */\n\nimport { surnameParts } from \"./name-compose.ts\";\nimport { type NameKinship, type NameKinshipRelation, nameKinship } from \"./name-kinship.ts\";\nimport { type NameRelation, nameRelation } from \"./name-middle.ts\";\nimport { type Level, type PersonName, type TransitiveLevel, levelOf } from \"./person-name.ts\";\n\n/**\n * Order two parsed names at one level.\n *\n * A PLAIN CODE-UNIT ORDER, not a locale collation, and that is deliberate: the\n * levels this may be asked at are ASCII from NN2 down, and a collation that\n * moved with the runtime's locale data would reorder a sorted output between two\n * machines running the same code.\n */\nexport function nameCompare(a: PersonName, b: PersonName, dop: TransitiveLevel): -1 | 0 | 1 {\n\tconst x = levelOf(a, dop);\n\tconst y = levelOf(b, dop);\n\tif (x < y) return -1;\n\treturn x > y ? 1 : 0;\n}\n\n/**\n * Might these two prints be the same name, to the declared precision?\n *\n * AT A TRANSITIVE LEVEL THIS IS EQUALITY, and equality at a level is exactly the\n * question the level was named for.\n *\n * A PRINT THAT NAMES NO PERSON IS EQUAL TO NOTHING, INCLUDING ITSELF. Every\n * refused print renders `NAME_REFUSED` from NN2 down, so a plain level equality made `TBD`\n * and `1234` one name at NN2-NN4: the false accept the paragraph below forbids. The question\n * is asked of the type (`isPerson()`), which also answers for an empty cell and a team, at\n * every level; NN5 already answered `different` here through `nameRelation`, and this is the\n * same rule at the transitive levels. `probablySameSchool` is the same comparator one type over.\n *\n * AT NN5 IT IS A RELATION AND THERE IS NO STRING TO COMPARE. `./name-middle.ts`\n * answers it, and this collapses its three-valued reading to the boolean this\n * signature promises: `same` and `candidate` are both \"these MAY be one person\",\n * and `different` is the veto. A caller that needs to tell an NN3 agreement from\n * a tolerated middle name asks `nameRelation` for the reading; this one is for\n * the caller that wants the yes/no at a declared precision.\n *\n * IT STILL FALLS BACK TO NOTHING. Before the relation existed this THREW at NN5\n * rather than answering the NN4 question to a caller that asked the NN5 one, and\n * the asymmetry that decided it is unchanged: a false reject is recoverable, a\n * false accept silently merges two dancers. What changed is that there is now an\n * NN5 answer to give. NN5 is still no level — nothing here renders one, `levelOf`\n * still takes `TransitiveLevel`, and `createNameSet(\"nn5\")` still does not\n * compile.\n */\nexport function probablySame(a: PersonName, b: PersonName, dop: Level): boolean {\n\tif (!a.isPerson() || !b.isPerson()) return false;\n\tif (dop === \"nn5\") return nameRelation(a, b).relation !== \"different\";\n\treturn levelOf(a, dop) === levelOf(b, dop);\n}\n\n/**\n * The slot a parse is filed under at one level, or `null` for a print that names no person.\n *\n * `null` IS NOT A KEY, for `probablySame`'s reason: every refused print renders one identical\n * level from NN2 down, so a slot read off the rendering would file a card number, `TBD` and a\n * team under one name. The structures below hold such a print under a slot nothing else can\n * name, the way `setOfSchools` does one type over.\n */\nfunction slotOf(name: PersonName, dop: TransitiveLevel): string | null {\n\treturn name.isPerson() ? levelOf(name, dop) : null;\n}\n\n/**\n * THE LONER SLOTS: a non-person is held under one of these, so it is iterated and counted but\n * never found, merged or deleted through another print. A slot opens with two unit separators,\n * the device `setOfSchools` uses; no file of a large results corpus carries a U+001F at all\n * (`grep -rlP '\\x1f'`, 0 files), so no person's level spells one.\n */\nlet loner = 0;\nconst lonerSlot = (): string => `\\u001f\\u001f${loner++}`;\n\n/** The set contract, over parsed names rather than over their strings. */\nexport interface NameSet {\n\treadonly dop: TransitiveLevel;\n\treadonly size: number;\n\t/** The name already held at this level, if any — not merely whether one is. */\n\tget(name: PersonName): PersonName | undefined;\n\thas(name: PersonName): boolean;\n\tadd(name: PersonName): this;\n\tdelete(name: PersonName): boolean;\n\tclear(): void;\n\tvalues(): IterableIterator<PersonName>;\n\t[Symbol.iterator](): IterableIterator<PersonName>;\n}\n\n/** The map contract, keyed on parsed names at one declared level. */\nexport interface NameMap<V> {\n\treadonly dop: TransitiveLevel;\n\treadonly size: number;\n\tget(name: PersonName): V | undefined;\n\thas(name: PersonName): boolean;\n\tset(name: PersonName, value: V): this;\n\tdelete(name: PersonName): boolean;\n\tclear(): void;\n\tkeys(): IterableIterator<PersonName>;\n\tvalues(): IterableIterator<V>;\n\tentries(): IterableIterator<[PersonName, V]>;\n\t[Symbol.iterator](): IterableIterator<[PersonName, V]>;\n}\n\n/**\n * A set of parsed names, folded at one declared level.\n *\n * FIRST INSERTION WINS THE SLOT, and `get()` exists so that a caller can see\n * which print holds it. Two prints that fold alike at `dop` are one member, so\n * without `get()` the set would silently discard the second print with no way to\n * find out which print the survivor is.\n *\n * A PRINT THAT NAMES NO PERSON IS HELD AND NEVER FOLDED: `add()` gives it a slot of its\n * own, so it counts and iterates, and `has()`, `get()` and `delete()` answer no for it, straight\n * after the `add()` too. `probablySame` is false for it against everything, and a set is that\n * comparator's partition.\n *\n * `createNameSet(\"nn5\")` DOES NOT COMPILE, which is this function's reason for\n * taking `TransitiveLevel`: membership in a hash set is an equivalence class and\n * a distance does not induce one.\n */\nexport function createNameSet(dop: TransitiveLevel): NameSet {\n\tconst held = new Map<string, PersonName>();\n\tconst set: NameSet = {\n\t\tdop,\n\t\tget size(): number {\n\t\t\treturn held.size;\n\t\t},\n\t\tget: (name) => {\n\t\t\tconst slot = slotOf(name, dop);\n\t\t\treturn slot === null ? undefined : held.get(slot);\n\t\t},\n\t\thas: (name) => {\n\t\t\tconst slot = slotOf(name, dop);\n\t\t\treturn slot === null ? false : held.has(slot);\n\t\t},\n\t\tadd(name) {\n\t\t\tconst slot = slotOf(name, dop);\n\t\t\tif (slot === null) held.set(lonerSlot(), name);\n\t\t\telse if (!held.has(slot)) held.set(slot, name);\n\t\t\treturn this;\n\t\t},\n\t\tdelete: (name) => {\n\t\t\tconst slot = slotOf(name, dop);\n\t\t\treturn slot === null ? false : held.delete(slot);\n\t\t},\n\t\tclear: () => held.clear(),\n\t\tvalues: () => held.values(),\n\t\t[Symbol.iterator]: () => held.values(),\n\t};\n\treturn set;\n}\n\n/**\n * A map keyed on parsed names, folded at one declared level.\n *\n * THE KEY A VALUE WAS FIRST FILED UNDER IS THE KEY IT KEEPS. A later `set()`\n * through a different print replaces the VALUE and leaves the stored\n * `PersonName` alone, so iterating the keys returns one print per class rather\n * than whichever print wrote last.\n *\n * A print that names no person is held under a slot of its own and never found again — see\n * `createNameSet`.\n *\n * `createNameMap(\"nn5\")` DOES NOT COMPILE — see `createNameSet`.\n */\nexport function createNameMap<V>(\n\tdop: TransitiveLevel,\n\tentries?: Iterable<readonly [PersonName, V]>,\n): NameMap<V> {\n\tconst held = new Map<string, [PersonName, V]>();\n\tconst map: NameMap<V> = {\n\t\tdop,\n\t\tget size(): number {\n\t\t\treturn held.size;\n\t\t},\n\t\tget: (name) => {\n\t\t\tconst key = slotOf(name, dop);\n\t\t\treturn key === null ? undefined : held.get(key)?.[1];\n\t\t},\n\t\thas: (name) => {\n\t\t\tconst key = slotOf(name, dop);\n\t\t\treturn key === null ? false : held.has(key);\n\t\t},\n\t\tset(name, value) {\n\t\t\tconst key = slotOf(name, dop);\n\t\t\tconst slot = key === null ? undefined : held.get(key);\n\t\t\tif (slot === undefined) held.set(key ?? lonerSlot(), [name, value]);\n\t\t\telse slot[1] = value;\n\t\t\treturn this;\n\t\t},\n\t\tdelete: (name) => {\n\t\t\tconst key = slotOf(name, dop);\n\t\t\treturn key === null ? false : held.delete(key);\n\t\t},\n\t\tclear: () => held.clear(),\n\t\t*keys() {\n\t\t\tfor (const [name] of held.values()) yield name;\n\t\t},\n\t\t*values() {\n\t\t\tfor (const [, value] of held.values()) yield value;\n\t\t},\n\t\t*entries() {\n\t\t\tfor (const slot of held.values()) yield [slot[0], slot[1]] as [PersonName, V];\n\t\t},\n\t\t[Symbol.iterator](): IterableIterator<[PersonName, V]> {\n\t\t\treturn this.entries();\n\t\t},\n\t};\n\tfor (const [name, value] of entries ?? []) map.set(name, value);\n\treturn map;\n}\n\n/** One held entry a tolerant lookup found, with what the relation said about it. */\nexport interface NameMatch<V> {\n\t/** the print the entry is held under — the first print filed into its slot */\n\treadonly name: PersonName;\n\treadonly value: V;\n\treadonly kinship: NameKinship;\n}\n\n/** A `NameMap` that can also answer which held names are RELATED to a print. */\nexport interface NameIndex<V> extends NameMap<V> {\n\t/**\n\t * Every held entry the index's relation does not call `different`, `same` before\n\t * `candidate` and otherwise in insertion order. `[]` for a print that names no person.\n\t */\n\trelated(name: PersonName): readonly NameMatch<V>[];\n}\n\nexport interface NameIndexOptions<V> {\n\t/** The tolerant relation `related` filters by. Default `nameKinship`. */\n\treadonly kinship?: NameKinshipRelation;\n\treadonly entries?: Iterable<readonly [PersonName, V]>;\n}\n\n/**\n * The secondary keys a print is found under: its NN3 surname key and each surname part.\n *\n * NOT `nameBlockKeys` (`./name-compose.ts`). That one keys a part WITH the first initial,\n * which is the necessary condition for a composition and not for kinship: a given-name\n * family need not keep its initial (`Evie` / `Genevieve`, `Peggy` / `Margaret`). Every pair\n * `nameKinship` relates shares one of these — an equal surname key, or the shorter side's\n * parts inside the longer side's — so the index cannot miss a pair the relation would accept.\n */\nfunction kinshipBuckets(name: PersonName): readonly string[] {\n\treturn [...new Set([name.surnameKey(), ...surnameParts(name)])];\n}\n\nconst RELATION_RANK: Readonly<Record<NameRelation, number>> = {\n\tsame: 0,\n\tcandidate: 1,\n\tdifferent: 2,\n};\n\n/**\n * A map keyed on parsed names at one declared level, with a TOLERANT LOOKUP beside it.\n *\n * `get`, `has`, `set` and `delete` ARE `createNameMap`'s, unchanged and delegated to: the\n * exact answer at a transitive level is still the slot. `related(name)` is the other\n * question — which held names MAY be this person — and it is answered by a relation, not by\n * a slot: candidates come from a secondary index on the surname key and every surname part\n * (so `Mary Larson` finds `Mary Conley-Larson` and the other way round), and each candidate\n * is kept when the relation does not call it `different`.\n *\n * A SIBLING OF `NameMap` AND NOT A METHOD ON IT, for three reasons. The tolerant answer is\n * NOT TRANSITIVE, and `NameMap`'s contract is an equivalence class; putting a non-transitive\n * lookup on it would blur exactly the boundary the type split above draws. The lookup needs\n * a RELATION, and a relation is chosen by options (its given-name providers), which a map\n * keyed by `dop` alone has no place to hold. And the secondary index costs memory on every\n * `set`, which a caller that only wants the exact map should not pay. A `NameIndex` IS a\n * `NameMap`, so a caller that needs both holds one structure.\n *\n * A print that names no person is held, counted and iterated as `createNameMap` holds it,\n * and is never related to anything, in either direction: `probablySame`'s rule.\n */\nexport function createNameIndex<V>(\n\tdop: TransitiveLevel,\n\toptions: NameIndexOptions<V> = {},\n): NameIndex<V> {\n\tconst kinship = options.kinship ?? nameKinship;\n\tconst map = createNameMap<V>(dop);\n\t/** slot -> the print filed in it and its insertion sequence; persons only */\n\tconst filed = new Map<string, { readonly name: PersonName; readonly seq: number }>();\n\t/** secondary key -> the slots filed under it */\n\tconst buckets = new Map<string, Set<string>>();\n\tlet seq = 0;\n\n\tconst file = (slot: string, name: PersonName): void => {\n\t\tfiled.set(slot, { name, seq: seq++ });\n\t\tfor (const key of kinshipBuckets(name)) {\n\t\t\tconst slots = buckets.get(key);\n\t\t\tif (slots === undefined) buckets.set(key, new Set([slot]));\n\t\t\telse slots.add(slot);\n\t\t}\n\t};\n\tconst unfile = (slot: string): void => {\n\t\tconst held = filed.get(slot);\n\t\tif (held === undefined) return;\n\t\tfiled.delete(slot);\n\t\tfor (const key of kinshipBuckets(held.name)) {\n\t\t\tconst slots = buckets.get(key);\n\t\t\tslots?.delete(slot);\n\t\t\tif (slots?.size === 0) buckets.delete(key);\n\t\t}\n\t};\n\n\tconst index: NameIndex<V> = {\n\t\tdop,\n\t\tget size(): number {\n\t\t\treturn map.size;\n\t\t},\n\t\tget: (name) => map.get(name),\n\t\thas: (name) => map.has(name),\n\t\tset(name, value) {\n\t\t\tconst slot = slotOf(name, dop);\n\t\t\tif (slot !== null && !filed.has(slot)) file(slot, name);\n\t\t\tmap.set(name, value);\n\t\t\treturn this;\n\t\t},\n\t\tdelete: (name) => {\n\t\t\tconst slot = slotOf(name, dop);\n\t\t\tif (slot !== null) unfile(slot);\n\t\t\treturn map.delete(name);\n\t\t},\n\t\tclear: () => {\n\t\t\tfiled.clear();\n\t\t\tbuckets.clear();\n\t\t\tmap.clear();\n\t\t},\n\t\tkeys: () => map.keys(),\n\t\tvalues: () => map.values(),\n\t\tentries: () => map.entries(),\n\t\t[Symbol.iterator]: () => map.entries(),\n\t\trelated(name) {\n\t\t\t// A NON-PERSON FINDS NOTHING WITHOUT A BRANCH OF ITS OWN: it has no surname key and\n\t\t\t// no part, so its one bucket is `\"\"`, and no person is ever filed there — `set`\n\t\t\t// files persons only, and every person carries a surname.\n\t\t\tconst slots = new Set<string>();\n\t\t\tfor (const key of kinshipBuckets(name)) {\n\t\t\t\tfor (const slot of buckets.get(key) ?? []) slots.add(slot);\n\t\t\t}\n\t\t\tconst found: (NameMatch<V> & { readonly seq: number })[] = [];\n\t\t\tfor (const slot of slots) {\n\t\t\t\tconst held = filed.get(slot);\n\t\t\t\tif (held === undefined) continue;\n\t\t\t\tconst k = kinship(name, held.name);\n\t\t\t\tif (k.relation === \"different\") continue;\n\t\t\t\tfound.push({\n\t\t\t\t\tname: held.name,\n\t\t\t\t\tvalue: map.get(held.name) as V,\n\t\t\t\t\tkinship: k,\n\t\t\t\t\tseq: held.seq,\n\t\t\t\t});\n\t\t\t}\n\t\t\tfound.sort(\n\t\t\t\t(x, y) =>\n\t\t\t\t\tRELATION_RANK[x.kinship.relation] - RELATION_RANK[y.kinship.relation] || x.seq - y.seq,\n\t\t\t);\n\t\t\treturn found.map(({ name: n, value, kinship: k }) => ({ name: n, value, kinship: k }));\n\t\t},\n\t};\n\tfor (const [name, value] of options.entries ?? []) index.set(name, value);\n\treturn index;\n}\n\n/** How a clustering decides whether a name joins an existing cluster. */\nexport type ClusterLinkage = \"single\" | \"complete\" | \"average\";\n\n/** A clustering over parsed names. Order-dependent by construction at NN5. */\nexport interface Clusters {\n\treadonly dop: Level;\n\treadonly linkage: ClusterLinkage;\n\treadonly size: number;\n\tadd(name: PersonName): this;\n\t/**\n\t * The cluster this name fell in, or `undefined` if it was never added — and for a print that\n\t * names no person, which sits in a cluster of its own that no print can name.\n\t */\n\tclusterOf(name: PersonName): readonly PersonName[] | undefined;\n\tclusters(): readonly (readonly PersonName[])[];\n\t[Symbol.iterator](): IterableIterator<readonly PersonName[]>;\n}\n\n/**\n * Cluster parsed names at one level.\n *\n * IT TAKES THE WIDER `Level` BECAUSE A CLUSTERING IS WHAT NN5 CAN LEGALLY\n * PRODUCE. That is the other half of the type split: the set and the map refuse\n * a similarity level, and this one accepts it.\n *\n * AT A TRANSITIVE LEVEL THE CLUSTERS ARE THE EQUIVALENCE CLASSES and `linkage`\n * changes nothing — single, complete and average linkage agree whenever the\n * relation is transitive, so the argument is recorded rather than consulted. It\n * is still required, so that a call site reads the same at every level and a\n * caller moving to NN5 has already stated the linkage it meant.\n *\n * AT NN5 IT THROWS AT CONSTRUCTION rather than on the first `add`, so a caller\n * that cannot be served finds out where it declared the level and not somewhere\n * downstream holding a half-filled structure.\n *\n * NN5 STILL THROWS EVEN THOUGH `probablySame` NOW ANSWERS AT IT, and that is a\n * decision rather than an omission. `linkage` names `single`, `complete` and\n * `average`, which are defined over a DISTANCE; NN5 answers a three-valued\n * relation and no number, so `average` has no meaning over it and picking one\n * would be inventing the semantics at the point a caller could no longer see it.\n * The relation is available through `nameRelation` and `probablySame(…, \"nn5\")`\n * for a caller that wants to cluster with a linkage IT declares.\n */\nexport function createNameClusters(dop: Level, linkage: ClusterLinkage): Clusters {\n\tif (dop === \"nn5\") {\n\t\tthrow new Error(\n\t\t\t'createNameClusters at nn5 is unimplemented: a linkage is defined over a distance and NN5 answers a relation. Use nameRelation / probablySame(a, b, \"nn5\"); see docs/NAME-NORMALIZATION.md § NN5 — the middle-name relation.',\n\t\t);\n\t}\n\tconst transitive: TransitiveLevel = dop;\n\tconst held = new Map<string, PersonName[]>();\n\tconst out: Clusters = {\n\t\tdop,\n\t\tlinkage,\n\t\tget size(): number {\n\t\t\treturn held.size;\n\t\t},\n\t\tadd(name) {\n\t\t\tconst key = slotOf(name, transitive);\n\t\t\tconst cluster = key === null ? undefined : held.get(key);\n\t\t\tif (cluster === undefined) held.set(key ?? lonerSlot(), [name]);\n\t\t\telse cluster.push(name);\n\t\t\treturn this;\n\t\t},\n\t\tclusterOf: (name) => {\n\t\t\tconst key = slotOf(name, transitive);\n\t\t\treturn key === null ? undefined : held.get(key);\n\t\t},\n\t\tclusters: () => [...held.values()],\n\t\t[Symbol.iterator]: () => held.values(),\n\t};\n\treturn out;\n}\n\n/**\n * THE TYPE SPLIT, ASSERTED IN TYPECHECKED SOURCE.\n *\n * `normalize-name-compare.spec.ts` asserts the three SIGNATURES with `@ts-expect-error`,\n * and `bun run typecheck` evaluates those (the root `tsconfig.json` includes\n * `test/`). These three aliases assert the TYPE instead of the signatures, and\n * they sit in source so that a typecheck that never reads a spec — the build's\n * `tsconfig.build.json` — goes red too.\n *\n * They are exported because an unexported alias nothing references is one\n * `noUnusedLocals` away from being deleted as dead, and the whole point is that\n * it is not.\n */\ntype AssertTrue<T extends true> = T;\n\n/** NN5 may not key a hash structure. `createNameSet`/`createNameMap`/`nameCompare` refuse it. */\nexport type Nn5IsNotTransitive = AssertTrue<\"nn5\" extends TransitiveLevel ? false : true>;\n/** NN5 is nonetheless a level, so `probablySame` and `createNameClusters` accept it. */\nexport type Nn5IsALevel = AssertTrue<\"nn5\" extends Level ? true : false>;\n/** Every transitive level is a level, so widening never needs a cast. */\nexport type TransitiveLevelsAreLevels = AssertTrue<TransitiveLevel extends Level ? true : false>;\n",
|
|
12
13
|
"/**\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",
|
|
13
14
|
"/**\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",
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
"/**\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",
|
|
16
17
|
"/**\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"
|
|
17
18
|
],
|
|
18
|
-
"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,EACb,C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