Metadata-Version: 2.5
Name: tarja-presidio
Version: 0.1.1
Summary: Brazilian identifiers for Microsoft/Data Privacy Stack Presidio, powered by tarja. / Identificadores brasileiros p/ o Presidio, via tarja.
Project-URL: Homepage, https://macmaia.github.io/tarja/
Project-URL: Source, https://github.com/macmaia/tarja
Project-URL: Issues, https://github.com/macmaia/tarja/issues
Project-URL: Changelog, https://github.com/macmaia/tarja/blob/main/packages/tarja-presidio/CHANGELOG.md
Author-email: Maria Alice Maia <tarja@micah6ai.com>
License-Expression: Apache-2.0
Keywords: anonymisation,brazil,cnpj,cpf,dlp,lgpd,pii,pii-detection,portuguese,presidio,redaction
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: Portuguese (Brazilian)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: presidio-analyzer>=2.2
Requires-Dist: tarja<1.0,>=0.12
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Description-Content-Type: text/markdown

# tarja-presidio

**EN** · Brazilian identifiers for [Presidio](https://github.com/data-privacy-stack/presidio), powered by [tarja](https://github.com/macmaia/tarja). One `PatternRecognizer` per tarja entity (CPF, alphanumeric CNPJ, CNS, CNJ, CNM, CIB...), with check-digit validation and Portuguese context words.

**PT** · Identificadores brasileiros p/ o Presidio, via tarja. 1 `PatternRecognizer` por entidade do tarja, c/ validação de DV e palavras de contexto em pt-BR.

EN: install / PT: instalar:

```bash
pip install tarja-presidio
```

EN: from a clone, for development / PT: a partir de um clone, p/ desenvolver:

```bash
pip install -e . -e "packages/tarja-presidio[dev]"
```

```python
from presidio_analyzer import AnalyzerEngine, RecognizerRegistry
import tarja_presidio

registry = RecognizerRegistry(supported_languages=["pt"])
registry.load_predefined_recognizers(languages=["pt"])  # EN: optional / PT: opcional
tarja_presidio.register(registry)  # EN: all tarja entities / PT: todas as entidades do tarja

engine = AnalyzerEngine(registry=registry, supported_languages=["pt"])  # EN: needs a pt NLP config / PT: precisa de config NLP pt
engine.analyze("Paciente CPF 529.982.247-25, cartao SUS 898 0000 0004 3208", language="pt")
```

EN: scores, from 0.1.1 on. A **verified check digit** reaches Presidio at 1.0, which is the 8 tier-N1
entities that need no context word. A wrong check digit is dropped. Everything else keeps a base score and
relies on Presidio's context enhancer, so filter with `score_threshold`: the entities that need context in
tarja (CEP, CNH, RENAVAM, PIX key, CIB, IPTU, matricula) start at 0.1, and the two that are format-only
without context (plate, phone) start at 0.5. Until 0.1.0 those two arrived at 1.0, which told Presidio a
format match had been verified. Full walkthrough: https://macmaia.github.io/tarja/presidio.html
PT: scores, da 0.1.1 em diante. DV conferido chega com 1.0, q são as 8 entidades N1 sem contexto. DV errado é
descartado. O resto mantém score base e depende do enhancer de contexto, então filtre c/ `score_threshold`.
Até a 0.1.0 placa e telefone chegavam com 1.0, dizendo ao Presidio q formato tinha sido verificado.
