Skip to content

feat(analyzer): add Korean-language context terms to KrRrnRecognizer - #2213

Open
juno-junho wants to merge 2 commits into
data-privacy-stack:mainfrom
juno-junho:feat/kr-rrn-korean-context
Open

feat(analyzer): add Korean-language context terms to KrRrnRecognizer#2213
juno-junho wants to merge 2 commits into
data-privacy-stack:mainfrom
juno-junho:feat/kr-rrn-korean-context

Conversation

@juno-junho

@juno-junho juno-junho commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Change Description

Add Korean-language context terms (주민등록번호, 주민번호, 신분증, 본인인증) to KrRrnRecognizer.CONTEXT, with a regression test.

The context list was English-only, so LemmaContextAwareEnhancer could never boost KR_RRN confidence on Korean-language text, which is the primary language Korean RRNs appear in. Every other Korean recognizer (driver license, passport, FRN, BRN) already ships Korean context terms. The last two terms are broader identity-related words, so feel free to ask me to drop them if you prefer the conservative set. All four come from a production Korean PII-masking deployment.

pytest tests/test_kr_rrn_recognizer.py and ruff check pass.

Issue reference

Fixes #2212

Checklist

  • I have reviewed the contribution guidelines
  • I agree to follow this project's Code of Conduct
  • I confirm that I have the right to submit this contribution and that it does not knowingly contain proprietary or confidential code.
  • My code includes unit tests
  • All unit tests and lint checks pass locally
  • My PR contains documentation updates / additions if required

Update: aligned with the recognizer instructions from #2211

This changes detection results for existing users: on Korean-language text the context enhancer can now raise KR_RRN scores where it previously never fired. Patterns and base scores are unchanged, so nothing that matched before stops matching.

Tests now show each of the four terms raising the score through the enhancer (0.5 to 0.85 via the explicit context argument, the route test_context_support uses, since text-derived context needs a Korean NLP model the test environment does not ship), plus Korean context text before and after the number at the pattern level.

@juno-junho
juno-junho force-pushed the feat/kr-rrn-korean-context branch from a998981 to acf4981 Compare August 18, 2026 02:56
…er placement

Per the recognizer instructions (data-privacy-stack#2211): each of the four new Korean terms is
shown to raise the score through the enhancer's explicit context argument
(text-derived context would need a Korean NLP model the test environment does
not ship), and Korean context text before and after the number is covered at
the pattern level.
@juno-junho

Copy link
Copy Markdown
Contributor Author

Updated per the recognizer instructions from #2211: the description now states the detection-behavior change for existing users, and the tests show each of the four Korean terms raising the score through the enhancer, plus placement coverage on both sides of the number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KR_RRN context enhancement never fires on Korean-language text

1 participant