Person and company name normalization: strip titles, suffixes, legal forms, resolve nicknames to canonical forms
Project description
corp-names
Name normalization library for people and companies. Strips titles, suffixes, middle initials, and resolves nicknames to canonical forms. Includes 15,000+ person name entries and 1,000+ company legal suffixes across 200+ jurisdictions.
Installation
pip install corp-names
Usage
from corp_names import normalize_name
result = normalize_name("Dr. Bob Smith Jr.")
print(result.normalized) # "robert smith"
print(result.first) # "robert"
print(result.last) # "smith"
print(result.prefix) # "dr"
print(result.suffix) # "jr"
International name resolution
normalize_name("Guillaume de la Fontaine").normalized # "william de la fontaine"
normalize_name("Prof. Klaus Müller").normalized # "nicholas muller"
normalize_name("Giuseppe Rossi").normalized # "joseph rossi"
Name lookup API
from corp_names import is_known_name, get_name_category
is_known_name("bob") # True (nickname)
is_known_name("robert") # True (canonical)
is_known_name("hiroshi") # True (japanese)
get_name_category("bob") # "common"
get_name_category("guillaume") # "international"
get_name_category("hiroshi") # "japanese"
Company Name Normalization
from corp_names import normalize_company
result = normalize_company("Apple Inc.")
print(result.normalized) # "apple"
print(result.suffix) # "inc"
print(result.entity_type) # "Corporation"
normalize_company("Siemens AG").normalized # "siemens"
normalize_company("Samsung Electronics Co., Ltd.").normalized # "samsung electronics"
normalize_company("Société Générale SA").normalized # "societe generale"
normalize_company("The Walt Disney Company").normalized # "walt disney"
normalize_company("Johnson & Johnson").normalized # "johnson and johnson"
normalize_company("Unilever N.V.").normalized # "unilever"
normalize_company("Bayerische Motoren Werke GmbH").normalized # "bayerische motoren werke"
CLI
Person names
corp-names normalize "Dr. Bob Smith Jr."
# Original: Dr. Bob Smith Jr.
# Normalized: robert smith
# First: robert
# Last: smith
# Prefix: dr
# Suffix: jr
# Nickname: resolved to canonical form
corp-names normalize "Sir William H. Gates III" --json
Company names
corp-names normalize-company "Apple Inc."
# Original: Apple Inc.
# Normalized: apple
# Suffix: inc
# Type: Corporation
corp-names normalize-company "Samsung Electronics Co., Ltd." --json
Normalization Pipeline
- Unicode normalize (unidecode for accented characters)
- Strip punctuation (remove periods, commas; preserve hyphens)
- Tokenize by whitespace
- Strip prefixes (titles, honorifics)
- Strip suffixes (generational, credentials)
- Remove middle initials (single-letter tokens)
- Resolve nicknames to canonical forms
- Build normalized lowercase output
NormalizedName Model
class NormalizedName(BaseModel):
original: str # Original input
normalized: str # Full normalized lowercase name
first: str # First/given name (after nickname resolution)
last: str # Last/family name
prefix: str # Detected prefix(es), e.g. "dr"
suffix: str # Detected suffix(es), e.g. "jr"
nickname_resolved: bool # Whether first name was a nickname
NormalizedCompany Model
class NormalizedCompany(BaseModel):
original: str # Original input
normalized: str # Cleaned lowercase name without suffixes
suffix: str # Detected suffix, e.g. "inc"
entity_type: str # Deduced type, e.g. "Corporation"
the_prefix_stripped: bool # Whether leading "The" was removed
Data
Company suffixes
1,000+ legal suffixes across 200+ jurisdictions, merged from cleanco (MIT) and GLEIF ELF Code List (ISO 20275). Entity types include Corporation, Limited, LLC, Partnership, Sole Proprietorship, Non-Profit, and more.
Person names
All name data is stored in nicknames.json with categorized entries:
- Nickname mappings (~1,350): resolve informal/international names to canonical forms
common: English nicknames (bob→robert, liz→elizabeth)international: cross-language variants (guillaume→william, giuseppe→joseph)archaic: historical nicknames (elsa→elizabeth, fanny→frances)
- Standalone canonical names (~13,800): known first names with no mapping needed
canonical: Western names (mark, laura, emma, scott)cjk: Chinese names (li, wang, zhang)japanese: Japanese names (hiroshi, takashi, akira)korean: Korean names (kim, park, choi)arabic: Arabic/Islamic names (ali, omar, mustafa)french_compound: French compound names (jean-pierre, marie-claire)
- Prefixes: ~150 titles and honorifics (military, religious, nobility, academic, political)
- Suffixes: ~600 credentials, generational markers, and honors (PhD, Jr, III, OBE, CPA)
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file corp_names-0.3.0.tar.gz.
File metadata
- Download URL: corp_names-0.3.0.tar.gz
- Upload date:
- Size: 98.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a39fa569aa8ccf75f69adc1dab48dab8a84b39bce4672d66eeb411df04760eb
|
|
| MD5 |
d61ec6e9c70e52528f9b76ddbbf7fb2f
|
|
| BLAKE2b-256 |
0b7bad6f9c58560c64b190f2d5242b757cbc225f02ad684e7b703bafaf169bed
|
File details
Details for the file corp_names-0.3.0-py3-none-any.whl.
File metadata
- Download URL: corp_names-0.3.0-py3-none-any.whl
- Upload date:
- Size: 92.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
718933638507684820f8662ad71286087bdc6d8f7d811b3a494bfbced5d4ca56
|
|
| MD5 |
7614af363f5be35015a29373dff8e9d8
|
|
| BLAKE2b-256 |
7e716a6d9d86c05b70c22583eb4488579357e76794ed9945ad022078b97345c3
|