Fold a leading non-first-name prefix into the surname (closes #121)#202
Merged
Conversation
Enforces the subset/disjointness invariants documented on the set so a future bad edit fails the import instead of silently drifting until a test happens to catch it.
Pins down behavior the review flagged as untested: case-insensitive matching, a suffix alongside the fold, and running with patronymic_name_order/middle_name_as_last enabled (confirming no double-processing against handle_non_first_name_prefix).
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.
Summary
NON_FIRST_NAME_PREFIXESas a curated static subset ofPREFIXES(mirrors theTITLES = FIRST_NAME_TITLES | {...}idiom), disjoint fromFIRST_NAME_PREFIXES.Constants.non_first_name_prefixesas a plainSetManager(not part of the cached_pstunion used byis_rootname).post_process()transform: when the parsed first name is a single leading non-first-name prefix (e.g.de,dos,ibn) with something to attach to, fold it (+ any middle) into the surname —"de Mesnil"now parses asfirst="",last="de Mesnil"instead offirst="de",last="Mesnil".van,von,della,di,del, ...) are intentionally excluded and remain unchanged.docs/customize.rstand log the change indocs/release_log.rst(1.3.0).Test plan
uv run pytest— 1232 passed, 22 xfailed, 0 regressionsuv run mypy nameparser/— cleanuv run ruff check nameparser/ tests/— clean🤖 Generated with Claude Code