You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add NER detection engine (GLiNER) and community infrastructure
- Add GLiNER zero-shot NER as alternative detection engine (default),
with automatic fallback to regex when gliner is not installed
- Add --detection-engine CLI flag to switch between ner/regex
- Add NerConfig/DetectionConfig dataclasses and config.json sections
- Add pip install privacy-mask[ner] optional dependency
- Add issue templates (bug, feature, new-rule), PR template, Code of Conduct
- Update architecture diagram to reflect dual-engine design
- Update README with detection engine docs
- Bump version to 0.3.0
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+49-3Lines changed: 49 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,9 +53,12 @@ This matters for compliance too: **GDPR**, **HIPAA**, and other regulations requ
53
53
## Quick Start
54
54
55
55
```bash
56
-
# Install
56
+
# Install (regex engine only)
57
57
pip install privacy-mask
58
58
59
+
# Install with NER engine (recommended)
60
+
pip install privacy-mask[ner]
61
+
59
62
# Mask a screenshot
60
63
privacy-mask mask screenshot.png
61
64
@@ -96,8 +99,44 @@ privacy-mask follows the [agentskills.io](https://agentskills.io) SKILL.md stand
96
99
97
100
---
98
101
102
+
## Detection Engines
103
+
104
+
privacy-mask supports two detection engines, switchable via config or CLI:
105
+
106
+
| Engine | Description | Install |
107
+
|--------|-------------|---------|
108
+
|**NER** (default) | Zero-shot Named Entity Recognition via [GLiNER](https://github.com/urchade/GLiNER). Detects person names, addresses, organizations, dates of birth, medical conditions, and more — without regex. |`pip install privacy-mask[ner]`|
109
+
|**Regex**| 47 hand-tuned regex rules covering 15+ countries. No extra dependencies. |`pip install privacy-mask`|
110
+
111
+
```bash
112
+
# Default: NER engine (requires privacy-mask[ner])
You can also set the default engine in `config.json`:
120
+
121
+
```json
122
+
{
123
+
"detection": { "engine": "ner" }
124
+
}
125
+
```
126
+
127
+
---
128
+
99
129
## What It Detects
100
130
131
+
### NER Engine
132
+
133
+
Configurable entity types (zero-shot, no training needed):
134
+
- Person names, street addresses, organization names
135
+
- Dates of birth, medical conditions, license plate numbers
136
+
- Custom entity types via `config.json``ner.entity_types`
137
+
138
+
### Regex Engine
139
+
101
140
**47 regex rules** covering **15+ countries**:
102
141
103
142
| Category | Rules |
@@ -119,9 +158,13 @@ privacy-mask follows the [agentskills.io](https://agentskills.io) SKILL.md stand
119
158
120
159
1.**OCR** — Dual-engine: Tesseract + RapidOCR extract text with bounding boxes. Multi-strategy preprocessing (grayscale, binarization, contrast enhancement) with confidence-based merge for maximum accuracy.
121
160
122
-
2.**Detect** — 47 compiled regex rules scan OCR results. Overlapping detections on nearby bounding boxes are merged automatically.
161
+
2.**Line Grouping** — OCR results are grouped into logical text lines using vertical overlap analysis.
123
162
124
-
3.**Mask** — Matched regions are blurred (default) or filled with solid color. Output is saved as a new file or overwrites the original.
163
+
3.**Detect** — Switchable engine:
164
+
-**NER** (default) — GLiNER zero-shot NER identifies entities (names, addresses, etc.) without regex
165
+
-**Regex** — 47 compiled regex rules scan for structured patterns (IDs, phone numbers, API keys)
166
+
167
+
4.**Mask** — Matched regions are blurred (default) or filled with solid color. Output is saved as a new file or overwrites the original.
125
168
126
169
---
127
170
@@ -143,6 +186,9 @@ privacy-mask mask screenshot.png --method fill
143
186
# Choose OCR engine (tesseract, rapidocr, or combined)
0 commit comments