@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.
- package/README.md +45 -6
- 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-pncn9y2r.js → index-a6f2y4aa.js} +2 -2
- package/dist/chunks/{index-2565cn5x.js → index-ky754nsf.js} +3 -3
- package/dist/chunks/{index-kw69ry3j.js → index-n6fpj92s.js} +11 -367
- package/dist/chunks/{index-kw69ry3j.js.map → index-n6fpj92s.js.map} +4 -5
- package/dist/chunks/index-qmn87bdh.js +1697 -0
- package/dist/chunks/index-qmn87bdh.js.map +11 -0
- 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/bin.js +109 -0
- package/dist/cli/bin.js.map +11 -0
- package/dist/cli/census.js +4 -4
- package/dist/index.js +18 -10
- 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 +13 -7
- package/dist/normalize/index.js.map +1 -1
- package/dist/types/cli/bin.d.ts +10 -0
- package/dist/types/cli/tables.d.ts +13 -0
- package/dist/types/lexicon/flags.d.ts +13 -5
- package/dist/types/normalize/given-diminutives.d.ts +15 -6
- package/dist/types/normalize/given-families.d.ts +53 -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-2nmvkrc5.js +0 -11
- /package/dist/chunks/{index-pncn9y2r.js.map → index-a6f2y4aa.js.map} +0 -0
- /package/dist/chunks/{index-2565cn5x.js.map → index-ky754nsf.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-2nmvkrc5.js.map → phrase-2hj26asc.js.map} +0 -0
package/README.md
CHANGED
|
@@ -145,8 +145,10 @@ name cells, one per line. The specification is `docs/NAME-NORMALIZATION.md`.
|
|
|
145
145
|
### How two names are related
|
|
146
146
|
|
|
147
147
|
```ts
|
|
148
|
-
import {
|
|
149
|
-
|
|
148
|
+
import {
|
|
149
|
+
createGivenFamilyList, createNameIndex, createNameKinship, givenFamilyTable, nameKinship,
|
|
150
|
+
personName,
|
|
151
|
+
} from "@finbheara/names/normalize";
|
|
150
152
|
|
|
151
153
|
nameKinship(personName("Kate Smith"), personName("Katherine Smith"));
|
|
152
154
|
// { relation: "candidate", via: ["given-family"], reason: "middles-equal", gateSafe: true }
|
|
@@ -157,13 +159,16 @@ nameKinship(personName("Kate M Smith"), personName("Katherine Conley-Smith")).vi
|
|
|
157
159
|
nameKinship(personName("Connor Smith"), personName("Conor Smith")).via; // ["given-variant"]
|
|
158
160
|
nameKinship(personName("Evie Smith"), personName("Genevieve Smith"));
|
|
159
161
|
// { relation: "candidate", via: ["given-family-not-gate"], reason: "middles-equal", gateSafe: false }
|
|
162
|
+
nameKinship(personName("Beth Smith"), personName("Bethany Smith")); // the extended family list
|
|
163
|
+
// { relation: "candidate", via: ["given-maybe"], reason: "middles-equal", gateSafe: false }
|
|
160
164
|
|
|
161
165
|
// the given-name tolerance is a list of providers, asked in order
|
|
162
|
-
const
|
|
163
|
-
|
|
166
|
+
const tableOnly = createNameKinship({ given: [givenFamilyTable] });
|
|
167
|
+
tableOnly(personName("Beth Smith"), personName("Bethany Smith")).reason; // "given-differs"
|
|
168
|
+
const common = createNameKinship({
|
|
169
|
+
given: [givenFamilyTable, createGivenFamilyList({ maxTier: 1 })], // common forms only
|
|
164
170
|
});
|
|
165
|
-
|
|
166
|
-
// { relation: "candidate", via: ["given-maybe"], reason: "middles-equal", gateSafe: false }
|
|
171
|
+
common(personName("Maggie Smith"), personName("Marjorie Smith")).reason; // "given-differs"
|
|
167
172
|
|
|
168
173
|
const index = createNameIndex<number>("nn3"); // a NameMap with a tolerant lookup
|
|
169
174
|
index.set(personName("Mary Conley-Larson"), 1).set(personName("Mary Carlson"), 2);
|
|
@@ -175,6 +180,39 @@ index.related(personName("Mary Larson")); // [{ name: Conley-Larson<<Mary
|
|
|
175
180
|
tolerance the pair used, and `gateSafe` is false when any of them is one a gate must not
|
|
176
181
|
admit on its own.
|
|
177
182
|
|
|
183
|
+
### The given-name tables, for another language
|
|
184
|
+
|
|
185
|
+
The tables behind `givenFamilyTable` and `givenFamilyList` print as JSON, for a consumer
|
|
186
|
+
that is not JavaScript:
|
|
187
|
+
|
|
188
|
+
```sh
|
|
189
|
+
npx @finbheara/names tables given-name > given-name-tables.json # or bunx
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
`--output json` and `--schema 1` are the defaults. The PRINTED form is the contract: a
|
|
193
|
+
schema keeps its shape for as long as the package offers it, and a new shape is a new
|
|
194
|
+
schema, so a command written today keeps working. The files the tables are stored in are
|
|
195
|
+
not part of it. Schema 1 is
|
|
196
|
+
|
|
197
|
+
```jsonc
|
|
198
|
+
{
|
|
199
|
+
"$comment": [ /* how to read it */ ],
|
|
200
|
+
"table": "given-name", "schema": 1,
|
|
201
|
+
"variants": { "CONNOR": ["CONOR"], … }, // canonical -> its other spellings
|
|
202
|
+
"families": { "CATHERINE": ["KATE", …], … }, // the curated gate tier: root -> forms
|
|
203
|
+
"notAtGate": ["MEGAN", …], // forms a gate must not admit as forms
|
|
204
|
+
"extended": { "BETHANY": { "BETH": 1 }, … } // root -> form -> tier (1 common .. 3 rare)
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Read it as the library does, and as `$comment` says: read each name as its canonical
|
|
209
|
+
spelling first; two names relate only when they share a root, a form meets EVERY root it
|
|
210
|
+
sits under, and nothing is transitive (`EVIE` meets `EVE` and `EVA`, which do not meet each
|
|
211
|
+
other). A shared root is `given-family` unless one name reaches it only as a `notAtGate`
|
|
212
|
+
form; a name that is the root itself always passes. An `extended` pair's tier is its rarer
|
|
213
|
+
member's, the root counting as 1. To avoid comparing every pair, index each name under
|
|
214
|
+
every root it has and compare within a root, never on one root per name.
|
|
215
|
+
|
|
178
216
|
## Phonetic and blocking keys
|
|
179
217
|
|
|
180
218
|
```ts
|
|
@@ -242,6 +280,7 @@ given name. Flags are case-sensitive and combine (`Kelly:AF`, `New York:BG`).
|
|
|
242
280
|
| `B` | multi-word entry (bigram or trigram) |
|
|
243
281
|
| `S` | a known typo, kept so it is recognised |
|
|
244
282
|
| `X` | excluded from the display renderer's round-trip check |
|
|
283
|
+
| `D` | a given name a diminutive table holds (`Kate:FD`); a mark, like `S` and `X` |
|
|
245
284
|
|
|
246
285
|
A digit after `L` or `A` is a **tradition footnote**: `1` Armenian, `2` Germanic,
|
|
247
286
|
`3` Iberian, `4` Irish/Gaelic, `5` Nordic, `6` Slavic (`Kowalski:L6`). An index is
|