@stll/anonymize 0.0.2
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 +27 -0
- package/README.md +79 -0
- package/dist/index.d.ts +939 -0
- package/dist/index.js +4969 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Stella
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any
|
|
6
|
+
person obtaining a copy of this software and associated
|
|
7
|
+
documentation files (the "Software"), to deal in the
|
|
8
|
+
Software without restriction, including without
|
|
9
|
+
limitation the rights to use, copy, modify, merge,
|
|
10
|
+
publish, distribute, sublicense, and/or sell copies of
|
|
11
|
+
the Software, and to permit persons to whom the
|
|
12
|
+
Software is furnished to do so, subject to the
|
|
13
|
+
following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice
|
|
16
|
+
shall be included in all copies or substantial portions
|
|
17
|
+
of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
20
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
21
|
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
22
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
23
|
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
24
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
25
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
26
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
27
|
+
DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src=".github/assets/banner.png" alt="Stella" width="100%" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# @stll/anonymize
|
|
6
|
+
|
|
7
|
+
Multi-layer PII detection and anonymization pipeline.
|
|
8
|
+
Regex, NER, deny lists, coreference resolution, and
|
|
9
|
+
legal form detection across 20+ languages.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Regex detector** — IBAN, email, phone, credit card,
|
|
14
|
+
Czech birth numbers, dates (22 languages), company IDs
|
|
15
|
+
- **Trigger phrases** — Czech, German, English, French,
|
|
16
|
+
Spanish, Italian, Polish, Hungarian, Romanian, Swedish
|
|
17
|
+
- **Name corpus** — first names, surnames, titles with
|
|
18
|
+
Czech/Slovak declension handling
|
|
19
|
+
- **Legal form detection** — s.r.o., GmbH, Ltd., S.A.,
|
|
20
|
+
and 1000+ forms across 20+ countries
|
|
21
|
+
- **GLiNER NER** — zero-shot named entity recognition
|
|
22
|
+
- **Deny-list gazetteer** — workspace-scoped Aho-Corasick
|
|
23
|
+
+ fuzzy matching
|
|
24
|
+
- **Coreference** — tracks "dále jen" / "hereinafter"
|
|
25
|
+
aliases with Czech declension variants
|
|
26
|
+
- **Confidence boosting** — context-aware score adjustment
|
|
27
|
+
- **False positive filtering** — template placeholders,
|
|
28
|
+
section numbers, generic roles
|
|
29
|
+
- **Operators** — replace (reversible) and redact
|
|
30
|
+
- **De-anonymization** — reverse replacements with key
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @stll/anonymize
|
|
36
|
+
# Optional: install data package for deny lists
|
|
37
|
+
npm install @stll/anonymize-data
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { runPipeline } from '@stll/anonymize'
|
|
44
|
+
|
|
45
|
+
const entities = await runPipeline({
|
|
46
|
+
fullText: text,
|
|
47
|
+
config: {
|
|
48
|
+
labels: ['person', 'organization', 'address',
|
|
49
|
+
'date', 'iban', 'phone number'],
|
|
50
|
+
threshold: 0.5,
|
|
51
|
+
enableRegex: true,
|
|
52
|
+
enableTriggerPhrases: true,
|
|
53
|
+
enableLegalForms: true,
|
|
54
|
+
enableNameCorpus: true,
|
|
55
|
+
},
|
|
56
|
+
gazetteerEntries: [],
|
|
57
|
+
})
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Architecture
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
text → [regex] → entities₁ ─┐
|
|
64
|
+
text → [triggers] → entities₂ ─┤
|
|
65
|
+
text → [legal forms] → entities₃ ─┤
|
|
66
|
+
text → [name corpus] → entities₄ ─┼→ merge → coref → boost → filter → result
|
|
67
|
+
text → [gazetteer] → entities₅ ─┤
|
|
68
|
+
text → [GLiNER NER] → entities₆ ─┘
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Built on
|
|
72
|
+
|
|
73
|
+
- [@stll/text-search](https://github.com/stella/text-search) — multi-engine search orchestrator
|
|
74
|
+
- [@stll/stdnum](https://github.com/stella/stdnum) — identifier validation (IBAN, IČO, RČ)
|
|
75
|
+
- [@stll/anonymize-data](https://github.com/stella/anonymize) — deny-list dictionaries
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
MIT
|