privyscope-ko 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: privyscope-ko
3
+ Version: 0.1.2
4
+ Summary: privyscope-ko — Korean language pack for the privyscope PII engine
5
+ Author: privyscope Core Team
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/zafrem/privyscope-ko
8
+ Project-URL: Documentation, https://github.com/zafrem/privyscope-ko/blob/main/README.md
9
+ Keywords: pii,ner,redaction,privacy,korean,onnx
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Text Processing :: Linguistic
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: privyscope>=0.1.0
23
+ Provides-Extra: train
24
+ Requires-Dist: privyscope[train]>=0.1.0; extra == "train"
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == "dev"
27
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # privyscope-ko
31
+
32
+ 한국어 텍스트에서 **개인정보(PII)를 찾는** 엔진이에요.
33
+ [privyscope](https://github.com/zafrem) 시리즈의 한국어 버전으로, 사람 이름,
34
+ 전화번호, 주민등록번호, 이메일, 주소, 금융 정보, 비공개 날짜, 인증 정보(시크릿)를
35
+ 알아서 찾아 마스킹해 줍니다.
36
+
37
+ > ⚠️ privyscope는 마스킹을 **도와주는** 도구일 뿐, 비식별화나 컴플라이언스를
38
+ > 보장하지는 않아요. 자세한 내용은 [한계](#한계)를 꼭 읽어보세요.
39
+
40
+ 📖 **[English README](README.en.md)**
41
+
42
+ ## 설치
43
+
44
+ ```bash
45
+ pip install privyscope-ko
46
+ ```
47
+
48
+ ## 1분 만에 시작하기
49
+
50
+ **Python에서 쓰기**
51
+
52
+ ```python
53
+ from privyscope_ko import Privyscope
54
+
55
+ engine = Privyscope.from_pretrained() # 처음 실행할 때 ONNX 가중치를 내려받아요
56
+ result = engine.redact("홍길동의 전화번호는 010-1234-5678")
57
+
58
+ result.masked_text # "<PER>의 전화번호는 <PHONE>"
59
+ result.detected_spans # [DetectedSpan(label="PER", start=0, end=3, ...), ...]
60
+ result.summary # {"span_count": 2, "by_label": {"PER": 1, "PHONE": 1}, ...}
61
+ ```
62
+
63
+ **터미널에서 쓰기**
64
+
65
+ ```bash
66
+ privyscope redact "홍길동의 전화번호는 010-1234-5678"
67
+ cat notes.txt | privyscope redact --operating-point high_recall
68
+ ```
69
+
70
+ ## 문서
71
+
72
+ 더 자세한 가이드는 [`docs/`](docs/) 폴더에 목적별로 정리해 뒀어요. 하고 싶은 걸
73
+ 골라서 보세요:
74
+
75
+ | 이런 게 궁금하다면 | 가이드 |
76
+ |---|---|
77
+ | 터미널에서 돌리고 싶어요 | [CLI 레퍼런스](docs/CLI.md) |
78
+ | Python 코드에서 부르고 싶어요 | [Python API 레퍼런스](docs/API.md) |
79
+ | JSON 출력이 무슨 뜻인지 알고 싶어요 | [출력 스키마](docs/OUTPUT_SCHEMAS.md) |
80
+ | 내 라벨링 데이터로 점수를 매겨보고 싶어요 | [평가 및 출력 모드](docs/EVAL_AND_OUTPUT_MODES.md) |
81
+ | 정밀도와 재현율을 조절하고 싶어요 | [운영 포인트](docs/OPERATING_POINTS.md) |
82
+ | 인터넷 없이 폐쇄망에서 쓰고 싶어요 | [오프라인 사용](docs/OFFLINE.md) |
83
+ | 내 데이터로 파인튜닝하고 싶어요 | [파인튜닝](docs/FINETUNING.md) |
84
+
85
+ ## 어떤 걸 찾아주나요
86
+
87
+ 찾아주는 항목은 이렇게 여덟 가지예요:
88
+ `PER` · `PHONE` · `ID_NUM` · `EMAIL` · `LOC` · `BANK` · `DATE` · `SECRET`.
89
+
90
+ 정규식 규칙은 [`privyscope/regex_rules.yaml`](privyscope/regex_rules.yaml)에 들어
91
+ 있고, 코드를 건드리지 않고도 직접 추가하거나 고칠 수 있어요. 한국어에만 있는
92
+ 확장 항목은 [`privyscope/entity_config.yaml`](privyscope/entity_config.yaml)에
93
+ 정의돼 있습니다.
94
+
95
+ ## 어떻게 동작하나요
96
+
97
+ 크게 **두 단계**로 나눠서 PII를 찾고, 두 결과를 합쳐서(합집합) 돌려줘요
98
+ (SRS §3.4):
99
+
100
+ 1. **정규식 필터** — 전화번호, 이메일, 주민번호, 카드번호, 시크릿처럼 형태가
101
+ 딱 정해져 있는 PII를 잡아냅니다.
102
+ 2. **ONNX NER** — 이름, 주소, 비공개 날짜처럼 앞뒤 문맥을 봐야 알 수 있는
103
+ PII를 잡아내요. BIOES 토큰 분류기에 제약 Viterbi 디코더를 붙여서 판단합니다.
104
+
105
+ 추론할 때는 **ONNX Runtime만 쓰고 PyTorch는 필요 없어요**. 기본적으로 빠뜨리지
106
+ 않는 걸(재현율) 우선하고, 재학습 없이 [운영 포인트](docs/OPERATING_POINTS.md)만
107
+ 바꿔서 동작을 조절할 수 있습니다. PyTorch는 [파인튜닝](docs/FINETUNING.md)을 할
108
+ 때만 있으면 돼요.
109
+
110
+ ## 모델과 성능
111
+
112
+ - **구조** — `klue/roberta-base` 인코더 → BIOES 토큰 분류 헤드 → Viterbi
113
+ 디코더로 이어지는 형태예요.
114
+ - **실제 배포 파일** — INT8로 양자화한 ONNX 모델이고 크기는 **약 105 MB**라
115
+ 150 MB 안에 넉넉히 들어와요. 최대 문장 길이는 256입니다. 가중치는 처음
116
+ 쓸 때 Hugging Face Hub에서 내려받고, 파일이 멀쩡한지 확인할 수 있게 SHA-256
117
+ `checksum.txt`가 함께 들어 있어요.
118
+ - **정확도** — 학습과 겹치지 않는 검증 세트(2,000문장, `typed`/strict 채점,
119
+ regex + NER 전체 파이프라인)에서 엔티티 단위 **strict 마이크로 F1 = 0.966**을
120
+ 기록했어요. 엔티티별 strict F1:
121
+
122
+ | PER | LOC | DATE | EMAIL | ID_NUM | BANK | PHONE |
123
+ |-----|-----|------|-------|--------|------|-------|
124
+ | 0.98 | 1.00 | 1.00 | 1.00 | 1.00 | 0.92 | 0.78 |
125
+
126
+ `PHONE`는 정밀도가 0.64로 전화번호처럼 보이는 숫자를 과검출하는 경향이 있고,
127
+ `BANK`는 재현율이 0.85라 일부를 놓쳐요. 검증 세트가 학습과 분리돼 있어 이
128
+ 점수는 암기가 아니라 일반화 성능을 보여주지만, 분포 밖 문장에서는 더 낮게
129
+ 나올 수 있어요. `privyscope eval --lang ko your_val.jsonl`로 직접 재현할 수
130
+ 있고, 자세한 내용은 [평가 및 출력 모드](docs/EVAL_AND_OUTPUT_MODES.md)를
131
+ 참고하세요.
132
+
133
+ ## 한계
134
+
135
+ 쓰기 전에 이 점들은 꼭 알아두세요:
136
+
137
+ - 비식별화나 컴플라이언스를 보장하지는 않아요. 프라이버시 설계의 **여러 안전장치
138
+ 중 하나**로 생각하고 쓰는 게 맞습니다.
139
+ - 잘 못 잡는 경우도 있어요. 예를 들어 드물거나 지역색이 강한 이름은 놓칠 수
140
+ 있고, 문맥이 애매하면 공인(공개 인물)까지 과하게 가릴 수 있어요. 형식이 복잡하게
141
+ 섞인 텍스트에서는 한 덩어리가 여러 조각으로 쪼개지기도 하고, 처음 보는 형식의
142
+ `SECRET`은 못 잡을 수 있습니다.
143
+ - 의료·법률·금융·정부 업무처럼 민감한 곳에서는 사람이 한 번 더 검토하는 걸
144
+ 권장해요.
145
+
146
+ ## 라이선스
147
+
148
+ Apache-2.0으로 배포돼요. 모델 가중치도 같은 Apache-2.0이고, 파일 무결성을 확인할
149
+ 수 있는 `checksum.txt`(SHA-256)와 함께 Hugging Face Hub에 올라가 있습니다. 기여는
150
+ 언제든 환영이에요 — [CONTRIBUTING.md](CONTRIBUTING.md)를 참고해 주세요.
@@ -0,0 +1,121 @@
1
+ # privyscope-ko
2
+
3
+ 한국어 텍스트에서 **개인정보(PII)를 찾는** 엔진이에요.
4
+ [privyscope](https://github.com/zafrem) 시리즈의 한국어 버전으로, 사람 이름,
5
+ 전화번호, 주민등록번호, 이메일, 주소, 금융 정보, 비공개 날짜, 인증 정보(시크릿)를
6
+ 알아서 찾아 마스킹해 줍니다.
7
+
8
+ > ⚠️ privyscope는 마스킹을 **도와주는** 도구일 뿐, 비식별화나 컴플라이언스를
9
+ > 보장하지는 않아요. 자세한 내용은 [한계](#한계)를 꼭 읽어보세요.
10
+
11
+ 📖 **[English README](README.en.md)**
12
+
13
+ ## 설치
14
+
15
+ ```bash
16
+ pip install privyscope-ko
17
+ ```
18
+
19
+ ## 1분 만에 시작하기
20
+
21
+ **Python에서 쓰기**
22
+
23
+ ```python
24
+ from privyscope_ko import Privyscope
25
+
26
+ engine = Privyscope.from_pretrained() # 처음 실행할 때 ONNX 가중치를 내려받아요
27
+ result = engine.redact("홍길동의 전화번호는 010-1234-5678")
28
+
29
+ result.masked_text # "<PER>의 전화번호는 <PHONE>"
30
+ result.detected_spans # [DetectedSpan(label="PER", start=0, end=3, ...), ...]
31
+ result.summary # {"span_count": 2, "by_label": {"PER": 1, "PHONE": 1}, ...}
32
+ ```
33
+
34
+ **터미널에서 쓰기**
35
+
36
+ ```bash
37
+ privyscope redact "홍길동의 전화번호는 010-1234-5678"
38
+ cat notes.txt | privyscope redact --operating-point high_recall
39
+ ```
40
+
41
+ ## 문서
42
+
43
+ 더 자세한 가이드는 [`docs/`](docs/) 폴더에 목적별로 정리해 뒀어요. 하고 싶은 걸
44
+ 골라서 보세요:
45
+
46
+ | 이런 게 궁금하다면 | 가이드 |
47
+ |---|---|
48
+ | 터미널에서 돌리고 싶어요 | [CLI 레퍼런스](docs/CLI.md) |
49
+ | Python 코드에서 부르고 싶어요 | [Python API 레퍼런스](docs/API.md) |
50
+ | JSON 출력이 무슨 뜻인지 알고 싶어요 | [출력 스키마](docs/OUTPUT_SCHEMAS.md) |
51
+ | 내 라벨링 데이터로 점수를 매겨보고 싶어요 | [평가 및 출력 모드](docs/EVAL_AND_OUTPUT_MODES.md) |
52
+ | 정밀도와 재현율을 조절하고 싶어요 | [운영 포인트](docs/OPERATING_POINTS.md) |
53
+ | 인터넷 없이 폐쇄망에서 쓰고 싶어요 | [오프라인 사용](docs/OFFLINE.md) |
54
+ | 내 데이터로 파인튜닝하고 싶어요 | [파인튜닝](docs/FINETUNING.md) |
55
+
56
+ ## 어떤 걸 찾아주나요
57
+
58
+ 찾아주는 항목은 이렇게 여덟 가지예요:
59
+ `PER` · `PHONE` · `ID_NUM` · `EMAIL` · `LOC` · `BANK` · `DATE` · `SECRET`.
60
+
61
+ 정규식 규칙은 [`privyscope/regex_rules.yaml`](privyscope/regex_rules.yaml)에 들어
62
+ 있고, 코드를 건드리지 않고도 직접 추가하거나 고칠 수 있어요. 한국어에만 있는
63
+ 확장 항목은 [`privyscope/entity_config.yaml`](privyscope/entity_config.yaml)에
64
+ 정의돼 있습니다.
65
+
66
+ ## 어떻게 동작하나요
67
+
68
+ 크게 **두 단계**로 나눠서 PII를 찾고, 두 결과를 합쳐서(합집합) 돌려줘요
69
+ (SRS §3.4):
70
+
71
+ 1. **정규식 필터** — 전화번호, 이메일, 주민번호, 카드번호, 시크릿처럼 형태가
72
+ 딱 정해져 있는 PII를 잡아냅니다.
73
+ 2. **ONNX NER** — 이름, 주소, 비공개 날짜처럼 앞뒤 문맥을 봐야 알 수 있는
74
+ PII를 잡아내요. BIOES 토큰 분류기에 제약 Viterbi 디코더를 붙여서 판단합니다.
75
+
76
+ 추론할 때는 **ONNX Runtime만 쓰고 PyTorch는 필요 없어요**. 기본적으로 빠뜨리지
77
+ 않는 걸(재현율) 우선하고, 재학습 없이 [운영 포인트](docs/OPERATING_POINTS.md)만
78
+ 바꿔서 동작을 조절할 수 있습니다. PyTorch는 [파인튜닝](docs/FINETUNING.md)을 할
79
+ 때만 있으면 돼요.
80
+
81
+ ## 모델과 성능
82
+
83
+ - **구조** — `klue/roberta-base` 인코더 → BIOES 토큰 분류 헤드 → Viterbi
84
+ 디코더로 이어지는 형태예요.
85
+ - **실제 배포 파일** — INT8로 양자화한 ONNX 모델이고 크기는 **약 105 MB**라
86
+ 150 MB 안에 넉넉히 들어와요. 최대 문장 길이는 256입니다. 가중치는 처음
87
+ 쓸 때 Hugging Face Hub에서 내려받고, 파일이 멀쩡한지 확인할 수 있게 SHA-256
88
+ `checksum.txt`가 함께 들어 있어요.
89
+ - **정확도** — 학습과 겹치지 않는 검증 세트(2,000문장, `typed`/strict 채점,
90
+ regex + NER 전체 파이프라인)에서 엔티티 단위 **strict 마이크로 F1 = 0.966**을
91
+ 기록했어요. 엔티티별 strict F1:
92
+
93
+ | PER | LOC | DATE | EMAIL | ID_NUM | BANK | PHONE |
94
+ |-----|-----|------|-------|--------|------|-------|
95
+ | 0.98 | 1.00 | 1.00 | 1.00 | 1.00 | 0.92 | 0.78 |
96
+
97
+ `PHONE`는 정밀도가 0.64로 전화번호처럼 보이는 숫자를 과검출하는 경향이 있고,
98
+ `BANK`는 재현율이 0.85라 일부를 놓쳐요. 검증 세트가 학습과 분리돼 있어 이
99
+ 점수는 암기가 아니라 일반화 성능을 보여주지만, 분포 밖 문장에서는 더 낮게
100
+ 나올 수 있어요. `privyscope eval --lang ko your_val.jsonl`로 직접 재현할 수
101
+ 있고, 자세한 내용은 [평가 및 출력 모드](docs/EVAL_AND_OUTPUT_MODES.md)를
102
+ 참고하세요.
103
+
104
+ ## 한계
105
+
106
+ 쓰기 전에 이 점들은 꼭 알아두세요:
107
+
108
+ - 비식별화나 컴플라이언스를 보장하지는 않아요. 프라이버시 설계의 **여러 안전장치
109
+ 중 하나**로 생각하고 쓰는 게 맞습니다.
110
+ - 잘 못 잡는 경우도 있어요. 예를 들어 드물거나 지역색이 강한 이름은 놓칠 수
111
+ 있고, 문맥이 애매하면 공인(공개 인물)까지 과하게 가릴 수 있어요. 형식이 복잡하게
112
+ 섞인 텍스트에서는 한 덩어리가 여러 조각으로 쪼개지기도 하고, 처음 보는 형식의
113
+ `SECRET`은 못 잡을 수 있습니다.
114
+ - 의료·법률·금융·정부 업무처럼 민감한 곳에서는 사람이 한 번 더 검토하는 걸
115
+ 권장해요.
116
+
117
+ ## 라이선스
118
+
119
+ Apache-2.0으로 배포돼요. 모델 가중치도 같은 Apache-2.0이고, 파일 무결성을 확인할
120
+ 수 있는 `checksum.txt`(SHA-256)와 함께 Hugging Face Hub에 올라가 있습니다. 기여는
121
+ 언제든 환영이에요 — [CONTRIBUTING.md](CONTRIBUTING.md)를 참고해 주세요.
@@ -0,0 +1,25 @@
1
+ """privyscope-ko — Korean language pack for the ``privyscope`` engine (Apache-2.0).
2
+
3
+ This is a thin **plugin**: it ships only Korean data (``regex_rules.yaml``,
4
+ ``entity_config.yaml``) and registers itself with the core via the
5
+ ``privyscope.languages`` entry point. All engine code lives in the ``privyscope``
6
+ core package, which is pulled in as a dependency.
7
+
8
+ from privyscope_ko import Privyscope # re-exported from the core
9
+ engine = Privyscope.from_pretrained(lang="ko")
10
+ engine.redact("홍길동의 전화번호는 010-1234-5678").masked_text
11
+ # "<PER>의 전화번호는 <PHONE>"
12
+ """
13
+ from privyscope import Privyscope, RedactionResult, DetectedSpan, LanguagePlugin, __version__
14
+
15
+ #: Registered under the ``privyscope.languages`` entry-point group (see pyproject).
16
+ LANG = LanguagePlugin(
17
+ code="ko",
18
+ display_name="Korean",
19
+ default_repo="zafrem/privyscope-ko",
20
+ package="privyscope_ko",
21
+ scripts=("Hangul",),
22
+ default_base_model="klue/roberta-base",
23
+ )
24
+
25
+ __all__ = ["Privyscope", "RedactionResult", "DetectedSpan", "LANG", "__version__"]
@@ -0,0 +1,49 @@
1
+ # privyscope-ko — entity configuration (ENTITY_SPEC §8.3).
2
+ # Base PII taxonomy (SRS §6) plus KO-specific extended entities. Extended
3
+ # entities are detected by regex only unless added to the NER label space via a
4
+ # custom fine-tune (FR-2.6).
5
+ language: ko
6
+
7
+ base_entities:
8
+ - code: PER
9
+ detection: contextual
10
+ regex: null
11
+ - code: PHONE
12
+ detection: structural
13
+ regex: '(?:010|011|016|017|018|019)-\d{3,4}-\d{4}'
14
+ - code: ID_NUM
15
+ detection: structural
16
+ regex: '\d{6}-[1-8]\d{6}'
17
+ - code: EMAIL
18
+ detection: structural
19
+ regex: '[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}'
20
+ - code: LOC
21
+ detection: contextual
22
+ regex: null
23
+ - code: BANK
24
+ detection: structural
25
+ regex: '\d{4}-\d{4}-\d{4}-\d{4}'
26
+ - code: DATE
27
+ detection: hybrid
28
+ regex: null
29
+ - code: SECRET
30
+ detection: hybrid
31
+ regex: 'sk-[A-Za-z0-9]{20,}'
32
+
33
+ extended_entities:
34
+ # KO-specific identifiers not in the base label set (ENTITY_SPEC §3.3).
35
+ - code: BIZ_NUM
36
+ detection: structural
37
+ regex: '\d{3}-\d{2}-\d{5}'
38
+ description: 사업자등록번호
39
+ - code: DRIVER_LICENSE
40
+ detection: structural
41
+ regex: '\d{2}-\d{2}-\d{6}-\d{2}'
42
+ description: 운전면허번호
43
+
44
+ # Partial-masking policy (ENTITY_SPEC §7.3); applied by downstream consumers.
45
+ partial_masking:
46
+ ID_NUM: '900101-1******'
47
+ PHONE: '010-****-5678'
48
+ BANK: '****-****-****-3456'
49
+ EMAIL: 'u***@domain.com'
@@ -0,0 +1,69 @@
1
+ # privyscope-ko — Stage 1 Regex Filter rules (SRS §3.4, ENTITY_SPEC §3).
2
+ # Structurally obvious PII caught before the NER stage. Externally extensible:
3
+ # add patterns here without touching engine code. Each rule is tried in order;
4
+ # `priority` breaks ties when two rules overlap (higher wins).
5
+ #
6
+ # Fields:
7
+ # label : privyscope entity code
8
+ # pattern : Python `regex`/`re` pattern (anchored as written)
9
+ # priority : overlap-resolution weight (default 0)
10
+ version: 1
11
+ language: ko
12
+ rules:
13
+ # -- SECRET (high priority: very specific, must win over generic numbers) --
14
+ - label: SECRET
15
+ pattern: 'sk-ant-api03-[A-Za-z0-9\-_]{20,}'
16
+ priority: 100
17
+ - label: SECRET
18
+ pattern: 'sk-[A-Za-z0-9]{20,}'
19
+ priority: 95
20
+ - label: SECRET
21
+ pattern: 'ghp_[A-Za-z0-9]{36}'
22
+ priority: 95
23
+ - label: SECRET
24
+ pattern: 'gho_[A-Za-z0-9]{36}'
25
+ priority: 95
26
+ - label: SECRET
27
+ pattern: 'AKIA[A-Z0-9]{16}'
28
+ priority: 95
29
+ - label: SECRET
30
+ pattern: 'AIza[A-Za-z0-9\-_]{35}'
31
+ priority: 95
32
+ - label: SECRET
33
+ pattern: 'eyJ[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+'
34
+ priority: 90
35
+ - label: SECRET
36
+ pattern: '[A-Z_]{2,}=\S{8,}'
37
+ priority: 40
38
+
39
+ # -- EMAIL ----------------------------------------------------------------
40
+ - label: EMAIL
41
+ pattern: '[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}'
42
+ priority: 80
43
+
44
+ # -- ID_NUM (KO) ----------------------------------------------------------
45
+ - label: ID_NUM # 주민등록번호 / 외국인등록번호
46
+ pattern: '\d{6}-[1-8]\d{6}'
47
+ priority: 70
48
+ - label: ID_NUM # 사업자등록번호
49
+ pattern: '\d{3}-\d{2}-\d{5}'
50
+ priority: 60
51
+
52
+ # -- BANK (card numbers; before phone to avoid mis-capture) ---------------
53
+ - label: BANK
54
+ pattern: '\d{4}-\d{4}-\d{4}-\d{4}'
55
+ priority: 65
56
+
57
+ # -- PHONE (KO) -----------------------------------------------------------
58
+ - label: PHONE
59
+ pattern: '\+82-10-\d{4}-\d{4}'
60
+ priority: 55
61
+ - label: PHONE
62
+ pattern: '(?:010|011|016|017|018|019)-\d{3,4}-\d{4}'
63
+ priority: 50
64
+ - label: PHONE
65
+ pattern: '0\d{1,2}-\d{3,4}-\d{4}'
66
+ priority: 45
67
+ - label: PHONE
68
+ pattern: '01\d{9}'
69
+ priority: 30
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: privyscope-ko
3
+ Version: 0.1.2
4
+ Summary: privyscope-ko — Korean language pack for the privyscope PII engine
5
+ Author: privyscope Core Team
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/zafrem/privyscope-ko
8
+ Project-URL: Documentation, https://github.com/zafrem/privyscope-ko/blob/main/README.md
9
+ Keywords: pii,ner,redaction,privacy,korean,onnx
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Text Processing :: Linguistic
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: privyscope>=0.1.0
23
+ Provides-Extra: train
24
+ Requires-Dist: privyscope[train]>=0.1.0; extra == "train"
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == "dev"
27
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # privyscope-ko
31
+
32
+ 한국어 텍스트에서 **개인정보(PII)를 찾는** 엔진이에요.
33
+ [privyscope](https://github.com/zafrem) 시리즈의 한국어 버전으로, 사람 이름,
34
+ 전화번호, 주민등록번호, 이메일, 주소, 금융 정보, 비공개 날짜, 인증 정보(시크릿)를
35
+ 알아서 찾아 마스킹해 줍니다.
36
+
37
+ > ⚠️ privyscope는 마스킹을 **도와주는** 도구일 뿐, 비식별화나 컴플라이언스를
38
+ > 보장하지는 않아요. 자세한 내용은 [한계](#한계)를 꼭 읽어보세요.
39
+
40
+ 📖 **[English README](README.en.md)**
41
+
42
+ ## 설치
43
+
44
+ ```bash
45
+ pip install privyscope-ko
46
+ ```
47
+
48
+ ## 1분 만에 시작하기
49
+
50
+ **Python에서 쓰기**
51
+
52
+ ```python
53
+ from privyscope_ko import Privyscope
54
+
55
+ engine = Privyscope.from_pretrained() # 처음 실행할 때 ONNX 가중치를 내려받아요
56
+ result = engine.redact("홍길동의 전화번호는 010-1234-5678")
57
+
58
+ result.masked_text # "<PER>의 전화번호는 <PHONE>"
59
+ result.detected_spans # [DetectedSpan(label="PER", start=0, end=3, ...), ...]
60
+ result.summary # {"span_count": 2, "by_label": {"PER": 1, "PHONE": 1}, ...}
61
+ ```
62
+
63
+ **터미널에서 쓰기**
64
+
65
+ ```bash
66
+ privyscope redact "홍길동의 전화번호는 010-1234-5678"
67
+ cat notes.txt | privyscope redact --operating-point high_recall
68
+ ```
69
+
70
+ ## 문서
71
+
72
+ 더 자세한 가이드는 [`docs/`](docs/) 폴더에 목적별로 정리해 뒀어요. 하고 싶은 걸
73
+ 골라서 보세요:
74
+
75
+ | 이런 게 궁금하다면 | 가이드 |
76
+ |---|---|
77
+ | 터미널에서 돌리고 싶어요 | [CLI 레퍼런스](docs/CLI.md) |
78
+ | Python 코드에서 부르고 싶어요 | [Python API 레퍼런스](docs/API.md) |
79
+ | JSON 출력이 무슨 뜻인지 알고 싶어요 | [출력 스키마](docs/OUTPUT_SCHEMAS.md) |
80
+ | 내 라벨링 데이터로 점수를 매겨보고 싶어요 | [평가 및 출력 모드](docs/EVAL_AND_OUTPUT_MODES.md) |
81
+ | 정밀도와 재현율을 조절하고 싶어요 | [운영 포인트](docs/OPERATING_POINTS.md) |
82
+ | 인터넷 없이 폐쇄망에서 쓰고 싶어요 | [오프라인 사용](docs/OFFLINE.md) |
83
+ | 내 데이터로 파인튜닝하고 싶어요 | [파인튜닝](docs/FINETUNING.md) |
84
+
85
+ ## 어떤 걸 찾아주나요
86
+
87
+ 찾아주는 항목은 이렇게 여덟 가지예요:
88
+ `PER` · `PHONE` · `ID_NUM` · `EMAIL` · `LOC` · `BANK` · `DATE` · `SECRET`.
89
+
90
+ 정규식 규칙은 [`privyscope/regex_rules.yaml`](privyscope/regex_rules.yaml)에 들어
91
+ 있고, 코드를 건드리지 않고도 직접 추가하거나 고칠 수 있어요. 한국어에만 있는
92
+ 확장 항목은 [`privyscope/entity_config.yaml`](privyscope/entity_config.yaml)에
93
+ 정의돼 있습니다.
94
+
95
+ ## 어떻게 동작하나요
96
+
97
+ 크게 **두 단계**로 나눠서 PII를 찾고, 두 결과를 합쳐서(합집합) 돌려줘요
98
+ (SRS §3.4):
99
+
100
+ 1. **정규식 필터** — 전화번호, 이메일, 주민번호, 카드번호, 시크릿처럼 형태가
101
+ 딱 정해져 있는 PII를 잡아냅니다.
102
+ 2. **ONNX NER** — 이름, 주소, 비공개 날짜처럼 앞뒤 문맥을 봐야 알 수 있는
103
+ PII를 잡아내요. BIOES 토큰 분류기에 제약 Viterbi 디코더를 붙여서 판단합니다.
104
+
105
+ 추론할 때는 **ONNX Runtime만 쓰고 PyTorch는 필요 없어요**. 기본적으로 빠뜨리지
106
+ 않는 걸(재현율) 우선하고, 재학습 없이 [운영 포인트](docs/OPERATING_POINTS.md)만
107
+ 바꿔서 동작을 조절할 수 있습니다. PyTorch는 [파인튜닝](docs/FINETUNING.md)을 할
108
+ 때만 있으면 돼요.
109
+
110
+ ## 모델과 성능
111
+
112
+ - **구조** — `klue/roberta-base` 인코더 → BIOES 토큰 분류 헤드 → Viterbi
113
+ 디코더로 이어지는 형태예요.
114
+ - **실제 배포 파일** — INT8로 양자화한 ONNX 모델이고 크기는 **약 105 MB**라
115
+ 150 MB 안에 넉넉히 들어와요. 최대 문장 길이는 256입니다. 가중치는 처음
116
+ 쓸 때 Hugging Face Hub에서 내려받고, 파일이 멀쩡한지 확인할 수 있게 SHA-256
117
+ `checksum.txt`가 함께 들어 있어요.
118
+ - **정확도** — 학습과 겹치지 않는 검증 세트(2,000문장, `typed`/strict 채점,
119
+ regex + NER 전체 파이프라인)에서 엔티티 단위 **strict 마이크로 F1 = 0.966**을
120
+ 기록했어요. 엔티티별 strict F1:
121
+
122
+ | PER | LOC | DATE | EMAIL | ID_NUM | BANK | PHONE |
123
+ |-----|-----|------|-------|--------|------|-------|
124
+ | 0.98 | 1.00 | 1.00 | 1.00 | 1.00 | 0.92 | 0.78 |
125
+
126
+ `PHONE`는 정밀도가 0.64로 전화번호처럼 보이는 숫자를 과검출하는 경향이 있고,
127
+ `BANK`는 재현율이 0.85라 일부를 놓쳐요. 검증 세트가 학습과 분리돼 있어 이
128
+ 점수는 암기가 아니라 일반화 성능을 보여주지만, 분포 밖 문장에서는 더 낮게
129
+ 나올 수 있어요. `privyscope eval --lang ko your_val.jsonl`로 직접 재현할 수
130
+ 있고, 자세한 내용은 [평가 및 출력 모드](docs/EVAL_AND_OUTPUT_MODES.md)를
131
+ 참고하세요.
132
+
133
+ ## 한계
134
+
135
+ 쓰기 전에 이 점들은 꼭 알아두세요:
136
+
137
+ - 비식별화나 컴플라이언스를 보장하지는 않아요. 프라이버시 설계의 **여러 안전장치
138
+ 중 하나**로 생각하고 쓰는 게 맞습니다.
139
+ - 잘 못 잡는 경우도 있어요. 예를 들어 드물거나 지역색이 강한 이름은 놓칠 수
140
+ 있고, 문맥이 애매하면 공인(공개 인물)까지 과하게 가릴 수 있어요. 형식이 복잡하게
141
+ 섞인 텍스트에서는 한 덩어리가 여러 조각으로 쪼개지기도 하고, 처음 보는 형식의
142
+ `SECRET`은 못 잡을 수 있습니다.
143
+ - 의료·법률·금융·정부 업무처럼 민감한 곳에서는 사람이 한 번 더 검토하는 걸
144
+ 권장해요.
145
+
146
+ ## 라이선스
147
+
148
+ Apache-2.0으로 배포돼요. 모델 가중치도 같은 Apache-2.0이고, 파일 무결성을 확인할
149
+ 수 있는 `checksum.txt`(SHA-256)와 함께 Hugging Face Hub에 올라가 있습니다. 기여는
150
+ 언제든 환영이에요 — [CONTRIBUTING.md](CONTRIBUTING.md)를 참고해 주세요.
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ privyscope_ko/__init__.py
5
+ privyscope_ko/entity_config.yaml
6
+ privyscope_ko/regex_rules.yaml
7
+ privyscope_ko.egg-info/PKG-INFO
8
+ privyscope_ko.egg-info/SOURCES.txt
9
+ privyscope_ko.egg-info/dependency_links.txt
10
+ privyscope_ko.egg-info/entry_points.txt
11
+ privyscope_ko.egg-info/requires.txt
12
+ privyscope_ko.egg-info/top_level.txt
13
+ tests/test_ko_regex.py
14
+ tests/test_plugin_registered.py
@@ -0,0 +1,2 @@
1
+ [privyscope.languages]
2
+ ko = privyscope_ko:LANG
@@ -0,0 +1,8 @@
1
+ privyscope>=0.1.0
2
+
3
+ [dev]
4
+ pytest>=7.0
5
+ pytest-cov>=4.0
6
+
7
+ [train]
8
+ privyscope[train]>=0.1.0
@@ -0,0 +1 @@
1
+ privyscope_ko
@@ -0,0 +1,48 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "privyscope-ko"
7
+ version = "0.1.2"
8
+ description = "privyscope-ko — Korean language pack for the privyscope PII engine"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { text = "Apache-2.0" }
12
+ authors = [{ name = "privyscope Core Team" }]
13
+ keywords = ["pii", "ner", "redaction", "privacy", "korean", "onnx"]
14
+ classifiers = [
15
+ "License :: OSI Approved :: Apache Software License",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3 :: Only",
18
+ "Programming Language :: Python :: 3.9",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Topic :: Text Processing :: Linguistic",
24
+ ]
25
+ # The engine lives in the core; this pack only adds Korean data + registration.
26
+ dependencies = [
27
+ "privyscope>=0.1.0",
28
+ ]
29
+
30
+ [project.optional-dependencies]
31
+ train = ["privyscope[train]>=0.1.0"]
32
+ dev = ["pytest>=7.0", "pytest-cov>=4.0"]
33
+
34
+ # Register the Korean plugin so the core discovers it at runtime. No console
35
+ # script here — the `privyscope` command is owned solely by the core.
36
+ [project.entry-points."privyscope.languages"]
37
+ ko = "privyscope_ko:LANG"
38
+
39
+ [project.urls]
40
+ Homepage = "https://github.com/zafrem/privyscope-ko"
41
+ Documentation = "https://github.com/zafrem/privyscope-ko/blob/main/README.md"
42
+
43
+ [tool.setuptools.packages.find]
44
+ where = ["."]
45
+ include = ["privyscope_ko*"]
46
+
47
+ [tool.setuptools.package-data]
48
+ privyscope_ko = ["*.yaml"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,35 @@
1
+ """Korean Stage-1 regex rules (over the real ko data) + engine wiring."""
2
+ import pytest
3
+
4
+ from privyscope import installed_languages
5
+ from privyscope._core.regex_filter import RegexFilter
6
+
7
+ from privyscope_ko import LANG, Privyscope
8
+
9
+
10
+ def _filter():
11
+ return RegexFilter.from_yaml(LANG.regex_rules_path())
12
+
13
+
14
+ def test_ko_phone_email_id():
15
+ rf = _filter()
16
+ text = "연락처 010-1234-5678, 이메일 user@naver.com, 주민 900101-1234567"
17
+ spans = {(s.label, text[s.start:s.end]) for s in rf.find(text)}
18
+ assert ("PHONE", "010-1234-5678") in spans
19
+ assert ("EMAIL", "user@naver.com") in spans
20
+ assert ("ID_NUM", "900101-1234567") in spans
21
+
22
+
23
+ def test_ko_card_is_bank_not_phone():
24
+ rf = _filter()
25
+ spans = {(s.label, s.start, s.end) for s in rf.find("카드 1234-5678-9012-3456 결제")}
26
+ assert any(lab == "BANK" for lab, _s, _e in spans)
27
+ assert not any(lab == "PHONE" for lab, _s, _e in spans)
28
+
29
+
30
+ def test_ko_engine_regex_only():
31
+ if "ko" not in installed_languages():
32
+ pytest.skip("privyscope-ko not pip-installed; plugin not discoverable")
33
+ engine = Privyscope.regex_only(lang="ko")
34
+ r = engine.redact("전화 010-1234-5678 이메일 user@naver.com")
35
+ assert r.redacted_text == "전화 <PHONE> 이메일 <EMAIL>"
@@ -0,0 +1,21 @@
1
+ """Verify the Korean pack registers itself with the core (requires install)."""
2
+ import pytest
3
+
4
+ from privyscope import installed_languages
5
+ from privyscope_ko import LANG
6
+
7
+
8
+ def test_lang_record_shape():
9
+ assert LANG.code == "ko"
10
+ assert LANG.display_name == "Korean"
11
+ assert LANG.default_repo == "zafrem/privyscope-ko"
12
+ assert LANG.scripts == ("Hangul",)
13
+ assert LANG.regex_rules_path().exists()
14
+ assert LANG.entity_config_path().exists()
15
+
16
+
17
+ def test_discovered_via_entry_point():
18
+ langs = installed_languages()
19
+ if "ko" not in langs:
20
+ pytest.skip("privyscope-ko not pip-installed; entry point not discoverable")
21
+ assert langs["ko"].display_name == "Korean"