@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/rules/us.json
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
{
|
|
2
|
+
"region": "us",
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "regex:us:ssn",
|
|
6
|
+
"entityType": "SSN",
|
|
7
|
+
"pattern": "\\b(?!000|666|9\\d{2})[0-8]\\d{2}-(?!00)\\d{2}-(?!0000)\\d{4}\\b",
|
|
8
|
+
"flags": "g",
|
|
9
|
+
"confidence": 0.92,
|
|
10
|
+
"domains": [
|
|
11
|
+
"identity",
|
|
12
|
+
"hr",
|
|
13
|
+
"financial"
|
|
14
|
+
],
|
|
15
|
+
"description": "US Social Security Number (SSA-valid ranges, hyphenated)",
|
|
16
|
+
"examples": [
|
|
17
|
+
"123-45-6789",
|
|
18
|
+
"078-05-1120"
|
|
19
|
+
],
|
|
20
|
+
"falsePositiveNotes": "Hyphenated form only — un-hyphenated SSNs are indistinguishable from other 9-digit IDs."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "regex:us:itin",
|
|
24
|
+
"entityType": "SSN",
|
|
25
|
+
"pattern": "\\b9\\d{2}-(?:5\\d|6[0-5]|7\\d|8[0-8]|9[0-24-9])-\\d{4}\\b",
|
|
26
|
+
"flags": "g",
|
|
27
|
+
"confidence": 0.85,
|
|
28
|
+
"domains": [
|
|
29
|
+
"identity",
|
|
30
|
+
"financial"
|
|
31
|
+
],
|
|
32
|
+
"description": "US IRS Individual Taxpayer Identification Number (ITIN)",
|
|
33
|
+
"examples": [
|
|
34
|
+
"912-70-1234",
|
|
35
|
+
"987-88-4321"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "regex:us:ein",
|
|
40
|
+
"entityType": "SSN",
|
|
41
|
+
"pattern": "\\b(?:0[1-6]|1[0-6]|2[0-7]|[35]\\d|[468][0-8]|7[1-7]|9[0-58-9])-\\d{7}\\b",
|
|
42
|
+
"flags": "g",
|
|
43
|
+
"confidence": 0.8,
|
|
44
|
+
"domains": [
|
|
45
|
+
"financial",
|
|
46
|
+
"legal"
|
|
47
|
+
],
|
|
48
|
+
"description": "US IRS Employer Identification Number (EIN)",
|
|
49
|
+
"examples": [
|
|
50
|
+
"12-3456789",
|
|
51
|
+
"87-6543210"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"id": "regex:us:passport",
|
|
56
|
+
"entityType": "SSN",
|
|
57
|
+
"pattern": "\\b[A-Z]?\\d{8,9}\\b",
|
|
58
|
+
"flags": "g",
|
|
59
|
+
"confidence": 0.35,
|
|
60
|
+
"domains": [
|
|
61
|
+
"identity"
|
|
62
|
+
],
|
|
63
|
+
"description": "US passport number (9 alphanumerics)",
|
|
64
|
+
"examples": [
|
|
65
|
+
"123456789",
|
|
66
|
+
"A12345678"
|
|
67
|
+
],
|
|
68
|
+
"falsePositiveNotes": "Very broad — best paired with the word \"passport\" in context."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"id": "regex:us:mbi",
|
|
72
|
+
"entityType": "SSN",
|
|
73
|
+
"pattern": "\\b[1-9][A-HJ-NP-Z][A-HJ-NP-Z0-9]\\d-?[A-HJ-NP-Z][A-HJ-NP-Z0-9]\\d-?[A-HJ-NP-Z]{2}\\d{2}\\b",
|
|
74
|
+
"flags": "g",
|
|
75
|
+
"confidence": 0.95,
|
|
76
|
+
"domains": [
|
|
77
|
+
"medical",
|
|
78
|
+
"identity"
|
|
79
|
+
],
|
|
80
|
+
"description": "Medicare Beneficiary Identifier (MBI, replaces SSN-based HICN)",
|
|
81
|
+
"examples": [
|
|
82
|
+
"1EG4-TE5-MK73",
|
|
83
|
+
"1AB2CD3EF45"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": "regex:us:dea",
|
|
88
|
+
"entityType": "SSN",
|
|
89
|
+
"pattern": "\\b[ABCDEFGHJKLMPRSTUX][A-Z]\\d{7}\\b",
|
|
90
|
+
"flags": "g",
|
|
91
|
+
"confidence": 0.92,
|
|
92
|
+
"domains": [
|
|
93
|
+
"medical"
|
|
94
|
+
],
|
|
95
|
+
"description": "US DEA registration number (prescriber identifier, with checksum)",
|
|
96
|
+
"examples": [
|
|
97
|
+
"BJ1234563",
|
|
98
|
+
"AS9876547"
|
|
99
|
+
],
|
|
100
|
+
"validate": "dea"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "regex:us:npi",
|
|
104
|
+
"entityType": "SSN",
|
|
105
|
+
"pattern": "\\b\\d{10}\\b",
|
|
106
|
+
"flags": "g",
|
|
107
|
+
"confidence": 0.9,
|
|
108
|
+
"domains": [
|
|
109
|
+
"medical"
|
|
110
|
+
],
|
|
111
|
+
"description": "US National Provider Identifier (NPI, Luhn-validated with 80840 prefix)",
|
|
112
|
+
"examples": [
|
|
113
|
+
"1234567893"
|
|
114
|
+
],
|
|
115
|
+
"falsePositiveNotes": "Raw 10 digits is broad — Luhn check makes the false-positive rate negligible.",
|
|
116
|
+
"validate": "npi"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "regex:us:routing",
|
|
120
|
+
"entityType": "OTHER",
|
|
121
|
+
"pattern": "\\b(?:0\\d|1[0-2]|2[1-9]|3[0-2]|6[1-9]|7[0-2]|80)\\d{7}\\b",
|
|
122
|
+
"flags": "g",
|
|
123
|
+
"confidence": 0.9,
|
|
124
|
+
"domains": [
|
|
125
|
+
"financial"
|
|
126
|
+
],
|
|
127
|
+
"description": "US ABA bank routing number (9 digits, valid prefix + mod-10 checksum)",
|
|
128
|
+
"examples": [
|
|
129
|
+
"021000021",
|
|
130
|
+
"011000015"
|
|
131
|
+
],
|
|
132
|
+
"validate": "aba"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"id": "regex:us:phone",
|
|
136
|
+
"entityType": "PHONE",
|
|
137
|
+
"pattern": "(?:\\+1[-.\\s]?)?(?:\\(([2-9]\\d{2})\\)[-.\\s]?|([2-9]\\d{2})[-.\\s])([2-9]\\d{2})[-.\\s](\\d{4})\\b",
|
|
138
|
+
"flags": "g",
|
|
139
|
+
"confidence": 0.85,
|
|
140
|
+
"domains": [
|
|
141
|
+
"contact"
|
|
142
|
+
],
|
|
143
|
+
"description": "US/NANP phone number (e.g., (555) 555-1234, 555-555-1234, +1 555.555.1234)",
|
|
144
|
+
"examples": [
|
|
145
|
+
"(415) 555-2671",
|
|
146
|
+
"415-555-2671",
|
|
147
|
+
"+1 415 555 2671",
|
|
148
|
+
"415.555.2671"
|
|
149
|
+
],
|
|
150
|
+
"falsePositiveNotes": "Bare 10-digit runs are excluded to avoid colliding with SSN/account numbers."
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"id": "regex:us:zip_plus4",
|
|
154
|
+
"entityType": "ADDRESS",
|
|
155
|
+
"pattern": "\\b\\d{5}-\\d{4}\\b",
|
|
156
|
+
"flags": "g",
|
|
157
|
+
"confidence": 0.8,
|
|
158
|
+
"domains": [
|
|
159
|
+
"contact"
|
|
160
|
+
],
|
|
161
|
+
"description": "US ZIP+4 postal code",
|
|
162
|
+
"examples": [
|
|
163
|
+
"94103-1741",
|
|
164
|
+
"10001-2345"
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"id": "regex:us:street",
|
|
169
|
+
"entityType": "ADDRESS",
|
|
170
|
+
"pattern": "\\b\\d{1,5}[A-Z]?\\s+(?:[NSEW]\\.?\\s+|North\\s+|South\\s+|East\\s+|West\\s+)?(?:\\d{1,4}(?:st|nd|rd|th)|[A-Z]\\w*)(?:\\s+(?:\\d{1,4}(?:st|nd|rd|th)|[A-Z]\\w*))*\\s+(?:Street|St|Road|Rd|Avenue|Ave|Boulevard|Blvd|Lane|Ln|Drive|Dr|Court|Ct|Circle|Cir|Place|Pl|Square|Sq|Terrace|Ter|Trail|Trl|Parkway|Pkwy|Highway|Hwy|Way|Plaza|Plz|Loop|Alley|Aly|Crossing|Xing|Expressway|Expy|Freeway|Fwy)\\b\\.?",
|
|
171
|
+
"flags": "gi",
|
|
172
|
+
"confidence": 0.85,
|
|
173
|
+
"domains": [
|
|
174
|
+
"contact"
|
|
175
|
+
],
|
|
176
|
+
"description": "US street address (number + name + USPS suffix)",
|
|
177
|
+
"examples": [
|
|
178
|
+
"1600 Pennsylvania Ave",
|
|
179
|
+
"350 5th Avenue",
|
|
180
|
+
"1 Infinite Loop",
|
|
181
|
+
"742 Evergreen Terrace"
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"id": "regex:us:currency_words",
|
|
186
|
+
"entityType": "CURRENCY",
|
|
187
|
+
"pattern": "(?:in\\s+(?:the\\s+)?(?:amount|sum)\\s+of|pay(?:able)?(?:\\s+the\\s+(?:amount|sum))?\\s+of)\\s+[\\p{L}\\s-]+(?:dollars?|cents?)\\b",
|
|
188
|
+
"flags": "giu",
|
|
189
|
+
"confidence": 0.9,
|
|
190
|
+
"domains": [
|
|
191
|
+
"financial"
|
|
192
|
+
],
|
|
193
|
+
"description": "US dollar amount written in words (e.g., \"in the amount of eight thousand five hundred dollars\")",
|
|
194
|
+
"examples": [
|
|
195
|
+
"in the amount of five thousand dollars",
|
|
196
|
+
"payable the sum of two hundred fifty dollars"
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"id": "regex:us:company",
|
|
201
|
+
"entityType": "COMPANY",
|
|
202
|
+
"pattern": "[\\p{L}][\\p{L}\\s&.']+(?:,?\\s+)?(?:Inc\\.?|LLC|L\\.L\\.C\\.|Corp\\.?|Corporation|Co\\.|Company|Ltd\\.?|LP|L\\.P\\.|LLP|L\\.L\\.P\\.|PLLC|P\\.C\\.)\\b",
|
|
203
|
+
"flags": "gu",
|
|
204
|
+
"confidence": 0.85,
|
|
205
|
+
"domains": [
|
|
206
|
+
"legal",
|
|
207
|
+
"financial"
|
|
208
|
+
],
|
|
209
|
+
"description": "US company name with legal suffix (Inc, LLC, Corp, etc.)",
|
|
210
|
+
"examples": [
|
|
211
|
+
"Apple Inc.",
|
|
212
|
+
"Acme LLC",
|
|
213
|
+
"Stark Industries Corp",
|
|
214
|
+
"Wayne Enterprises, Inc."
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
}
|