PyNon is a simple Python tool that uses Microsoft Presidio to anonymize text containing personally identifiable information (PII).
- Detects and anonymizes PII in English text using Presidio Analyzer and Anonymizer
- Command-line interface for quick anonymization
- Python 3.7+
- presidio-analyzer
- presidio-anonymizer
- spaCy (with the
en_core_web_lgmodel)
- Clone this repository:
git clone https://github.com/samuelcotterall/pynon.git cd pynon - (Recommended) Create and activate a virtual environment:
python3 -m venv .venv source .venv/bin/activate - Install dependencies:
pip install -r requirements.txt
- Install the required spaCy model:
python -m spacy download en_core_web_lg
python anon.py 'My name is John Doe and my phone number is 555-123-4567.'You can use the provided CLI script:
./pynon 'My name is John Doe and my phone number is 555-123-4567.'If you want to run pynon from anywhere, add it to your PATH or symlink it to a directory in your PATH.
Note: Always activate your virtual environment before running the tool to ensure all dependencies and models are available.
If you see an error about the spaCy model not being installed, run:
python -m spacy download en_core_web_lgMIT