@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.
Files changed (66) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +5 -0
  4. package/README.md +230 -0
  5. package/dist/doc.d.ts +13 -0
  6. package/dist/doc.js +683 -0
  7. package/dist/docx.d.ts +31 -0
  8. package/dist/docx.js +26 -0
  9. package/dist/dom/docx.d.ts +90 -0
  10. package/dist/dom/docx.js +472 -0
  11. package/dist/dom/index.d.ts +11 -0
  12. package/dist/dom/index.js +11 -0
  13. package/dist/dom/ocr.d.ts +112 -0
  14. package/dist/dom/ocr.js +224 -0
  15. package/dist/engine.d.ts +81 -0
  16. package/dist/engine.js +274 -0
  17. package/dist/env.d.ts +49 -0
  18. package/dist/env.js +53 -0
  19. package/dist/index.d.ts +20 -0
  20. package/dist/index.js +29 -0
  21. package/dist/model-loader.d.ts +55 -0
  22. package/dist/model-loader.js +253 -0
  23. package/dist/pipeline.d.ts +19 -0
  24. package/dist/pipeline.js +128 -0
  25. package/dist/providers/bardsai.d.ts +38 -0
  26. package/dist/providers/bardsai.js +393 -0
  27. package/dist/providers/gliner.d.ts +52 -0
  28. package/dist/providers/gliner.js +360 -0
  29. package/dist/regex/index.d.ts +17 -0
  30. package/dist/regex/index.js +18 -0
  31. package/dist/regex/loader.d.ts +44 -0
  32. package/dist/regex/loader.js +44 -0
  33. package/dist/regex/rules.data.d.ts +2 -0
  34. package/dist/regex/rules.data.js +2671 -0
  35. package/dist/regex/types.d.ts +27 -0
  36. package/dist/regex/types.js +1 -0
  37. package/dist/regex/validators.d.ts +17 -0
  38. package/dist/regex/validators.js +492 -0
  39. package/dist/session.d.ts +59 -0
  40. package/dist/session.js +153 -0
  41. package/dist/types.d.ts +42 -0
  42. package/dist/types.js +28 -0
  43. package/dist/worker-protocol.d.ts +119 -0
  44. package/dist/worker-protocol.js +285 -0
  45. package/package.json +75 -0
  46. package/rules/at.json +70 -0
  47. package/rules/be.json +70 -0
  48. package/rules/ch.json +66 -0
  49. package/rules/cn.json +155 -0
  50. package/rules/de.json +192 -0
  51. package/rules/dk.json +43 -0
  52. package/rules/es.json +158 -0
  53. package/rules/fi.json +43 -0
  54. package/rules/fr.json +178 -0
  55. package/rules/gb.json +194 -0
  56. package/rules/ie.json +48 -0
  57. package/rules/it.json +116 -0
  58. package/rules/jp.json +136 -0
  59. package/rules/nl.json +99 -0
  60. package/rules/no.json +132 -0
  61. package/rules/pl.json +210 -0
  62. package/rules/pt.json +113 -0
  63. package/rules/schema.json +91 -0
  64. package/rules/se.json +149 -0
  65. package/rules/universal.json +279 -0
  66. package/rules/us.json +218 -0
package/rules/es.json ADDED
@@ -0,0 +1,158 @@
1
+ {
2
+ "region": "es",
3
+ "rules": [
4
+ {
5
+ "id": "regex:es:dni",
6
+ "entityType": "SSN",
7
+ "pattern": "\\b\\d{8}[\\s-]?[A-Z]\\b",
8
+ "flags": "gi",
9
+ "confidence": 0.9,
10
+ "domains": [
11
+ "identity"
12
+ ],
13
+ "description": "Spanish DNI (8 digits + letter)",
14
+ "examples": [
15
+ "12345678Z",
16
+ "12345678-Z"
17
+ ],
18
+ "validate": "dni"
19
+ },
20
+ {
21
+ "id": "regex:es:nie",
22
+ "entityType": "SSN",
23
+ "pattern": "\\b[XYZ][\\s-]?\\d{7}[\\s-]?[A-Z]\\b",
24
+ "flags": "gi",
25
+ "confidence": 0.9,
26
+ "domains": [
27
+ "identity"
28
+ ],
29
+ "description": "Spanish NIE for foreigners (X/Y/Z + 7 digits + letter)",
30
+ "examples": [
31
+ "X1234567L",
32
+ "Y-1234567-A"
33
+ ]
34
+ },
35
+ {
36
+ "id": "regex:es:cif",
37
+ "entityType": "SSN",
38
+ "pattern": "\\b[A-H]\\d{7}[0-9A-J]\\b",
39
+ "flags": "gi",
40
+ "confidence": 0.8,
41
+ "domains": [
42
+ "financial",
43
+ "legal"
44
+ ],
45
+ "description": "Spanish CIF company tax ID",
46
+ "examples": [
47
+ "A12345678",
48
+ "B87654321"
49
+ ]
50
+ },
51
+ {
52
+ "id": "regex:es:cuenta_bancaria",
53
+ "entityType": "SSN",
54
+ "pattern": "\\b(?:ES)?\\d{2}\\s?\\d{4}\\s?\\d{4}\\s?\\d{4}\\s?\\d{4}\\s?\\d{4}\\b",
55
+ "flags": "gi",
56
+ "confidence": 0.8,
57
+ "domains": [
58
+ "financial"
59
+ ],
60
+ "description": "Spanish bank account number (CCC, 20 digits)",
61
+ "examples": [
62
+ "ES12 1234 5678 9012 3456 7890"
63
+ ]
64
+ },
65
+ {
66
+ "id": "regex:es:phone",
67
+ "entityType": "PHONE",
68
+ "pattern": "\\b(?:\\+?34[\\s-]?)?[6789]\\d{2}[\\s-]?\\d{3}[\\s-]?\\d{3}\\b",
69
+ "flags": "g",
70
+ "confidence": 0.8,
71
+ "domains": [
72
+ "contact"
73
+ ],
74
+ "description": "Spanish phone number (9 digits, optionally with +34)",
75
+ "examples": [
76
+ "+34 612 345 678",
77
+ "912 345 678"
78
+ ]
79
+ },
80
+ {
81
+ "id": "regex:es:postal",
82
+ "entityType": "ADDRESS",
83
+ "pattern": "\\b\\d{5}\\s+[\\p{L}][\\p{L}\\s'-]+\\b",
84
+ "flags": "gu",
85
+ "confidence": 0.75,
86
+ "domains": [
87
+ "contact"
88
+ ],
89
+ "description": "Spanish postal code (5 digits) followed by city name",
90
+ "examples": [
91
+ "28001 Madrid",
92
+ "08001 Barcelona"
93
+ ]
94
+ },
95
+ {
96
+ "id": "regex:es:currency_words",
97
+ "entityType": "CURRENCY",
98
+ "pattern": "(?:(?:en\\s+)?(?:letras?|palabras?)\\s*:\\s*|(?:la\\s+)?(?:cantidad|suma)\\s+de\\s+)[\\p{L}\\s-]+(?:euros?|céntimos?|pesos?|centavos?)\\b",
99
+ "flags": "giu",
100
+ "confidence": 0.9,
101
+ "domains": [
102
+ "financial"
103
+ ],
104
+ "description": "Spanish amount written in words (e.g., \"en letras: ocho mil quinientos euros\")",
105
+ "examples": [
106
+ "en letras: ocho mil quinientos euros"
107
+ ]
108
+ },
109
+ {
110
+ "id": "regex:es:street",
111
+ "entityType": "ADDRESS",
112
+ "pattern": "(?:(?:C(?:alle)?|Av(?:enida|da)?|Avda|Pza|Plaza|Pl|Paseo|P\\.º|Ronda|Ctra|Carretera|Camino|Travesía|Glorieta)\\.?\\s+)[\\p{L}][\\p{L}\\s'-]+(?:,?\\s*(?:n\\.?º?\\s*)?\\d+)?",
113
+ "flags": "giu",
114
+ "confidence": 0.85,
115
+ "domains": [
116
+ "contact"
117
+ ],
118
+ "description": "Spanish street address (Calle/Avenida/Plaza + name + optional number)",
119
+ "examples": [
120
+ "Calle Mayor 15",
121
+ "Av. de la Constitución 3",
122
+ "Plaza de España"
123
+ ]
124
+ },
125
+ {
126
+ "id": "regex:es:company",
127
+ "entityType": "COMPANY",
128
+ "pattern": "[\\p{L}][\\p{L}\\s&.']+(?:\\s+)?(?:S\\.L\\.U\\.|S\\.L\\.U|S\\.L\\.|S\\.L|S\\.A\\.U\\.|S\\.A\\.U|S\\.A\\.|S\\.A|S\\.C\\.)\\b",
129
+ "flags": "gu",
130
+ "confidence": 0.9,
131
+ "domains": [
132
+ "legal",
133
+ "financial"
134
+ ],
135
+ "description": "Spanish company name with legal form (S.L., S.A., S.L.U., S.A.U., S.C.)",
136
+ "examples": [
137
+ "Telefónica S.A.",
138
+ "Construcciones García S.L.",
139
+ "Inditex S.A."
140
+ ]
141
+ },
142
+ {
143
+ "id": "regex:es:nuss",
144
+ "entityType": "SSN",
145
+ "pattern": "\\b\\d{2}[-/]?\\d{8}[-/]?\\d{2}\\b",
146
+ "flags": "g",
147
+ "confidence": 0.75,
148
+ "domains": [
149
+ "medical",
150
+ "hr"
151
+ ],
152
+ "description": "Spanish Social Security Number (NUSS/NAF, 12 digits: province + sequential + check)",
153
+ "examples": [
154
+ "28-12345678-56"
155
+ ]
156
+ }
157
+ ]
158
+ }
package/rules/fi.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "region": "fi",
3
+ "rules": [
4
+ {
5
+ "id": "regex:fi:hetu",
6
+ "entityType": "SSN",
7
+ "pattern": "\\b(?:0[1-9]|[12]\\d|3[01])(?:0[1-9]|1[0-2])\\d{2}[ABCDEFYXWVU+-]\\d{3}[\\dA-FHJK-NPR-Y]\\b",
8
+ "flags": "gi",
9
+ "confidence": 0.9,
10
+ "domains": [
11
+ "identity",
12
+ "hr"
13
+ ],
14
+ "description": "Finnish personal identity code (henkilötunnus / HETU)",
15
+ "examples": [
16
+ "131052-308T"
17
+ ],
18
+ "validate": "hetu"
19
+ },
20
+ {
21
+ "id": "regex:fi:phone",
22
+ "entityType": "PHONE",
23
+ "pattern": "\\b(?:\\+?358[\\s-]?|0)[1-9]\\d?[\\s-]?\\d{3,4}[\\s-]?\\d{3,4}\\b",
24
+ "flags": "g",
25
+ "confidence": 0.8,
26
+ "domains": [
27
+ "contact"
28
+ ],
29
+ "description": "Finnish phone number"
30
+ },
31
+ {
32
+ "id": "regex:fi:postal-city",
33
+ "entityType": "ADDRESS",
34
+ "pattern": "\\b\\d{5}\\s+[\\p{L}][\\p{L}\\s-]+\\b",
35
+ "flags": "gu",
36
+ "confidence": 0.8,
37
+ "domains": [
38
+ "contact"
39
+ ],
40
+ "description": "Finnish postal code followed by city name"
41
+ }
42
+ ]
43
+ }
package/rules/fr.json ADDED
@@ -0,0 +1,178 @@
1
+ {
2
+ "region": "fr",
3
+ "rules": [
4
+ {
5
+ "id": "regex:fr:nir",
6
+ "entityType": "SSN",
7
+ "pattern": "\\b[12]\\s?\\d{2}\\s?\\d{2}\\s?\\d{2}\\s?\\d{3}\\s?\\d{3}(?:\\s?\\d{2})?\\b",
8
+ "flags": "g",
9
+ "confidence": 0.9,
10
+ "domains": [
11
+ "identity",
12
+ "medical",
13
+ "hr"
14
+ ],
15
+ "description": "French NIR / INSEE number (numéro de sécurité sociale, 13+2 digits)",
16
+ "examples": [
17
+ "1 85 05 78 049 013 36"
18
+ ],
19
+ "validate": "nir"
20
+ },
21
+ {
22
+ "id": "regex:fr:passport",
23
+ "entityType": "SSN",
24
+ "pattern": "\\b\\d{2}[A-Z]{2}\\d{5}\\b",
25
+ "flags": "g",
26
+ "confidence": 0.75,
27
+ "domains": [
28
+ "identity"
29
+ ],
30
+ "description": "French passport number (2 digits + 2 letters + 5 digits)",
31
+ "examples": [
32
+ "12AB34567"
33
+ ]
34
+ },
35
+ {
36
+ "id": "regex:fr:cni",
37
+ "entityType": "SSN",
38
+ "pattern": "\\b\\d{12}\\b",
39
+ "flags": "g",
40
+ "confidence": 0.4,
41
+ "domains": [
42
+ "identity"
43
+ ],
44
+ "description": "French national ID card number (12 digits, new format)",
45
+ "examples": [
46
+ "123456789012"
47
+ ],
48
+ "falsePositiveNotes": "Very broad — 12 digits matches many things"
49
+ },
50
+ {
51
+ "id": "regex:fr:siret",
52
+ "entityType": "SSN",
53
+ "pattern": "\\b\\d{3}\\s?\\d{3}\\s?\\d{3}(?:\\s?\\d{5})?\\b",
54
+ "flags": "g",
55
+ "confidence": 0.65,
56
+ "domains": [
57
+ "financial",
58
+ "legal"
59
+ ],
60
+ "description": "French SIRET (14 digits) or SIREN (9 digits) business number",
61
+ "examples": [
62
+ "362 521 879 00034",
63
+ "362 521 879"
64
+ ],
65
+ "falsePositiveNotes": "9-digit SIREN overlaps with many formats"
66
+ },
67
+ {
68
+ "id": "regex:fr:vat",
69
+ "entityType": "SSN",
70
+ "pattern": "\\b(?:FR)?\\d{2}\\s?\\d{9}\\b",
71
+ "flags": "gi",
72
+ "confidence": 0.75,
73
+ "domains": [
74
+ "financial",
75
+ "legal"
76
+ ],
77
+ "description": "French VAT number (FR + 2 digits + 9 digits SIREN)",
78
+ "examples": [
79
+ "FR12 362521879",
80
+ "FR 12362521879"
81
+ ]
82
+ },
83
+ {
84
+ "id": "regex:fr:phone",
85
+ "entityType": "PHONE",
86
+ "pattern": "\\b0[1-9](?:\\s?\\d{2}){4}\\b",
87
+ "flags": "g",
88
+ "confidence": 0.85,
89
+ "domains": [
90
+ "contact"
91
+ ],
92
+ "description": "French phone number (0X XX XX XX XX)",
93
+ "examples": [
94
+ "01 23 45 67 89",
95
+ "06 12 34 56 78",
96
+ "0612345678"
97
+ ]
98
+ },
99
+ {
100
+ "id": "regex:fr:postal",
101
+ "entityType": "ADDRESS",
102
+ "pattern": "\\b\\d{5}\\s+[\\p{L}][\\p{L}\\s'-]+\\b",
103
+ "flags": "gu",
104
+ "confidence": 0.8,
105
+ "domains": [
106
+ "contact"
107
+ ],
108
+ "description": "French postal code (5 digits) followed by city name",
109
+ "examples": [
110
+ "75008 Paris",
111
+ "69001 Lyon",
112
+ "13001 Marseille"
113
+ ]
114
+ },
115
+ {
116
+ "id": "regex:fr:currency_words",
117
+ "entityType": "CURRENCY",
118
+ "pattern": "(?:(?:soit|montant)\\s+(?:en\\s+)?(?:lettres?|toutes?\\s+lettres?)\\s*:\\s*|(?:la\\s+)?somme\\s+de\\s+)[\\p{L}\\s'-]+(?:euros?|centimes?)\\b",
119
+ "flags": "giu",
120
+ "confidence": 0.9,
121
+ "domains": [
122
+ "financial"
123
+ ],
124
+ "description": "French amount written in words (e.g., \"soit en lettres: huit mille cinq cents euros\")",
125
+ "examples": [
126
+ "soit en lettres: huit mille cinq cents euros"
127
+ ]
128
+ },
129
+ {
130
+ "id": "regex:fr:street",
131
+ "entityType": "ADDRESS",
132
+ "pattern": "\\b\\d{1,5}(?:\\s*(?:bis|ter))?\\s*,?\\s*(?:rue|avenue|av\\.|boulevard|bd\\.?|place|pl\\.|impasse|allée|passage|chemin|route|quai|cours|square|voie|sentier|résidence)\\s+[\\p{L}][\\p{L}\\s'-]+",
133
+ "flags": "giu",
134
+ "confidence": 0.9,
135
+ "domains": [
136
+ "contact"
137
+ ],
138
+ "description": "French street address (number + rue/avenue/boulevard + name)",
139
+ "examples": [
140
+ "12 rue de Rivoli",
141
+ "42 avenue des Champs-Élysées",
142
+ "8 bis boulevard Haussmann"
143
+ ]
144
+ },
145
+ {
146
+ "id": "regex:fr:company",
147
+ "entityType": "COMPANY",
148
+ "pattern": "[\\p{L}][\\p{L}\\s&.']+(?:\\s+)?(?:SARL|SAS|SA|EURL|SCI|SNC|SASU)\\b",
149
+ "flags": "gu",
150
+ "confidence": 0.9,
151
+ "domains": [
152
+ "legal",
153
+ "financial"
154
+ ],
155
+ "description": "French company name with legal form (SARL, SAS, SA, EURL, SCI, SNC)",
156
+ "examples": [
157
+ "Total SA",
158
+ "Capgemini SAS",
159
+ "Dupont et Fils SARL"
160
+ ]
161
+ },
162
+ {
163
+ "id": "regex:fr:carte_vitale",
164
+ "entityType": "OTHER",
165
+ "pattern": "\\b\\d{1}\\s?\\d{2}\\s?\\d{2}\\s?\\d{3}\\s?\\d{3}\\b",
166
+ "flags": "g",
167
+ "confidence": 0.7,
168
+ "domains": [
169
+ "medical"
170
+ ],
171
+ "description": "French Carte Vitale number (same as NIR, 13 digits)",
172
+ "examples": [
173
+ "1 85 05 780 490"
174
+ ],
175
+ "falsePositiveNotes": "Duplicate of NIR — overlap resolution will keep one"
176
+ }
177
+ ]
178
+ }
package/rules/gb.json ADDED
@@ -0,0 +1,194 @@
1
+ {
2
+ "region": "gb",
3
+ "rules": [
4
+ {
5
+ "id": "regex:gb:nino",
6
+ "entityType": "SSN",
7
+ "pattern": "\\b[A-Z]{2}\\s?\\d{2}\\s?\\d{2}\\s?\\d{2}\\s?[A-D]\\b",
8
+ "flags": "gi",
9
+ "confidence": 0.9,
10
+ "domains": [
11
+ "identity",
12
+ "hr",
13
+ "financial"
14
+ ],
15
+ "description": "UK National Insurance Number (NINO, e.g., AB 12 34 56 C)",
16
+ "examples": [
17
+ "AB 12 34 56 C",
18
+ "CE123456C"
19
+ ],
20
+ "validate": "nino"
21
+ },
22
+ {
23
+ "id": "regex:gb:nhs",
24
+ "entityType": "SSN",
25
+ "pattern": "\\b\\d{3}\\s?\\d{3}\\s?\\d{4}\\b",
26
+ "flags": "g",
27
+ "confidence": 0.6,
28
+ "domains": [
29
+ "medical",
30
+ "identity"
31
+ ],
32
+ "description": "UK NHS number (10 digits)",
33
+ "examples": [
34
+ "943 476 5919"
35
+ ],
36
+ "falsePositiveNotes": "10-digit format overlaps with many phone numbers",
37
+ "validate": "nhs"
38
+ },
39
+ {
40
+ "id": "regex:gb:passport",
41
+ "entityType": "SSN",
42
+ "pattern": "\\b\\d{9}\\b",
43
+ "flags": "g",
44
+ "confidence": 0.4,
45
+ "domains": [
46
+ "identity"
47
+ ],
48
+ "description": "UK passport number (9 digits)",
49
+ "examples": [
50
+ "123456789"
51
+ ],
52
+ "falsePositiveNotes": "Very broad — 9 digits matches many things. Best paired with context clues."
53
+ },
54
+ {
55
+ "id": "regex:gb:sort_code",
56
+ "entityType": "OTHER",
57
+ "pattern": "\\b\\d{2}-\\d{2}-\\d{2}\\b",
58
+ "flags": "g",
59
+ "confidence": 0.65,
60
+ "domains": [
61
+ "financial"
62
+ ],
63
+ "description": "UK bank sort code (XX-XX-XX)",
64
+ "examples": [
65
+ "12-34-56"
66
+ ],
67
+ "falsePositiveNotes": "Also matches dates in dd-mm-yy format"
68
+ },
69
+ {
70
+ "id": "regex:gb:bank_account",
71
+ "entityType": "OTHER",
72
+ "pattern": "\\b\\d{7,8}\\b",
73
+ "flags": "g",
74
+ "confidence": 0.3,
75
+ "domains": [
76
+ "financial"
77
+ ],
78
+ "description": "UK bank account number (7-8 digits)",
79
+ "examples": [
80
+ "12345678"
81
+ ],
82
+ "falsePositiveNotes": "Extremely broad — disabled by default in low-sensitivity mode"
83
+ },
84
+ {
85
+ "id": "regex:gb:vat",
86
+ "entityType": "SSN",
87
+ "pattern": "\\b(?:GB)?\\d{3}\\s?\\d{4}\\s?\\d{2}(?:\\s?\\d{3})?\\b",
88
+ "flags": "gi",
89
+ "confidence": 0.75,
90
+ "domains": [
91
+ "financial",
92
+ "legal"
93
+ ],
94
+ "description": "UK VAT number (GB + 9 or 12 digits)",
95
+ "examples": [
96
+ "GB123 4567 89",
97
+ "GB123456789"
98
+ ]
99
+ },
100
+ {
101
+ "id": "regex:gb:phone_landline",
102
+ "entityType": "PHONE",
103
+ "pattern": "\\b0\\d{4}\\s?\\d{6}\\b",
104
+ "flags": "g",
105
+ "confidence": 0.8,
106
+ "domains": [
107
+ "contact"
108
+ ],
109
+ "description": "UK landline phone number (e.g., 020 7946 0958)",
110
+ "examples": [
111
+ "01234 567890",
112
+ "02079 460958"
113
+ ]
114
+ },
115
+ {
116
+ "id": "regex:gb:phone_mobile",
117
+ "entityType": "PHONE",
118
+ "pattern": "\\b07\\d{3}\\s?\\d{6}\\b",
119
+ "flags": "g",
120
+ "confidence": 0.85,
121
+ "domains": [
122
+ "contact"
123
+ ],
124
+ "description": "UK mobile phone number (07XXX XXXXXX)",
125
+ "examples": [
126
+ "07911 123456"
127
+ ]
128
+ },
129
+ {
130
+ "id": "regex:gb:postcode",
131
+ "entityType": "ADDRESS",
132
+ "pattern": "\\b[A-Z]{1,2}\\d[A-Z\\d]?\\s?\\d[A-Z]{2}\\b",
133
+ "flags": "gi",
134
+ "confidence": 0.8,
135
+ "domains": [
136
+ "contact"
137
+ ],
138
+ "description": "UK postcode (e.g., SW1A 1AA, EC2A 1NT, M1 1AA)",
139
+ "examples": [
140
+ "SW1A 1AA",
141
+ "EC2A 1NT",
142
+ "M1 1AA",
143
+ "B33 8TH"
144
+ ]
145
+ },
146
+ {
147
+ "id": "regex:gb:currency_words",
148
+ "entityType": "CURRENCY",
149
+ "pattern": "(?:in\\s+(?:the\\s+)?(?:amount|sum)\\s+of|pay(?:able)?(?:\\s+the\\s+(?:amount|sum))?\\s+of)\\s+[\\p{L}\\s-]+(?:pounds?|pence|sterling)\\b",
150
+ "flags": "giu",
151
+ "confidence": 0.9,
152
+ "domains": [
153
+ "financial"
154
+ ],
155
+ "description": "English (UK) amount written in words (e.g., \"in the amount of eight thousand five hundred pounds\")",
156
+ "examples": [
157
+ "in the amount of eight thousand five hundred pounds"
158
+ ]
159
+ },
160
+ {
161
+ "id": "regex:gb:street",
162
+ "entityType": "ADDRESS",
163
+ "pattern": "\\b\\d{1,4}[A-Z]?\\s+[A-Z][\\w]+(?:\\s+[A-Z][\\w]+)*\\s+(?:Street|St|Road|Rd|Avenue|Ave|Lane|Ln|Drive|Dr|Close|Cl|Crescent|Cres|Terrace|Terr|Place|Pl|Gardens|Gdns|Grove|Way|Court|Ct|Square|Sq|Mews|Row|Rise|Hill|Park|Gate|Walk|Green|Parade|Wharf)\\.?\\b",
164
+ "flags": "gi",
165
+ "confidence": 0.85,
166
+ "domains": [
167
+ "contact"
168
+ ],
169
+ "description": "UK street address (number + street name + type)",
170
+ "examples": [
171
+ "10 Downing Street",
172
+ "221B Baker Street",
173
+ "42 Oxford Road"
174
+ ]
175
+ },
176
+ {
177
+ "id": "regex:gb:company",
178
+ "entityType": "COMPANY",
179
+ "pattern": "[\\p{L}][\\p{L}\\s&.']+(?:,?\\s+)?(?:Ltd\\.?|PLC|LLP|L\\.L\\.P\\.)\\b",
180
+ "flags": "gu",
181
+ "confidence": 0.85,
182
+ "domains": [
183
+ "legal",
184
+ "financial"
185
+ ],
186
+ "description": "UK company name with legal suffix (Ltd, PLC, LLP)",
187
+ "examples": [
188
+ "Barclays PLC",
189
+ "Tesco Ltd",
190
+ "Deloitte LLP"
191
+ ]
192
+ }
193
+ ]
194
+ }
package/rules/ie.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "region": "ie",
3
+ "rules": [
4
+ {
5
+ "id": "regex:ie:pps-number",
6
+ "entityType": "SSN",
7
+ "pattern": "\\b\\d{7}[A-W][ABWTXZ]?\\b",
8
+ "flags": "gi",
9
+ "confidence": 0.9,
10
+ "domains": [
11
+ "identity",
12
+ "hr"
13
+ ],
14
+ "description": "Irish PPS (Personal Public Service) number",
15
+ "examples": [
16
+ "1234567T",
17
+ "1234567TW"
18
+ ],
19
+ "validate": "pps"
20
+ },
21
+ {
22
+ "id": "regex:ie:phone",
23
+ "entityType": "PHONE",
24
+ "pattern": "\\b(?:\\+?353[\\s-]?|0)[1-9]\\d?[\\s-]?\\d{3}[\\s-]?\\d{3,4}\\b",
25
+ "flags": "g",
26
+ "confidence": 0.8,
27
+ "domains": [
28
+ "contact"
29
+ ],
30
+ "description": "Irish phone number"
31
+ },
32
+ {
33
+ "id": "regex:ie:eircode",
34
+ "entityType": "ADDRESS",
35
+ "pattern": "\\b[A-Z]\\d{2}\\s?[A-Z0-9]{4}\\b",
36
+ "flags": "gi",
37
+ "confidence": 0.8,
38
+ "domains": [
39
+ "contact"
40
+ ],
41
+ "description": "Irish Eircode postal code",
42
+ "examples": [
43
+ "A65 F4E2",
44
+ "D08YX4T"
45
+ ]
46
+ }
47
+ ]
48
+ }