Skip to main content
PIILO logo

PIILO

Personally Identifiable Information Labeling and Obfuscation

Tests License: Apache 2.0 Python 3.10+ Paper

What is PIILO?

PIILO is an open-source deidentification system for student-generated text. Most deidentification tools stop at finding personally identifiable information and replace it with a redaction marker such as <PERSON>. PIILO treats obfuscation as equally important: it replaces identifiers with realistic, contextually plausible surrogates, an approach known as HIPS (hiding in plain sight).

Redaction markers advertise exactly where sensitive content used to be and make the resulting text awkward to read or model. Surrogates keep the document natural, so deidentified text stays usable for downstream research.

Written by John Williams -- (714) 328-9989 -- johnwilliams@yahoo.com
                          |
                          v
Written by Stephen Yu    -- 272-947-1857   -- harveylisa@yahoo.com

Detection combines spaCy's named entity recognition with a rule- and feature-based recognizer adapted from the third-place solution to the Kaggle PII Detection Removal from Educational Data competition, which uses gradient-boosted trees over name lists and lexical features rather than a transformer.

Installation

pip install piilo-anonymizer

The package is distributed as piilo-anonymizer on PyPI, but you still import piilo and run the obfuscate command — the shorter name was already taken. The name tables and XGBoost models PIILO needs (roughly 120 MB) are bundled in the release, so pip install gives a fully working package with nothing else to download.

On macOS, XGBoost also needs the OpenMP runtime: brew install libomp.

Note Those model files are not stored in the git repository, only in the published package. If you install from a clone (pip install -e .) you must fetch them separately — see DEV_README.md.

Usage

As a Python package

import piilo

texts = [
    "test string without identifiers",
    "My name is Antonio. Email: Antonio99@yahoo.com",
]

# Locate PII. Returns presidio_analyzer.RecognizerResult objects.
results = [piilo.analyze(text) for text in texts]

# Locate and obfuscate PII with hiding-in-plain-sight surrogates.
cleaned = [piilo.anonymize(text).text for text in texts]

The models load on first use rather than at import, so the first call is slower than those that follow.

From the command line

obfuscate anonymizes every .txt file in a directory:

obfuscate --dir ./essays --file_format csv
Option Description
--dir Directory containing text files to anonymize. Defaults to the current directory, with a confirmation prompt.
--entities Restrict analysis to specific entity types. Defaults to all recognizers.
--language Language of the text files. Currently only en.
--file_format csv (one row per file) or txt (one output file per input).

With a graphical interface

A Streamlit app is included for interactive exploration:

pip install -e ".[app]"
streamlit run app.py

A packaged desktop build is also available from linguisticanalysistools.org.

Detected entities

Entity Obfuscation
PERSON Surrogate name matched on inferred gender and country of origin
EMAIL_ADDRESS Generated address
PHONE_NUMBER Generated number
URL Generated URL
STREET_ADDRESS Generated address
ID_NUM Generated identifier
DATE_TIME Date shifted while preserving format
LOCATION Preserved

Surrogates are consistent within a document: the same name is always replaced by the same surrogate, so coreference survives deidentification.

Development

See DEV_README.md for the package layout, how to obtain the model files, and how to build a release.

pip install -e ".[dev]"
pytest

Tests that need the model files skip automatically when those files are absent.

Citation

If you use PIILO in your research, please cite:

@article{holmes2023piilo,
  title={PIILO: an open-source system for personally identifiable information labeling and obfuscation},
  author={Holmes, Langdon and Crossley, Scott and Sikka, Harshvardhan and Morris, Wesley},
  journal={Information and Learning Sciences},
  volume={124},
  number={9/10},
  pages={266--284},
  year={2023},
  publisher={Emerald Publishing Limited},
  doi={10.1108/ILS-04-2023-0032}
}

License

Apache License 2.0. See LICENSE.

Metadata

Release files for piilo-anonymizer 0.3.0

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

Source distribution (sdist)

Source distribution for piilo-anonymizer 0.3.0
File Size Uploaded
piilo_anonymizer-0.3.0.tar.gz 69.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for piilo-anonymizer 0.3.0
File Interpreter ABI Platform
piilo_anonymizer-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 139.0 MB

Release files / piilo_anonymizer-0.3.0.tar.gz

Download URL piilo_anonymizer-0.3.0.tar.gz
Size 69.3 MB
Tags Source
SHA-256 checksum
How to use checksums
38008c05816dd469aedf9adb732e0b2414605d2ed110d979e5d1f88b8b9e24a0
BLAKE2b-256 checksum
How to use checksums
a7e88372aaf614463a4767b1e724753d597e0656758e0702656a56edbdf4444e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.5

Release files / piilo_anonymizer-0.3.0-py3-none-any.whl

Download URL piilo_anonymizer-0.3.0-py3-none-any.whl
Size 69.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e1b2a9e4db098087126ca0e6f3f153406f0560e64b5b906f3751d7a8162ca2aa
BLAKE2b-256 checksum
How to use checksums
03beb157f6590d23fb0c6e208fe55087c71d956feb11f5524bd0a727c2dca5c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.5

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

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