detect() result is now a required transform argument (0.4.0)
Browse files
README.md
CHANGED
|
@@ -42,8 +42,8 @@ brew install tesseract
|
|
| 42 |
|
| 43 |
**`detect()` is the core primitive** — it finds every PII entity with its
|
| 44 |
location, category, and confidence. The transforms (redact / anonymize /
|
| 45 |
-
de-identify)
|
| 46 |
-
|
| 47 |
|
| 48 |
### Image — text + visual PII in document images
|
| 49 |
|
|
@@ -61,9 +61,9 @@ for e in entities:
|
|
| 61 |
print(e.kind, e.category, e.bbox, e.text, e.score)
|
| 62 |
|
| 63 |
# One detection, three possible outputs:
|
| 64 |
-
redactor.redact("page.jpg", entities
|
| 65 |
-
redactor.anonymize("page.jpg", entities
|
| 66 |
-
deid = redactor.deidentify("page.jpg", entities
|
| 67 |
deid.image.save("deidentified.png"); deid.mapping.to_dict()
|
| 68 |
```
|
| 69 |
|
|
@@ -79,9 +79,9 @@ spans = r.detect(text) # char-offset spans — the core call
|
|
| 79 |
for s in spans:
|
| 80 |
print(s.category, s.start, s.end, s.text, s.score)
|
| 81 |
|
| 82 |
-
r.redact(text, mask="[REDACTED]"
|
| 83 |
-
r.anonymize(text, spans
|
| 84 |
-
r.deidentify(text, spans
|
| 85 |
```
|
| 86 |
|
| 87 |
### De-identify and anonymize (v0.2.0+, both modalities)
|
|
|
|
| 42 |
|
| 43 |
**`detect()` is the core primitive** — it finds every PII entity with its
|
| 44 |
location, category, and confidence. The transforms (redact / anonymize /
|
| 45 |
+
de-identify) take its result as a required argument: detection always runs
|
| 46 |
+
first, once, and every transform consumes its output.
|
| 47 |
|
| 48 |
### Image — text + visual PII in document images
|
| 49 |
|
|
|
|
| 61 |
print(e.kind, e.category, e.bbox, e.text, e.score)
|
| 62 |
|
| 63 |
# One detection, three possible outputs:
|
| 64 |
+
redactor.redact("page.jpg", entities).save("redacted.png")
|
| 65 |
+
redactor.anonymize("page.jpg", entities).save("anonymized.png")
|
| 66 |
+
deid = redactor.deidentify("page.jpg", entities)
|
| 67 |
deid.image.save("deidentified.png"); deid.mapping.to_dict()
|
| 68 |
```
|
| 69 |
|
|
|
|
| 79 |
for s in spans:
|
| 80 |
print(s.category, s.start, s.end, s.text, s.score)
|
| 81 |
|
| 82 |
+
r.redact(text, spans, mask="[REDACTED]")
|
| 83 |
+
r.anonymize(text, spans)
|
| 84 |
+
r.deidentify(text, spans) # .text + .mapping
|
| 85 |
```
|
| 86 |
|
| 87 |
### De-identify and anonymize (v0.2.0+, both modalities)
|