Skip to main content

PrivMasker

PrivMasker, to narzędzie do anonimizacji danych osobowych i wrażliwych w dokumentach. Biblioteka umożliwia automatyczną detekcję oraz szybkie i skuteczne maskowanie danych osobowych i wrażliwychw różnego typu dokumentach. W zależności od rodzaju tekstu i preferencji użytkownika możliwy jest opcjonalny wybór maskowanych komponentów:

  • imię i nazwisko
  • dane kontaktowe (nr. telefonów, adresy e-mail)
  • adresy fizyczne
  • daty
  • numery identyfikacyjne
  • kwoty

Instalacja

1. Zainstaluj PrivMaskera

pip install priv_masker

2. Pobierz i zainstaluj model Spacy

  • pobierz pl_nask 0.0.5
  • zainstaluj:
python -m pip install <PATH_TO_MODEL/pl_nask-0.0.5.tar.gz>

Użycie

import spacy
from priv_masker import add_pipeline, analyse_text, AnalyseOut

# dostępne maski (False - wyłączone)
masked_components = {
    'date_mask': True,
    'persname_mask': True,
    'contact_mask': True,
    'address_mask': True,
    'id_numbers_mask': True,
    'cash_mask': True,
    'orgname_mask': True
}

nlp = spacy.load('pl_nask')
nlp = add_pipeline(nlp)

text = "Halina Kowalska (tel. 228595959, adres e-mail: halina.kowalska@xyz.com), reprezentująca Stowarzyszenie Przedsiębiorców Polskich, zamieszkała w Warszawie przy ulicy Juliusza Słowackiego 13/13, identyfikująca się numerem PESEL 76121305873, złożyła w dniu 12 sierpnia 2022 oświadczenie wyjaśniające i uiściła karę grzywny w wysokości 500 złotych."

masked_text = analyse_text(text, nlp, masked_components, out=AnalyseOut.TEXT)
# [XXX] [XXX] (tel. [XXX], adres e-mail: [XXX]), reprezentująca [XXX] [XXX] [XXX], zamieszkała w [XXX] przy [XXX] [XXX] [XXX] [XXX], identyfikująca się numerem PESEL [XXX], złożyła w dniu [XXX] [XXX] [XXX] oświadczenie wyjaśniające i uiściła karę grzywny w wysokości [XXX] złotych.

doc = analyse_text(text, nlp, masked_components, out=AnalyseOut.DOC)  # obiekt Spacy

Wersja

v0.0.4

  • Dodanie kodu PrivMaskera
  • Dodanie dokumentacji
  • Dodanie licencji
Poprzednie wersje

Implementacja

Szczegółowe informacje na temat biblioteki umieszczone są w dokumentacji.

Kontakt

Adam Nowakowski adam.nowakowski@nask.pl | Inez Okulska inez.okulska@nask.pl

Copyright (C) 2022 NASK PIB

Metadata

Release files for priv-masker 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for priv-masker 0.4
File Interpreter ABI Platform Actions
priv_masker-0.4-py3-none-any.whl Python 3 none any Details for priv_masker-0.4-py3-none-any.whl

Release files / priv_masker-0.4-py3-none-any.whl

Download URL priv_masker-0.4-py3-none-any.whl
Size 17.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
b6a18c76b64338ba028bcab32f5d4b6b6326ac7b4298a950d447a0223574b7cb
BLAKE2b-256 checksum
How to use checksums
2011a7757c7a235fa2288fdffa9f705f3f9015079b22594b5a65b38ed7ffd0e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.9

Security for priv-masker 0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page