Nameparser is a simple Python module designed for parsing human names into their distinct components, such as title, first, middle, last, suffix, and nickname. It supports a variety of common name formats for Latin-based languages and is currently at version 1.1.3, receiving updates for bug fixes and feature enhancements.
pip install nameparserVerified import paths — ran on the pinned version, not inferred.
Parses a full name string into a `HumanName` object, allowing access to its individual components as attributes like `title`, `first`, `middle`, `last`, `suffix`, and `nickname`.
If you relied on `full_name` returning the exact original string, store the original string separately or adjust your code to expect the formatted output.
Thoroughly test parsing outcomes for a representative set of names if upgrading from pre-1.0.0 versions to ensure consistent results.
Call `name_instance.parse_full_name()` after modifying constants that affect parsing or ensure constants are configured before instantiation/first parsing.
To force capitalization of mixed-case names, use `name.capitalize(force=True)` or set `nameparser.config.CONSTANTS.force_mixed_case_capitalization = True` globally.
For non-English names, consider customizing `nameparser.config.Constants` with language-specific titles, prefixes, and suffixes, or evaluate alternative libraries if primary use is non-Latin or non-English.
Install the library using pip: `pip install nameparser`
Use the correct attribute name, for example: `name.middle` instead of `name.middle_name`.
Ensure that values assigned to `HumanName` attributes are always strings, lists of strings, or `None`.
No dependency data recorded yet.