Skip to content

fix(analyzer): register KrPassportRecognizer and align its default language#2170

Open
developer0hye wants to merge 2 commits into
data-privacy-stack:mainfrom
developer0hye:fix-kr-passport-registry
Open

fix(analyzer): register KrPassportRecognizer and align its default language#2170
developer0hye wants to merge 2 commits into
data-privacy-stack:mainfrom
developer0hye:fix-kr-passport-registry

Conversation

@developer0hye

@developer0hye developer0hye commented Jul 18, 2026

Copy link
Copy Markdown

Change Description

KrPassportRecognizer was the only Korean recognizer missing from default_recognizers.yaml, and two inconsistencies with its siblings kept it out of the predefined registry:

  • Constructor signature. The YAML loader (RecognizerListLoader.get) instantiates every predefined recognizer with a name keyword argument, but KrPassportRecognizer.__init__ did not accept name. Adding the recognizer to default_recognizers.yaml therefore raised TypeError: __init__() got an unexpected keyword argument 'name'. KrRrnRecognizer, KrBrnRecognizer, KrFrnRecognizer and KrDriverLicenseRecognizer all already accept name.
  • Default language. Its default supported_language was kr, while every other Korean recognizer defaults to ko. fix(analyzer): update Korean language code from 'kr' to 'ko' #1742 already migrated the Korean recognizers from kr to ko (correct ISO 639-1 code) and warned that the wrong code breaks loading once a Korean NLP model such as spaCy is configured. KrPassportRecognizer was added later in feat: Add Korean passport number recognizer (KR_PASSPORT) #1814 and reintroduced kr, so an AnalyzerEngine running ko silently skips it.

Before: KrPassportRecognizer is absent from default_recognizers.yaml, cannot be loaded through the registry (TypeError if listed), and does not participate in a ko analysis when instantiated with defaults.

After: the constructor accepts name, defaults to ko, and is registered in default_recognizers.yaml with enabled: false and country_code: kr (matching the other Korean recognizers per the country-specific recognizer guidelines). It now loads from the registry for both ko and kr once enabled.

Added regression tests covering the default language, the name keyword argument, and end-to-end loading from the YAML registry for both ko and kr.

Issue reference

No existing issue. Follows up on #1742 (Korean kr -> ko migration) and #1814 (which added this recognizer).

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

🤖 Generated with Claude Code

…nguage

KrPassportRecognizer was the only Korean recognizer missing from
default_recognizers.yaml. Its constructor did not accept the `name`
keyword argument that the YAML loader passes to every predefined
recognizer, so adding it to the YAML raised TypeError. Its default
supported_language was also "kr" while every other Korean recognizer
(RRN/BRN/FRN/driver license) defaults to "ko", so an AnalyzerEngine
running "ko" silently skipped it.

Add the `name` argument, change the default language to "ko", and
register the recognizer in default_recognizers.yaml (enabled: false,
country_code: kr) like its siblings. Add regression tests covering the
default language, the `name` kwarg, and end-to-end loading from the
YAML registry for both "ko" and "kr".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant