feat: add patronymic_name_order for Russian formal name order (#85)#184
Merged
Conversation
Add two precompiled regex patterns to detect Russian patronymic suffixes: - patronymic: Detects Latin-character patronymic endings (ovich, ovna, evich, etc.) - patronymic_cyrillic: Detects Cyrillic patronymic endings (ович, овна, евич, etc.) Both patterns are end-anchored ($) to match complete patronymic suffixes, supporting case-insensitive Latin matching and case-sensitive Cyrillic matching. These patterns will be used by Tasks 2-3 to implement Russian formal name order detection. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…cNameOrderFlagTests)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add documentation for the new patronymic_name_order feature: - Add bullet to "Other editable attributes" list in customize.rst - Add new "Russian Formal Name Order" subsection with code example - Add release log entry for the feature - Fix pre-existing doctest output formatting in prefix example Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Jun 30, 2026
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
patronymic_name_orderflag toConstantsthat detects Russian formal-order names (Surname GivenName Patronymic) by anchoring on a trailing East-Slavic patronymic suffix and rotates to Western order (first=GivenName,middle=Patronymic,last=Surname)patronymic(Latin) andpatronymic_cyrillicregex patterns toREGEXESis_patronymic()helper andhandle_patronymic_name_order()toHumanName; wired intopost_process()afterhandle_firstnames()and beforehandle_capitalization()patronymic_name_order = Falseleaves all existing parses byte-for-byte unchangedGuards (reordering only fires when all hold)
first_list,middle_list,last_listlasttoken matches a patronymic suffixmiddletoken does NOT match a patronymic suffix (already Western order → skip)Test Plan
uv run pytest— 942 passed, 22 xfailed, 0 failuresuv run mypy nameparser/— no issuesuv run ruff check nameparser/ tests/— all checks passedtests/test_patronymic_order.pycovers: 7 reorder cases (Latin, Cyrillic, hyphenated surname, title/suffix preserved), 8 guard cases (comma guard, 2-token, no patronymic, middle-is-patronymic, documented tradeoff), and flag-off baselineConstants.patronymic_name_orderdocstring runs live and passesCloses #85
🤖 Generated with Claude Code