HumanName Class Documentation

HumanName.parser

class nameparser.parser.HumanName[source]
class nameparser.parser.HumanName(full_name=u'', constants=<Constants() instance>, encoding=u'utf-8', string_format=None)[source]

Parse a person’s name into individual components.

Instantiation assigns to full_name, and assignment to full_name triggers parse_full_name(). After parsing the name, these instance attributes are available.

HumanName Instance Attributes

Parameters:
  • full_name (str) – The name string to be parsed.
  • constants (constants) – a Constants instance. Pass None for per-instance config.
  • encoding (str) – string representing the encoding of your input
  • string_format (str) – python string formatting
C = <Constants() instance>

A reference to the configuration for this instance, which may or may not be a reference to the shared, module-wide instance at CONSTANTS. See Customizing the Parser.

__eq__(other)[source]

HumanName instances are equal to other objects whose lower case unicode representation is the same.

are_suffixes(pieces)[source]

Return True if all pieces are suffixes.

as_dict(include_empty=True)[source]

Return the parsed name as a dictionary of its attributes.

Parameters:include_empty (bool) – Include keys in the dictionary for empty name attributes.
Return type:dict
>>> name = HumanName("Bob Dole")
>>> name.as_dict()
{'last': 'Dole', 'suffix': '', 'title': '', 'middle': '', 'nickname': '', 'first': 'Bob'}
>>> name.as_dict(False)
{'last': 'Dole', 'first': 'Bob'}
capitalize(force=False)[source]

The HumanName class can try to guess the correct capitalization of name entered in all upper or lower case. By default, it will not adjust the case of names entered in mixed case. To run capitalization on all names pass the parameter force=True.

Parameters:force (bool) – force capitalization of strings that include mixed case

Usage

>>> name = HumanName('bob v. de la macdole-eisenhower phd')
>>> name.capitalize()
>>> str(name)
'Bob V. de la MacDole-Eisenhower Ph.D.'
>>> # Don't touch good names
>>> name = HumanName('Shirley Maclaine')
>>> name.capitalize()
>>> str(name) 
'Shirley Maclaine'
>>> name.capitalize(force=True)
>>> str(name) 
'Shirley MacLaine'
first

The person’s first name. The first name piece after any known title pieces parsed from full_name.

full_name

The name string to be parsed.

handle_firstnames()[source]

If there are only two parts and one is a title, assume it’s a last name instead of a first name. e.g. Mr. Johnson. Unless it’s a special title like “Sir”, then when it’s followed by a single name that name is always a first name.

has_own_config

True if this instance is not using the shared module-level configuration.

is_an_initial(value)[source]

Words with a single period at the end, or a single uppercase letter.

Matches the initial regular expression in REGEXES.

is_conjunction(piece)[source]

Is in the conjuctions set and not is_an_initial().

is_prefix(piece)[source]

Lowercase and no periods version of piece is in the ~nameparser.config.titles.PREFIXES set.

is_roman_numeral(value)[source]

Matches the roman_numeral regular expression in REGEXES.

is_rootname(piece)[source]

Is not a known title, suffix or prefix. Just first, middle, last names.

is_suffix(piece)[source]

Is in the suffixes set and not is_an_initial().

Some suffixes may be acronyms (M.B.A) while some are not (Jr.), so we remove the periods from piece when testing against C.suffix_acronyms.

is_title(value)[source]

Is in the TITLES set.

join_on_conjunctions(pieces, additional_parts_count=0)[source]

Join conjunctions to surrounding pieces. Title- and prefix-aware. e.g.:

[‘Mr.’, ‘and’. ‘Mrs.’, ‘John’, ‘Doe’] ==>
[‘Mr. and Mrs.’, ‘John’, ‘Doe’]
[‘The’, ‘Secretary’, ‘of’, ‘State’, ‘Hillary’, ‘Clinton’] ==>
[‘The Secretary of State’, ‘Hillary’, ‘Clinton’]

When joining titles, saves newly formed piece to the instance’s titles constant so they will be parsed correctly later. E.g. after parsing the example names above, ‘The Secretary of State’ and ‘Mr. and Mrs.’ would be present in the titles constant set.

Parameters:
  • pieces (list) – name pieces strings after split on spaces
  • additional_parts_count (int) –
Returns:

new list with piece next to conjunctions merged into one piece

with spaces in it. :rtype: list

last

The person’s last name. The last name piece parsed from full_name.

middle

The person’s middle names. All name pieces after the first name and before the last name parsed from full_name.

nickname

The person’s nicknames. Any text found inside of quotes ("") or parenthesis (())

original = u''

The original string, untouched by the parser.

parse_full_name()[source]

The main parse method for the parser. This method is run upon assignment to the full_name attribute or instantiation.

Basic flow is to hand off to pre_process() to handle nicknames. It then splits on commas and chooses a code path depending on the number of commas.

parse_pieces() then splits those parts on spaces and join_on_conjunctions() joins any pieces next to conjunctions.

parse_nicknames()[source]

The content of parenthesis or double quotes in the name will be treated as nicknames. This happens before any other processing of the name.

parse_pieces(parts, additional_parts_count=0)[source]

Split parts on spaces and remove commas, join on conjunctions and lastname prefixes. If parts have periods in the middle, try splitting on periods and check if the parts are titles or suffixes. If they are add to the constant so they will be found.

Parameters:
  • parts (list) – name part strings from the comma split
  • additional_parts_count (int) – if the comma format contains other parts, we need to know how many there are to decide if things should be considered a conjunction.
Returns:

pieces split on spaces and joined on conjunctions

Return type:

list

post_process()[source]

This happens at the end of the parse_full_name() after all other processing has taken place. Runs handle_firstnames().

pre_process()[source]

This method happens at the beginning of the parse_full_name() before any other processing of the string aside from unicode normalization, so it’s a good place to do any custom handling in a subclass. Runs parse_nicknames().

squash_emoji()[source]

Remove emoji from the input string.

suffix

The persons’s suffixes. Pieces at the end of the name that are found in suffixes, or pieces that are at the end of comma separated formats, e.g. “Lastname, Title Firstname Middle[,] Suffix [, Suffix]” parsed from full_name.

title

The person’s titles. Any string of consecutive pieces in titles or conjunctions at the beginning of full_name.

HumanName.config

The nameparser.config module manages the configuration of the nameparser.

A module-level instance of Constants is created and used by default for all HumanName instances. You can adjust the entire module’s configuration by importing this instance and changing it.

>>> from nameparser.config import CONSTANTS
>>> CONSTANTS.titles.remove('hon').add('chemistry','dean') 
SetManager(set([u'msgt', ..., u'adjutant']))

You can also adjust the configuration of individual instances by passing None as the second argument upon instantiation.

>>> from nameparser import HumanName
>>> hn = HumanName("Dean Robert Johns", None)
>>> hn.C.titles.add('dean') 
SetManager(set([u'msgt', ..., u'adjutant']))
>>> hn.parse_full_name() # need to run this again after config changes

Potential Gotcha: If you do not pass None as the second argument, hn.C will be a reference to the module config, possibly yielding unexpected results. See Customizing the Parser.

nameparser.config.CONSTANTS = <Constants() instance>

A module-level instance of the Constants() class. Provides a common instance for the module to share to easily adjust configuration for the entire module. See Customizing the Parser with Your Own Configuration.

class nameparser.config.Constants(prefixes=set([u'dela', u'san', u'von', u'le', u'degli', u'la', u'abu', u'dei', u'vel', u'bin', u'dxed', u'di', u'dal', u'de', u'da', u'santa', u'van', u'du', u'ste', u'ibn', u'der', u'st', u'dello', u'del', u'bon', u'delli', u'delle', u'della']), suffix_acronyms=set([u'dbe', u'kbe', u'gc', u'gm', u'lg', u'idsm', u'lt', u'mbe', u'clu', u'td', u'do', u'kcb', u'kcsi', u'dmd', u'gbe', u'cie', u'cmg', u'qc', u'gcvo', u'dpm', u'pmp', u'bart', u'ed', u'rrc', u'kcvo', u'cfp', u'dds', u'gcmg', u'rd', u'dso', u'dsm', u'dsc', u'dcm', u'cgm', u'chfc', u'dcb', u'cgc', u'kcie', u'bt', u'dcmg', u'gcsi', u'vrd', u'mscmsm', u'obi', u'obe', u'iso', u'mvo', u'ch', u'cb', u'mba', u'sgm', u'vd', u'qpm', u'qgm', u'dfm', u'dcvo', u'dfc', u'om', u'md', u'ma', u'mc', u'bem', u'mm', u'erd', u'cvo', u'mp', u'ud', u'lvo', u'vc', u'ae', u'cbe', u'rvm', u'gcie', u'afm', u'gcb', u'arrc', u'qfsm', u'afc', u'qam', u'csm', u'kcmg', u'csi', u'phd', u'iom', u'phr', u'dvm', u'kg', u'cpm', u'cpa', u'kp', u'kt']), suffix_not_acronyms=set([u'jnr', u'esq', u'i', u'sr', u'v', u'jr', u'iv', u'ii', u'2', u'snr', u'esquire', u'iii', u'dr']), titles=set([u'msgt', u'coach', u'founder', u'manager', u'legal', u'rebbe', u'chair', u'captain', u'ballet', u'baron', u'father', u'literary', u'keyboardist', u'ccmsgt', u'merchant', u'adviser', u'dutchess', u'lamido', u'mag/judge', u'surgeon', u'missionary', u'prefect', u'magnate', u'scholar', u'investigator', u'excellency', u'celebrity', u'brother', u'delegate', u'judicial', u'dir', u'cfo', u'sultana', u'docent', u'chef', u'honourable', u'lawyer', u'7th', u'subaltern', u'business', u'2ndlt', u'hereditary', u'nurse', u'jurist', u'admiral', u'9th', u'clerk', u'theorist', u'ranger', u'baseball', u'nanny', u'abbess', u'dramatist', u'teacher', u'knowledge', u'cyclist', u'publisher', u'comptroller', u'mpco-cg', u'technical', u'envoy', u'united', u'credit', u'musicologist', u'advertising', u'social', u'military', u'mag-judge', u'cmsgt', u'family', u'deputy', u'courtier', u'sgt', u'private', u'sgm', u'composer', u'1st', u'bandleader', u'army', u'archbishop', u'archdruid', u'sysselmann', u'ayatollah', u'msg', u'pres', u'baba', u'pfc', u'lcdr', u'biblical', u'cwo-2', u'musician', u'heir', u'flag', u'excellent', u'commander', u'alderman', u'chaplain', u'md', u'mg', u'primate', u'patriarch', u'ms', u'mr', u'entertainer', u'giani', u'mufti', u'suffragist', u'division', u'tax', u'high', u'critic', u'cpo', u'2lt', u'spc', u'botanist', u'risk', u'csm', u'sir', u'lama', u'guru', u'hon', u'effendi', u'wo-1', u"king's", u'drummer', u'cardinal', u'ltg', u'banker', u'edohen', u'designer', u'information', u'customs', u'4th', u'mag', u'president', u'law', u'sr', u'doctor', u'psychologist', u'presiding', u'chief', u'sn', u'sa', u'travel', u'se', u'producer', u'rabbi', u'tsarina', u'gyani', u'scientist', u'comtesse', u'mayor', u'developer', u'superior', u'archdeacon', u'verderer', u'theologian', u'dr', u'councillor', u'maid', u'lt', u'ens', u'co-chairs', u'criminal', u'fadm', u'ceo', u'goodwife', u'comedienne', u'brigadier', u'commodore', u'bgen', u'investor', u'mystery', u'mathematician', u'naturalist', u'curator', u'shehu', u'neuroscientist', u'rock', u'maharajah', u'financial', u'catholicos', u'group', u'navy', u'blues', u'adjutant', u'collector', u'eminence', u'special', u'rt', u'shayk', u'1sgt', u'3rd', u'miss', u'rep', u'rev', u'vadm', u'reverend', u'misses', u'activist', u'lord', u'honorable', u'sma', u'associate', u'marquise', u'mme', u'princess', u'barrister', u'monsignor', u'british', u'sheikh', u'registrar', u'generalissimo', u'hajji', u'first', u'tirthankar', u'mademoiselle', u'playwright', u'revenue', u'researcher', u'blogger', u'ltjg', u'smsgt', u'elder', u'sailor', u'comic', u'paleontologist', u'co-founder', u'engineer', u'corporal', u'maj', u'district', u'5th', u'historian', u'master', u'sergeant', u'burgess', u'saint', u'edmi', u'solicitor', u'burlesque', u'treasurer', u'correspondent', u'mcpoc', u'mcpon', u'inventor', u'king', u'minister', u'cartoonist', u'states', u'architect', u'6th', u'counselor', u'countess', u'printmaker', u'anthropologist', u'pro', u'premier', u'maharani', u'comedian', u'host', u'tsar', u'scpo', u'goodman', u'appellate', u'educator', u'pianist', u'cwo5', u'lecturer', u'evangelist', u'printer', u'matriarch', u'theatre', u'exec', u'english', u'pharaoh', u'majgen', u'most', u'assoc', u'librarian', u'mullah', u'screenwriter', u'presbyter', u'singer', u'duchesse', u'docket', u'professor', u'mrs', u'deacon', u'aunt', u'colonel', u'marchess', u'businessman', u'senior', u'ltc', u'detective', u'pope', u'prin', u'queen', u'sheik', u'briggen', u'television ', u'radio', u'industrialist', u'economist', u'principal', u'archeologist', u'sheriff', u'writer', u'philantropist', u'historien', u'sainte', u'apprentice', u'headman', u'personality', u'do', u'mister', u'his', u'psychiatrist', u'assistant', u'designated', u'ecologist', u'mgr', u'singer-songwriter', u'magistrate', u'ssg', u'banner', u'gen', u'prime', u'businesswoman', u'vizier', u'cwo2', u'linguist', u'graf', u'secretary', u'1stlt', u'pvt', u'choreographer', u'intelligence', u'national', u'memoirist', u'tsgt', u'analytics', u'computer', u'bard', u'marchioness', u'marquess', u'compositeur', u'arhat', u'expert', u'federal', u'radm', u'magistrate-judge', u'state', u'obstetritian', u'discovery', u'cartographer', u'pv2', u'criminologist', u'archduke', u'prior', u'physicist', u'jr', u'adept', u'police', u'10th', u'almoner', u'wo5', u'wo4', u'wo1', u'priestess', u'wo3', u'foreign', u'award-winning', u'col', u'author', u'majesty', u'attache', u'ltcol', u'seigneur', u'2nd', u'dancer', u'gysgt', u'biographer', u'technologist', u'shaykh', u'petty', u'shaikh', u'strategy', u'arbitrator', u'poet', u'ssgt', u'dame', u'imam', u'acolyte', u'po3', u'po1', u'controller', u'representative', u'gaf', u'instructor', u'dpty', u'painter', u'pilot', u'physician', u'soccer', u'politician', u'consultant', u'sultan', u"chargxe9 d'affaires", u'governor', u'air', u'cmsaf', u'voice', u'abbot', u'elerunwon', u'vc', u'metropolitan', u'resident', u'attachxe9', u'canon', u'dissident', u'monk', u'player', u'tenor', u'wo2', u'co-chair', u'soldier', u'sociologist', u'member', u'mobster', u'speaker', u'grand', u'essayist', u'biochemist', u'marcher', u'phd', u'director', u'warden', u'senator', u'vocalist', u'priest', u'theater', u'mlle', u'bailiff', u'academic', u'mother', u'model', u'corporate', u'madame', u'ambassador', u'bearer', u'madam', u'executive', u'actress', u'biologist', u'holiness', u'prince', u'pursuivant', u'clergyman', u'swordbearer', u'photographer', u'ltgen', u'royal', u'schoolmaster', u'civil', u'bench', u'sgtmaj', u'chieftain', u'doyen', u'prelate', u'cdr', u'adm', u'warrant', u'kingdom', u'lyricist', u'municipal', u'amn', u'capt', u'chancellor', u'advocate', u'forester', u'senior-judge', u'judge', u'anarchist', u'lady', u'rear', u'lcpl', u'chairs', u'akhoond', u'servant', u'broadcaster', u'journalist', u'friar', u'security', u'attorney', u'right', u'classical', u'staff', u'astronomer', u'shaik', u'abolitionist', u'mountaineer', u'novelist', u'1stsgt', u'philosopher', u'8th', u'pioneer', u'buddha', u'prof', u'leader', u'officer', u'mgysgt', u'bg', u'archduchess', u'sgtmajmc', u'marketing', u'ornithologist', u'lieutenant', u'journeyman', u'political', u'contessa', u'cwo-3', u'translator', u'sister', u'sra', u'cwo-5', u'cwo-4', u'gentiluomo', u'subedar', u'pediatrician', u'emperor', u'software', u'cheikh', u'duke', u'vicar', u'auntie', u'intendant', u'1lt', u'blessed', u'empress', u'entrepreneur', u'saoshyant', u'her', u'zoologist', u'flying', u'sfc', u'bookseller', u'editor', u'narrator', u'pastor', u'soprano', u'uncle', u'junior', u'highness', u'count', u'illustrator', u'marquis', u'siddha', u'cwo3', u'pslc', u'actor ', u'vardapet', u'us', u'cwo4', u'swami', u'arranger', u'uk', u'heiress', u'asst', u'mcpo', u'rangatira', u'supreme', u'ab', u'opera', u'general', u'provost', u"queen's", u'historicus', u'a1c', u'pir', u'bishop', u'film', u'commander-in-chief', u'diplomat', u'conductor', u'operating', u'bodhisattva', u'guitarist', u'bwana', u'murshid', u'field', u'shekh', u'mathematics', u'wing', u'chemist', u'satirist', u'woodman', u'venerable', u'po2', u'druid', u'mahdi', u'rdml', u'viscount', u'bibliographer', u'cpl', u'ekegbian', u'vice', u'behavioral', u'timi', u'cpt', u'animator']), first_name_titles=set([u'cheikh', u'pope', u'auntie', u'father', u'queen', u'sheik', u'shaik', u'shaykh', u'sir', u'shayk', u'shaikh', u'maid', u'master', u'shekh', u'dame', u'uncle', u'king', u'sister', u'brother', u'sheikh', u'aunt', u'mother']), conjunctions=set([u'and', u'e', u'&', u'of', u'und', u'y', u'et', u'the']), capitalization_exceptions=((u'ii', u'II'), (u'iii', u'III'), (u'iv', u'IV'), (u'md', u'M.D.'), (u'phd', u'Ph.D.')), regexes=set([(u'emoji', <_sre.SRE_Pattern object>), (u'word', <_sre.SRE_Pattern object>), (u'period_not_at_end', <_sre.SRE_Pattern object>), (u'no_vowels', <_sre.SRE_Pattern object at 0x179c620>), (u'initial', <_sre.SRE_Pattern object>), (u'spaces', <_sre.SRE_Pattern object>), (u'nickname', <_sre.SRE_Pattern object>), (u'mac', <_sre.SRE_Pattern object>), (u'roman_numeral', <_sre.SRE_Pattern object>)]))[source]

An instance of this class hold all of the configuration constants for the parser.

Parameters:
empty_attribute_default = u''

Default return value for empty attributes.

>>> from nameparser.config import CONSTANTS
>>> CONSTANTS.empty_attribute_default = None
>>> name = HumanName("John Doe")
>>> name.title
None
>>>name.first
'John'
string_format = u'{title} {first} {middle} {last} {suffix} ({nickname})'

The default string format use for all new HumanName instances.

class nameparser.config.SetManager(elements)[source]

Easily add and remove config variables per module or instance. Subclass of collections.Set.

Only special functionality beyond that provided by set() is to normalize constants for comparison (lower case, no periods) when they are add()ed and remove()d and allow passing multiple string arguments to the add() and remove() methods.

add(*strings)[source]

Add the lower case and no-period version of the string arguments to the set. Returns self for chaining.

remove(*strings)[source]

Remove the lower case and no-period version of the string arguments from the set. Returns self for chaining.

class nameparser.config.TupleManager[source]

A dictionary with dot.notation access. Subclass of dict. Makes the tuple constants more friendly.

HumanName.config Defaults

nameparser.config.titles.FIRST_NAME_TITLES = set([u'cheikh', u'pope', u'auntie', u'father', u'queen', u'sheik', u'shaik', u'shaykh', u'sir', u'shayk', u'shaikh', u'maid', u'master', u'shekh', u'dame', u'uncle', u'king', u'sister', u'brother', u'sheikh', u'aunt', u'mother'])

When these titles appear with a single other name, that name is a first name, e.g. “Sir John”, “Sister Mary”, “Queen Elizabeth”.

nameparser.config.titles.TITLES = set([u'msgt', u'coach', u'founder', u'manager', u'legal', u'rebbe', u'chair', u'captain', u'ballet', u'baron', u'father', u'literary', u'keyboardist', u'ccmsgt', u'merchant', u'adviser', u'dutchess', u'lamido', u'mag/judge', u'surgeon', u'missionary', u'prefect', u'magnate', u'scholar', u'investigator', u'excellency', u'celebrity', u'brother', u'delegate', u'judicial', u'dir', u'cfo', u'sultana', u'docent', u'chef', u'honourable', u'lawyer', u'7th', u'subaltern', u'business', u'2ndlt', u'hereditary', u'nurse', u'jurist', u'admiral', u'9th', u'clerk', u'theorist', u'ranger', u'baseball', u'nanny', u'abbess', u'dramatist', u'teacher', u'knowledge', u'cyclist', u'publisher', u'comptroller', u'mpco-cg', u'technical', u'envoy', u'united', u'credit', u'musicologist', u'advertising', u'social', u'military', u'mag-judge', u'cmsgt', u'family', u'deputy', u'courtier', u'sgt', u'private', u'sgm', u'composer', u'1st', u'bandleader', u'army', u'archbishop', u'archdruid', u'sysselmann', u'ayatollah', u'msg', u'pres', u'baba', u'pfc', u'lcdr', u'biblical', u'cwo-2', u'musician', u'heir', u'flag', u'excellent', u'commander', u'alderman', u'chaplain', u'md', u'mg', u'primate', u'patriarch', u'ms', u'mr', u'entertainer', u'giani', u'mufti', u'suffragist', u'division', u'tax', u'high', u'critic', u'cpo', u'2lt', u'spc', u'botanist', u'risk', u'csm', u'sir', u'lama', u'guru', u'hon', u'effendi', u'wo-1', u"king's", u'drummer', u'cardinal', u'ltg', u'banker', u'edohen', u'designer', u'information', u'customs', u'4th', u'mag', u'president', u'law', u'sr', u'doctor', u'psychologist', u'presiding', u'chief', u'sn', u'sa', u'travel', u'se', u'producer', u'rabbi', u'tsarina', u'gyani', u'scientist', u'comtesse', u'mayor', u'developer', u'superior', u'archdeacon', u'verderer', u'theologian', u'dr', u'councillor', u'maid', u'lt', u'ens', u'co-chairs', u'criminal', u'fadm', u'ceo', u'goodwife', u'comedienne', u'brigadier', u'commodore', u'bgen', u'investor', u'mystery', u'mathematician', u'naturalist', u'curator', u'shehu', u'neuroscientist', u'rock', u'maharajah', u'financial', u'catholicos', u'group', u'navy', u'blues', u'adjutant', u'collector', u'eminence', u'special', u'rt', u'shayk', u'1sgt', u'3rd', u'miss', u'rep', u'rev', u'vadm', u'reverend', u'misses', u'activist', u'lord', u'honorable', u'sma', u'associate', u'marquise', u'mme', u'princess', u'barrister', u'monsignor', u'british', u'sheikh', u'registrar', u'generalissimo', u'hajji', u'first', u'tirthankar', u'mademoiselle', u'playwright', u'revenue', u'researcher', u'blogger', u'ltjg', u'smsgt', u'elder', u'sailor', u'comic', u'paleontologist', u'co-founder', u'engineer', u'corporal', u'maj', u'district', u'5th', u'historian', u'master', u'sergeant', u'burgess', u'saint', u'edmi', u'solicitor', u'burlesque', u'treasurer', u'correspondent', u'mcpoc', u'mcpon', u'inventor', u'king', u'minister', u'cartoonist', u'states', u'architect', u'6th', u'counselor', u'countess', u'printmaker', u'anthropologist', u'pro', u'premier', u'maharani', u'comedian', u'host', u'tsar', u'scpo', u'goodman', u'appellate', u'educator', u'pianist', u'cwo5', u'lecturer', u'evangelist', u'printer', u'matriarch', u'theatre', u'exec', u'english', u'pharaoh', u'majgen', u'most', u'assoc', u'librarian', u'mullah', u'screenwriter', u'presbyter', u'singer', u'duchesse', u'docket', u'professor', u'mrs', u'deacon', u'aunt', u'colonel', u'marchess', u'businessman', u'senior', u'ltc', u'detective', u'pope', u'prin', u'queen', u'sheik', u'briggen', u'television ', u'radio', u'industrialist', u'economist', u'principal', u'archeologist', u'sheriff', u'writer', u'philantropist', u'historien', u'sainte', u'apprentice', u'headman', u'personality', u'do', u'mister', u'his', u'psychiatrist', u'assistant', u'designated', u'ecologist', u'mgr', u'singer-songwriter', u'magistrate', u'ssg', u'banner', u'gen', u'prime', u'businesswoman', u'vizier', u'cwo2', u'linguist', u'graf', u'secretary', u'1stlt', u'pvt', u'choreographer', u'intelligence', u'national', u'memoirist', u'tsgt', u'analytics', u'computer', u'bard', u'marchioness', u'marquess', u'compositeur', u'arhat', u'expert', u'federal', u'radm', u'magistrate-judge', u'state', u'obstetritian', u'discovery', u'cartographer', u'pv2', u'criminologist', u'archduke', u'prior', u'physicist', u'jr', u'adept', u'police', u'10th', u'almoner', u'wo5', u'wo4', u'wo1', u'priestess', u'wo3', u'foreign', u'award-winning', u'col', u'author', u'majesty', u'attache', u'ltcol', u'seigneur', u'2nd', u'dancer', u'gysgt', u'biographer', u'technologist', u'shaykh', u'petty', u'shaikh', u'strategy', u'arbitrator', u'poet', u'ssgt', u'dame', u'imam', u'acolyte', u'po3', u'po1', u'controller', u'representative', u'gaf', u'instructor', u'dpty', u'painter', u'pilot', u'physician', u'soccer', u'politician', u'consultant', u'sultan', u"charg\xe9 d'affaires", u'governor', u'air', u'cmsaf', u'voice', u'abbot', u'elerunwon', u'vc', u'metropolitan', u'resident', u'attach\xe9', u'canon', u'dissident', u'monk', u'player', u'tenor', u'wo2', u'co-chair', u'soldier', u'sociologist', u'member', u'mobster', u'speaker', u'grand', u'essayist', u'biochemist', u'marcher', u'phd', u'director', u'warden', u'senator', u'vocalist', u'priest', u'theater', u'mlle', u'bailiff', u'academic', u'mother', u'model', u'corporate', u'madame', u'ambassador', u'bearer', u'madam', u'executive', u'actress', u'biologist', u'holiness', u'prince', u'pursuivant', u'clergyman', u'swordbearer', u'photographer', u'ltgen', u'royal', u'schoolmaster', u'civil', u'bench', u'sgtmaj', u'chieftain', u'doyen', u'prelate', u'cdr', u'adm', u'warrant', u'kingdom', u'lyricist', u'municipal', u'amn', u'capt', u'chancellor', u'advocate', u'forester', u'senior-judge', u'judge', u'anarchist', u'lady', u'rear', u'lcpl', u'chairs', u'akhoond', u'servant', u'broadcaster', u'journalist', u'friar', u'security', u'attorney', u'right', u'classical', u'staff', u'astronomer', u'shaik', u'abolitionist', u'mountaineer', u'novelist', u'1stsgt', u'philosopher', u'8th', u'pioneer', u'buddha', u'prof', u'leader', u'officer', u'mgysgt', u'bg', u'archduchess', u'sgtmajmc', u'marketing', u'ornithologist', u'lieutenant', u'journeyman', u'political', u'contessa', u'cwo-3', u'translator', u'sister', u'sra', u'cwo-5', u'cwo-4', u'gentiluomo', u'subedar', u'pediatrician', u'emperor', u'software', u'cheikh', u'duke', u'vicar', u'auntie', u'intendant', u'1lt', u'blessed', u'empress', u'entrepreneur', u'saoshyant', u'her', u'zoologist', u'flying', u'sfc', u'bookseller', u'editor', u'narrator', u'pastor', u'soprano', u'uncle', u'junior', u'highness', u'count', u'illustrator', u'marquis', u'siddha', u'cwo3', u'pslc', u'actor ', u'vardapet', u'us', u'cwo4', u'swami', u'arranger', u'uk', u'heiress', u'asst', u'mcpo', u'rangatira', u'supreme', u'ab', u'opera', u'general', u'provost', u"queen's", u'historicus', u'a1c', u'pir', u'bishop', u'film', u'commander-in-chief', u'diplomat', u'conductor', u'operating', u'bodhisattva', u'guitarist', u'bwana', u'murshid', u'field', u'shekh', u'mathematics', u'wing', u'chemist', u'satirist', u'woodman', u'venerable', u'po2', u'druid', u'mahdi', u'rdml', u'viscount', u'bibliographer', u'cpl', u'ekegbian', u'vice', u'behavioral', u'timi', u'cpt', u'animator'])

Cannot include things that could also be first names, e.g. “dean”. Many of these from wikipedia: https://en.wikipedia.org/wiki/Title. The parser recognizes chains of these including conjunctions allowing recognition titles like “Deputy Secretary of State”.

nameparser.config.suffixes.SUFFIX_ACRONYMS = set([u'dbe', u'kbe', u'gc', u'gm', u'lg', u'idsm', u'lt', u'mbe', u'clu', u'td', u'do', u'kcb', u'kcsi', u'dmd', u'gbe', u'cie', u'cmg', u'qc', u'gcvo', u'dpm', u'pmp', u'bart', u'ed', u'rrc', u'kcvo', u'cfp', u'dds', u'gcmg', u'rd', u'dso', u'dsm', u'dsc', u'dcm', u'cgm', u'chfc', u'dcb', u'cgc', u'kcie', u'bt', u'dcmg', u'gcsi', u'vrd', u'mscmsm', u'obi', u'obe', u'iso', u'mvo', u'ch', u'cb', u'mba', u'sgm', u'vd', u'qpm', u'qgm', u'dfm', u'dcvo', u'dfc', u'om', u'md', u'ma', u'mc', u'bem', u'mm', u'erd', u'cvo', u'mp', u'ud', u'lvo', u'vc', u'ae', u'cbe', u'rvm', u'gcie', u'afm', u'gcb', u'arrc', u'qfsm', u'afc', u'qam', u'csm', u'kcmg', u'csi', u'phd', u'iom', u'phr', u'dvm', u'kg', u'cpm', u'cpa', u'kp', u'kt'])

Post-nominal acronyms. Titles, degrees and other things people stick after their name that may or may not have periods between the letters. The parser removes periods when matching against these pieces.

nameparser.config.suffixes.SUFFIX_NOT_ACRONYMS = set([u'jnr', u'esq', u'i', u'sr', u'v', u'jr', u'iv', u'ii', u'2', u'snr', u'esquire', u'iii', u'dr'])

Post-nominal pieces that are not acronyms. The parser does not remove periods when matching against these pieces.

nameparser.config.prefixes.PREFIXES = set([u'dela', u'san', u'von', u'le', u'degli', u'la', u'abu', u'dei', u'vel', u'bin', u'd\xed', u'di', u'dal', u'de', u'da', u'santa', u'van', u'du', u'ste', u'ibn', u'der', u'st', u'dello', u'del', u'bon', u'delli', u'delle', u'della'])

Name pieces that appear before a last name. They join to the piece that follows them to make one new piece.

nameparser.config.conjunctions.CONJUNCTIONS = set([u'and', u'e', u'&', u'of', u'und', u'y', u'et', u'the'])

Pieces that should join to their neighboring pieces, e.g. “and”, “y” and “&”. “of” and “the” are also include to facilitate joining multiple titles, e.g. “President of the United States”.

nameparser.config.capitalization.CAPITALIZATION_EXCEPTIONS = ((u'ii', u'II'), (u'iii', u'III'), (u'iv', u'IV'), (u'md', u'M.D.'), (u'phd', u'Ph.D.'))

Any pieces that are not capitalized by capitalizing the first letter.

nameparser.config.regexes.REGEXES = set([(u'emoji', <_sre.SRE_Pattern object>), (u'word', <_sre.SRE_Pattern object>), (u'period_not_at_end', <_sre.SRE_Pattern object>), (u'no_vowels', <_sre.SRE_Pattern object at 0x179c620>), (u'initial', <_sre.SRE_Pattern object>), (u'spaces', <_sre.SRE_Pattern object>), (u'nickname', <_sre.SRE_Pattern object>), (u'mac', <_sre.SRE_Pattern object>), (u'roman_numeral', <_sre.SRE_Pattern object>)])

All regular expressions used by the parser are precompiled and stored in the config.