@finbheara/names 0.16.0 → 0.18.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 +33 -0
- package/dist/chunks/{index-ye6j60jn.js → index-17zzg7f3.js} +5 -5
- package/dist/chunks/{index-ye6j60jn.js.map → index-17zzg7f3.js.map} +2 -2
- package/dist/chunks/index-18z8akw8.js +42 -0
- package/dist/chunks/{index-tqdbxd92.js.map → index-18z8akw8.js.map} +3 -3
- package/dist/chunks/{index-ky754nsf.js → index-7j32khen.js} +9 -7
- package/dist/chunks/{index-ky754nsf.js.map → index-7j32khen.js.map} +4 -4
- package/dist/chunks/{index-tk01chxw.js → index-gxw36cg3.js} +27 -16
- package/dist/chunks/{index-tk01chxw.js.map → index-gxw36cg3.js.map} +2 -2
- package/dist/chunks/{index-74fyytnh.js → index-qmn87bdh.js} +21 -1411
- package/dist/chunks/index-qmn87bdh.js.map +11 -0
- package/dist/chunks/index-xtwbdzy1.js +1418 -0
- package/dist/chunks/{index-74fyytnh.js.map → index-xtwbdzy1.js.map} +3 -5
- package/dist/chunks/{phrase-2hj26asc.js → phrase-hze7av6y.js} +3 -3
- package/dist/classifier/index.js +2 -2
- package/dist/cli/bin.js +109 -0
- package/dist/cli/bin.js.map +11 -0
- package/dist/cli/census.js +3 -3
- package/dist/index.js +24 -10
- package/dist/index.js.map +1 -1
- package/dist/measure/index.js +2 -2
- package/dist/normalize/index.js +22 -8
- package/dist/normalize/index.js.map +1 -1
- package/dist/types/classifier/features.d.ts +2 -2
- package/dist/types/cli/bin.d.ts +10 -0
- package/dist/types/cli/tables.d.ts +13 -0
- package/dist/types/lexicon/place.d.ts +16 -0
- package/dist/types/normalize/given-diminutives.d.ts +15 -6
- package/dist/types/normalize/given-families.d.ts +5 -0
- package/dist/types/normalize/index.d.ts +2 -2
- package/package.json +2 -1
- package/dist/chunks/index-tqdbxd92.js +0 -27
- /package/dist/chunks/{phrase-2hj26asc.js.map → phrase-hze7av6y.js.map} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/cli/tables.ts", "../src/cli/bin.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * tables.ts — the package's data tables, printed for a consumer in any language.\n *\n * names tables given-name [--output json] [--schema 1] > given-name-tables.json\n *\n * THE PRINTED FORM IS THE CONTRACT, not the files the tables are stored in. Each table has\n * numbered schemas; a schema, once released, prints the same shape for as long as the\n * package offers it, and a new shape is a new schema. `--schema` defaults to 1 and\n * `--output` to `json`, so a command written against the first release keeps working.\n * (`--schema`, not `--version`: the number is the output's shape, not the package's.)\n */\n\nimport { givenDiminutiveTable } from \"../normalize/given-diminutives.ts\";\nimport { givenFamilyTiers } from \"../normalize/given-families.ts\";\n\n/** table -> schema -> its printed value */\nconst TABLES: Record<string, Record<string, () => unknown>> = {\n\t\"given-name\": { \"1\": givenNameV1 },\n};\n\nconst OUTPUTS = [\"json\"];\n\n/**\n * `given-name` schema 1: the curated gate table and the extended family list, with the\n * rules a reader needs to answer as `givenFamilyTable` and `givenFamilyList` do.\n */\nfunction givenNameV1() {\n\tconst gate = givenDiminutiveTable();\n\treturn {\n\t\t$comment: [\n\t\t\t\"@finbheara/names given-name tables, schema 1. Every name is NN3: upper case, letters only.\",\n\t\t\t\"`variants`: canonical -> its other spellings. Read each name as its canonical spelling first;\",\n\t\t\t\"two names with one canonical are `given-variant`. `families` and `notAtGate` hold canonical\",\n\t\t\t\"spellings only.\",\n\t\t\t\"`families`: root -> its familiar forms, the curated gate tier. A root belongs to its own family.\",\n\t\t\t\"A form may sit under several roots and meets EVERY one of them; nothing is transitive, so two\",\n\t\t\t\"names relate only when they share a root. They are `given-family` when, for some shared root,\",\n\t\t\t\"neither name is a `notAtGate` form of it (a name that IS the root always passes), else\",\n\t\t\t\"`given-family-not-gate`, which an identity gate must refuse.\",\n\t\t\t\"`extended`: root -> form -> tier (1 common, 2 uncommon, 3 rare), the extended list. Two names\",\n\t\t\t\"relate when they share a root; the pair's tier is its rarer member's, the root counting as 1.\",\n\t\t\t\"Every pair here is `given-maybe`: a lead, never a gate. It is asked after `families`.\",\n\t\t\t\"Two equal names are none of these: equality is the caller's own test.\",\n\t\t],\n\t\ttable: \"given-name\",\n\t\tschema: 1,\n\t\tvariants: gate.variants,\n\t\tfamilies: gate.families,\n\t\tnotAtGate: gate.notAtGate,\n\t\textended: givenFamilyTiers(),\n\t};\n}\n\nconst USAGE = [\n\t\"usage: names tables <table> [--output json] [--schema N]\",\n\t`tables: ${Object.entries(TABLES)\n\t\t.map(([t, v]) => `${t} (schemas ${Object.keys(v).join(\", \")})`)\n\t\t.join(\"; \")}`,\n\t\"defaults: --output json --schema 1\",\n].join(\"\\n\");\n\n/** `names tables …`: prints one table to stdout. Returns the exit code. */\nexport function tables(argv: readonly string[]): number {\n\tconst options: Record<string, string> = { output: \"json\", schema: \"1\" };\n\tconst positional: string[] = [];\n\tfor (let i = 0; i < argv.length; i++) {\n\t\tconst a = argv[i]!;\n\t\tif (a === \"--help\" || a === \"-h\") {\n\t\t\tconsole.log(USAGE);\n\t\t\treturn 0;\n\t\t}\n\t\tconst m = /^--([a-z]+)(?:=(.*))?$/.exec(a);\n\t\tif (m === null) {\n\t\t\tpositional.push(a);\n\t\t\tcontinue;\n\t\t}\n\t\tconst [, key, inline] = m as unknown as [string, string, string | undefined];\n\t\tif (!(key in options)) return fail(`unknown option --${key}`);\n\t\tconst value = inline ?? argv[++i];\n\t\tif (value === undefined) return fail(`--${key} needs a value`);\n\t\toptions[key] = value;\n\t}\n\tif (positional.length !== 1) return fail(\"name one table\");\n\tconst schemas = TABLES[positional[0]!];\n\tif (schemas === undefined) return fail(`unknown table \"${positional[0]}\"`);\n\tconst print = schemas[options.schema!];\n\tif (print === undefined) return fail(`${positional[0]} has no schema ${options.schema}`);\n\tif (!OUTPUTS.includes(options.output!)) return fail(`unknown output \"${options.output}\"`);\n\tconsole.log(JSON.stringify(print(), null, \"\\t\"));\n\treturn 0;\n}\n\nfunction fail(message: string): number {\n\tconsole.error(`names tables: ${message}\\n${USAGE}`);\n\treturn 2;\n}\n",
|
|
6
|
+
"#!/usr/bin/env node\n/**\n * names — the package's command, run as `npx @finbheara/names …` or `bunx @finbheara/names …`.\n *\n * names tables <table> [--output json] [--schema N] print a data table\n *\n * Runs under Node or Bun. (`bun run names` in this repository is the lexicon curation CLI,\n * `./names.ts`, which is not shipped.)\n */\n\nimport { tables } from \"./tables.ts\";\n\nconst COMMANDS: Record<string, (argv: readonly string[]) => number> = { tables };\n\nconst USAGE = \"usage: names tables <table> [--output json] [--schema N]\";\n\nfunction main(argv: readonly string[]): number {\n\tconst [command, ...rest] = argv;\n\tif (command === \"--help\" || command === \"-h\") {\n\t\tconsole.log(USAGE);\n\t\treturn 0;\n\t}\n\tif (command === undefined) {\n\t\tconsole.error(USAGE);\n\t\treturn 2;\n\t}\n\tconst run = COMMANDS[command];\n\tif (run === undefined) {\n\t\tconsole.error(`names: unknown command \"${command}\"\\n${USAGE}`);\n\t\treturn 2;\n\t}\n\treturn run(rest);\n}\n\n// Run unconditionally: this module is only ever the entry (a `.bin` symlink makes an\n// `import.meta.url === argv[1]` test unreliable).\nprocess.exitCode = main(process.argv.slice(2));\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": "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",
|
|
9
|
+
"debugId": "E2CE232D305113AE64756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
package/dist/cli/census.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import"../chunks/index-0wpvbdgh.js";
|
|
3
3
|
import {
|
|
4
4
|
createNameCensus2
|
|
5
|
-
} from "../chunks/index-
|
|
6
|
-
import"../chunks/index-
|
|
5
|
+
} from "../chunks/index-17zzg7f3.js";
|
|
6
|
+
import"../chunks/index-gxw36cg3.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-hze7av6y.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
|
@@ -38,14 +38,11 @@ import {
|
|
|
38
38
|
createSegmenter2,
|
|
39
39
|
createClassifier2,
|
|
40
40
|
phraseClassifier2
|
|
41
|
-
} from "./chunks/index-
|
|
41
|
+
} from "./chunks/index-7j32khen.js";
|
|
42
42
|
import"./chunks/index-jwx1mm4k.js";
|
|
43
43
|
import {
|
|
44
44
|
repairMojibake2,
|
|
45
|
-
|
|
46
|
-
givenFamilyTable2,
|
|
47
|
-
createGivenFamilyList2,
|
|
48
|
-
givenFamilyList2,
|
|
45
|
+
middleFields2,
|
|
49
46
|
comparePosition2,
|
|
50
47
|
nameRelation2,
|
|
51
48
|
MAX_READINGS2,
|
|
@@ -93,19 +90,25 @@ import {
|
|
|
93
90
|
readNameCell2,
|
|
94
91
|
DEFAULT_NAME_FORMAT_THRESHOLD2,
|
|
95
92
|
deriveNameFormat2
|
|
96
|
-
} from "./chunks/index-
|
|
93
|
+
} from "./chunks/index-xtwbdzy1.js";
|
|
97
94
|
import"./chunks/index-qsznkk4s.js";
|
|
98
95
|
import {
|
|
99
96
|
composeEvalSet2,
|
|
100
97
|
evaluateClassifier2
|
|
101
98
|
} from "./chunks/index-a6f2y4aa.js";
|
|
102
|
-
import
|
|
99
|
+
import {
|
|
100
|
+
sameGivenFamily2,
|
|
101
|
+
givenFamilyTable2,
|
|
102
|
+
createGivenFamilyList2,
|
|
103
|
+
givenFamilyList2
|
|
104
|
+
} from "./chunks/index-qmn87bdh.js";
|
|
105
|
+
import"./chunks/index-18z8akw8.js";
|
|
103
106
|
import {
|
|
104
107
|
doubleMetaphone2
|
|
105
108
|
} from "./chunks/index-ebebeamh.js";
|
|
106
109
|
import {
|
|
107
110
|
createNameCensus2
|
|
108
|
-
} from "./chunks/index-
|
|
111
|
+
} from "./chunks/index-17zzg7f3.js";
|
|
109
112
|
import {
|
|
110
113
|
NAME_REFUSED2,
|
|
111
114
|
stripEveryAside2,
|
|
@@ -122,10 +125,15 @@ import {
|
|
|
122
125
|
COMPOUND_SURNAMES2,
|
|
123
126
|
isCompoundSurname2,
|
|
124
127
|
spaceAfterComma2,
|
|
128
|
+
NAME_SUFFIXES2,
|
|
129
|
+
isNameSuffix2,
|
|
125
130
|
inferNameOrder2,
|
|
126
131
|
commaReading2,
|
|
132
|
+
lexiconNameOrder2,
|
|
133
|
+
tippedNameOrder2,
|
|
127
134
|
resolveNameOrder2,
|
|
128
135
|
splitPersonName2,
|
|
136
|
+
givenNameGroups2,
|
|
129
137
|
classifyCell2,
|
|
130
138
|
capitalise2,
|
|
131
139
|
nameCase2,
|
|
@@ -150,7 +158,7 @@ import {
|
|
|
150
158
|
defaultPersonNameFactory2,
|
|
151
159
|
personName2,
|
|
152
160
|
personNameFromIcao2
|
|
153
|
-
} from "./chunks/index-
|
|
161
|
+
} from "./chunks/index-gxw36cg3.js";
|
|
154
162
|
import {
|
|
155
163
|
TEAM_WORD2,
|
|
156
164
|
TEAM_DESIGNATION_WORDS2,
|
|
@@ -191,6 +199,7 @@ export {
|
|
|
191
199
|
NAME_LEVEL_COLUMNS2 as NAME_LEVEL_COLUMNS,
|
|
192
200
|
NAME_PLACEHOLDERS2 as NAME_PLACEHOLDERS,
|
|
193
201
|
NAME_REFUSED2 as NAME_REFUSED,
|
|
202
|
+
NAME_SUFFIXES2 as NAME_SUFFIXES,
|
|
194
203
|
NAME_TRADITIONS2 as NAME_TRADITIONS,
|
|
195
204
|
ORDER_READINGS2 as ORDER_READINGS,
|
|
196
205
|
PARTICLE_SECTION2 as PARTICLE_SECTION,
|
|
@@ -239,6 +248,7 @@ export {
|
|
|
239
248
|
givenFamilyList2 as givenFamilyList,
|
|
240
249
|
givenFamilyTable2 as givenFamilyTable,
|
|
241
250
|
givenKeyAbbreviates2 as givenKeyAbbreviates,
|
|
251
|
+
givenNameGroups2 as givenNameGroups,
|
|
242
252
|
infeasibleClass2 as infeasibleClass,
|
|
243
253
|
inferNameOrder2 as inferNameOrder,
|
|
244
254
|
initialsBlock2 as initialsBlock,
|
|
@@ -255,6 +265,7 @@ export {
|
|
|
255
265
|
isMale2 as isMale,
|
|
256
266
|
isMultiWord2 as isMultiWord,
|
|
257
267
|
isNameParticle2 as isNameParticle,
|
|
268
|
+
isNameSuffix2 as isNameSuffix,
|
|
258
269
|
isNeutral2 as isNeutral,
|
|
259
270
|
isNoNamePrint2 as isNoNamePrint,
|
|
260
271
|
isPerson2 as isPerson,
|
|
@@ -269,10 +280,12 @@ export {
|
|
|
269
280
|
isTradename2 as isTradename,
|
|
270
281
|
levelOf2 as levelOf,
|
|
271
282
|
lexiconKey2 as lexiconKey,
|
|
283
|
+
lexiconNameOrder2 as lexiconNameOrder,
|
|
272
284
|
lookupKey2 as lookupKey,
|
|
273
285
|
meetReading2 as meetReading,
|
|
274
286
|
meetReadings2 as meetReadings,
|
|
275
287
|
metaphoneBlocks2 as metaphoneBlocks,
|
|
288
|
+
middleFields2 as middleFields,
|
|
276
289
|
middleForm2 as middleForm,
|
|
277
290
|
nameBlockKeys2 as nameBlockKeys,
|
|
278
291
|
nameCase2 as nameCase,
|
|
@@ -319,6 +332,7 @@ export {
|
|
|
319
332
|
surnameParts2 as surnameParts,
|
|
320
333
|
teamLetter2 as teamLetter,
|
|
321
334
|
teamRowDesignation2 as teamRowDesignation,
|
|
335
|
+
tippedNameOrder2 as tippedNameOrder,
|
|
322
336
|
titleCaseNamePart2 as titleCaseNamePart,
|
|
323
337
|
toAscii2 as toAscii,
|
|
324
338
|
traditionFromIndex2 as traditionFromIndex,
|
|
@@ -326,5 +340,5 @@ export {
|
|
|
326
340
|
traditionOf2 as traditionOf
|
|
327
341
|
};
|
|
328
342
|
|
|
329
|
-
//# debugId=
|
|
343
|
+
//# debugId=05E6D5B79CEDF96564756E2164756E21
|
|
330
344
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
package/dist/measure/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "../chunks/index-a6f2y4aa.js";
|
|
5
5
|
import {
|
|
6
6
|
createNameCensus2
|
|
7
|
-
} from "../chunks/index-
|
|
8
|
-
import"../chunks/index-
|
|
7
|
+
} from "../chunks/index-17zzg7f3.js";
|
|
8
|
+
import"../chunks/index-gxw36cg3.js";
|
|
9
9
|
import"../chunks/index-0wpvbdgh.js";
|
|
10
10
|
export {
|
|
11
11
|
composeEvalSet2 as composeEvalSet,
|
package/dist/normalize/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
repairMojibake2,
|
|
3
|
-
|
|
4
|
-
givenFamilyTable2,
|
|
5
|
-
createGivenFamilyList2,
|
|
6
|
-
givenFamilyList2,
|
|
3
|
+
middleFields2,
|
|
7
4
|
comparePosition2,
|
|
8
5
|
nameRelation2,
|
|
9
6
|
MAX_READINGS2,
|
|
@@ -51,8 +48,14 @@ import {
|
|
|
51
48
|
readNameCell2,
|
|
52
49
|
DEFAULT_NAME_FORMAT_THRESHOLD2,
|
|
53
50
|
deriveNameFormat2
|
|
54
|
-
} from "../chunks/index-
|
|
55
|
-
import
|
|
51
|
+
} from "../chunks/index-xtwbdzy1.js";
|
|
52
|
+
import {
|
|
53
|
+
sameGivenFamily2,
|
|
54
|
+
givenFamilyTable2,
|
|
55
|
+
createGivenFamilyList2,
|
|
56
|
+
givenFamilyList2
|
|
57
|
+
} from "../chunks/index-qmn87bdh.js";
|
|
58
|
+
import"../chunks/index-18z8akw8.js";
|
|
56
59
|
import {
|
|
57
60
|
NAME_REFUSED2,
|
|
58
61
|
stripEveryAside2,
|
|
@@ -69,10 +72,15 @@ import {
|
|
|
69
72
|
COMPOUND_SURNAMES2,
|
|
70
73
|
isCompoundSurname2,
|
|
71
74
|
spaceAfterComma2,
|
|
75
|
+
NAME_SUFFIXES2,
|
|
76
|
+
isNameSuffix2,
|
|
72
77
|
inferNameOrder2,
|
|
73
78
|
commaReading2,
|
|
79
|
+
lexiconNameOrder2,
|
|
80
|
+
tippedNameOrder2,
|
|
74
81
|
resolveNameOrder2,
|
|
75
82
|
splitPersonName2,
|
|
83
|
+
givenNameGroups2,
|
|
76
84
|
classifyCell2,
|
|
77
85
|
capitalise2,
|
|
78
86
|
nameCase2,
|
|
@@ -97,7 +105,7 @@ import {
|
|
|
97
105
|
defaultPersonNameFactory2,
|
|
98
106
|
personName2,
|
|
99
107
|
personNameFromIcao2
|
|
100
|
-
} from "../chunks/index-
|
|
108
|
+
} from "../chunks/index-gxw36cg3.js";
|
|
101
109
|
import {
|
|
102
110
|
TEAM_WORD2,
|
|
103
111
|
TEAM_DESIGNATION_WORDS2,
|
|
@@ -124,6 +132,7 @@ export {
|
|
|
124
132
|
NAME_LEVEL_COLUMNS2 as NAME_LEVEL_COLUMNS,
|
|
125
133
|
NAME_PLACEHOLDERS2 as NAME_PLACEHOLDERS,
|
|
126
134
|
NAME_REFUSED2 as NAME_REFUSED,
|
|
135
|
+
NAME_SUFFIXES2 as NAME_SUFFIXES,
|
|
127
136
|
NAME_TRADITIONS2 as NAME_TRADITIONS,
|
|
128
137
|
ORDER_READINGS2 as ORDER_READINGS,
|
|
129
138
|
PLATFORM_PLACEHOLDERS2 as PLATFORM_PLACEHOLDERS,
|
|
@@ -158,6 +167,7 @@ export {
|
|
|
158
167
|
givenFamilyList2 as givenFamilyList,
|
|
159
168
|
givenFamilyTable2 as givenFamilyTable,
|
|
160
169
|
givenKeyAbbreviates2 as givenKeyAbbreviates,
|
|
170
|
+
givenNameGroups2 as givenNameGroups,
|
|
161
171
|
infeasibleClass2 as infeasibleClass,
|
|
162
172
|
inferNameOrder2 as inferNameOrder,
|
|
163
173
|
initialsBlock2 as initialsBlock,
|
|
@@ -165,14 +175,17 @@ export {
|
|
|
165
175
|
isCompoundSurname2 as isCompoundSurname,
|
|
166
176
|
isIcaoName2 as isIcaoName,
|
|
167
177
|
isListJoiner2 as isListJoiner,
|
|
178
|
+
isNameSuffix2 as isNameSuffix,
|
|
168
179
|
isNoNamePrint2 as isNoNamePrint,
|
|
169
180
|
isPlaceholderPrint2 as isPlaceholderPrint,
|
|
170
181
|
isTeamPrint2 as isTeamPrint,
|
|
171
182
|
levelOf2 as levelOf,
|
|
172
183
|
lexiconKey2 as lexiconKey,
|
|
184
|
+
lexiconNameOrder2 as lexiconNameOrder,
|
|
173
185
|
meetReading2 as meetReading,
|
|
174
186
|
meetReadings2 as meetReadings,
|
|
175
187
|
metaphoneBlocks2 as metaphoneBlocks,
|
|
188
|
+
middleFields2 as middleFields,
|
|
176
189
|
middleForm2 as middleForm,
|
|
177
190
|
nameBlockKeys2 as nameBlockKeys,
|
|
178
191
|
nameCase2 as nameCase,
|
|
@@ -213,10 +226,11 @@ export {
|
|
|
213
226
|
surnameParts2 as surnameParts,
|
|
214
227
|
teamLetter2 as teamLetter,
|
|
215
228
|
teamRowDesignation2 as teamRowDesignation,
|
|
229
|
+
tippedNameOrder2 as tippedNameOrder,
|
|
216
230
|
titleCaseNamePart2 as titleCaseNamePart,
|
|
217
231
|
traditionFromIndex2 as traditionFromIndex,
|
|
218
232
|
traditionLookupOf2 as traditionLookupOf
|
|
219
233
|
};
|
|
220
234
|
|
|
221
|
-
//# debugId=
|
|
235
|
+
//# debugId=2FD5851B5C07803564756E2164756E21
|
|
222
236
|
//# sourceMappingURL=index.js.map
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* `FEATURE_NAMES` stays in the weights file it was generated with; a weights
|
|
7
7
|
* object is valid for this code only when its vectors are that long.
|
|
8
8
|
*/
|
|
9
|
-
import { isPlacePhrase } from "../lexicon/place.ts";
|
|
9
|
+
import { isCommaPlacePhrase, isPlacePhrase } from "../lexicon/place.ts";
|
|
10
10
|
import { FEATURE_NAMES } from "./weights-v4.ts";
|
|
11
|
-
export { FEATURE_NAMES, isPlacePhrase };
|
|
11
|
+
export { FEATURE_NAMES, isCommaPlacePhrase, isPlacePhrase };
|
|
12
12
|
/** The three phrase categories, as the weights and the exact-match short-circuit name them. */
|
|
13
13
|
export interface CategoryScores {
|
|
14
14
|
person: number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* names — the package's command, run as `npx @finbheara/names …` or `bunx @finbheara/names …`.
|
|
4
|
+
*
|
|
5
|
+
* names tables <table> [--output json] [--schema N] print a data table
|
|
6
|
+
*
|
|
7
|
+
* Runs under Node or Bun. (`bun run names` in this repository is the lexicon curation CLI,
|
|
8
|
+
* `./names.ts`, which is not shipped.)
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tables.ts — the package's data tables, printed for a consumer in any language.
|
|
3
|
+
*
|
|
4
|
+
* names tables given-name [--output json] [--schema 1] > given-name-tables.json
|
|
5
|
+
*
|
|
6
|
+
* THE PRINTED FORM IS THE CONTRACT, not the files the tables are stored in. Each table has
|
|
7
|
+
* numbered schemas; a schema, once released, prints the same shape for as long as the
|
|
8
|
+
* package offers it, and a new shape is a new schema. `--schema` defaults to 1 and
|
|
9
|
+
* `--output` to `json`, so a command written against the first release keeps working.
|
|
10
|
+
* (`--schema`, not `--version`: the number is the output's shape, not the package's.)
|
|
11
|
+
*/
|
|
12
|
+
/** `names tables …`: prints one table to stdout. Returns the exit code. */
|
|
13
|
+
export declare function tables(argv: readonly string[]): number;
|
|
@@ -31,3 +31,19 @@ export declare function isPlaceWordFlags(flags: string): boolean;
|
|
|
31
31
|
* phrase `location` without the regression, as it answers one word flagged G.
|
|
32
32
|
*/
|
|
33
33
|
export declare function isPlacePhrase(phrase: string, getFlags: (name: string) => string | null): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* A place cut by a comma: two or more printed words, every one a place (`G`), at least one
|
|
36
|
+
* before the last ending its field with `,`, and every word after the last such comma a
|
|
37
|
+
* place and nothing else (`isPlaceWordFlags`). The words before the comma may also be a
|
|
38
|
+
* given name or a school's name: `Victoria, Australia` (`Victoria:FG`, `Australia:G`) and
|
|
39
|
+
* `Sydney, Australia` (`Sydney:FGT`) are ones; `Victoria Australia` (no comma) and
|
|
40
|
+
* `Australia, Victoria` (a given name after the comma) are not.
|
|
41
|
+
*
|
|
42
|
+
* The comma is the signal only where the document prints given names first. A person is
|
|
43
|
+
* printed `Surname, Given`, and under a surname-first or an undeclared order a given name
|
|
44
|
+
* that is also a place may follow the comma; a school is printed `School, State`
|
|
45
|
+
* (`Claddagh, Utah`) in surname-first documents. So the runtime answers this phrase
|
|
46
|
+
* `location` only for a document that declares `given-first`; `isPlacePhrase` answers
|
|
47
|
+
* under every order.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isCommaPlacePhrase(phrase: string, getFlags: (name: string) => string | null): boolean;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* given-diminutives.ts — ONE GIVEN-NAME DIMINUTIVE TABLE, read by the TypeScript side.
|
|
3
3
|
*
|
|
4
|
-
* `./given-diminutives.json` is the table and this file is its reader. A
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* map of eight entries and said *"the name primitives are
|
|
8
|
-
* consumer wants one"*; the teachers-directory gate is that
|
|
9
|
-
* entries are in the table.
|
|
4
|
+
* `./given-diminutives.json` is the table and this file is its reader. A consumer in another
|
|
5
|
+
* language reads the table as `names tables given-name` prints it (`../cli/tables.ts`), never
|
|
6
|
+
* this file, so the file's layout may change and no second copy exists. An earlier
|
|
7
|
+
* adjudicator carried a `FAMILIAR` map of eight entries and said *"the name primitives are
|
|
8
|
+
* where it belongs once a second consumer wants one"*; the teachers-directory gate is that
|
|
9
|
+
* second consumer, and the eight entries are in the table.
|
|
10
10
|
*
|
|
11
11
|
* A RELATION OF A PAIR AND NEVER A KEY. Nothing here rewrites a given name: a stored key,
|
|
12
12
|
* a filing key and every rendering keep the print's own spelling. A caller asks whether
|
|
@@ -32,6 +32,15 @@
|
|
|
32
32
|
* `Eve` and `Eva` share none, though `Evie` meets both. A `notAtGate` form is refused AS A
|
|
33
33
|
* FORM: where it is the root itself (`Caitlin` / `Cait`), its own forms meet it at a gate.
|
|
34
34
|
*/
|
|
35
|
+
/**
|
|
36
|
+
* The table as this module reads it, for `names tables given-name`, which prints it. Not a
|
|
37
|
+
* package export: the printed form is the contract, and this file's layout may change.
|
|
38
|
+
*/
|
|
39
|
+
export declare function givenDiminutiveTable(): {
|
|
40
|
+
readonly variants: Readonly<Record<string, readonly string[]>>;
|
|
41
|
+
readonly families: Readonly<Record<string, readonly string[]>>;
|
|
42
|
+
readonly notAtGate: readonly string[];
|
|
43
|
+
};
|
|
35
44
|
/**
|
|
36
45
|
* Do two DIFFERENT given names (NN3, letters only) stand for one another at a gate?
|
|
37
46
|
*
|
|
@@ -44,5 +44,10 @@ export type GivenFamilyList = (a: string, b: string) => "given-maybe" | null;
|
|
|
44
44
|
* The list is parsed on the first question, once per provider.
|
|
45
45
|
*/
|
|
46
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>>;
|
|
47
52
|
/** The shipped list, every tier: the second given-name provider of `nameKinship`. */
|
|
48
53
|
export declare const givenFamilyList: GivenFamilyList;
|
|
@@ -14,14 +14,14 @@ export { type CellVerdict, type NameRefusalRule, type Refusal, classifyCell, } f
|
|
|
14
14
|
export { NAME_PLACEHOLDERS, type NamePlaceholder, PLATFORM_PLACEHOLDERS, isNoNamePrint, isPlaceholderPrint, placeholderOf, } from "./name-placeholder.ts";
|
|
15
15
|
export { capitalise, nameCase, type SpellingLookup } from "./name-case.ts";
|
|
16
16
|
export { type DisplayLexicon, GIVEN_SEPARATOR, type PersonNameParts, SURNAME_SEPARATOR, formatPersonDisplay, lexiconKey, parsePersonName, personDisplayName, spellingLookup, titleCaseNamePart, } from "./person-display.ts";
|
|
17
|
-
export { type CommaReading, type NameOrder, type NameSplit, type ResolvedNameOrder, commaReading, inferNameOrder, resolveNameOrder, spaceAfterComma, splitPersonName, } from "./name-split.ts";
|
|
17
|
+
export { type CommaReading, NAME_SUFFIXES, type NameOrder, type NameSplit, type ResolvedNameOrder, commaReading, givenNameGroups, inferNameOrder, isNameSuffix, lexiconNameOrder, resolveNameOrder, spaceAfterComma, splitPersonName, tippedNameOrder, } from "./name-split.ts";
|
|
18
18
|
export { TEAM_DESIGNATION_WORDS, TEAM_WORD, type TeamSuffixPartition, canonicalTeamName, isCanonicalTeamName, isTeamPrint, partitionTeamSuffix, teamLetter, teamRowDesignation, } from "./team-name.ts";
|
|
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
22
|
export { type GivenFamilyList, type GivenFamilyListOptions, type GivenFamilyTier, createGivenFamilyList, givenFamilyList, } from "./given-families.ts";
|
|
23
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";
|
|
24
|
-
export { type NameReading, type NameRelation, type NameRelationReason, comparePosition, nameRelation, } from "./name-middle.ts";
|
|
24
|
+
export { type NameReading, type NameRelation, type NameRelationReason, comparePosition, middleFields, nameRelation, } from "./name-middle.ts";
|
|
25
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";
|
|
26
26
|
export * from "./name-compose.ts";
|
|
27
27
|
export { INFEASIBLE_CLASSES, type InfeasibleClass, compoundGiven, editDistance, infeasibleClass, middleForm, nearSpelling, } from "./name-infeasible.ts";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finbheara/names",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.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",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"typescript": "7.0.2"
|
|
89
89
|
},
|
|
90
90
|
"bin": {
|
|
91
|
+
"names": "./dist/cli/bin.js",
|
|
91
92
|
"names-census": "./dist/cli/census.js"
|
|
92
93
|
}
|
|
93
94
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isGiven2,
|
|
3
|
-
isAmbiguous2,
|
|
4
|
-
isPlace2,
|
|
5
|
-
isTradename2
|
|
6
|
-
} from "./index-0wpvbdgh.js";
|
|
7
|
-
|
|
8
|
-
// src/lexicon/place.ts
|
|
9
|
-
var JOINING_COMMA = /(?<=[^\s,]),(?=[^\s,])/g;
|
|
10
|
-
function splitWords(s) {
|
|
11
|
-
return s.replace(JOINING_COMMA, (comma, at) => /\d/.test(s[at - 1]) && /\d/.test(s[at + 1]) ? comma : ", ").split(/\s+/).filter(Boolean);
|
|
12
|
-
}
|
|
13
|
-
var FIELD_END = /[,-]+$/;
|
|
14
|
-
function isPlaceWordFlags(flags) {
|
|
15
|
-
return isPlace2(flags) && !isGiven2(flags) && !isAmbiguous2(flags) && !isTradename2(flags);
|
|
16
|
-
}
|
|
17
|
-
function isPlacePhrase(phrase, getFlags) {
|
|
18
|
-
const words = splitWords(phrase).map((w) => w.replace(FIELD_END, "")).filter((w) => w !== "");
|
|
19
|
-
if (words.length < 2)
|
|
20
|
-
return false;
|
|
21
|
-
return words.every((w) => isPlaceWordFlags(getFlags(w) ?? ""));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { splitWords, FIELD_END, isPlaceWordFlags, isPlacePhrase };
|
|
25
|
-
|
|
26
|
-
//# debugId=A9815F8EF12D8D4964756E2164756E21
|
|
27
|
-
//# sourceMappingURL=index-tqdbxd92.js.map
|
|
File without changes
|