feat(analyzer): add Korean Corporate Registration Number (KR_CRN) recognizer#2178
Open
developer0hye wants to merge 1 commit into
Open
feat(analyzer): add Korean Corporate Registration Number (KR_CRN) recognizer#2178developer0hye wants to merge 1 commit into
developer0hye wants to merge 1 commit into
Conversation
…ognizer Adds KrCrnRecognizer for the 13-digit corporate identifier assigned by the Korean court registry office, complementing the tax-oriented KR_BRN recognizer. The pattern constrains the corporate type code (digits 5-6) to the codes assigned in attached Table 3 of the Supreme Court rule, and validates the check digit for CRNs issued before 2025-01-31, when Supreme Court Rule No. 3173 abolished it. Closes data-privacy-stack#2177 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Description
This PR adds a new recognizer,
KrCrnRecognizer(KR_CRN), to detect and validate South Korean Corporate Registration Numbers (법인등록번호) — the 13-digit identifier the court registry office assigns to every legal entity upon incorporation.Korea currently has only the tax-oriented business identifier covered (
KR_BRN, #1822). Jurisdictions with both identifier kinds have both covered:AU_ABN/AU_ACN,DE_VAT_ID/DE_HANDELSREGISTER,SE_ORGANISATIONSNUMMER,SG_UEN. The CRN routinely appears next to the BRN in Korean contracts, invoices and corporate filings, and resolves to the entity's representative and registered address through the public corporate registry, so leaving it undetected undermines de-identification of such documents.Implementation details:
AAAABB-CCCCCCD, 13 digits with optional hyphen after the 6th. The corporate type code (digits 5–6) is constrained to the codes assigned in attached Table 3 of the Supreme Court rule on registration numbers (법인 및 재외국민의 부동산등기용등록번호 부여에 관한 규칙): 11–15 commercial companies, 21–22 civil-law corporations, 31–53 special-law corporations, 71 other, 81–86 foreign corporations. This also reduces overlap withKR_RRN, which shares the hyphenated 6-7 digit shape.(10 - (alternating 1,2 weighted sum of the first 12 digits mod 10)) mod 10, boosting the score on match. Supreme Court Rule No. 3173 (effective 2025-01-31) expanded the serial number to 7 digits and abolished the check digit, sovalidate_resultreturnsNonerather thanFalseon mismatch — the same approachKrRrnRecognizertakes for post-2020 RRNs with random serials.default_recognizers.yamlwithenabled: falseandcountry_code: krunder bothkoandkr, matching the other Korean recognizers. The constructor accepts thenamekwarg the YAML loader passes (see KrPassportRecognizer is missing from the predefined registry and defaults to wrong language code 'kr' #2176 for why this matters).country_specific/korea/__init__.py's__all__while registering the new recognizer there.Added unit tests covering checksum pass/fail, hyphenated and plain forms, corporate type code constraints, the
None-on-mismatch validation contract, thekodefault language, thenamekwarg, and end-to-end loading from the YAML registry for bothkoandkr.Issue reference
Closes #2177
Checklist
🤖 Generated with Claude Code