@finbheara/names 0.13.0 → 0.15.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 +5 -2
- package/data/bloom/MANIFEST.json +59 -13
- package/dist/chunks/{index-r5fp3znj.js → index-2565cn5x.js} +5 -5
- package/dist/chunks/{index-r5fp3znj.js.map → index-2565cn5x.js.map} +3 -3
- package/dist/chunks/{index-ztpxgcs1.js → index-a15g2gp6.js} +2 -2
- package/dist/chunks/{index-yf904dam.js → index-ka8nzreg.js} +6 -2
- package/dist/chunks/{index-yf904dam.js.map → index-ka8nzreg.js.map} +3 -3
- package/dist/chunks/{index-wq6kn9jq.js → index-kw69ry3j.js} +213 -42
- package/dist/chunks/{index-wq6kn9jq.js.map → index-kw69ry3j.js.map} +4 -4
- package/dist/chunks/{phrase-672g18kw.js → phrase-2nmvkrc5.js} +2 -2
- package/dist/classifier/index.js +1 -1
- package/dist/cli/census.js +3 -3
- package/dist/index.js +4 -4
- package/dist/measure/index.js +2 -2
- package/dist/normalize/index.js +2 -2
- package/dist/types/classifier/bf/filters.d.ts +8 -3
- package/dist/types/normalize/given-diminutives.d.ts +29 -18
- package/dist/types/normalize/name-kinship.d.ts +6 -0
- package/docs/NAME-NORMALIZATION.md +31 -6
- package/package.json +2 -1
- /package/dist/chunks/{index-ztpxgcs1.js.map → index-a15g2gp6.js.map} +0 -0
- /package/dist/chunks/{phrase-672g18kw.js.map → phrase-2nmvkrc5.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
phraseClassifier2
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-2565cn5x.js";
|
|
4
4
|
import"./index-kw6gbrnq.js";
|
|
5
5
|
import"./index-7vvt5hhy.js";
|
|
6
6
|
export {
|
|
@@ -8,4 +8,4 @@ export {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
//# debugId=BD8F5B3E6DE1DCF664756E2164756E21
|
|
11
|
-
//# sourceMappingURL=phrase-
|
|
11
|
+
//# sourceMappingURL=phrase-2nmvkrc5.js.map
|
package/dist/classifier/index.js
CHANGED
package/dist/cli/census.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import"../chunks/index-7vvt5hhy.js";
|
|
3
3
|
import {
|
|
4
4
|
createNameCensus2
|
|
5
|
-
} from "../chunks/index-
|
|
6
|
-
import"../chunks/index-
|
|
5
|
+
} from "../chunks/index-a15g2gp6.js";
|
|
6
|
+
import"../chunks/index-ka8nzreg.js";
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
9
9
|
|
|
@@ -20,7 +20,7 @@ async function main(argv) {
|
|
|
20
20
|
const limit = Number(value("limit") ?? 25);
|
|
21
21
|
const field = value("field") ?? "name";
|
|
22
22
|
const orderField = value("order-field") ?? "order";
|
|
23
|
-
const classifier = flag("classify") ? (await import("../chunks/phrase-
|
|
23
|
+
const classifier = flag("classify") ? (await import("../chunks/phrase-2nmvkrc5.js")).phraseClassifier() : undefined;
|
|
24
24
|
const census = createNameCensus2(classifier === undefined ? {} : { classifier });
|
|
25
25
|
for await (const line of createInterface({
|
|
26
26
|
input: process.stdin,
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
createSegmenter2,
|
|
38
38
|
createClassifier2,
|
|
39
39
|
phraseClassifier2
|
|
40
|
-
} from "./chunks/index-
|
|
40
|
+
} from "./chunks/index-2565cn5x.js";
|
|
41
41
|
import"./chunks/index-jwx1mm4k.js";
|
|
42
42
|
import {
|
|
43
43
|
repairMojibake2,
|
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
readNameCell2,
|
|
91
91
|
DEFAULT_NAME_FORMAT_THRESHOLD2,
|
|
92
92
|
deriveNameFormat2
|
|
93
|
-
} from "./chunks/index-
|
|
93
|
+
} from "./chunks/index-kw69ry3j.js";
|
|
94
94
|
import"./chunks/index-qsznkk4s.js";
|
|
95
95
|
import {
|
|
96
96
|
composeEvalSet2,
|
|
@@ -102,7 +102,7 @@ import {
|
|
|
102
102
|
} from "./chunks/index-ebebeamh.js";
|
|
103
103
|
import {
|
|
104
104
|
createNameCensus2
|
|
105
|
-
} from "./chunks/index-
|
|
105
|
+
} from "./chunks/index-a15g2gp6.js";
|
|
106
106
|
import {
|
|
107
107
|
NAME_REFUSED2,
|
|
108
108
|
stripEveryAside2,
|
|
@@ -147,7 +147,7 @@ import {
|
|
|
147
147
|
defaultPersonNameFactory2,
|
|
148
148
|
personName2,
|
|
149
149
|
personNameFromIcao2
|
|
150
|
-
} from "./chunks/index-
|
|
150
|
+
} from "./chunks/index-ka8nzreg.js";
|
|
151
151
|
import {
|
|
152
152
|
TEAM_WORD2,
|
|
153
153
|
TEAM_DESIGNATION_WORDS2,
|
package/dist/measure/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "../chunks/index-pncn9y2r.js";
|
|
5
5
|
import {
|
|
6
6
|
createNameCensus2
|
|
7
|
-
} from "../chunks/index-
|
|
8
|
-
import"../chunks/index-
|
|
7
|
+
} from "../chunks/index-a15g2gp6.js";
|
|
8
|
+
import"../chunks/index-ka8nzreg.js";
|
|
9
9
|
import"../chunks/index-7vvt5hhy.js";
|
|
10
10
|
export {
|
|
11
11
|
composeEvalSet2 as composeEvalSet,
|
package/dist/normalize/index.js
CHANGED
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
readNameCell2,
|
|
50
50
|
DEFAULT_NAME_FORMAT_THRESHOLD2,
|
|
51
51
|
deriveNameFormat2
|
|
52
|
-
} from "../chunks/index-
|
|
52
|
+
} from "../chunks/index-kw69ry3j.js";
|
|
53
53
|
import"../chunks/index-kw6gbrnq.js";
|
|
54
54
|
import {
|
|
55
55
|
NAME_REFUSED2,
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
defaultPersonNameFactory2,
|
|
96
96
|
personName2,
|
|
97
97
|
personNameFromIcao2
|
|
98
|
-
} from "../chunks/index-
|
|
98
|
+
} from "../chunks/index-ka8nzreg.js";
|
|
99
99
|
import {
|
|
100
100
|
TEAM_WORD2,
|
|
101
101
|
TEAM_DESIGNATION_WORDS2,
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bloom filters for name classification
|
|
3
|
-
*
|
|
3
|
+
* Built by scripts/build-blooms.ts from the source lists recorded in
|
|
4
|
+
* data/bloom/MANIFEST.json, which also holds each table's item count.
|
|
4
5
|
* Target FPP: 0.01
|
|
5
|
-
* Total items: 484,270
|
|
6
|
-
* Total bits: 4,641,758 (566.6 KB)
|
|
7
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* The key a name table holds and is asked: lower-cased, NFD, combining marks dropped,
|
|
9
|
+
* the ASCII apostrophe dropped. `scripts/build-blooms.ts` builds the tables with it, so
|
|
10
|
+
* a lookup and a build cannot disagree.
|
|
11
|
+
*/
|
|
12
|
+
export declare function normalize(s: string): string;
|
|
8
13
|
/** Check if word is a known surname (151k entries) */
|
|
9
14
|
export declare function isSurname(word: string): boolean;
|
|
10
15
|
/** Check if word is in the human names list (197k first+last names) */
|
|
@@ -14,31 +14,42 @@
|
|
|
14
14
|
* root never leaves this module: `sameGivenFamily` and `givenFamilyTable` answer about a
|
|
15
15
|
* pair and neither returns a root, for that reason.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* `
|
|
23
|
-
*
|
|
17
|
+
* SPELLINGS, FAMILIES AND THE GATE. Two different given names are related in one of three
|
|
18
|
+
* ways, and the answer says which:
|
|
19
|
+
*
|
|
20
|
+
* - `given-variant`: two spellings of one name (`Connor` / `Conor`, `Sara` / `Sarah`). A
|
|
21
|
+
* spelling is not a familiar form, so `variants` is its own table, and a gate admits it.
|
|
22
|
+
* - `given-family`: after each spelling is read as its canonical, the two share a ROOT of
|
|
23
|
+
* `families` (`Tom` / `Thomas`, `Kate` / `Katherine`), and a gate admits it.
|
|
24
|
+
* - `given-family-not-gate`: they share a root, but only through a `notAtGate` form: a name in
|
|
25
|
+
* its own right (`Megan`, `Grace`), a translation (`Sean`, `Padraig`), another gender's
|
|
26
|
+
* name (`Michelle`, `Sam`) or a form of more than one root (`Ellie`, `Evie`). The lane
|
|
27
|
+
* reads it as evidence below an exact match; a gate refuses it.
|
|
28
|
+
*
|
|
29
|
+
* EVERY ROOT, NEVER THE FIRST. A form under several roots meets each of them (`Evie` is
|
|
30
|
+
* Evelyn's, Genevieve's, Eve's and Eva's), and every such form is `notAtGate`, because the
|
|
31
|
+
* form alone cannot say which root its bearer carries. Sharing a root is not transitive:
|
|
32
|
+
* `Eve` and `Eva` share none, though `Evie` meets both. A `notAtGate` form is refused AS A
|
|
33
|
+
* FORM: where it is the root itself (`Caitlin` / `Cait`), its own forms meet it at a gate.
|
|
24
34
|
*/
|
|
25
35
|
/**
|
|
26
36
|
* Do two DIFFERENT given names (NN3, letters only) stand for one another at a gate?
|
|
27
37
|
*
|
|
28
|
-
* True exactly when
|
|
29
|
-
* form. Two equal names answer `false`:
|
|
30
|
-
* tolerance past it, so a caller can tell
|
|
38
|
+
* True exactly when `givenFamilyTable` relates them by a gate-safe answer: two spellings of
|
|
39
|
+
* one name, or one family through no `notAtGate` form. Two equal names answer `false`:
|
|
40
|
+
* equality is the caller's own test and this is the tolerance past it, so a caller can tell
|
|
41
|
+
* which one admitted a pair.
|
|
31
42
|
*/
|
|
32
43
|
export declare function sameGivenFamily(a: string, b: string): boolean;
|
|
33
44
|
/**
|
|
34
45
|
* What the table says about two DIFFERENT given names (NN3, letters only), as a kinship
|
|
35
|
-
* `via`: `given-
|
|
36
|
-
*
|
|
37
|
-
*
|
|
46
|
+
* `via`: `given-variant` for two spellings of one name, `given-family` where the two share a
|
|
47
|
+
* root and a gate admits the pair, `given-family-not-gate` where every root they share is
|
|
48
|
+
* reached through a `notAtGate` form, and `null` where the table does not relate them. Two
|
|
49
|
+
* equal names answer `null`, for `sameGivenFamily`'s reason.
|
|
38
50
|
*
|
|
39
|
-
* THE DEFAULT GIVEN-NAME PROVIDER of `createNameKinship` (`./name-kinship.ts`).
|
|
40
|
-
* `
|
|
41
|
-
*
|
|
42
|
-
* pair.
|
|
51
|
+
* THE DEFAULT GIVEN-NAME PROVIDER of `createNameKinship` (`./name-kinship.ts`).
|
|
52
|
+
* `sameGivenFamily` is defined as its gate-safe answers, so the gate and the tolerant relation
|
|
53
|
+
* cannot disagree about a pair.
|
|
43
54
|
*/
|
|
44
|
-
export declare function givenFamilyTable(a: string, b: string): "given-family" | "given-family-not-gate" | null;
|
|
55
|
+
export declare function givenFamilyTable(a: string, b: string): "given-variant" | "given-family" | "given-family-not-gate" | null;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* caller decides how much to accept:
|
|
15
15
|
*
|
|
16
16
|
* Kate Smith / Katherine Smith candidate via [given-family]
|
|
17
|
+
* Connor Smith / Conor Smith candidate via [given-variant]
|
|
17
18
|
* Mary Larson / Mary Conley-Larson candidate via [surname-part]
|
|
18
19
|
* Kate M Smith / Katherine Conley-Smith
|
|
19
20
|
* candidate via [surname-part, given-family, middle-absent]
|
|
@@ -63,6 +64,11 @@ export declare const KINSHIP_VIAS: Readonly<{
|
|
|
63
64
|
field: "surname";
|
|
64
65
|
gateSafe: true;
|
|
65
66
|
}>;
|
|
67
|
+
/** the two first given names are two spellings of one name (`Connor` / `Conor`) */
|
|
68
|
+
readonly "given-variant": Readonly<{
|
|
69
|
+
field: "given";
|
|
70
|
+
gateSafe: true;
|
|
71
|
+
}>;
|
|
66
72
|
/** the given-name table relates the two first given names, and the gate admits them */
|
|
67
73
|
readonly "given-family": Readonly<{
|
|
68
74
|
field: "given";
|
|
@@ -468,8 +468,9 @@ interface NameKinship {
|
|
|
468
468
|
| via | field | gate-safe | when |
|
|
469
469
|
|---|---|---|---|
|
|
470
470
|
| `surname-part` | surname | yes | one surname is a whole hyphen- or space-joined part of the other's compound |
|
|
471
|
+
| `given-variant` | given | yes | the two first given names are two spellings of one name (`Connor` / `Conor`) |
|
|
471
472
|
| `given-family` | given | yes | a provider says the two first given names are one family, and a gate admits them |
|
|
472
|
-
| `given-family-not-gate` | given | no | the table relates them through a `notAtGate` form |
|
|
473
|
+
| `given-family-not-gate` | given | no | the table relates them only through a `notAtGate` form |
|
|
473
474
|
| `given-maybe` | given | no | a probabilistic source says they MAY be one family |
|
|
474
475
|
| `middle-absent` | middle | yes | NN5's: one side carries no middle |
|
|
475
476
|
| `initial-agrees` | middle | yes | NN5's: an initial against a full middle that starts with it |
|
|
@@ -486,8 +487,8 @@ interface NameKinship {
|
|
|
486
487
|
each `GivenProvider` in order and the first non-null answer wins. A provider is asked
|
|
487
488
|
once per pair, with the two NN3 first given names in code-unit order, and never with two
|
|
488
489
|
equal names. The default is `[givenFamilyTable]`, which answers from
|
|
489
|
-
`given-diminutives.json`; `sameGivenFamily(a, b)` is exactly
|
|
490
|
-
`
|
|
490
|
+
`given-diminutives.json`; `sameGivenFamily(a, b)` is exactly "`givenFamilyTable(a, b)` is
|
|
491
|
+
`given-variant` or `given-family`". `[]` tolerates no given name.
|
|
491
492
|
- A new kind of `via` is one entry in `KINSHIP_VIAS`, which carries its field and its
|
|
492
493
|
gate-safety. The relation's rules do not change.
|
|
493
494
|
- With no tolerance used, the answer is `nameRelation`'s. `head-differs` is split into
|
|
@@ -495,9 +496,33 @@ interface NameKinship {
|
|
|
495
496
|
suffix and middle rows are NN5's (`tailRelation`) and still veto.
|
|
496
497
|
- A print that names no person is `different` from everything, itself included.
|
|
497
498
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
`
|
|
499
|
+
### The given-name table
|
|
500
|
+
|
|
501
|
+
`given-diminutives.json` holds three things, each in NN3 upper case:
|
|
502
|
+
|
|
503
|
+
- `variants`: one name's SPELLINGS, canonical first (`CONNOR` / `CONOR`, `SARAH` / `SARA`,
|
|
504
|
+
`MEGAN` / `MEGHAN` / `MEAGAN` / `MEAGHAN`). Two spellings are `given-variant`, and a gate
|
|
505
|
+
admits them. A spelling is read as its canonical before `families` is consulted, so
|
|
506
|
+
`Cate` meets `Katherine` as `Kate` does. A transposition or a typo (`Oliva`, `Cailtin`,
|
|
507
|
+
`Naimh`) is NOT a variant: a misprint tolerance is a separate provider.
|
|
508
|
+
- `families`: root -> its familiar forms. Two names are one family when they SHARE A ROOT,
|
|
509
|
+
a root belonging to itself. A form may sit under several roots and meets EVERY one of
|
|
510
|
+
them: `Evie` is Evelyn's, Genevieve's, Eve's, Eva's and Evangeline's. Sharing a root is
|
|
511
|
+
not transitive, so `Eve` and `Eva` stay apart though `Evie` meets both.
|
|
512
|
+
- `notAtGate`: forms a gate refuses — a name in its own right (`Josie`, `Gracie`, `Lily`),
|
|
513
|
+
a translation (`Sean`), another gender's name (`Sam`, `Charlie`, `Frankie`), and every
|
|
514
|
+
form under more than one root (`Ellie`, `Maddie`, `Ally`, `Kit`), because the form alone
|
|
515
|
+
cannot say which root its bearer carries. A pair through such a form is
|
|
516
|
+
`given-family-not-gate`. The flag refuses a name AS A FORM: where it is the root itself,
|
|
517
|
+
its own forms still meet it at a gate (`Caitlin` is Catherine's Irish form, refused
|
|
518
|
+
against `Katherine`, and still meets `Cait`).
|
|
519
|
+
|
|
520
|
+
`Kate` and `Katie` are Catherine's, and `Katelyn` is a spelling of Caitlin. They meet below
|
|
521
|
+
the gate through Caitlin as a form of Catherine, so `Kate` / `Katherine` keeps its gate.
|
|
522
|
+
|
|
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.
|
|
501
526
|
|
|
502
527
|
### The tolerant lookup
|
|
503
528
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finbheara/names",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "A curated lexicon of personal, school and place names, the surname-particle vocabulary, a phrase classifier and a person-name normalizer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"names",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"lint:fix": "biome check --write",
|
|
75
75
|
"test": "bun test",
|
|
76
76
|
"build": "bun scripts/build.ts",
|
|
77
|
+
"build:blooms": "bun scripts/build-blooms.ts",
|
|
77
78
|
"names": "bun src/cli/names.ts",
|
|
78
79
|
"prepublishOnly": "bun run build"
|
|
79
80
|
},
|
|
File without changes
|
|
File without changes
|