한국어 개인정보 탐지 및 마스킹 라이브러리
Project description
KPII (Korean Personal Information Identifier)
한국어 텍스트에서 개인정보를 탐지하고 마스킹 처리하는 Python 라이브러리입니다.
설치
pip install kpii
사용 예시
from kpii import KoreanPIIDetector
# 감지기 초기화
detector = KoreanPIIDetector()
# 텍스트에서 개인정보 탐지
text = """
주민번호: 901231-2123456
전화번호: 010-1234-5678
이메일: hong@example.com
신용카드: 9430-8212-3456-2393
"""
# 모든 개인정보 마스킹
masked_text = detector.mask_text(text)
# 특정 유형만 마스킹
masked_text = detector.mask_text(text, mask_types=["rrn", "phone"])
지원하는 개인정보 유형
- 주민등록번호
- 전화번호
- 이메일
- 신용카드 번호
개발 환경 설정
- 저장소 클론
git clone https://github.com/sotthang/kpii.git
cd kpii
- Poetry를 사용한 의존성 설치
poetry install
- 개발 의존성 설치 (테스트 도구 포함)
poetry install --with dev
테스트
테스트 실행
# 모든 테스트 실행
poetry run pytest
# 커버리지 리포트와 함께 테스트 실행
poetry run pytest --cov=kpii
# 특정 테스트 파일만 실행
poetry run pytest tests/test_detector.py
# 특정 테스트 함수만 실행
poetry run pytest tests/test_detector.py::test_detect_rrn
테스트 커버리지 확인
# HTML 형식의 커버리지 리포트 생성
poetry run pytest --cov=kpii --cov-report=html
# 터미널에서 커버리지 리포트 확인
poetry run pytest --cov=kpii --cov-report=term-missing
라이선스
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
kpii-0.1.0.tar.gz
(26.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
kpii-0.1.0-py3-none-any.whl
(4.8 kB
view details)
File details
Details for the file kpii-0.1.0.tar.gz.
File metadata
- Download URL: kpii-0.1.0.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a42612fa4d82f2375426744e62ba3511d13bc457b1841af331b6c5a96e606eb
|
|
| MD5 |
403db7682d68ddd3ab904fb94ac5a8b6
|
|
| BLAKE2b-256 |
e9d72ce02d20e564b48ccf75c41952a385573b8bdd971f03c435714a837d2a91
|
File details
Details for the file kpii-0.1.0-py3-none-any.whl.
File metadata
- Download URL: kpii-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79d4b9dcc4ef13b1a34f39b8499d84a8fdd21801ddaa80170f5eb9d1d363c1df
|
|
| MD5 |
5a1ba1e4c1815ce539cabcd630fb96b3
|
|
| BLAKE2b-256 |
cc648047a2236e3b262f933853ae44b72500780f8c5334078fa21cdd857c183b
|