Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Name parser and formatter (for politicians, individuals, and organizations)

Project description

This is the name parser and standardizer for the datacommons project. It now supports politician, individual and organization names.

Installation

Installation is easy:

pip install name-cleaver

Usage

Basic usage is the same for each type of name, just import the relevant NameCleaver class from one of:

  • PoliticianNameCleaver
  • IndividualNameCleaver
  • OrganizationNameCleaver

Example:

from name_cleaver import PolicitianNameCleaver smith = PoliticianNameCleaver(‘Smith, Robert J’).parse()

print str(smith) => “Robert J Smith”

Usage as above can usually be expected to return a Name object, but is not guaranteed to not throw an exception, if NameCleaver is given unexpected input or otherwise can’t figure out what to do with a name. In the case that you don’t want to deal with handling exceptions, NameCleaver has a safe mode:

smith = PoliticianNameCleaver(‘Smith, Robert J’).parse(safe=True)

In safe mode, if NameCleaver encounters an exception or doesn’t come up with a fully-formed name, it will return the original input string.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
name-cleaver-0.3.1.tar.gz (6.3 kB) Copy SHA256 hash SHA256 Source None Jun 25, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page