@stll/anonymize-wasm 1.4.11 → 2.0.0-alpha.1
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/LICENSE +1 -2
- package/dist/address-boundaries.mjs +2 -0
- package/dist/address-jurisdiction-prefixes.mjs +16 -0
- package/dist/address-jurisdiction-prefixes.mjs.map +1 -0
- package/dist/address-stop-keywords.mjs +12 -1
- package/dist/address-stopwords.mjs +2 -0
- package/dist/address-unit-abbreviations.mjs +15 -0
- package/dist/address-unit-abbreviations.mjs.map +1 -0
- package/dist/allow-list.mjs +1 -0
- package/dist/clause-noun-heads.mjs +5 -1
- package/dist/constants.mjs +1 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/constants2.d.mts +1 -1
- package/dist/coreference-org-determiners.mjs +19 -0
- package/dist/coreference-org-determiners.mjs.map +1 -0
- package/dist/defined-term-heads.mjs +15 -0
- package/dist/defined-term-heads.mjs.map +1 -0
- package/dist/false-positive-shapes.mjs +36 -0
- package/dist/false-positive-shapes.mjs.map +1 -0
- package/dist/legal-role-heads.cs.mjs +6 -0
- package/dist/organization-unit-heads.mjs +20 -0
- package/dist/organization-unit-heads.mjs.map +1 -0
- package/dist/person-stopwords.mjs +205 -199
- package/dist/signing-clauses.mjs +33 -9
- package/dist/wasm.d.mts +705 -45
- package/dist/wasm.mjs +4225 -1442
- package/dist/wasm.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/address-prepositions.mjs +0 -182
- package/dist/address-prepositions.mjs.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2026
|
|
3
|
+
Copyright (c) 2026 stella
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any
|
|
6
6
|
person obtaining a copy of this software and associated
|
|
@@ -25,4 +25,3 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
25
25
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
26
26
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
27
27
|
DEALINGS IN THE SOFTWARE.
|
|
28
|
-
|
|
@@ -6,6 +6,7 @@ var address_boundaries_default = {
|
|
|
6
6
|
"jednajícím",
|
|
7
7
|
"jejímž jménem",
|
|
8
8
|
"kontaktní osoba",
|
|
9
|
+
"pokud",
|
|
9
10
|
"zapsán",
|
|
10
11
|
"zapsaná",
|
|
11
12
|
"zapsané",
|
|
@@ -36,6 +37,7 @@ var address_boundaries_default = {
|
|
|
36
37
|
"shall govern",
|
|
37
38
|
"shall be governed",
|
|
38
39
|
"to be enforced",
|
|
40
|
+
"with a copy",
|
|
39
41
|
"with the intention",
|
|
40
42
|
"without reference",
|
|
41
43
|
"without regard"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/data/address-jurisdiction-prefixes.json
|
|
2
|
+
var _comment = "Address-like jurisdiction prefixes that are valid location/address spans without digits or street-type words. Lowercased and organized per language.";
|
|
3
|
+
var en = [
|
|
4
|
+
"commonwealth of",
|
|
5
|
+
"district of",
|
|
6
|
+
"state of",
|
|
7
|
+
"territory of"
|
|
8
|
+
];
|
|
9
|
+
var address_jurisdiction_prefixes_default = {
|
|
10
|
+
_comment,
|
|
11
|
+
en
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { _comment, address_jurisdiction_prefixes_default as default, en };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=address-jurisdiction-prefixes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-jurisdiction-prefixes.mjs","names":[],"sources":["../../src/data/address-jurisdiction-prefixes.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -17,6 +17,16 @@ var cs = [
|
|
|
17
17
|
"ičo",
|
|
18
18
|
"ič"
|
|
19
19
|
];
|
|
20
|
+
var de = [
|
|
21
|
+
"bank",
|
|
22
|
+
"bic",
|
|
23
|
+
"iban",
|
|
24
|
+
"steuer-id",
|
|
25
|
+
"steueridentifikationsnummer",
|
|
26
|
+
"steuernummer",
|
|
27
|
+
"ust-idnr",
|
|
28
|
+
"ust-idnr."
|
|
29
|
+
];
|
|
20
30
|
var en = [
|
|
21
31
|
"e-mail",
|
|
22
32
|
"email",
|
|
@@ -123,6 +133,7 @@ var it = [
|
|
|
123
133
|
var address_stop_keywords_default = {
|
|
124
134
|
_comment,
|
|
125
135
|
cs,
|
|
136
|
+
de,
|
|
126
137
|
en,
|
|
127
138
|
pl,
|
|
128
139
|
fr,
|
|
@@ -132,6 +143,6 @@ var address_stop_keywords_default = {
|
|
|
132
143
|
it
|
|
133
144
|
};
|
|
134
145
|
//#endregion
|
|
135
|
-
export { _comment, cs, address_stop_keywords_default as default, en, es, fr, it, pl, pt_br as "pt-br", sk };
|
|
146
|
+
export { _comment, cs, de, address_stop_keywords_default as default, en, es, fr, it, pl, pt_br as "pt-br", sk };
|
|
136
147
|
|
|
137
148
|
//# sourceMappingURL=address-stop-keywords.mjs.map
|
|
@@ -6,6 +6,7 @@ var address_stopwords_default = {
|
|
|
6
6
|
"agenda",
|
|
7
7
|
"agent",
|
|
8
8
|
"amount",
|
|
9
|
+
"basic",
|
|
9
10
|
"brent",
|
|
10
11
|
"central",
|
|
11
12
|
"centro",
|
|
@@ -32,6 +33,7 @@ var address_stopwords_default = {
|
|
|
32
33
|
"price",
|
|
33
34
|
"principal",
|
|
34
35
|
"rate",
|
|
36
|
+
"rent",
|
|
35
37
|
"registro",
|
|
36
38
|
"schedule",
|
|
37
39
|
"se",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/data/address-unit-abbreviations.json
|
|
2
|
+
var address_unit_abbreviations_default = {
|
|
3
|
+
_comment: "Dotted address unit abbreviations that should not terminate address seed expansion. Organised per language because abbreviations are locale-specific.",
|
|
4
|
+
en: [
|
|
5
|
+
"apt.",
|
|
6
|
+
"bldg.",
|
|
7
|
+
"fl.",
|
|
8
|
+
"ste.",
|
|
9
|
+
"unit."
|
|
10
|
+
]
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { address_unit_abbreviations_default as default };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=address-unit-abbreviations.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-unit-abbreviations.mjs","names":[],"sources":["../../src/data/address-unit-abbreviations.json"],"sourcesContent":[""],"mappings":""}
|
package/dist/allow-list.mjs
CHANGED
package/dist/constants.mjs
CHANGED
package/dist/constants.mjs.map
CHANGED
|
@@ -1 +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 COUNTRY: \"country\",\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.COUNTRY]: 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 \"country\",\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,SAAS;CACT,KAAK;CACL,aAAa;AACf;;;;;;;AAWA,MAAa,oBAAoB;EAC9B,kBAAkB,YAAY;EAC9B,kBAAkB,UAAU;EAC5B,kBAAkB,aAAa;EAC/B,kBAAkB,QAAQ;EAC1B,kBAAkB,UAAU;EAC5B,kBAAkB,YAAY;EAC9B,kBAAkB,cAAc;EAChC,kBAAkB,MAAM;AAC3B;;;;;AAMA,MAAa,iBAAiB,CAAC,WAAW,QAAQ;;;;;;;;;;AAalD,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
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 COUNTRY: \"country\",\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.COUNTRY]: 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 \"country\",\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 \"crypto\",\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,SAAS;CACT,KAAK;CACL,aAAa;AACf;;;;;;;AAWA,MAAa,oBAAoB;EAC9B,kBAAkB,YAAY;EAC9B,kBAAkB,UAAU;EAC5B,kBAAkB,aAAa;EAC/B,kBAAkB,QAAQ;EAC1B,kBAAkB,UAAU;EAC5B,kBAAkB,YAAY;EAC9B,kBAAkB,cAAc;EAChC,kBAAkB,MAAM;AAC3B;;;;;AAMA,MAAa,iBAAiB,CAAC,WAAW,QAAQ;;;;;;;;;;AAalD,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
package/dist/constants2.d.mts
CHANGED
|
@@ -61,7 +61,7 @@ type OperatorType = (typeof OPERATOR_TYPES)[number];
|
|
|
61
61
|
* every pipeline run and never persisted to the database.
|
|
62
62
|
* Renaming a label here requires no migration.
|
|
63
63
|
*/
|
|
64
|
-
declare const DEFAULT_ENTITY_LABELS: readonly ["person", "organization", "phone number", "address", "country", "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"];
|
|
64
|
+
declare const DEFAULT_ENTITY_LABELS: readonly ["person", "organization", "phone number", "address", "country", "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", "crypto", "monetary amount", "land parcel", "misc"];
|
|
65
65
|
//#endregion
|
|
66
66
|
export { OPERATOR_TYPES as a, DetectionSource as i, DETECTION_SOURCES as n, OperatorType as o, DETECTOR_PRIORITY as r, DEFAULT_ENTITY_LABELS as t };
|
|
67
67
|
//# sourceMappingURL=constants2.d.mts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/data/coreference-org-determiners.json
|
|
2
|
+
var _comment = "Organization reference determiners used before propagated bare organization names. Values are regex fragments grouped by language.";
|
|
3
|
+
var cs = ["společnost(?:i|í|em|u)?", "spolecnost(?:i|em|u)?"];
|
|
4
|
+
var de = ["die\\s+(?:gesellschaft|firma)"];
|
|
5
|
+
var en = ["the\\s+(?:company|corporation|firm)"];
|
|
6
|
+
var es = ["la\\s+(?:empresa|sociedad)", "el\\s+(?:empresa|sociedad)"];
|
|
7
|
+
var fr = ["la\\s+société"];
|
|
8
|
+
var coreference_org_determiners_default = {
|
|
9
|
+
_comment,
|
|
10
|
+
cs,
|
|
11
|
+
de,
|
|
12
|
+
en,
|
|
13
|
+
es,
|
|
14
|
+
fr
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { _comment, cs, de, coreference_org_determiners_default as default, en, es, fr };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=coreference-org-determiners.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coreference-org-determiners.mjs","names":[],"sources":["../../src/data/coreference-org-determiners.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/data/defined-term-heads.json
|
|
2
|
+
var _comment = "Common head nouns for capitalized defined/legal concepts. These are not person names by themselves; detector-specific filters assemble this vocabulary where needed. Lowercased and organized per language.";
|
|
3
|
+
var en = [
|
|
4
|
+
"association",
|
|
5
|
+
"period",
|
|
6
|
+
"reform"
|
|
7
|
+
];
|
|
8
|
+
var defined_term_heads_default = {
|
|
9
|
+
_comment,
|
|
10
|
+
en
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { _comment, defined_term_heads_default as default, en };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=defined-term-heads.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defined-term-heads.mjs","names":[],"sources":["../../src/data/defined-term-heads.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/data/false-positive-shapes.json
|
|
2
|
+
var _comment = "Language-keyed lexical markers used by false-positive shape guards.";
|
|
3
|
+
var addressComponentTerms = { "cs": [
|
|
4
|
+
"č.p.",
|
|
5
|
+
"č.ev.",
|
|
6
|
+
"č.",
|
|
7
|
+
"sídliště"
|
|
8
|
+
] };
|
|
9
|
+
var ambiguousStreetTypeTerms = { "fr": ["cours"] };
|
|
10
|
+
var numberAbbrevPrefixes = {
|
|
11
|
+
"cs": ["čís.", "č."],
|
|
12
|
+
"de": ["nr."],
|
|
13
|
+
"en": ["no.", "n."]
|
|
14
|
+
};
|
|
15
|
+
var documentHeadingOrdinalMarkers = {
|
|
16
|
+
"cs": ["č.", "č"],
|
|
17
|
+
"de": ["nr.", "nr"],
|
|
18
|
+
"en": [
|
|
19
|
+
"no.",
|
|
20
|
+
"no",
|
|
21
|
+
"n.",
|
|
22
|
+
"n"
|
|
23
|
+
],
|
|
24
|
+
"global": ["#"]
|
|
25
|
+
};
|
|
26
|
+
var false_positive_shapes_default = {
|
|
27
|
+
_comment,
|
|
28
|
+
addressComponentTerms,
|
|
29
|
+
ambiguousStreetTypeTerms,
|
|
30
|
+
numberAbbrevPrefixes,
|
|
31
|
+
documentHeadingOrdinalMarkers
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { _comment, addressComponentTerms, ambiguousStreetTypeTerms, false_positive_shapes_default as default, documentHeadingOrdinalMarkers, numberAbbrevPrefixes };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=false-positive-shapes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"false-positive-shapes.mjs","names":[],"sources":["../../src/data/false-positive-shapes.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/data/organization-unit-heads.json
|
|
2
|
+
var _comment = "Administrative or organizational unit nouns that can appear in legal prose without denoting a person or a street/city suffix. Lowercased and organized per language.";
|
|
3
|
+
var cs = [
|
|
4
|
+
"agentura",
|
|
5
|
+
"inspekce",
|
|
6
|
+
"kancelář",
|
|
7
|
+
"odbor",
|
|
8
|
+
"oddělení",
|
|
9
|
+
"sekretariát",
|
|
10
|
+
"správa",
|
|
11
|
+
"úřad"
|
|
12
|
+
];
|
|
13
|
+
var organization_unit_heads_default = {
|
|
14
|
+
_comment,
|
|
15
|
+
cs
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { _comment, cs, organization_unit_heads_default as default };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=organization-unit-heads.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization-unit-heads.mjs","names":[],"sources":["../../src/data/organization-unit-heads.json"],"sourcesContent":[""],"mappings":""}
|