Nameparser

Simple Python module for parsing human names into their components

Library
PyPI
v2.1.0
713stars
GNU LGPLv2.1

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
84/100Excellent
Development Activity100
Maintenance84
Community72
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
77/100Good
Architecture78
Code Quality80
Innovation66
Learning Curve85

Nameparser is a simple Python module for parsing human names into their individual components — title, first, middle, last, suffix, nickname, and maiden name — along with useful derived attributes like initials, given names, and surnames. It handles the common “Title First Middle Last Suffix” structure as well as comma-separated “Last, First” formats, all through a small, dependency-free API.

Rather than relying on statistical models or machine learning, it uses a deterministic, rule-based approach built from configurable vocabularies of titles, suffixes, last-name prefixes, and conjunctions. The same input always parses the same way, and you can tune the recognized word sets to fit your own dataset.

What You Get

  • Structured name attributes: title, first, middle, last, suffix, nickname, and maiden
  • Derived attributes like initials, given names, surnames, and last-name prefixes
  • Support for both ‘Title First Middle Last Suffix’ and comma-separated ‘Last, First’ formats
  • Configurable vocabularies of titles, suffixes, prefixes, and conjunctions you can extend
  • Optional capitalization correction for all-uppercase or all-lowercase names
  • A deterministic, dependency-free, rule-based parser with no ML models

Common Use Cases

  • Splitting a single full-name field into first and last name for a database
  • Normalizing and capitalizing imported contact or customer records
  • Extracting titles and suffixes from names in CRM or CSV data
  • Customizing recognized titles and prefixes to match a specialized dataset

Under The Hood

Architecture - Parsing happens in two cooperating layers. A vocabulary layer recognizes name pieces by identity using configurable sets of known words — titles (‘Dr.’), suffixes (‘III’, ‘PhD’), last-name prefixes (‘de la’), conjunctions, and delimited nicknames — chaining titles and joining prefixes forward so multi-word particles stay attached. A positional layer then assigns everything unclaimed by location: first unclaimed word is the first name, the last is the last name, and the rest are middle names. The design is deterministic with no statistical model, so a given input always parses identically.

Tech Stack - The module is pure Python (3.10+) with no runtime dependencies, distributed on PyPI and documented on Read the Docs. Configuration is exposed through mutable vocabulary sets that consumers can extend or trim.

Code Quality - The project is mature and actively maintained, with 28 contributors, CI build status, and Codecov coverage. A 2.0 redesign toward an immutable core API is in progress via a public RFC, signalling ongoing stewardship while preserving 2.x compatibility.

API Design - The public surface is a single HumanName class whose parsed pieces are read as plain attributes, making it very approachable — you construct it with a string and read hn.first, hn.last, and so on. Customization is equally direct: adjust the module-level vocabulary sets to change parsing behavior, keeping the learning curve low.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search