@doccloak/core 0.8.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/CHANGELOG.md +35 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +230 -0
- package/dist/doc.d.ts +13 -0
- package/dist/doc.js +683 -0
- package/dist/docx.d.ts +31 -0
- package/dist/docx.js +26 -0
- package/dist/dom/docx.d.ts +90 -0
- package/dist/dom/docx.js +472 -0
- package/dist/dom/index.d.ts +11 -0
- package/dist/dom/index.js +11 -0
- package/dist/dom/ocr.d.ts +112 -0
- package/dist/dom/ocr.js +224 -0
- package/dist/engine.d.ts +81 -0
- package/dist/engine.js +274 -0
- package/dist/env.d.ts +49 -0
- package/dist/env.js +53 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +29 -0
- package/dist/model-loader.d.ts +55 -0
- package/dist/model-loader.js +253 -0
- package/dist/pipeline.d.ts +19 -0
- package/dist/pipeline.js +128 -0
- package/dist/providers/bardsai.d.ts +38 -0
- package/dist/providers/bardsai.js +393 -0
- package/dist/providers/gliner.d.ts +52 -0
- package/dist/providers/gliner.js +360 -0
- package/dist/regex/index.d.ts +17 -0
- package/dist/regex/index.js +18 -0
- package/dist/regex/loader.d.ts +44 -0
- package/dist/regex/loader.js +44 -0
- package/dist/regex/rules.data.d.ts +2 -0
- package/dist/regex/rules.data.js +2671 -0
- package/dist/regex/types.d.ts +27 -0
- package/dist/regex/types.js +1 -0
- package/dist/regex/validators.d.ts +17 -0
- package/dist/regex/validators.js +492 -0
- package/dist/session.d.ts +59 -0
- package/dist/session.js +153 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.js +28 -0
- package/dist/worker-protocol.d.ts +119 -0
- package/dist/worker-protocol.js +285 -0
- package/package.json +75 -0
- package/rules/at.json +70 -0
- package/rules/be.json +70 -0
- package/rules/ch.json +66 -0
- package/rules/cn.json +155 -0
- package/rules/de.json +192 -0
- package/rules/dk.json +43 -0
- package/rules/es.json +158 -0
- package/rules/fi.json +43 -0
- package/rules/fr.json +178 -0
- package/rules/gb.json +194 -0
- package/rules/ie.json +48 -0
- package/rules/it.json +116 -0
- package/rules/jp.json +136 -0
- package/rules/nl.json +99 -0
- package/rules/no.json +132 -0
- package/rules/pl.json +210 -0
- package/rules/pt.json +113 -0
- package/rules/schema.json +91 -0
- package/rules/se.json +149 -0
- package/rules/universal.json +279 -0
- package/rules/us.json +218 -0
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@doccloak/core",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Environment-agnostic document anonymization engine for the DocCloak ecosystem.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "Witold Lojek",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./dom": {
|
|
16
|
+
"types": "./dist/dom/index.d.ts",
|
|
17
|
+
"default": "./dist/dom/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./worker-protocol": {
|
|
20
|
+
"types": "./dist/worker-protocol.d.ts",
|
|
21
|
+
"default": "./dist/worker-protocol.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"rules",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"NOTICE",
|
|
29
|
+
"README.md",
|
|
30
|
+
"CHANGELOG.md"
|
|
31
|
+
],
|
|
32
|
+
"keywords": [
|
|
33
|
+
"anonymization",
|
|
34
|
+
"pii",
|
|
35
|
+
"ner",
|
|
36
|
+
"redaction",
|
|
37
|
+
"privacy",
|
|
38
|
+
"gdpr",
|
|
39
|
+
"onnx",
|
|
40
|
+
"docx",
|
|
41
|
+
"ocr"
|
|
42
|
+
],
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/WLojek/DocCloak.Core.git"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/WLojek/DocCloak.Core#readme",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/WLojek/DocCloak.Core/issues"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json && node scripts/fix-dts-extensions.mjs",
|
|
56
|
+
"prepack": "npm run build && node scripts/package-exports.mjs dist",
|
|
57
|
+
"postpack": "node scripts/package-exports.mjs src",
|
|
58
|
+
"rules:gen": "node scripts/generate-rules-module.mjs",
|
|
59
|
+
"rules:check": "node scripts/generate-rules-module.mjs --check",
|
|
60
|
+
"test": "vitest run",
|
|
61
|
+
"test:watch": "vitest",
|
|
62
|
+
"typecheck": "tsc --noEmit"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"jsdom": "24.1.3",
|
|
66
|
+
"typescript": "5.8.3",
|
|
67
|
+
"vitest": "4.1.0"
|
|
68
|
+
},
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"cfb": "1.2.2",
|
|
71
|
+
"jszip": "3.10.1",
|
|
72
|
+
"onnxruntime-web": "1.19.2",
|
|
73
|
+
"tesseract.js": "7.0.0"
|
|
74
|
+
}
|
|
75
|
+
}
|
package/rules/at.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"region": "at",
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "regex:at:svnr",
|
|
6
|
+
"entityType": "SSN",
|
|
7
|
+
"pattern": "\\b[1-9]\\d{3}\\s?(?:0[1-9]|[12]\\d|3[01])(?:0[1-9]|1[0-2])\\d{2}\\b",
|
|
8
|
+
"flags": "g",
|
|
9
|
+
"confidence": 0.85,
|
|
10
|
+
"domains": [
|
|
11
|
+
"identity",
|
|
12
|
+
"hr",
|
|
13
|
+
"medical"
|
|
14
|
+
],
|
|
15
|
+
"description": "Austrian social insurance number (SVNR / Sozialversicherungsnummer, 10 digits)",
|
|
16
|
+
"examples": [
|
|
17
|
+
"1237 010180"
|
|
18
|
+
],
|
|
19
|
+
"validate": "svnr"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "regex:at:phone",
|
|
23
|
+
"entityType": "PHONE",
|
|
24
|
+
"pattern": "\\b(?:\\+?43[\\s-]?|0)\\d{1,4}[\\s-]?\\d{4,10}\\b",
|
|
25
|
+
"flags": "g",
|
|
26
|
+
"confidence": 0.75,
|
|
27
|
+
"domains": [
|
|
28
|
+
"contact"
|
|
29
|
+
],
|
|
30
|
+
"description": "Austrian phone number (variable-length area codes)",
|
|
31
|
+
"examples": [
|
|
32
|
+
"+43 1 12345678",
|
|
33
|
+
"0664 1234567"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "regex:at:postal",
|
|
38
|
+
"entityType": "ADDRESS",
|
|
39
|
+
"pattern": "\\b\\d{4}\\s+[\\p{L}][\\p{L}\\s-]+\\b",
|
|
40
|
+
"flags": "gu",
|
|
41
|
+
"confidence": 0.8,
|
|
42
|
+
"domains": [
|
|
43
|
+
"contact"
|
|
44
|
+
],
|
|
45
|
+
"description": "Austrian postal code (4 digits) followed by city name",
|
|
46
|
+
"examples": [
|
|
47
|
+
"1010 Wien",
|
|
48
|
+
"5020 Salzburg",
|
|
49
|
+
"8010 Graz"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "regex:at:street",
|
|
54
|
+
"entityType": "ADDRESS",
|
|
55
|
+
"pattern": "[\\p{L}][\\p{L}\\s-]*(?:straße|strasse|str\\.|gasse|weg|platz|ring|allee)\\s+\\d+[\\p{L}]?(?:\\s*[/\\\\]\\s*\\d+)?",
|
|
56
|
+
"flags": "giu",
|
|
57
|
+
"confidence": 0.85,
|
|
58
|
+
"domains": [
|
|
59
|
+
"contact"
|
|
60
|
+
],
|
|
61
|
+
"description": "Austrian street address (name + Straße/Gasse/Weg/Platz + number)",
|
|
62
|
+
"examples": [
|
|
63
|
+
"Mariahilfer Straße 45",
|
|
64
|
+
"Währinger Str. 12",
|
|
65
|
+
"Hauptplatz 1",
|
|
66
|
+
"Neubaugasse 7/3"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
package/rules/be.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"region": "be",
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "regex:be:national_register",
|
|
6
|
+
"entityType": "SSN",
|
|
7
|
+
"pattern": "\\b\\d{2}[.\\s]?\\d{2}[.\\s]?\\d{2}[-.\\s]?\\d{3}[.\\s]?\\d{2}\\b",
|
|
8
|
+
"flags": "g",
|
|
9
|
+
"confidence": 0.9,
|
|
10
|
+
"domains": [
|
|
11
|
+
"identity",
|
|
12
|
+
"hr"
|
|
13
|
+
],
|
|
14
|
+
"description": "Belgian National Register Number (Rijksregisternummer / Numéro de registre national)",
|
|
15
|
+
"examples": [
|
|
16
|
+
"85.07.15-123.97",
|
|
17
|
+
"85071512397"
|
|
18
|
+
],
|
|
19
|
+
"validate": "belgianNrn"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "regex:be:phone",
|
|
23
|
+
"entityType": "PHONE",
|
|
24
|
+
"pattern": "\\b(?:\\+?32[\\s-]?|0)(?:4\\d{2}[\\s-]?\\d{2}[\\s-]?\\d{2}[\\s-]?\\d{2}|[1-9]\\d?[\\s-]?\\d{3}[\\s-]?\\d{2}[\\s-]?\\d{2})\\b",
|
|
25
|
+
"flags": "g",
|
|
26
|
+
"confidence": 0.8,
|
|
27
|
+
"domains": [
|
|
28
|
+
"contact"
|
|
29
|
+
],
|
|
30
|
+
"description": "Belgian phone number (mobile 04xx or landline)",
|
|
31
|
+
"examples": [
|
|
32
|
+
"+32 475 12 34 56",
|
|
33
|
+
"02 123 45 67"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "regex:be:postal",
|
|
38
|
+
"entityType": "ADDRESS",
|
|
39
|
+
"pattern": "\\b[1-9]\\d{3}\\s+[\\p{L}][\\p{L}\\s'-]+\\b",
|
|
40
|
+
"flags": "gu",
|
|
41
|
+
"confidence": 0.75,
|
|
42
|
+
"domains": [
|
|
43
|
+
"contact"
|
|
44
|
+
],
|
|
45
|
+
"description": "Belgian postal code (4 digits, 1000-9999) followed by city name",
|
|
46
|
+
"examples": [
|
|
47
|
+
"1000 Bruxelles",
|
|
48
|
+
"2000 Antwerpen",
|
|
49
|
+
"9000 Gent"
|
|
50
|
+
],
|
|
51
|
+
"falsePositiveNotes": "4-digit numbers are common"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "regex:be:street",
|
|
55
|
+
"entityType": "ADDRESS",
|
|
56
|
+
"pattern": "(?:straat|laan|weg|plein|steenweg|lei|dreef|boulevard|avenue|rue|place|chaussée)[\\p{L}\\s'-]+\\d{1,5}[\\p{L}]?|[\\p{L}][\\p{L}\\s'-]*(?:straat|laan|weg|plein|steenweg|lei|dreef)\\s+\\d{1,5}[\\p{L}]?",
|
|
57
|
+
"flags": "giu",
|
|
58
|
+
"confidence": 0.85,
|
|
59
|
+
"domains": [
|
|
60
|
+
"contact"
|
|
61
|
+
],
|
|
62
|
+
"description": "Belgian street address (Dutch/French street types + number)",
|
|
63
|
+
"examples": [
|
|
64
|
+
"Kerkstraat 12",
|
|
65
|
+
"Avenue Louise 54",
|
|
66
|
+
"Rue de la Loi 16"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
package/rules/ch.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"region": "ch",
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "regex:ch:ahv-avs-number",
|
|
6
|
+
"entityType": "SSN",
|
|
7
|
+
"pattern": "\\b756[.\\s]?\\d{4}[.\\s]?\\d{4}[.\\s]?\\d{2}\\b",
|
|
8
|
+
"flags": "g",
|
|
9
|
+
"confidence": 0.95,
|
|
10
|
+
"domains": [
|
|
11
|
+
"identity",
|
|
12
|
+
"hr",
|
|
13
|
+
"medical"
|
|
14
|
+
],
|
|
15
|
+
"description": "Swiss AHV/AVS social security number (new format, EAN-13 based)",
|
|
16
|
+
"examples": [
|
|
17
|
+
"756.1234.5678.97"
|
|
18
|
+
],
|
|
19
|
+
"validate": "ahv"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "regex:ch:phone",
|
|
23
|
+
"entityType": "PHONE",
|
|
24
|
+
"pattern": "\\b(?:\\+?41[\\s-]?|0)[1-9]\\d[\\s-]?\\d{3}[\\s-]?\\d{2}[\\s-]?\\d{2}\\b",
|
|
25
|
+
"flags": "g",
|
|
26
|
+
"confidence": 0.8,
|
|
27
|
+
"domains": [
|
|
28
|
+
"contact"
|
|
29
|
+
],
|
|
30
|
+
"description": "Swiss phone number"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "regex:ch:postal-city",
|
|
34
|
+
"entityType": "ADDRESS",
|
|
35
|
+
"pattern": "\\b\\d{4}\\s+[\\p{L}][\\p{L}\\s-]+\\b",
|
|
36
|
+
"flags": "gu",
|
|
37
|
+
"confidence": 0.8,
|
|
38
|
+
"domains": [
|
|
39
|
+
"contact"
|
|
40
|
+
],
|
|
41
|
+
"description": "Swiss postal code followed by city name"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "regex:ch:street-german",
|
|
45
|
+
"entityType": "ADDRESS",
|
|
46
|
+
"pattern": "[\\p{L}][\\p{L}\\s-]*(?:strasse|str\\.|weg|gasse|platz|allee|rain|matte)\\s+\\d+[\\p{L}]?",
|
|
47
|
+
"flags": "giu",
|
|
48
|
+
"confidence": 0.85,
|
|
49
|
+
"domains": [
|
|
50
|
+
"contact"
|
|
51
|
+
],
|
|
52
|
+
"description": "Swiss street address in German (e.g. Bahnhofstrasse 10)"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"id": "regex:ch:street-french",
|
|
56
|
+
"entityType": "ADDRESS",
|
|
57
|
+
"pattern": "(?:rue|avenue|chemin|route|place|boulevard)\\s+[\\p{L}][\\p{L}\\s'-]+\\s*\\d+",
|
|
58
|
+
"flags": "giu",
|
|
59
|
+
"confidence": 0.85,
|
|
60
|
+
"domains": [
|
|
61
|
+
"contact"
|
|
62
|
+
],
|
|
63
|
+
"description": "Swiss street address in French (e.g. rue de Lausanne 12)"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
package/rules/cn.json
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
{
|
|
2
|
+
"region": "cn",
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "regex:cn:resident_id",
|
|
6
|
+
"entityType": "SSN",
|
|
7
|
+
"pattern": "\\b\\d{6}(?:19|20)\\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\\d|3[01])\\d{3}[\\dXx]\\b",
|
|
8
|
+
"flags": "g",
|
|
9
|
+
"confidence": 0.9,
|
|
10
|
+
"domains": [
|
|
11
|
+
"identity"
|
|
12
|
+
],
|
|
13
|
+
"description": "Chinese Resident Identity Card number (18 digits)",
|
|
14
|
+
"examples": [
|
|
15
|
+
"110101199003070003"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "regex:cn:passport",
|
|
20
|
+
"entityType": "SSN",
|
|
21
|
+
"pattern": "\\b[GDE]\\d{8}\\b",
|
|
22
|
+
"flags": "g",
|
|
23
|
+
"confidence": 0.75,
|
|
24
|
+
"domains": [
|
|
25
|
+
"identity"
|
|
26
|
+
],
|
|
27
|
+
"description": "Chinese passport number (G/D/E + 8 digits)",
|
|
28
|
+
"examples": [
|
|
29
|
+
"G12345678",
|
|
30
|
+
"E00000001"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "regex:cn:bank_card",
|
|
35
|
+
"entityType": "OTHER",
|
|
36
|
+
"pattern": "\\b\\d{15,19}\\b",
|
|
37
|
+
"flags": "g",
|
|
38
|
+
"confidence": 0.4,
|
|
39
|
+
"domains": [
|
|
40
|
+
"financial"
|
|
41
|
+
],
|
|
42
|
+
"description": "Chinese bank card number (15-19 digits)",
|
|
43
|
+
"examples": [
|
|
44
|
+
"6222021234567890123"
|
|
45
|
+
],
|
|
46
|
+
"falsePositiveNotes": "Any 15-19 digit run matches; low confidence by design"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "regex:cn:uscc",
|
|
50
|
+
"entityType": "SSN",
|
|
51
|
+
"pattern": "\\b[0-9A-Z]{18}\\b",
|
|
52
|
+
"flags": "g",
|
|
53
|
+
"confidence": 0.6,
|
|
54
|
+
"domains": [
|
|
55
|
+
"identity",
|
|
56
|
+
"financial"
|
|
57
|
+
],
|
|
58
|
+
"description": "Chinese Unified Social Credit Code (18 alphanumeric)",
|
|
59
|
+
"examples": [
|
|
60
|
+
"91110000710921000K"
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"id": "regex:cn:phone_mobile",
|
|
65
|
+
"entityType": "PHONE",
|
|
66
|
+
"pattern": "\\b(?:\\+?86[\\s-]?)?1[3-9]\\d[\\s-]?\\d{4}[\\s-]?\\d{4}\\b",
|
|
67
|
+
"flags": "g",
|
|
68
|
+
"confidence": 0.85,
|
|
69
|
+
"domains": [
|
|
70
|
+
"contact"
|
|
71
|
+
],
|
|
72
|
+
"description": "Chinese mobile phone number (1XX-XXXX-XXXX, optionally with +86)",
|
|
73
|
+
"examples": [
|
|
74
|
+
"+86 138 1234 5678",
|
|
75
|
+
"13812345678"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"id": "regex:cn:phone_landline",
|
|
80
|
+
"entityType": "PHONE",
|
|
81
|
+
"pattern": "\\b0\\d{2,3}[\\s-]?\\d{7,8}\\b",
|
|
82
|
+
"flags": "g",
|
|
83
|
+
"confidence": 0.8,
|
|
84
|
+
"domains": [
|
|
85
|
+
"contact"
|
|
86
|
+
],
|
|
87
|
+
"description": "Chinese landline phone number (0XX-XXXXXXXX)",
|
|
88
|
+
"examples": [
|
|
89
|
+
"010-12345678",
|
|
90
|
+
"021-87654321"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"id": "regex:cn:postal",
|
|
95
|
+
"entityType": "ADDRESS",
|
|
96
|
+
"pattern": "\\b\\d{6}\\b",
|
|
97
|
+
"flags": "g",
|
|
98
|
+
"confidence": 0.35,
|
|
99
|
+
"domains": [
|
|
100
|
+
"contact"
|
|
101
|
+
],
|
|
102
|
+
"description": "Chinese postal code (6 digits)",
|
|
103
|
+
"examples": [
|
|
104
|
+
"100000",
|
|
105
|
+
"200000"
|
|
106
|
+
],
|
|
107
|
+
"falsePositiveNotes": "Any standalone 6-digit number matches; low confidence by design"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"id": "regex:cn:currency_hanzi",
|
|
111
|
+
"entityType": "CURRENCY",
|
|
112
|
+
"pattern": "[零壹贰叁肆伍陆柒捌玖拾佰仟萬億一二三四五六七八九十百千万亿]+\\s*(?:元|圆|块)",
|
|
113
|
+
"flags": "g",
|
|
114
|
+
"confidence": 0.9,
|
|
115
|
+
"domains": [
|
|
116
|
+
"financial"
|
|
117
|
+
],
|
|
118
|
+
"description": "Chinese amount in hanzi numerals + yuan sign (e.g., 捌仟伍佰元)",
|
|
119
|
+
"examples": [
|
|
120
|
+
"捌仟伍佰元",
|
|
121
|
+
"八千五百元"
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"id": "regex:cn:address",
|
|
126
|
+
"entityType": "ADDRESS",
|
|
127
|
+
"pattern": "[\\u4E00-\\u9FFF]+[省市][\\u4E00-\\u9FFF]+[市区县][\\u4E00-\\u9FFF\\d-]+",
|
|
128
|
+
"flags": "g",
|
|
129
|
+
"confidence": 0.85,
|
|
130
|
+
"domains": [
|
|
131
|
+
"contact"
|
|
132
|
+
],
|
|
133
|
+
"description": "Chinese address (province/city + district + street)",
|
|
134
|
+
"examples": [
|
|
135
|
+
"北京市朝阳区建国路1号"
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"id": "regex:cn:company",
|
|
140
|
+
"entityType": "COMPANY",
|
|
141
|
+
"pattern": "[\\u4E00-\\u9FFF][\\u4E00-\\u9FFF\\s]+(?:有限公司|股份有限公司|集团|有限责任公司)",
|
|
142
|
+
"flags": "g",
|
|
143
|
+
"confidence": 0.9,
|
|
144
|
+
"domains": [
|
|
145
|
+
"general"
|
|
146
|
+
],
|
|
147
|
+
"description": "Chinese company name with legal form",
|
|
148
|
+
"examples": [
|
|
149
|
+
"阿里巴巴集团",
|
|
150
|
+
"华为技术有限公司",
|
|
151
|
+
"腾讯科技股份有限公司"
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
}
|
package/rules/de.json
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
{
|
|
2
|
+
"region": "de",
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "regex:de:personalausweis",
|
|
6
|
+
"entityType": "SSN",
|
|
7
|
+
"pattern": "\\b[CFGHJKLMNPRTVWXYZ]\\d{2}[CFGHJKLMNPRTVWXYZ0-9]{6}\\d\\b",
|
|
8
|
+
"flags": "g",
|
|
9
|
+
"confidence": 0.75,
|
|
10
|
+
"domains": [
|
|
11
|
+
"identity"
|
|
12
|
+
],
|
|
13
|
+
"description": "German ID card number (Personalausweisnummer)",
|
|
14
|
+
"examples": [
|
|
15
|
+
"T220001297"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "regex:de:passport",
|
|
20
|
+
"entityType": "SSN",
|
|
21
|
+
"pattern": "\\b[CFGHJKLMNPRTVWXYZ]\\d{2}[CFGHJKLMNPRTVWXYZ0-9]{5}\\d[A-Z]\\d{7}\\b",
|
|
22
|
+
"flags": "g",
|
|
23
|
+
"confidence": 0.75,
|
|
24
|
+
"domains": [
|
|
25
|
+
"identity"
|
|
26
|
+
],
|
|
27
|
+
"description": "German passport number",
|
|
28
|
+
"examples": [
|
|
29
|
+
"C01X00T47D1234567"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "regex:de:steuernummer",
|
|
34
|
+
"entityType": "SSN",
|
|
35
|
+
"pattern": "\\b\\d{2,3}\\/?\\d{3}\\/?\\d{4,5}\\b",
|
|
36
|
+
"flags": "g",
|
|
37
|
+
"confidence": 0.6,
|
|
38
|
+
"domains": [
|
|
39
|
+
"financial"
|
|
40
|
+
],
|
|
41
|
+
"description": "German tax number (Steuernummer, 10-11 digits, format varies by state)",
|
|
42
|
+
"examples": [
|
|
43
|
+
"93/815/08152",
|
|
44
|
+
"2181508152"
|
|
45
|
+
],
|
|
46
|
+
"falsePositiveNotes": "Format varies by Bundesland — hard to validate precisely"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "regex:de:steuerid",
|
|
50
|
+
"entityType": "SSN",
|
|
51
|
+
"pattern": "\\b\\d{2}\\s?\\d{3}\\s?\\d{3}\\s?\\d{3}\\b",
|
|
52
|
+
"flags": "g",
|
|
53
|
+
"confidence": 0.8,
|
|
54
|
+
"domains": [
|
|
55
|
+
"financial",
|
|
56
|
+
"identity"
|
|
57
|
+
],
|
|
58
|
+
"description": "German tax ID (Steuerliche Identifikationsnummer, 11 digits)",
|
|
59
|
+
"examples": [
|
|
60
|
+
"12 345 678 903"
|
|
61
|
+
],
|
|
62
|
+
"validate": "steuerId"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id": "regex:de:vat",
|
|
66
|
+
"entityType": "SSN",
|
|
67
|
+
"pattern": "\\b(?:DE)?\\d{9}\\b",
|
|
68
|
+
"flags": "gi",
|
|
69
|
+
"confidence": 0.65,
|
|
70
|
+
"domains": [
|
|
71
|
+
"financial",
|
|
72
|
+
"legal"
|
|
73
|
+
],
|
|
74
|
+
"description": "German VAT number (USt-IdNr., DE + 9 digits)",
|
|
75
|
+
"examples": [
|
|
76
|
+
"DE123456789"
|
|
77
|
+
],
|
|
78
|
+
"falsePositiveNotes": "Without DE prefix, 9 digits alone has many false positives"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"id": "regex:de:phone",
|
|
82
|
+
"entityType": "PHONE",
|
|
83
|
+
"pattern": "\\b(?:\\+?49[\\s-]?)?\\(?\\d{2,5}\\)?[\\s-]?\\d{3,10}\\b",
|
|
84
|
+
"flags": "g",
|
|
85
|
+
"confidence": 0.7,
|
|
86
|
+
"domains": [
|
|
87
|
+
"contact"
|
|
88
|
+
],
|
|
89
|
+
"description": "German phone number (variable-length area codes)",
|
|
90
|
+
"examples": [
|
|
91
|
+
"+49 30 12345678",
|
|
92
|
+
"089/12345678",
|
|
93
|
+
"(030) 12345678"
|
|
94
|
+
],
|
|
95
|
+
"falsePositiveNotes": "Variable-length area codes make this pattern broad"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "regex:de:postal",
|
|
99
|
+
"entityType": "ADDRESS",
|
|
100
|
+
"pattern": "\\b\\d{5}\\s+[\\p{L}][\\p{L}\\s-]+\\b",
|
|
101
|
+
"flags": "gu",
|
|
102
|
+
"confidence": 0.8,
|
|
103
|
+
"domains": [
|
|
104
|
+
"contact"
|
|
105
|
+
],
|
|
106
|
+
"description": "German postal code (5 digits) followed by city name",
|
|
107
|
+
"examples": [
|
|
108
|
+
"10115 Berlin",
|
|
109
|
+
"80331 München"
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"id": "regex:de:currency_words",
|
|
114
|
+
"entityType": "CURRENCY",
|
|
115
|
+
"pattern": "(?:in\\s+(?:Höhe|Worten?)\\s+(?:von\\s+)?|(?:Betrag|Summe)\\s+von\\s+)[\\p{L}\\s-]+(?:Euro|Cent)\\b",
|
|
116
|
+
"flags": "giu",
|
|
117
|
+
"confidence": 0.9,
|
|
118
|
+
"domains": [
|
|
119
|
+
"financial"
|
|
120
|
+
],
|
|
121
|
+
"description": "German amount written in words (e.g., \"in Höhe von achttausendfünfhundert Euro\")",
|
|
122
|
+
"examples": [
|
|
123
|
+
"in Höhe von achttausendfünfhundert Euro"
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"id": "regex:de:street",
|
|
128
|
+
"entityType": "ADDRESS",
|
|
129
|
+
"pattern": "[\\p{L}][\\p{L}\\s-]*(?:straße|strasse|str\\.|weg|gasse|platz|allee|ring|damm|ufer|chaussee)\\s+\\d+[\\p{L}]?(?:\\s*[/\\\\]\\s*\\d+)?",
|
|
130
|
+
"flags": "giu",
|
|
131
|
+
"confidence": 0.9,
|
|
132
|
+
"domains": [
|
|
133
|
+
"contact"
|
|
134
|
+
],
|
|
135
|
+
"description": "German street address (name + straße/str./weg/gasse/platz + number)",
|
|
136
|
+
"examples": [
|
|
137
|
+
"Friedrichstraße 43",
|
|
138
|
+
"Berliner Str. 12",
|
|
139
|
+
"Hauptplatz 1",
|
|
140
|
+
"Am Damm 7a"
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"id": "regex:de:company",
|
|
145
|
+
"entityType": "COMPANY",
|
|
146
|
+
"pattern": "[\\p{L}][\\p{L}\\s&.]+(?:\\s+)?(?:GmbH|AG|KG|OHG|e\\.?\\s?V\\.?|GbR|UG|mbH|KGaA)\\b",
|
|
147
|
+
"flags": "gu",
|
|
148
|
+
"confidence": 0.9,
|
|
149
|
+
"domains": [
|
|
150
|
+
"legal",
|
|
151
|
+
"financial"
|
|
152
|
+
],
|
|
153
|
+
"description": "German company name with legal form (GmbH, AG, KG, OHG, e.V., GbR, UG)",
|
|
154
|
+
"examples": [
|
|
155
|
+
"Deutsche Bank AG",
|
|
156
|
+
"Siemens GmbH",
|
|
157
|
+
"Bosch KG"
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"id": "regex:de:icd10gm",
|
|
162
|
+
"entityType": "OTHER",
|
|
163
|
+
"pattern": "\\b[A-Z]\\d{2}(?:\\.\\d{1,2})?(?:\\s?[GLRAZ])?\\b",
|
|
164
|
+
"flags": "g",
|
|
165
|
+
"confidence": 0.55,
|
|
166
|
+
"domains": [
|
|
167
|
+
"medical"
|
|
168
|
+
],
|
|
169
|
+
"description": "ICD-10-GM diagnosis code (German modification)",
|
|
170
|
+
"examples": [
|
|
171
|
+
"J18.9 G",
|
|
172
|
+
"E11.65"
|
|
173
|
+
],
|
|
174
|
+
"falsePositiveNotes": "Very short codes — high false positive risk"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"id": "regex:de:sozialversicherung",
|
|
178
|
+
"entityType": "SSN",
|
|
179
|
+
"pattern": "\\b\\d{2}(?:0[1-9]|[12]\\d|3[01])(?:0[1-9]|1[0-2])\\d{2}[A-Z]\\d{2}\\d\\b",
|
|
180
|
+
"flags": "gi",
|
|
181
|
+
"confidence": 0.75,
|
|
182
|
+
"domains": [
|
|
183
|
+
"hr",
|
|
184
|
+
"identity"
|
|
185
|
+
],
|
|
186
|
+
"description": "German social insurance number (Sozialversicherungsnummer, 12 chars: area + DDMMYY birth date + letter + serial + check digit)",
|
|
187
|
+
"examples": [
|
|
188
|
+
"12010182A056"
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
}
|
package/rules/dk.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"region": "dk",
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "regex:dk:cpr-number",
|
|
6
|
+
"entityType": "SSN",
|
|
7
|
+
"pattern": "\\b(?:0[1-9]|[12]\\d|3[01])(?:0[1-9]|1[0-2])\\d{2}[-\\s]?\\d{4}\\b",
|
|
8
|
+
"flags": "g",
|
|
9
|
+
"confidence": 0.8,
|
|
10
|
+
"domains": [
|
|
11
|
+
"identity",
|
|
12
|
+
"hr"
|
|
13
|
+
],
|
|
14
|
+
"description": "Danish CPR (Central Person Register) number",
|
|
15
|
+
"examples": [
|
|
16
|
+
"010190-1234"
|
|
17
|
+
],
|
|
18
|
+
"falsePositiveNotes": "Post-2007 CPR numbers may not satisfy modulo-11 check"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "regex:dk:phone",
|
|
22
|
+
"entityType": "PHONE",
|
|
23
|
+
"pattern": "\\b(?:\\+?45[\\s-]?)?\\d{2}[\\s-]?\\d{2}[\\s-]?\\d{2}[\\s-]?\\d{2}\\b",
|
|
24
|
+
"flags": "g",
|
|
25
|
+
"confidence": 0.75,
|
|
26
|
+
"domains": [
|
|
27
|
+
"contact"
|
|
28
|
+
],
|
|
29
|
+
"description": "Danish phone number"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "regex:dk:postal-city",
|
|
33
|
+
"entityType": "ADDRESS",
|
|
34
|
+
"pattern": "\\b\\d{4}\\s+[\\p{L}][\\p{L}\\s-]+\\b",
|
|
35
|
+
"flags": "gu",
|
|
36
|
+
"confidence": 0.8,
|
|
37
|
+
"domains": [
|
|
38
|
+
"contact"
|
|
39
|
+
],
|
|
40
|
+
"description": "Danish postal code followed by city name"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|