You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add suffix_delimiter for parsing suffixes separated by arbitrary delimiters (#156) (#172)
* docs: add design spec for suffix_delimiter feature (issue #156)
* docs: add implementation plan for suffix_delimiter feature
* feat: add suffix_delimiter to Constants (default None)
Add the suffix_delimiter class attribute to the Constants class with a default
value of None. This attribute will be used by HumanName to split suffix groups
after comma-splitting. The attribute follows the existing pattern of scalar
class attributes (string_format, initials_delimiter, initials_separator).
* feat: wire suffix_delimiter kwarg into HumanName.__init__
* feat: expand parts on suffix_delimiter after comma split in parse()
When parsing names with suffixes separated by a custom delimiter (e.g.
"Steven Hardman, RN - CRNA" with suffix_delimiter=" - "), the parser
now re-splits post-comma parts on the suffix_delimiter and flattens them
before processing. This transforms ["Steven Hardman", "RN - CRNA"] into
["Steven Hardman", "RN", "CRNA"], making downstream suffix detection work
correctly instead of treating the delimiter as an invalid suffix.
* test: add CONSTANTS-level and known-limitation tests for suffix_delimiter
* docs: note inverted-format limitation in suffix_delimiter docstring; clarify known-limitation test
* chore: remove planning docs for suffix_delimiter feature
* docs: add suffix_delimiter to customize.rst and release_log.rst
* fix: address PR review feedback on suffix_delimiter
- Filter empty tokens from trailing/leading delimiters to prevent
silent parse corruption (e.g. "MD-PhD-" with suffix_delimiter="-")
- Clarify no-op note in Constants docstring: both the comma split and
subsequent strip() make ", " a no-op, not just the comma split
- Correct param docstring: expansion applies to all post-comma parts,
not just identified suffix groups
- Tighten known-limitation test with concrete field assertions instead
of a fragile assertNotEqual
- Add tests: trailing delimiter, comma-space no-op, inverted-format
limitation
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/customize.rst
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,6 +59,7 @@ Other editable attributes
59
59
* :py:obj:`~nameparser.config.Constants.empty_attribute_default` - value returned by empty attributes, defaults to empty string
60
60
* :py:obj:`~nameparser.config.Constants.capitalize_name` - If set, applies :py:meth:`~nameparser.parser.HumanName.capitalize` to :py:class:`~nameparser.parser.HumanName` instance.
61
61
* :py:obj:`~nameparser.config.Constants.force_mixed_case_capitalization` - If set, forces the capitalization of mixed case strings when :py:meth:`~nameparser.parser.HumanName.capitalize` is called.
62
+
* :py:obj:`~nameparser.config.Constants.suffix_delimiter` - additional delimiter used to split suffix groups after comma-splitting, e.g. ``" - "`` for names like ``"Jane Smith, RN - CRNA"``. Defaults to ``None`` (disabled).
Copy file name to clipboardExpand all lines: docs/release_log.rst
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
Release Log
2
2
===========
3
+
* 1.2.2 - June 28, 2026
4
+
- Add ``suffix_delimiter`` to ``Constants`` and ``HumanName`` for parsing suffixes separated by arbitrary delimiters, e.g. ``"RN - CRNA"`` (#156)
3
5
* 1.2.1 - June 19, 2026
4
6
- Fix ``initials()`` interpolating the literal ``None`` for empty name parts when ``empty_attribute_default = None`` (e.g. ``"J. None D."``); empty parts now render as an empty string and a fully-empty result returns ``empty_attribute_default``
5
7
- Add ``python -m nameparser "Name String"`` command-line helper that prints a parsed name
0 commit comments