ko-pii
한국어 텍스트의 개인정보를 탐지하고 가명화하는 Python 라이브러리입니다. 코어는 모델 다운로드나 외부 API 없이 규칙·사전·형식 검증으로 동작합니다. Python 3.10 이상, 코드 MIT 라이선스, 코어 런타임 의존성 없음.
먼저 사용하기
python -m pip install ko-pii
아래 예제는 실행 파일과 동일하며 CI에서 설치한 wheel로 검사합니다.
from ko_pii import Anonymizer, ProcessingMode
result = Anonymizer(
mode=ProcessingMode.STRICT,
strategy="tokenize",
include={"EMAIL", "PHONE"},
).process("Email: demo@example.com / Tel: 010-2345-6789")
print(result.text)
assert "demo@example.com" not in result.text
assert "010-2345-6789" not in result.text
assert result.vault.reveal("<EMAIL_1>") == "demo@example.com"
tokenize는 원문을 없애지 않고 Vault로 옮깁니다. Vault에 접근할 수 있는 코드는
원문을 복원할 수 있으므로 출력과 분리 보관하세요. 인증·인가는 호출 애플리케이션의 책임입니다.
무엇을 처리하나
- 주민등록번호·전화번호·이메일·카드 등 구조적 식별자와 한국어 이름·주소 등 33개 라벨.
- 토큰 치환, 일부 마스킹, 삭제형 치환 등 처리 전략과 라벨별 정책.
- JSON/JSONL의 필드·배열 경로별 설정과 명시적 필드 라벨.
- 재사용 가능한
PolicyProfile, 정책 변경 전후 비교, 값 없는 설명 보고서. - 알려진 값의
LiteralDetector와 신뢰된 코드용 정규식·콜백 확장 지점. - 선택적 문서 형식 처리와 Vault 암호화. ML/RAG 연동은 별도 extras이며 코어에 필요하지 않습니다.
최신 릴리스의 정확한 변경 범위는 CHANGELOG를 확인하세요.
CLI와 같은 정책 재사용
저장소의 정책 예제는 EMAIL과 PHONE을 STRICT/redact로 처리합니다. 아래 명령은 저장소 루트에서 실행하며, 입력 예제와 정책을 함께 제공합니다.
ko-pii examples/input.txt --policy examples/policy.json --output masked.txt
ko-pii examples/request.json --format json --policy examples/policy.json --output masked.json
명령 사용법은 ko-pii --help, 상세한 설정은 정책 안내를
참고하세요. JSON 처리와 필드 규칙은 구조화 처리에 있습니다.
도입 전에 확인할 것
이 라이브러리는 모든 개인정보의 제거, 법적 익명성 또는 규정 준수를 보장하지 않습니다. 형식·체크섬 검증이 있어도 미탐과 오탐이 가능합니다. 이름·비정형 주소는 특히 도메인에 의존합니다. 위험도는 보조 휴리스틱이지 법적 판정이 아닙니다.
자기 문서에서 필요한 라벨을 정하고 탐지 성능과 실제 출력에 남는 값을 따로 검증하세요. 샘플 몇십 건의 성공은 낮은 유출률의 통계적 증명이 아닙니다. 공개·외부 전송 전에는 업무별 검토와 승인 정책이 필요합니다. 테스트·버그 보고에는 실제 개인정보를 넣지 마세요.
외부 평가 프로토콜과 결과는 데이터 리비전·라벨 범위·표본 선정법을 함께 공개합니다. 과거 F1/속도 수치는 당시 조건의 기록이며 현재 버전이나 고객 환경의 성능 보증으로 쓰지 않습니다.
문서
| 필요 | 안내 |
|---|---|
| 기능별 문서 찾기 | 문서 목차 |
| 파일 형식·추출 한계 | 파일 처리 |
| Vault·키·권한 경계 | Vault 보안 |
| 사용자 규칙·추적 | 확장과 설명 |
| 도메인 검증·회귀 비교 | 평가 |
| API·CLI·저장 형식 호환성 | 호환성 정책 |
| 개발·배포 검사 | 기여 안내 |
| 취약점 비공개 보고 | 보안 정책 |
개발 상태와 자료 구분
Ubuntu Python 3.10/3.12/3.14, Windows/macOS CLI, 선택적 RAG 연동을 CI에서 검사합니다. 배포 태그도 같은 검증을 다시 실행하며, 설치 테스트를 통과한 배포 파일만 PyPI로 보냅니다. 이 검사는 패키지 동작에 대한 것으로 실제 개인정보 제거율을 보증하지 않습니다.
src/는 제품 코드, tests/와 examples/는 유지되는 검증 대상입니다.
data/의 과거 연구 스크립트·결과는 별도 목록으로 관리하며
PyPI 패키지에 포함하지 않습니다. 데이터 라이선스는 코드 MIT와 별개입니다.
이전 긴 소개는 1.22.0 README에 보존되어 있습니다.
Metadata
Release files for ko-pii 1.23.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ko_pii-1.23.0.tar.gz | 732.4 kB | With provenance | Details for ko_pii-1.23.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ko_pii-1.23.0-py3-none-any.whl | Python 3 | none | any | Details for ko_pii-1.23.0-py3-none-any.whl |
Total release size: 1.1 MB
Release files / ko_pii-1.23.0.tar.gz
| Download URL | ko_pii-1.23.0.tar.gz |
|---|---|
| Size | 732.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7251282c603e515db56d3cf10453fb9a52e5dac847bb733e3eb51a7d76e884cd
|
|
BLAKE2b-256 checksum How to use checksums |
3db31577f3d1f2a303c757b2ad05a6b493b3b043f4871fe7ad383e696dd5f8cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / ko_pii-1.23.0-py3-none-any.whl
| Download URL | ko_pii-1.23.0-py3-none-any.whl |
|---|---|
| Size | 405.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be4a5422b7b0639cac75e9ebeff9376955615d4f499d5f5341c5f96730f60c7e
|
|
BLAKE2b-256 checksum How to use checksums |
151650139c959c63369214c3bfe5d18fbc303dc028a135f99c864306c147db85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logSecurity for ko-pii 1.23.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ko_pii-1.23.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.