webfilteringdatabase.com
Home Find Your Solution
Features
Domain Categorization API Real-Time Classification 59 Filtering Categories Offline Database (100M) ML Classification Content Classification
Industries
K-12 Schools Corporate Healthcare Government ISPs
Tools
Domain Lookup Bulk Categorization Category Explorer
Resources
Pricing API Documentation Login / Sign Up
How-To Guide

How to Redact Names

Learn how to automatically detect and redact personal names from text, documents, and data streams using Anonymization API. Protect privacy while maintaining data utility with multiple anonymization techniques.

10 min read Code examples included Updated Jan 2025
In This Guide Overview Why Redact Names Quick Start Techniques Code Examples Best Practices Edge Cases FAQ
Overview

Names Are the Most Common PII in Text

Personal names are one of the most common types of personally identifiable information (PII) found in text data. Names can appear in countless formats and contexts, from formal documents ("Mr. John William Smith III") to casual mentions ("Hey John!").

Context-Aware Detection Across 50+ Languages

Anonymization API uses advanced natural language processing (NLP) to detect names with high accuracy across 50+ languages. Our AI models understand context, distinguishing between personal names and other uses of the same words (like "Paris" the city vs "Paris Hilton" the person).

  • Properly redacting names is essential for GDPR compliance, HIPAA requirements, and general privacy protection.

Before Anonymization

Please contact Dr. Sarah Johnson at the clinic. Her assistant Michael will help you.

After Anonymization

Please contact Dr. [PERSON] at the clinic. Her assistant [PERSON] will help you.

50+ Languages

Detect names in English, Spanish, Chinese, Arabic, and more

Context-Aware

AI understands when a word is used as a name vs other meaning

Real-Time

Sub-100ms response for instant anonymization

Why Redact Names

Why Name Redaction Matters

Redacting personal names from data is critical for multiple reasons across different industries and use cases. Understanding why name redaction matters helps you implement the right approach for your specific needs.

GDPR (Europe)

Names are personal data that must be protected. Anonymization allows data processing without consent requirements.

HIPAA (Healthcare)

Patient names are protected health information (PHI) that must be de-identified before sharing.

CCPA (California)

Consumer names are personal information subject to disclosure and deletion rights.

FERPA (Education)

Student names in education records require protection.

Common Use Cases

  • Data Analytics: Analyze customer feedback, support tickets, or survey responses without exposing individual identities.
  • Machine Learning: Train ML models on text data without including personal names that could cause privacy leaks.
  • Document Sharing: Share legal documents, medical records, or case studies after removing identifying names.

 

  • Customer Support: Log and analyze support conversations without storing customer names.
  • Research: Use interview transcripts and qualitative data for research while protecting participant privacy.

Tip: Even when names seem innocuous, combining them with other data points can lead to re-identification. Always consider the broader context of your data when deciding what to redact.

Quick Start

Redact Names in a Few Lines of Code

Get started with name redaction in just a few lines of code. This example shows the simplest way to redact names from text using our API.

from anonymization import Client

client = Client(api_key="your_api_key")

result = client.anonymize(
    text="Contact John Smith at [email protected]",
    entity_types=["PERSON"]
)

print(result.anonymized_text)
# Output: Contact [PERSON] at [email protected]
const { AnonymizationClient } = require('@anonymization/api');

const client = new AnonymizationClient('your_api_key');

const result = await client.anonymize({
    text: "Contact John Smith at [email protected]",
    entityTypes: ["PERSON"]
});

console.log(result.anonymizedText);
// Output: Contact [PERSON] at [email protected]
curl -X POST https://api.anonymizationapi.com/v2/anonymize \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Contact John Smith at [email protected]",
    "entity_types": ["PERSON"]
  }'

The response includes both the anonymized text and metadata about detected entities:

{
  "anonymized_text": "Contact [PERSON] at [email protected]",
  "entities": [
    {
      "type": "PERSON",
      "text": "John Smith",
      "start": 8,
      "end": 18,
      "confidence": 0.98
    }
  ]
}
Anonymization Techniques

Four Ways to Anonymize a Name

Different situations call for different anonymization approaches. Choose the technique that best balances privacy protection with data utility for your use case.

1

Redaction (Default)

Replaces names with a placeholder tag. Best for maximum privacy when the name itself carries no analytical value.

Dr. Sarah Johnson reviewed the case.
Dr. [PERSON] reviewed the case.
2

Masking

Partially obscures names while preserving length and some characters. Useful when you need to show that a name exists without revealing it fully.

Dr. Sarah Johnson reviewed the case.
Dr. S**** J****** reviewed the case.
3

Pseudonymization

Replaces names with consistent fake names. The same input name always maps to the same pseudonym within a session, preserving referential relationships.

Sarah told Michael about Sarah's discovery.
Emily told David about Emily's discovery.
4

Generalization

Replaces names with generic descriptors based on context. Useful when you need to preserve the narrative structure.

Dr. Sarah Johnson and nurse Michael treated the patient.
[DOCTOR] and [NURSE] treated the patient.
# Using different anonymization modes

# Redaction (default)
result = client.anonymize(text, mode="redact")

# Masking
result = client.anonymize(text, mode="mask")

# Pseudonymization
result = client.anonymize(text, mode="pseudonymize")

# Generalization
result = client.anonymize(text, mode="generalize")
Detection at a Glance

Built for Accuracy and Speed

98.5%Name detection accuracy on standard benchmarks
50+Languages and country name formats supported
<100msResponse time for real-time anonymization
4Anonymization modes: redact, mask, pseudonymize, generalize
Redaction is permanent — we don't store the original names. If you need reversibility, use pseudonymization mode and securely store the mapping table that's returned in the response.
Code Examples

Practical Recipes for Name Redaction

Batch Processing

Process multiple texts efficiently in a single API call:

texts = [
    "John Smith submitted the report.",
    "Maria Garcia approved the request.",
    "Contact Dr. James Wilson for details."
]

results = client.batch_anonymize(
    items=[{"text": t} for t in texts],
    entity_types=["PERSON"]
)

for r in results:
    print(r.anonymized_text)

Custom Confidence Threshold

Adjust detection sensitivity based on your accuracy requirements:

# Higher threshold = fewer false positives, may miss some names
result = client.anonymize(
    text=text,
    entity_types=["PERSON"],
    min_confidence=0.9
)

# Lower threshold = catches more names, may have false positives
result = client.anonymize(
    text=text,
    entity_types=["PERSON"],
    min_confidence=0.6
)

Preserving Name Structure

Keep first names while redacting last names, or vice versa:

# Redact only last names
result = client.anonymize(
    text="John Smith and Sarah Johnson",
    entity_types=["PERSON_LAST_NAME"]
)
# Output: John [LAST_NAME] and Sarah [LAST_NAME]

# Redact only first names
result = client.anonymize(
    text="John Smith and Sarah Johnson",
    entity_types=["PERSON_FIRST_NAME"]
)
# Output: [FIRST_NAME] Smith and [FIRST_NAME] Johnson
Best Practices

Get Name Redaction Right in Production

Combine with Other Entity Types

Names alone may not be enough to protect privacy. Consider redacting names alongside emails, phone numbers, and addresses for comprehensive protection:

result = client.anonymize(
    text=text,
    entity_types=["PERSON", "EMAIL", "PHONE", "ADDRESS"]
)

Handle Titles and Honorifics

Our API automatically detects titles (Dr., Mr., Mrs., Prof.) associated with names. You can choose to include or exclude these in the redaction:

# Include titles in redaction
result = client.anonymize(
    text="Dr. Sarah Johnson is available.",
    options={"include_titles": True}
)
# Output: [PERSON] is available.

# Preserve titles
result = client.anonymize(
    text="Dr. Sarah Johnson is available.",
    options={"include_titles": False}
)
# Output: Dr. [PERSON] is available.

Review Before Production

Always review a sample of anonymized output before deploying to production. Check for:

  • Missed names (false negatives)
  • Incorrectly flagged non-names (false positives)
  • Consistency in how similar names are handled
  • Context preservation in the anonymized text

Use Consistent Pseudonyms When Needed

If your analysis requires tracking the same person across mentions, use pseudonymization mode with a session ID to ensure consistent fake names:

result = client.anonymize(
    text=text,
    mode="pseudonymize",
    session_id="my-analysis-session-123"
)
Handling Edge Cases

When Names Get Tricky

Ambiguous Names

Some words can be both names and common nouns (like "Rose" or "Hunter"). Our AI uses context to determine the most likely interpretation, but you can adjust the confidence threshold if needed.

Multi-Cultural Names

Names from different cultures follow different patterns. Our models are trained on names from 50+ countries and handle various formats.

  • Western names (John Smith)
  • East Asian names (family name first: Zhang Wei)
  • Hispanic names (compound surnames: Garcia Rodriguez)
  • Arabic names (with patronymics: Mohammed bin Salman)
  • Indian names (with titles: Shri Narendra Modi)

Nicknames and Aliases

Common nicknames (Bob for Robert, Liz for Elizabeth) are detected as names. For custom nicknames or aliases specific to your domain, you can add them using custom entity definitions.

Note: Very short or unusual names may occasionally be missed. If you have domain-specific names (like product codenames that look like names), consider adding them to your custom entity list.

FAQ

Frequently Asked Questions

How accurate is name detection?

Our name detection achieves 98.5% accuracy on standard benchmarks. Accuracy may vary depending on language, domain, and text quality. For specialized domains (legal, medical), accuracy is often higher due to structured name formats.

Can I detect names in non-English text?

Yes, we support name detection in 50+ languages. The API auto-detects language by default, or you can specify the language explicitly for better accuracy with mixed-language content.

How do I handle false positives?

If common words are being incorrectly flagged as names, try increasing the confidence threshold. You can also provide an allow-list of terms that should never be redacted.

What about fictional or historical names?

The API treats all names consistently regardless of whether they're real people, fictional characters, or historical figures. If you need different handling for specific categories, use custom rules.

Is the name replacement reversible?

Redaction is permanent - we don't store the original names. If you need reversibility, use pseudonymization mode and securely store the mapping table that's returned in the response.

Related Guides

Keep Building Your Redaction Pipeline

Start Redacting Names Today

Get your free API key and protect personal names in your data within minutes.

Get Started Free