Fix IN vehicle registration under-scoring zero-padded district codes#2110
Open
jichaowang02-lang wants to merge 1 commit into
Open
Conversation
The district-code validity check compares the parsed code against
state_rto_district_map. Some states store their district codes single-digit
("1".."9"), but the parser produces the zero-padded form ("DL01" -> "01") when
both characters after the state are digits. So a valid Delhi/Gujarat plate
written in the standard zero-padded form (DL01..DL09, GJ01..GJ09) failed the
district lookup and validate_result kept it at the base 0.5 score instead of
promoting it to 1.0 — even though "DL3" (single-digit) and "DL13" (two-digit)
were promoted correctly. (Other states, e.g. OD, store the padded form and
already worked.)
Normalise the leading zero (`str(int(dist_code))`) as an additional lookup, so
a zero-padded district still matches a single-digit entry. The check is purely
additive — states that store the padded form keep matching, and invalid
districts (e.g. DL99, DL00) are still not promoted.
Adds DL01/GJ09 cases (previously scored 0.5).
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
InVehicleRegistrationRecognizervalidates the district code againststate_rto_district_map. The parser produces a two-digit district code when both characters after the state are digits (DL01→01), but several states store their district codes single-digit ("1".."9"). So a valid Delhi/Gujarat plate written in the standard zero-padded form fails the district lookup and stays at the base0.5score instead of being promoted to1.0:Only the zero-padded single-digit districts (DL/GJ 01–09) are affected; states that store the padded form (e.g.
OD→"02") already worked.Fix
Normalise the leading zero (
str(int(dist_code))) as an additional lookup. The check is purely additive — padded-form states keep matching via the original check, and invalid districts (DL99,DL00) are still not promoted.Checklist
Tests
Adds
DL01CA1234andGJ09AB1234(expected score 1.0) — both score 0.5 before the fix. The existingOD02BA2341(already padded),DL3CJI0001, and invalid-districtKA99ME3456cases are unchanged.