Skip to main content
Netra SDK provides advanced PII detection with multiple engines: To use the PII detection features provided by Netra SDK:
If you try to use the PII detection utility in Netra SDK without installing this dependency, you will receive an exception. So, always make sure to install the package if you plan to use this utility.

Entity Anonymization Details

Netra SDK uses different anonymization mechanisms based on entity type:
  1. Email Addresses
    • Format-preserving anonymization
    • Maintains @ and . characters
    • Example: john.doe@example.com → fank.fzr@hgbcfxa.zrl
  2. Other Entities
    • Hash-based anonymization with consistent hashing
    • Same entity always produces the same hash
    • Format: <ENTITY_TYPE_hash>
    • Examples:
      • Person: John Doe → <PERSON_6cea57c2>
      • Phone: 555-123-4567 → <PHONE_NUMBER_2dcbf551>
    Important Note: The hashing mechanism is deterministic, meaning that the same entity will always produce the same hash value. This ensures consistency across multiple detections and allows for proper data correlation while maintaining privacy.
    • Format: <ENTITY_TYPE_hash>
    • Examples:
      • Person: John Doe → <PERSON_6cea57c2>
      • Phone: 555-123-4567 → <PHONE_NUMBER_2dcbf551>

Example Results

Original text:
Anonymized text:
Entity mappings:

Verification Features

  • Emails maintain format (contains @ and .)
  • Hashes follow consistent naming convention
  • Entity types are preserved in anonymization
  • Consistent mapping between original and anonymized values

Presidio-based Detection

Regex-based Detection

Chat Message PII Detection

Custom Models for PII Detection

The PresidioPIIDetector supports custom NLP models through the nlp_configuration parameter, allowing you to use specialized models for improved PII detection accuracy. You can configure custom spaCy, Stanza, or transformers models:

NLP Configuration Example

Follow this configuration structure to provide your custom models.

Using Custom spaCy Models

Using Stanza Models

Using Transformers Models

For advanced NER capabilities, you can use transformer-based models: