3636 from typing_extensions import Self
3737
3838from nameparser .util import lc
39- from nameparser .config .prefixes import PREFIXES
39+ from nameparser .config .prefixes import PREFIXES , NON_FIRST_NAME_PREFIXES
4040from nameparser .config .first_name_prefixes import FIRST_NAME_PREFIXES
4141from nameparser .config .capitalization import CAPITALIZATION_EXCEPTIONS
4242from nameparser .config .conjunctions import CONJUNCTIONS
@@ -264,6 +264,11 @@ class Constants:
264264 :py:attr:`conjunctions` wrapped with :py:class:`SetManager`.
265265 :param set first_name_prefixes:
266266 :py:attr:`~first_name_prefixes.FIRST_NAME_PREFIXES` wrapped with :py:class:`SetManager`.
267+ :param set non_first_name_prefixes:
268+ :py:attr:`~prefixes.NON_FIRST_NAME_PREFIXES` wrapped with :py:class:`SetManager`.
269+ The subset of prefixes that are never a first name, so a *leading* one
270+ marks the whole name as a surname. Must stay disjoint from
271+ ``first_name_prefixes``.
267272 :type capitalization_exceptions: tuple or dict
268273 :param capitalization_exceptions:
269274 :py:attr:`~capitalization.CAPITALIZATION_EXCEPTIONS` wrapped with :py:class:`TupleManager`.
@@ -289,6 +294,7 @@ class Constants:
289294 first_name_titles : SetManager
290295 conjunctions : SetManager
291296 first_name_prefixes : SetManager
297+ non_first_name_prefixes : SetManager
292298 suffix_acronyms_ambiguous : SetManager
293299 capitalization_exceptions : TupleManager [str ]
294300 regexes : RegexTupleManager
@@ -463,6 +469,7 @@ def __init__(self,
463469 first_name_titles : Iterable [str ] = FIRST_NAME_TITLES ,
464470 conjunctions : Iterable [str ] = CONJUNCTIONS ,
465471 first_name_prefixes : Iterable [str ] = FIRST_NAME_PREFIXES ,
472+ non_first_name_prefixes : Iterable [str ] = NON_FIRST_NAME_PREFIXES ,
466473 capitalization_exceptions : TupleManager [str ] | Iterable [tuple [str , str ]] = CAPITALIZATION_EXCEPTIONS ,
467474 regexes : RegexTupleManager | TupleManager [re .Pattern [str ]] | Iterable [tuple [str , re .Pattern [str ]]] = REGEXES ,
468475 patronymic_name_order : bool = False ,
@@ -478,6 +485,7 @@ def __init__(self,
478485 self .first_name_titles = SetManager (first_name_titles )
479486 self .conjunctions = SetManager (conjunctions )
480487 self .first_name_prefixes = SetManager (first_name_prefixes )
488+ self .non_first_name_prefixes = SetManager (non_first_name_prefixes )
481489 self .suffix_acronyms_ambiguous = SetManager (suffix_acronyms_ambiguous )
482490 self .capitalization_exceptions = TupleManager (capitalization_exceptions )
483491 self .regexes = RegexTupleManager (regexes )
0 commit comments