Skip to content

Fold a leading non-first-name prefix into the surname (closes #121)#202

Merged
derek73 merged 6 commits into
masterfrom
worktree-non-first-name-prefixes
Jul 4, 2026
Merged

Fold a leading non-first-name prefix into the surname (closes #121)#202
derek73 merged 6 commits into
masterfrom
worktree-non-first-name-prefixes

Conversation

@derek73

@derek73 derek73 commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add NON_FIRST_NAME_PREFIXES as a curated static subset of PREFIXES (mirrors the TITLES = FIRST_NAME_TITLES | {...} idiom), disjoint from FIRST_NAME_PREFIXES.
  • Expose Constants.non_first_name_prefixes as a plain SetManager (not part of the cached _pst union used by is_rootname).
  • Default-on 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 as first="", last="de Mesnil" instead of first="de", last="Mesnil".
  • Ambiguous particles that can be given names (van, von, della, di, del, ...) are intentionally excluded and remain unchanged.
  • Document the new config set in docs/customize.rst and log the change in docs/release_log.rst (1.3.0).

Test plan

  • uv run pytest — 1232 passed, 22 xfailed, 0 regressions
  • uv run mypy nameparser/ — clean
  • uv run ruff check nameparser/ tests/ — clean
  • New invariant + behavior tests cover target folds, safety/unchanged cases (von/van/della/di/del), non-leading particle, custom-title interaction, and the bare-prefix guard

🤖 Generated with Claude Code

@derek73 derek73 self-assigned this Jul 4, 2026
@derek73 derek73 added this to the v1.3.0 milestone Jul 4, 2026
derek73 added 2 commits July 4, 2026 00:30
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).
@derek73 derek73 merged commit d8a1d19 into master Jul 4, 2026
8 checks passed
@derek73 derek73 deleted the worktree-non-first-name-prefixes branch July 4, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant