Sending raw documents to external LLM endpoints or RAG pipelines raises immediate compliance risks in regulated industries, and general-purpose PII scrubbers routinely miss Korean-specific identifier formats. ko-pii is a Python library that detects and pseudonymizes 33 types of Korean personal information locally without calling external APIs.

Local Architecture and Token Vault Support

The core ko-pii package runs without remote servers or heavyweight ML models. Built on Python’s standard library, regex patterns, dictionaries, and checksum validators, it identifies 33 Korean PII categories including resident registration numbers, passport numbers, business registration numbers, and payment card numbers.

Teams can choose irreversible masking, category-tag replacement, or reversible tokenization backed by a separate Vault so only authorized roles can restore original values.

Consistent token replacement maps identical entities to the same placeholder across a document, preserving cross-sentence context during RAG vector indexing and LLM prompting. Optional extension modules extract text from common enterprise formats including HWP, HWPX, DOCX, PDF, CSV, and XLSX.

Benchmark Accuracy and Pre-Deployment Validation

Structured identifiers with deterministic validation formulas show strong detection rates. Across 4,891 conversational samples in KDPII, ko-pii scored F1 0.66, rising to F1 0.79 on 540 structured administrative form samples, performing best on resident registration numbers, phone numbers, emails, and business registration numbers.

Unstructured person names and free-form street addresses in prose can still produce false positives or misses depending on domain phrasing. Treat published F1 scores as a baseline and test 30-100 internal documents before deploying to production.

Install the package via pip install ko-pii; both a browser-based Hugging Face Space demo and the open-source GitHub repository are available for quick evaluation.

Engineers building preprocessing pipelines in air-gapped networks or regulated sectors get a lightweight, zero-dependency starting point.

Summary

  • Detects 33 Korean PII types locally using Python’s standard library, regex rules, and checksums without external ML models or APIs.
  • Supports masking, category tags, and Vault-backed consistent tokenization to preserve document context for RAG indexing and LLM prompts.
  • Excels on structured identifiers like resident registration numbers, though teams should validate 30-100 internal docs first to check unstructured name and address edge cases.