@finbheara/names 0.15.0 → 0.17.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.
Files changed (42) hide show
  1. package/README.md +45 -6
  2. package/dist/chunks/{index-7vvt5hhy.js → index-0wpvbdgh.js} +2631 -1395
  3. package/dist/chunks/{index-7vvt5hhy.js.map → index-0wpvbdgh.js.map} +4 -4
  4. package/dist/chunks/{index-pncn9y2r.js → index-a6f2y4aa.js} +2 -2
  5. package/dist/chunks/{index-2565cn5x.js → index-ky754nsf.js} +3 -3
  6. package/dist/chunks/{index-kw69ry3j.js → index-n6fpj92s.js} +11 -367
  7. package/dist/chunks/{index-kw69ry3j.js.map → index-n6fpj92s.js.map} +4 -5
  8. package/dist/chunks/index-qmn87bdh.js +1697 -0
  9. package/dist/chunks/index-qmn87bdh.js.map +11 -0
  10. package/dist/chunks/{index-ka8nzreg.js → index-tk01chxw.js} +2 -2
  11. package/dist/chunks/{index-kw6gbrnq.js → index-tqdbxd92.js} +2 -2
  12. package/dist/chunks/{index-a15g2gp6.js → index-ye6j60jn.js} +3 -3
  13. package/dist/chunks/phrase-2hj26asc.js +11 -0
  14. package/dist/classifier/index.js +3 -3
  15. package/dist/cli/bin.js +109 -0
  16. package/dist/cli/bin.js.map +11 -0
  17. package/dist/cli/census.js +4 -4
  18. package/dist/index.js +18 -10
  19. package/dist/index.js.map +1 -1
  20. package/dist/lexicon/index.js +4 -2
  21. package/dist/lexicon/index.js.map +1 -1
  22. package/dist/measure/index.js +4 -4
  23. package/dist/normalize/index.js +13 -7
  24. package/dist/normalize/index.js.map +1 -1
  25. package/dist/types/cli/bin.d.ts +10 -0
  26. package/dist/types/cli/tables.d.ts +13 -0
  27. package/dist/types/lexicon/flags.d.ts +13 -5
  28. package/dist/types/normalize/given-diminutives.d.ts +15 -6
  29. package/dist/types/normalize/given-families.d.ts +53 -0
  30. package/dist/types/normalize/index.d.ts +1 -0
  31. package/dist/types/normalize/name-kinship.d.ts +12 -8
  32. package/docs/NAME-NORMALIZATION.md +36 -7
  33. package/names.txt +2624 -1389
  34. package/package.json +4 -2
  35. package/src/normalize/given-families.MANIFEST.json +46 -0
  36. package/dist/chunks/phrase-2nmvkrc5.js +0 -11
  37. /package/dist/chunks/{index-pncn9y2r.js.map → index-a6f2y4aa.js.map} +0 -0
  38. /package/dist/chunks/{index-2565cn5x.js.map → index-ky754nsf.js.map} +0 -0
  39. /package/dist/chunks/{index-ka8nzreg.js.map → index-tk01chxw.js.map} +0 -0
  40. /package/dist/chunks/{index-kw6gbrnq.js.map → index-tqdbxd92.js.map} +0 -0
  41. /package/dist/chunks/{index-a15g2gp6.js.map → index-ye6j60jn.js.map} +0 -0
  42. /package/dist/chunks/{phrase-2nmvkrc5.js.map → phrase-2hj26asc.js.map} +0 -0
@@ -0,0 +1,53 @@
1
+ /**
2
+ * given-families.ts — THE EXTENDED GIVEN-NAME FAMILY LIST, read by the TypeScript side.
3
+ *
4
+ * `./given-families.json` is the list and this file is its reader; `scripts/given-families.ts`
5
+ * builds the list and `./given-families.MANIFEST.json` records its sources.
6
+ *
7
+ * TWO TIERS OF GIVEN-NAME KNOWLEDGE. `./given-diminutives.json` is the GATE tier: pairs this
8
+ * package is sure of, curated by hand, some of them admitted at an identity gate. This list
9
+ * is the EXTENDED tier: every family the sources record for English, Irish, Scottish, Welsh,
10
+ * French, Italian, Spanish, German, Dutch and Polish usage, about 2,600 names. A pair it
11
+ * relates MAY be one name, and the answer is `given-maybe`, which no gate admits.
12
+ *
13
+ * AN EXACT LIST, NOT A FILTER. A bloom filter of the same pairs at 8 KB answers about fifty
14
+ * false partners for every given name it is asked about; the exact list is a few KB more
15
+ * and answers none.
16
+ *
17
+ * A FAMILY IS CLOSED. Two names relate when they are a root and its form, or two forms of
18
+ * one root (`Kate` / `Katie`, both Catherine's). A form under several roots meets each
19
+ * root's family, and nothing is transitive across families: `Kit` meets Catherine's and
20
+ * Christopher's, and `Kate` / `Chris` stay apart.
21
+ *
22
+ * A TIER BOUNDS HOW RARE A FORM MAY BE. Each form carries 1 (common), 2 (uncommon) or 3
23
+ * (rare); a pair's tier is its rarer member's, the root counting as 1, and where two names
24
+ * share several families the commonest counts. `maxTier` admits pairs up to that tier.
25
+ */
26
+ /** How common a form is: 1 common, 2 uncommon, 3 rare. */
27
+ export type GivenFamilyTier = 1 | 2 | 3;
28
+ export interface GivenFamilyListOptions {
29
+ /** The rarest tier admitted. Default 3: every pair the list holds. */
30
+ readonly maxTier?: GivenFamilyTier;
31
+ /**
32
+ * The families, one `ROOT,FORM:TIER,…` line each, NN3 upper case. Default: the shipped
33
+ * `given-families.json`. A caller with its own list passes it here.
34
+ */
35
+ readonly families?: readonly string[];
36
+ }
37
+ /** A given-name provider over the extended list: `given-maybe` or `null`. */
38
+ export type GivenFamilyList = (a: string, b: string) => "given-maybe" | null;
39
+ /**
40
+ * The extended list as a `GivenProvider` for `createNameKinship`: `given-maybe` where two
41
+ * DIFFERENT names (NN3) share a family within `maxTier`, `null` otherwise. Two equal names
42
+ * answer `null`, as `givenFamilyTable`'s do.
43
+ *
44
+ * The list is parsed on the first question, once per provider.
45
+ */
46
+ export declare function createGivenFamilyList(options?: GivenFamilyListOptions): GivenFamilyList;
47
+ /**
48
+ * The shipped list as root -> form -> tier, roots and forms sorted, for `names tables
49
+ * given-name`, which prints it. Not a package export: the printed form is the contract.
50
+ */
51
+ export declare function givenFamilyTiers(): Record<string, Record<string, GivenFamilyTier>>;
52
+ /** The shipped list, every tier: the second given-name provider of `nameKinship`. */
53
+ export declare const givenFamilyList: GivenFamilyList;
@@ -19,6 +19,7 @@ export { TEAM_DESIGNATION_WORDS, TEAM_WORD, type TeamSuffixPartition, canonicalT
19
19
  export { foldNameKey, nameFold } from "./name-fold.ts";
20
20
  export { COMPOUND_SURNAMES, isCompoundSurname } from "./compound-surnames.ts";
21
21
  export { givenFamilyTable, sameGivenFamily } from "./given-diminutives.ts";
22
+ export { type GivenFamilyList, type GivenFamilyListOptions, type GivenFamilyTier, createGivenFamilyList, givenFamilyList, } from "./given-families.ts";
22
23
  export { type ClusterLinkage, type Clusters, type NameIndex, type NameIndexOptions, type NameMap, type NameMatch, type NameSet, createNameClusters, createNameIndex, createNameMap, createNameSet, nameCompare, probablySame, } from "./name-compare.ts";
23
24
  export { type NameReading, type NameRelation, type NameRelationReason, comparePosition, nameRelation, } from "./name-middle.ts";
24
25
  export { type GivenProvider, type GivenVia, KINSHIP_VIAS, type KinshipReason, type KinshipVia, type MiddleVia, type MiddleViasAreNn5Reasons, type NameKinship, type NameKinshipOptions, type NameKinshipRelation, createNameKinship, nameKinship, } from "./name-kinship.ts";
@@ -32,14 +32,14 @@
32
32
  * narrower: every tolerance used is one this package's own gate comparators already admit —
33
33
  * a middle name `probablySame(…, "nn5")` admits, a given-name family `sameGivenFamily`
34
34
  * admits, a compound the print itself carries. A table form that is a name in its own right
35
- * (`given-family-not-gate`) or a probabilistic source (`given-maybe`) is a lead for the rest
36
- * of the evidence and never a gate.
35
+ * (`given-family-not-gate`) or the extended family list (`given-maybe`) is a lead for the
36
+ * rest of the evidence and never a gate.
37
37
  *
38
38
  * ## THE GIVEN-NAME TOLERANCE IS INJECTED
39
39
  *
40
- * Which given names are one family is DATA, and the data will move: a probabilistic source
41
- * of diminutive pairs is expected beside the curated table, and the table may shrink. So the
42
- * relation asks an ordered list of `GivenProvider`s fixed by `createNameKinship`'s options,
40
+ * Which given names are one family is DATA, and the data will move: the curated table
41
+ * (`given-diminutives.json`) is the gate tier, the extended family list (`given-families.json`)
42
+ * stands beside it, and either may grow or shrink. So the relation asks an ordered list of `GivenProvider`s fixed by `createNameKinship`'s options,
43
43
  * and the core knows no table. A new provider is an option; a new kind of answer is one
44
44
  * line in `KINSHIP_VIAS`, which also carries its gate-safety, so no branch here changes.
45
45
  *
@@ -79,7 +79,7 @@ export declare const KINSHIP_VIAS: Readonly<{
79
79
  field: "given";
80
80
  gateSafe: false;
81
81
  }>;
82
- /** a probabilistic source says the two MAY be one family; reserved for one */
82
+ /** the extended family list says the two MAY be one family (`./given-families.ts`) */
83
83
  readonly "given-maybe": Readonly<{
84
84
  field: "given";
85
85
  gateSafe: false;
@@ -136,7 +136,8 @@ export type GivenProvider = (a: string, b: string) => GivenVia | null;
136
136
  export interface NameKinshipOptions {
137
137
  /**
138
138
  * The given-name tolerances, asked in order; THE FIRST NON-NULL ANSWER WINS, so a caller
139
- * lists its most trusted source first. Default `[givenFamilyTable]`; `[]` tolerates no
139
+ * lists its most trusted source first. Default `[givenFamilyTable, givenFamilyList]`: the
140
+ * curated table, then the extended list for what the table does not relate. `[]` tolerates no
140
141
  * given name.
141
142
  */
142
143
  readonly given?: readonly GivenProvider[];
@@ -158,7 +159,10 @@ export type NameKinshipRelation = (a: PersonName, b: PersonName) => NameKinship;
158
159
  * | otherwise | `candidate`, via every tolerance used |
159
160
  */
160
161
  export declare function createNameKinship(options?: NameKinshipOptions): NameKinshipRelation;
161
- /** The tolerant relation over the curated given-name table, `givenFamilyTable`. */
162
+ /**
163
+ * The tolerant relation over the curated given-name table, `givenFamilyTable`, then the
164
+ * extended family list, `givenFamilyList`.
165
+ */
162
166
  export declare const nameKinship: NameKinshipRelation;
163
167
  /**
164
168
  * THE MIDDLE VIAS ARE NN5'S CANDIDATE REASONS, ASSERTED IN TYPECHECKED SOURCE. A middle
@@ -471,7 +471,7 @@ interface NameKinship {
471
471
  | `given-variant` | given | yes | the two first given names are two spellings of one name (`Connor` / `Conor`) |
472
472
  | `given-family` | given | yes | a provider says the two first given names are one family, and a gate admits them |
473
473
  | `given-family-not-gate` | given | no | the table relates them only through a `notAtGate` form |
474
- | `given-maybe` | given | no | a probabilistic source says they MAY be one family |
474
+ | `given-maybe` | given | no | the extended family list says they MAY be one family |
475
475
  | `middle-absent` | middle | yes | NN5's: one side carries no middle |
476
476
  | `initial-agrees` | middle | yes | NN5's: an initial against a full middle that starts with it |
477
477
 
@@ -486,9 +486,10 @@ interface NameKinship {
486
486
  - The given-name tolerance is INJECTED: `createNameKinship({ given: [p1, p2, …] })` asks
487
487
  each `GivenProvider` in order and the first non-null answer wins. A provider is asked
488
488
  once per pair, with the two NN3 first given names in code-unit order, and never with two
489
- equal names. The default is `[givenFamilyTable]`, which answers from
490
- `given-diminutives.json`; `sameGivenFamily(a, b)` is exactly "`givenFamilyTable(a, b)` is
491
- `given-variant` or `given-family`". `[]` tolerates no given name.
489
+ equal names. The default is `[givenFamilyTable, givenFamilyList]`: the curated table
490
+ (`given-diminutives.json`) first, then the extended family list (`given-families.json`) for
491
+ a pair the table does not relate. `sameGivenFamily(a, b)` is exactly "`givenFamilyTable(a, b)`
492
+ is `given-variant` or `given-family`". `[]` tolerates no given name.
492
493
  - A new kind of `via` is one entry in `KINSHIP_VIAS`, which carries its field and its
493
494
  gate-safety. The relation's rules do not change.
494
495
  - With no tolerance used, the answer is `nameRelation`'s. `head-differs` is split into
@@ -520,9 +521,37 @@ interface NameKinship {
520
521
  `Kate` and `Katie` are Catherine's, and `Katelyn` is a spelling of Caitlin. They meet below
521
522
  the gate through Caitlin as a form of Catherine, so `Kate` / `Katherine` keeps its gate.
522
523
 
523
- Over the 421 forms and spellings of the table (88,410 distinct pairs), `givenFamilyTable`
524
- answers `given-variant` for 90 pairs, `given-family` for 371, `given-family-not-gate` for 553,
525
- and `null` for the rest; `sameGivenFamily` admits 461.
524
+ Over the 541 roots, forms and spellings of the table (146,070 distinct pairs),
525
+ `givenFamilyTable` answers `given-variant` for 127 pairs, `given-family` for 540,
526
+ `given-family-not-gate` for 725, and `null` for the rest; `sameGivenFamily` admits 667.
527
+
528
+ ### The extended family list
529
+
530
+ The table is the GATE tier: pairs this package is sure of. `given-families.json` is the
531
+ EXTENDED tier: every family its sources record for English, Irish, Scottish, Welsh, French,
532
+ Italian, Spanish, German, Dutch and Polish usage — 1,171 families over 2,613 names, the table's
533
+ own families and spellings among them. `givenFamilyList(a, b)` answers `given-maybe` where two
534
+ names share a family, and `null` otherwise; no gate admits it.
535
+
536
+ - One line per family, `ROOT,FORM:TIER,…`, NN3. A TIER says how common the form is: 1 common,
537
+ 2 uncommon, 3 rare. `createGivenFamilyList({ maxTier })` admits pairs up to that tier; a
538
+ pair's tier is its rarer member's, the root counting as 1, and where two names share several
539
+ families the commonest counts. The default admits every tier.
540
+ - A family is CLOSED: two forms of one root relate (`Kate` / `Katie`), as well as a root and
541
+ its form. Nothing is transitive across families: `Kit` meets Catherine's and Christopher's,
542
+ and `Kate` / `Chris` stay apart.
543
+ - It is an exact list, not a filter. An 8 KB bloom filter of 6,980 such pairs, asked about
544
+ every pair of the 4,730 given names in the 0.14.0 `names.txt`, answered 50.6 false partners
545
+ per name; the list is 11.8 KB gzipped and answers none.
546
+ - `given-families.MANIFEST.json` beside it records the sources, their tiers and the names it
547
+ excludes; `scripts/given-families.ts` rebuilds it from them.
548
+
549
+ Every name either table holds is in `names.txt` as a given name carrying the `D` mark, and
550
+ only those carry it (`test/golden.spec.ts`). A SURNAME STAYS A SURNAME: a name `names.txt`
551
+ holds only as a surname (an `L` entry, none on its key with `F`, `M`, `N` or `A`) is in neither
552
+ table, and every pair through it goes with it (`Ward:LT`, so `Ward` / `Eduard` is not related).
553
+ A genuine given name is made one in `names.txt` first (`Henry:AMD`, read `L` before), and the
554
+ list rebuilt.
526
555
 
527
556
  ### The tolerant lookup
528
557