Pitfalls and false positives
Presidio is not magic. Product names get flagged as people. Version strings get flagged as phone numbers. Domain-specific jargon sails through unscrubbed. Knowing the failure modes is what separates a toy integration from a production one.
Flashcards: Flashcards
Loading practice…
def _ensure_engines(self):
if self._analyzer is not None:
return
try:
from presidio_analyzer import AnalyzerEngine
from presidio_anonymizer import AnonymizerEngine
self._analyzer = AnalyzerEngine()
self._anonymizer = AnonymizerEngine()
except Exception as e:
logger.warning(f"Presidio unavailable ({e}); anonymizer will be a no-op.")
self._analyzer = False
self._anonymizer = FalseThe lazy init also degrades safely: if Presidio is missing or fails to load, the anonymizer becomes a no-op and the pipeline continues. That prevents the privacy layer from being a hard dependency for local experimentation.
AI prompt: Try it: audit your own question set
Loading practice…
Quiz: Quiz
Loading practice…