@stll/anonymize-wasm 1.3.0 → 1.4.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/dist/constants.d.mts +2 -0
- package/dist/constants.mjs +85 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/constants2.d.mts +65 -0
- package/dist/triggers.en.mjs +32 -0
- package/dist/wasm.d.mts +1 -37
- package/dist/wasm.mjs +21 -65
- package/dist/wasm.mjs.map +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as OPERATOR_TYPES, i as DetectionSource, n as DETECTION_SOURCES, o as OperatorType, r as DETECTOR_PRIORITY, t as DEFAULT_ENTITY_LABELS } from "./constants2.mjs";
|
|
2
|
+
export { DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, DetectionSource, OPERATOR_TYPES, OperatorType };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
//#region src/constants.ts
|
|
2
|
+
/**
|
|
3
|
+
* Runtime-free constants for the anonymization pipeline.
|
|
4
|
+
*
|
|
5
|
+
* This module is the SSR-safe / browser-safe entrypoint:
|
|
6
|
+
* importing it must not pull in `@stll/text-search`,
|
|
7
|
+
* `@stll/anonymize-wasm`, or any other runtime-bearing
|
|
8
|
+
* module. Consumers that only need the static label list,
|
|
9
|
+
* detection-source identifiers, or operator names import
|
|
10
|
+
* from `@stll/anonymize/constants` (or
|
|
11
|
+
* `@stll/anonymize-wasm/constants`) without paying the
|
|
12
|
+
* wasm / regex-set startup cost.
|
|
13
|
+
*
|
|
14
|
+
* `types.ts` re-exports these for back-compat, so existing
|
|
15
|
+
* `import { DEFAULT_ENTITY_LABELS } from "@stll/anonymize"`
|
|
16
|
+
* call sites keep working.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Source of a detected entity span.
|
|
20
|
+
* Ordered by detection layer in the pipeline.
|
|
21
|
+
*/
|
|
22
|
+
const DETECTION_SOURCES = {
|
|
23
|
+
TRIGGER: "trigger",
|
|
24
|
+
REGEX: "regex",
|
|
25
|
+
DENY_LIST: "deny-list",
|
|
26
|
+
LEGAL_FORM: "legal-form",
|
|
27
|
+
GAZETTEER: "gazetteer",
|
|
28
|
+
NER: "ner",
|
|
29
|
+
COREFERENCE: "coreference"
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Priority levels for detection sources.
|
|
33
|
+
* Higher = more structurally reliable. Used during
|
|
34
|
+
* overlap resolution so deterministic detectors beat
|
|
35
|
+
* probabilistic ones regardless of raw score.
|
|
36
|
+
*/
|
|
37
|
+
const DETECTOR_PRIORITY = {
|
|
38
|
+
[DETECTION_SOURCES.GAZETTEER]: 5,
|
|
39
|
+
[DETECTION_SOURCES.TRIGGER]: 4,
|
|
40
|
+
[DETECTION_SOURCES.LEGAL_FORM]: 3,
|
|
41
|
+
[DETECTION_SOURCES.REGEX]: 3,
|
|
42
|
+
[DETECTION_SOURCES.DENY_LIST]: 2,
|
|
43
|
+
[DETECTION_SOURCES.COREFERENCE]: 2,
|
|
44
|
+
[DETECTION_SOURCES.NER]: 1
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Anonymization operator types. Each operator defines
|
|
48
|
+
* how a confirmed entity is replaced in the output.
|
|
49
|
+
*/
|
|
50
|
+
const OPERATOR_TYPES = ["replace", "redact"];
|
|
51
|
+
/**
|
|
52
|
+
* Canonical entity labels used across the pipeline.
|
|
53
|
+
* NER models may use different native labels; the bench
|
|
54
|
+
* NER wrapper maps model output to these canonical names.
|
|
55
|
+
*
|
|
56
|
+
* These labels are ephemeral: entities are regenerated on
|
|
57
|
+
* every pipeline run and never persisted to the database.
|
|
58
|
+
* Renaming a label here requires no migration.
|
|
59
|
+
*/
|
|
60
|
+
const DEFAULT_ENTITY_LABELS = [
|
|
61
|
+
"person",
|
|
62
|
+
"organization",
|
|
63
|
+
"phone number",
|
|
64
|
+
"address",
|
|
65
|
+
"email address",
|
|
66
|
+
"date",
|
|
67
|
+
"date of birth",
|
|
68
|
+
"bank account number",
|
|
69
|
+
"iban",
|
|
70
|
+
"tax identification number",
|
|
71
|
+
"identity card number",
|
|
72
|
+
"birth number",
|
|
73
|
+
"national identification number",
|
|
74
|
+
"social security number",
|
|
75
|
+
"registration number",
|
|
76
|
+
"credit card number",
|
|
77
|
+
"passport number",
|
|
78
|
+
"monetary amount",
|
|
79
|
+
"land parcel",
|
|
80
|
+
"misc"
|
|
81
|
+
];
|
|
82
|
+
//#endregion
|
|
83
|
+
export { DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, OPERATOR_TYPES };
|
|
84
|
+
|
|
85
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../../src/constants.ts"],"sourcesContent":["/**\n * Runtime-free constants for the anonymization pipeline.\n *\n * This module is the SSR-safe / browser-safe entrypoint:\n * importing it must not pull in `@stll/text-search`,\n * `@stll/anonymize-wasm`, or any other runtime-bearing\n * module. Consumers that only need the static label list,\n * detection-source identifiers, or operator names import\n * from `@stll/anonymize/constants` (or\n * `@stll/anonymize-wasm/constants`) without paying the\n * wasm / regex-set startup cost.\n *\n * `types.ts` re-exports these for back-compat, so existing\n * `import { DEFAULT_ENTITY_LABELS } from \"@stll/anonymize\"`\n * call sites keep working.\n */\n\n/**\n * Source of a detected entity span.\n * Ordered by detection layer in the pipeline.\n */\nexport const DETECTION_SOURCES = {\n TRIGGER: \"trigger\",\n REGEX: \"regex\",\n DENY_LIST: \"deny-list\",\n LEGAL_FORM: \"legal-form\",\n GAZETTEER: \"gazetteer\",\n NER: \"ner\",\n COREFERENCE: \"coreference\",\n} as const;\n\nexport type DetectionSource =\n (typeof DETECTION_SOURCES)[keyof typeof DETECTION_SOURCES];\n\n/**\n * Priority levels for detection sources.\n * Higher = more structurally reliable. Used during\n * overlap resolution so deterministic detectors beat\n * probabilistic ones regardless of raw score.\n */\nexport const DETECTOR_PRIORITY = {\n [DETECTION_SOURCES.GAZETTEER]: 5,\n [DETECTION_SOURCES.TRIGGER]: 4,\n [DETECTION_SOURCES.LEGAL_FORM]: 3,\n [DETECTION_SOURCES.REGEX]: 3,\n [DETECTION_SOURCES.DENY_LIST]: 2,\n [DETECTION_SOURCES.COREFERENCE]: 2,\n [DETECTION_SOURCES.NER]: 1,\n} as const satisfies Record<DetectionSource, number>;\n\n/**\n * Anonymization operator types. Each operator defines\n * how a confirmed entity is replaced in the output.\n */\nexport const OPERATOR_TYPES = [\"replace\", \"redact\"] as const;\n\nexport type OperatorType = (typeof OPERATOR_TYPES)[number];\n\n/**\n * Canonical entity labels used across the pipeline.\n * NER models may use different native labels; the bench\n * NER wrapper maps model output to these canonical names.\n *\n * These labels are ephemeral: entities are regenerated on\n * every pipeline run and never persisted to the database.\n * Renaming a label here requires no migration.\n */\nexport const DEFAULT_ENTITY_LABELS = [\n \"person\",\n \"organization\",\n \"phone number\",\n \"address\",\n \"email address\",\n \"date\",\n \"date of birth\",\n \"bank account number\",\n \"iban\",\n \"tax identification number\",\n \"identity card number\",\n \"birth number\",\n \"national identification number\",\n \"social security number\",\n \"registration number\",\n \"credit card number\",\n \"passport number\",\n \"monetary amount\",\n \"land parcel\",\n \"misc\",\n] as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,oBAAoB;CAC/B,SAAS;CACT,OAAO;CACP,WAAW;CACX,YAAY;CACZ,WAAW;CACX,KAAK;CACL,aAAa;CACd;;;;;;;AAWD,MAAa,oBAAoB;EAC9B,kBAAkB,YAAY;EAC9B,kBAAkB,UAAU;EAC5B,kBAAkB,aAAa;EAC/B,kBAAkB,QAAQ;EAC1B,kBAAkB,YAAY;EAC9B,kBAAkB,cAAc;EAChC,kBAAkB,MAAM;CAC1B;;;;;AAMD,MAAa,iBAAiB,CAAC,WAAW,SAAS;;;;;;;;;;AAanD,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/constants.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Runtime-free constants for the anonymization pipeline.
|
|
4
|
+
*
|
|
5
|
+
* This module is the SSR-safe / browser-safe entrypoint:
|
|
6
|
+
* importing it must not pull in `@stll/text-search`,
|
|
7
|
+
* `@stll/anonymize-wasm`, or any other runtime-bearing
|
|
8
|
+
* module. Consumers that only need the static label list,
|
|
9
|
+
* detection-source identifiers, or operator names import
|
|
10
|
+
* from `@stll/anonymize/constants` (or
|
|
11
|
+
* `@stll/anonymize-wasm/constants`) without paying the
|
|
12
|
+
* wasm / regex-set startup cost.
|
|
13
|
+
*
|
|
14
|
+
* `types.ts` re-exports these for back-compat, so existing
|
|
15
|
+
* `import { DEFAULT_ENTITY_LABELS } from "@stll/anonymize"`
|
|
16
|
+
* call sites keep working.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Source of a detected entity span.
|
|
20
|
+
* Ordered by detection layer in the pipeline.
|
|
21
|
+
*/
|
|
22
|
+
declare const DETECTION_SOURCES: {
|
|
23
|
+
readonly TRIGGER: "trigger";
|
|
24
|
+
readonly REGEX: "regex";
|
|
25
|
+
readonly DENY_LIST: "deny-list";
|
|
26
|
+
readonly LEGAL_FORM: "legal-form";
|
|
27
|
+
readonly GAZETTEER: "gazetteer";
|
|
28
|
+
readonly NER: "ner";
|
|
29
|
+
readonly COREFERENCE: "coreference";
|
|
30
|
+
};
|
|
31
|
+
type DetectionSource = (typeof DETECTION_SOURCES)[keyof typeof DETECTION_SOURCES];
|
|
32
|
+
/**
|
|
33
|
+
* Priority levels for detection sources.
|
|
34
|
+
* Higher = more structurally reliable. Used during
|
|
35
|
+
* overlap resolution so deterministic detectors beat
|
|
36
|
+
* probabilistic ones regardless of raw score.
|
|
37
|
+
*/
|
|
38
|
+
declare const DETECTOR_PRIORITY: {
|
|
39
|
+
readonly gazetteer: 5;
|
|
40
|
+
readonly trigger: 4;
|
|
41
|
+
readonly "legal-form": 3;
|
|
42
|
+
readonly regex: 3;
|
|
43
|
+
readonly "deny-list": 2;
|
|
44
|
+
readonly coreference: 2;
|
|
45
|
+
readonly ner: 1;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Anonymization operator types. Each operator defines
|
|
49
|
+
* how a confirmed entity is replaced in the output.
|
|
50
|
+
*/
|
|
51
|
+
declare const OPERATOR_TYPES: readonly ["replace", "redact"];
|
|
52
|
+
type OperatorType = (typeof OPERATOR_TYPES)[number];
|
|
53
|
+
/**
|
|
54
|
+
* Canonical entity labels used across the pipeline.
|
|
55
|
+
* NER models may use different native labels; the bench
|
|
56
|
+
* NER wrapper maps model output to these canonical names.
|
|
57
|
+
*
|
|
58
|
+
* These labels are ephemeral: entities are regenerated on
|
|
59
|
+
* every pipeline run and never persisted to the database.
|
|
60
|
+
* Renaming a label here requires no migration.
|
|
61
|
+
*/
|
|
62
|
+
declare const DEFAULT_ENTITY_LABELS: readonly ["person", "organization", "phone number", "address", "email address", "date", "date of birth", "bank account number", "iban", "tax identification number", "identity card number", "birth number", "national identification number", "social security number", "registration number", "credit card number", "passport number", "monetary amount", "land parcel", "misc"];
|
|
63
|
+
//#endregion
|
|
64
|
+
export { OPERATOR_TYPES as a, DetectionSource as i, DETECTION_SOURCES as n, OperatorType as o, DETECTOR_PRIORITY as r, DEFAULT_ENTITY_LABELS as t };
|
|
65
|
+
//# sourceMappingURL=constants2.d.mts.map
|
package/dist/triggers.en.mjs
CHANGED
|
@@ -64,6 +64,38 @@ var triggers_en_default = [
|
|
|
64
64
|
"tax identification number",
|
|
65
65
|
"tax id"
|
|
66
66
|
]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "en-uk-companies-house",
|
|
70
|
+
"label": "registration number",
|
|
71
|
+
"strategy": { "type": "company-id-value" },
|
|
72
|
+
"triggers": [
|
|
73
|
+
"Companies House",
|
|
74
|
+
"Company No.",
|
|
75
|
+
"Company No",
|
|
76
|
+
"CRN"
|
|
77
|
+
],
|
|
78
|
+
"extensions": ["add-colon", "add-colon-space"],
|
|
79
|
+
"validations": [{
|
|
80
|
+
"type": "matches-pattern",
|
|
81
|
+
"pattern": "^(?:SC|NI|OC|SO|R|FC|GE|GS|IC|IP|LP|NC|NF|NL|NO|NP|NR|NZ|RC|SA|SF|SI|SL|SP|SR|SZ)?\\d{6,8}$"
|
|
82
|
+
}]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"id": "en-uk-utr",
|
|
86
|
+
"label": "tax identification number",
|
|
87
|
+
"strategy": { "type": "company-id-value" },
|
|
88
|
+
"triggers": [
|
|
89
|
+
"UTR",
|
|
90
|
+
"Unique Tax Reference",
|
|
91
|
+
"Unique Taxpayer Reference",
|
|
92
|
+
"Self Assessment UTR"
|
|
93
|
+
],
|
|
94
|
+
"extensions": ["add-colon", "add-colon-space"],
|
|
95
|
+
"validations": [{
|
|
96
|
+
"type": "matches-pattern",
|
|
97
|
+
"pattern": "^\\d{10}$"
|
|
98
|
+
}]
|
|
67
99
|
}
|
|
68
100
|
];
|
|
69
101
|
//#endregion
|
package/dist/wasm.d.mts
CHANGED
|
@@ -1,29 +1,9 @@
|
|
|
1
|
+
import { a as OPERATOR_TYPES, i as DetectionSource, n as DETECTION_SOURCES, o as OperatorType, r as DETECTOR_PRIORITY, t as DEFAULT_ENTITY_LABELS } from "./constants2.mjs";
|
|
1
2
|
import { Validator } from "@stll/stdnum";
|
|
2
3
|
import { Match, PatternEntry, TextSearch } from "@stll/text-search";
|
|
3
4
|
import { Tokenizer } from "@huggingface/tokenizers";
|
|
4
5
|
|
|
5
6
|
//#region src/types.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Source of a detected entity span.
|
|
8
|
-
* Ordered by detection layer in the pipeline.
|
|
9
|
-
*/
|
|
10
|
-
declare const DETECTION_SOURCES: {
|
|
11
|
-
readonly TRIGGER: "trigger";
|
|
12
|
-
readonly REGEX: "regex";
|
|
13
|
-
readonly DENY_LIST: "deny-list";
|
|
14
|
-
readonly LEGAL_FORM: "legal-form";
|
|
15
|
-
readonly GAZETTEER: "gazetteer";
|
|
16
|
-
readonly NER: "ner";
|
|
17
|
-
readonly COREFERENCE: "coreference";
|
|
18
|
-
};
|
|
19
|
-
type DetectionSource = (typeof DETECTION_SOURCES)[keyof typeof DETECTION_SOURCES];
|
|
20
|
-
/**
|
|
21
|
-
* Priority levels for detection sources.
|
|
22
|
-
* Higher = more structurally reliable. Used during
|
|
23
|
-
* overlap resolution so deterministic detectors beat
|
|
24
|
-
* probabilistic ones regardless of raw score.
|
|
25
|
-
*/
|
|
26
|
-
declare const DETECTOR_PRIORITY: Record<DetectionSource, number>;
|
|
27
7
|
/**
|
|
28
8
|
* A detected PII entity span in the source text.
|
|
29
9
|
* Every detection layer produces these.
|
|
@@ -176,12 +156,6 @@ type TriggerRule = {
|
|
|
176
156
|
validations: CompiledValidation[];
|
|
177
157
|
includeTrigger: boolean;
|
|
178
158
|
};
|
|
179
|
-
/**
|
|
180
|
-
* Anonymisation operator types. Each operator defines
|
|
181
|
-
* how a confirmed entity is replaced in the output.
|
|
182
|
-
*/
|
|
183
|
-
declare const OPERATOR_TYPES: readonly ["replace", "redact"];
|
|
184
|
-
type OperatorType = (typeof OPERATOR_TYPES)[number];
|
|
185
159
|
/** Per-label operator selection. Key is the entity label. */
|
|
186
160
|
type OperatorConfig = {
|
|
187
161
|
/** Operator per label. Missing labels default to "replace". */operators: Record<string, OperatorType>; /** Custom replacement string for the redact operator. */
|
|
@@ -341,16 +315,6 @@ type PipelineConfig = {
|
|
|
341
315
|
*/
|
|
342
316
|
dictionaries?: Dictionaries;
|
|
343
317
|
};
|
|
344
|
-
/**
|
|
345
|
-
* Canonical entity labels used across the pipeline.
|
|
346
|
-
* NER models may use different native labels; the bench
|
|
347
|
-
* NER wrapper maps model output to these canonical names.
|
|
348
|
-
*
|
|
349
|
-
* These labels are ephemeral: entities are regenerated on
|
|
350
|
-
* every pipeline run and never persisted to the database.
|
|
351
|
-
* Renaming a label here requires no migration.
|
|
352
|
-
*/
|
|
353
|
-
declare const DEFAULT_ENTITY_LABELS: readonly ["person", "organization", "phone number", "address", "email address", "date", "date of birth", "bank account number", "iban", "tax identification number", "identity card number", "birth number", "national identification number", "social security number", "registration number", "credit card number", "passport number", "monetary amount", "land parcel", "misc"];
|
|
354
318
|
//#endregion
|
|
355
319
|
//#region src/detectors/regex.d.ts
|
|
356
320
|
type RegexMeta = {
|
package/dist/wasm.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, OPERATOR_TYPES } from "./constants.mjs";
|
|
1
2
|
import { TextSearch } from "@stll/text-search-wasm";
|
|
2
3
|
import { at, be, bg, br, cy, cz, de, dk, ee, es, fi, fr, gb, gr, hr, hu, ie, it, lt, lu, lv, mt, nl, pl, pt, ro, se, si, sk } from "@stll/stdnum";
|
|
3
4
|
import { toRegex } from "@stll/stdnum/patterns";
|
|
@@ -12,70 +13,6 @@ const getTextSearch = () => {
|
|
|
12
13
|
};
|
|
13
14
|
//#endregion
|
|
14
15
|
//#region src/types.ts
|
|
15
|
-
/**
|
|
16
|
-
* Source of a detected entity span.
|
|
17
|
-
* Ordered by detection layer in the pipeline.
|
|
18
|
-
*/
|
|
19
|
-
const DETECTION_SOURCES = {
|
|
20
|
-
TRIGGER: "trigger",
|
|
21
|
-
REGEX: "regex",
|
|
22
|
-
DENY_LIST: "deny-list",
|
|
23
|
-
LEGAL_FORM: "legal-form",
|
|
24
|
-
GAZETTEER: "gazetteer",
|
|
25
|
-
NER: "ner",
|
|
26
|
-
COREFERENCE: "coreference"
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Priority levels for detection sources.
|
|
30
|
-
* Higher = more structurally reliable. Used during
|
|
31
|
-
* overlap resolution so deterministic detectors beat
|
|
32
|
-
* probabilistic ones regardless of raw score.
|
|
33
|
-
*/
|
|
34
|
-
const DETECTOR_PRIORITY = {
|
|
35
|
-
gazetteer: 5,
|
|
36
|
-
trigger: 4,
|
|
37
|
-
"legal-form": 3,
|
|
38
|
-
regex: 3,
|
|
39
|
-
"deny-list": 2,
|
|
40
|
-
coreference: 2,
|
|
41
|
-
ner: 1
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Anonymisation operator types. Each operator defines
|
|
45
|
-
* how a confirmed entity is replaced in the output.
|
|
46
|
-
*/
|
|
47
|
-
const OPERATOR_TYPES = ["replace", "redact"];
|
|
48
|
-
/**
|
|
49
|
-
* Canonical entity labels used across the pipeline.
|
|
50
|
-
* NER models may use different native labels; the bench
|
|
51
|
-
* NER wrapper maps model output to these canonical names.
|
|
52
|
-
*
|
|
53
|
-
* These labels are ephemeral: entities are regenerated on
|
|
54
|
-
* every pipeline run and never persisted to the database.
|
|
55
|
-
* Renaming a label here requires no migration.
|
|
56
|
-
*/
|
|
57
|
-
const DEFAULT_ENTITY_LABELS = [
|
|
58
|
-
"person",
|
|
59
|
-
"organization",
|
|
60
|
-
"phone number",
|
|
61
|
-
"address",
|
|
62
|
-
"email address",
|
|
63
|
-
"date",
|
|
64
|
-
"date of birth",
|
|
65
|
-
"bank account number",
|
|
66
|
-
"iban",
|
|
67
|
-
"tax identification number",
|
|
68
|
-
"identity card number",
|
|
69
|
-
"birth number",
|
|
70
|
-
"national identification number",
|
|
71
|
-
"social security number",
|
|
72
|
-
"registration number",
|
|
73
|
-
"credit card number",
|
|
74
|
-
"passport number",
|
|
75
|
-
"monetary amount",
|
|
76
|
-
"land parcel",
|
|
77
|
-
"misc"
|
|
78
|
-
];
|
|
79
16
|
const isLegalFormsEnabled = (config) => config.enableLegalForms !== false;
|
|
80
17
|
//#endregion
|
|
81
18
|
//#region src/context.ts
|
|
@@ -2174,7 +2111,9 @@ const POST_NOMINALS = [
|
|
|
2174
2111
|
"CIPM",
|
|
2175
2112
|
"CIPT",
|
|
2176
2113
|
"CIPP/E",
|
|
2177
|
-
"CIPP"
|
|
2114
|
+
"CIPP",
|
|
2115
|
+
"KC",
|
|
2116
|
+
"QC"
|
|
2178
2117
|
];
|
|
2179
2118
|
//#endregion
|
|
2180
2119
|
//#region src/detectors/regex.ts
|
|
@@ -2277,6 +2216,11 @@ const HONORIFIC_PERSON = {
|
|
|
2277
2216
|
label: "person",
|
|
2278
2217
|
score: .95
|
|
2279
2218
|
};
|
|
2219
|
+
const POSTNOMINAL_PERSON = {
|
|
2220
|
+
pattern: `${NAME_WORD}(?:(?:${SP}|-){1,2}(?:${PARTICLE}${SP}+)?${NAME_WORD}){1,3},?${SP}+(?:KC|QC)\\b`,
|
|
2221
|
+
label: "person",
|
|
2222
|
+
score: .95
|
|
2223
|
+
};
|
|
2280
2224
|
const IBAN = {
|
|
2281
2225
|
pattern: "\\b[A-Z]{2}\\d{2}\\s?[\\dA-Z]{4}\\s?[\\dA-Z]{4}\\s?[\\dA-Z]{4}\\s?[\\dA-Z]{4}\\s?[\\dA-Z]{0,14}\\b",
|
|
2282
2226
|
label: "iban",
|
|
@@ -2421,6 +2365,7 @@ const PATH_SUFFIX = `(?:[/?#][^\\s)\\]>]*[^\\s.,;:!?)\\]>])?`;
|
|
|
2421
2365
|
const ALL_REGEX_DEFS = [
|
|
2422
2366
|
TITLED_PERSON,
|
|
2423
2367
|
HONORIFIC_PERSON,
|
|
2368
|
+
POSTNOMINAL_PERSON,
|
|
2424
2369
|
IBAN,
|
|
2425
2370
|
EMAIL,
|
|
2426
2371
|
INTL_PHONE,
|
|
@@ -2458,6 +2403,17 @@ const ALL_REGEX_DEFS = [
|
|
|
2458
2403
|
label: "url",
|
|
2459
2404
|
score: .9
|
|
2460
2405
|
},
|
|
2406
|
+
{
|
|
2407
|
+
pattern: "\\b(?:GIR[^\\S\\n]?0AA|[A-PR-UWYZ](?:[A-HK-Y][0-9](?:[0-9]|[ABEHMNPRV-Y])?|[0-9](?:[0-9]|[A-HJKPS-UW])?)[^\\S\\n]?[0-9][ABD-HJLNP-UW-Z]{2})\\b",
|
|
2408
|
+
label: "address",
|
|
2409
|
+
score: .9
|
|
2410
|
+
},
|
|
2411
|
+
{
|
|
2412
|
+
pattern: "\\b[A-CEGHJ-PR-TWXYZ][A-CEGHJ-NPR-TWXYZ][^\\S\\n]?\\d{2}[^\\S\\n]?\\d{2}[^\\S\\n]?\\d{2}[^\\S\\n]?[A-D]?\\b",
|
|
2413
|
+
label: "social security number",
|
|
2414
|
+
score: .95,
|
|
2415
|
+
validator: gb.nino
|
|
2416
|
+
},
|
|
2461
2417
|
{
|
|
2462
2418
|
pattern: "\\b(?:1[0-2]|0?[1-9]):[0-5]\\d[^\\S\\n]?(?:[aApP]\\.?[mM]\\.?)(?=[\\s,;!?)]|$)",
|
|
2463
2419
|
label: "date",
|