Skip to main content

nameparts

[![Build Status](https://secure.travis-ci.org/polera/nameparts.png)](http://travis-ci.org/polera/nameparts)

nameparts is a Python module that I wrote to address a problem splitting full names into individual parts (first, middle, last, etc.)

You can use it like this:

>>> from nameparts import Name
>>> n = Name("Thurston Howel III")
>>> n.first_name
'Thurston'
>>> n.last_name
'Howel'
>>> n.as_dict
{'first_name': 'Thurston', 'last_name': 'Howel', \
  'middle_name': None, 'suffix': None, 'generation': 'III', \
  'salutation': None}
>>> n = Name("Smith, John Paul")
>>> n.first_name
'John'
>>> n.last_name
'Smith'
>>> n.middle_name
'Paul'

If you suspect you may see more than one name in a given field (i.e. separated by a/k/a) you can use MultiName:

>>> from nameparts import MultiName
>>> names = MultiName("Bruce Wayne a/k/a Batman")
>>> names
[<Name: 'Bruce Wayne'>, <Name: 'Batman'>]
>>> [n.as_dict for n in names]
[{'last_name': 'Wayne', 'salutation': None, 'first_name': 'Bruce', 'suffix': None,
  'generation': None, 'middle_name': None, 'aliases': None},
 {'last_name': '', 'salutation': None, 'first_name': 'Batman', 'suffix': None,
  'generation': None, 'middle_name': None, 'aliases': None}]

MultiName automatically uses the string ‘a/k/a’ to split names, but you can provide an optional splitter argument to override that:

>>> from nameparts import MultiName
>>> names = MultiName("Tony Stark | Ironman | Stark, Tony", splitter="|")
>>> names
[<Name: 'Tony Stark'>, <Name: 'Ironman'>, <Name: 'Tony Stark'>]

Installing

From source:

python setup.py install

via pip:

pip install nameparts

nameparts runs on CPython 2.6, 2.7, 3.2 and PyPy

License

nameparts is released under the BSD license.

Comments/Questions/Improvements

Any of the above are welcome. Contact me at the email address in my profile.

Metadata

Release files for nameparts 0.5.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nameparts 0.5.8
File Size Uploaded Provenance Actions
nameparts-0.5.8.tar.gz 6.4 kB Without provenance Details for nameparts-0.5.8.tar.gz

Release files / nameparts-0.5.8.tar.gz

Download URL nameparts-0.5.8.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1b0eb7dbd27f4d510fa512065c3e45dfc2f600f39c45c16c0ed07a7a182f08a5
BLAKE2b-256 checksum
How to use checksums
f943f36269d5e7fd45c5a1f2c088429142509800f7d2188970e0691b18242c0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for nameparts 0.5.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page