Skip to content

Conversation

@RektPunk
Copy link
Contributor

@RektPunk RektPunk commented Jan 1, 2026

Change Description

This PR adds a new recognizer, KrFrnRecognizer, to detect and validate South Korean Foreigner Registration Numbers.

Issue reference

Fixes #XX

Checklist

  • I have reviewed the contribution guidelines
  • I have signed the CLA (if required)
  • My code includes unit tests
  • All unit tests and lint checks pass locally
  • My PR contains documentation updates / additions if required

@RonShakutai RonShakutai self-requested a review January 8, 2026 09:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for detecting Korean Foreigner Registration Numbers (FRN), a 13-digit identifier issued to registered foreigners in Korea. The implementation follows best practices by inheriting from the existing KrRrnRecognizer and reusing common validation logic through a well-designed refactoring.

Changes:

  • Added new KrFrnRecognizer class that detects Korean Foreigner Registration Numbers with pattern matching, context-based detection, and checksum validation
  • Refactored KrRrnRecognizer to extract common checksum computation logic into a reusable _compute_checksum method
  • Added comprehensive test coverage with 13 test cases covering valid FRNs (with and without checksums), invalid formats, and edge cases

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/korea/kr_frn_recognizer.py New recognizer implementation that inherits from KrRrnRecognizer, defines FRN-specific patterns (gender codes 5-8), context words (Korean and English), and FRN-specific checksum validation formula
presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/korea/kr_rrn_recognizer.py Refactored to extract common checksum computation into _compute_checksum method and improved type hints from Union[bool, None] to Optional[bool]
presidio-analyzer/tests/test_kr_frn_recognizer.py Comprehensive test suite with 13 parametrized test cases covering valid FRNs with correct/incorrect checksums and various invalid formats
presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/korea/__init__.py Added KrFrnRecognizer to module exports in alphabetical order
presidio-analyzer/presidio_analyzer/predefined_recognizers/__init__.py Added KrFrnRecognizer import and export to main predefined recognizers module
presidio-analyzer/presidio_analyzer/conf/default_recognizers.yaml Added KrFrnRecognizer configuration with ko/kr language support and enabled: false flag
docs/supported_entities.md Added KR_FRN entity documentation in alphabetically ordered Korea section

@RektPunk
Copy link
Contributor Author

I’ve addressed the issues raised by Copilot. Could you please take a look at the changes now @omri374 ?

Copy link
Collaborator

@RonShakutai RonShakutai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RonShakutai RonShakutai merged commit 5eb2078 into microsoft:main Jan 15, 2026
34 checks passed
@RektPunk RektPunk deleted the feat/kr-frn-recognizer branch January 15, 2026 10:23
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.

3 participants