Repository navigation
Description
HumanName("Aishwarya Rai") returns an empty last and puts the surname in suffix:
>>> from nameparser import HumanName
>>> n = HumanName("Aishwarya Rai")
>>> n.last, n.suffix
('', 'Rai')'rai' is a bare entry in SUFFIX_ACRONYMS (nameparser/config/suffixes.py:747). It entered in af5bdab ("add post-nominal list from wikipedia. fix #93") as part of a bulk import, so it was never individually reviewed against surname collisions. Rai is a common surname across Hindi- and Bengali-speaking regions, and the bare form currently wins over the surname reading.
Two candidate fixes — pick when this is picked up
Option A — remove 'rai' from SUFFIX_ACRONYMS. Fixes both the two-token and three-token surname cases. Costs bare all-caps RAI as a post-nominal.
Option B — add 'rai' to SUFFIX_ACRONYMS_AMBIGUOUS (keeping it in SUFFIX_ACRONYMS). This is the mechanism that already protects Jack Ma. Keeps the bare credential, but the period-gate only rescues the two-token case, so Lala Lajpat Rai stays misparsed — the same limitation 'ma' has today with Jack Wei Ma.
Verified behavior at 2.1.0
| input | today | A (remove) | B (ambiguous) |
|---|---|---|---|
Aishwarya Rai |
last='', suffix='Rai' ❌ |
last='Rai' ✅ |
last='Rai' ✅ |
Lala Lajpat Rai |
last='Lajpat', suffix='Rai' ❌ |
last='Rai' ✅ |
suffix='Rai' ❌ |
Aishwarya Rai Bachchan |
middle='Rai', last='Bachchan' ✅ |
unchanged ✅ | unchanged ✅ |
John Smith R.A.I. |
suffix='R.A.I.' ✅ |
unchanged ✅ | unchanged ✅ |
John Smith RAI |
suffix='RAI' ✅ |
last='RAI' ❌ |
suffix='RAI' ✅ |
John Smith, RAI |
suffix='RAI' ✅ |
last='John Smith' ❌ |
last='John Smith' ❌ |
So the trade is: A fixes one more surname case, B preserves one more credential case. Neither dominates. Note John Smith, RAI regresses under both, which may be worth understanding before choosing.
The dotted R.A.I. form is unaffected either way, and not for the reason it looks like: period_joined_vocab (nameparser/_pipeline/_vocab.py:181) splits on periods and derives the suffix from the chunk i — a suffix word (the Roman numeral, as in "John Smith I") — never from rai.
Workaround
Either behavior is reachable today without a release:
from nameparser.config import CONSTANTS
CONSTANTS.suffix_acronyms.remove('rai') # option A
CONSTANTS.suffix_acronyms_ambiguous.add('rai') # option B
Activity
docs(rules): topic-review amendments from the Indic session (primary …
Say which esq spellings move, not that many do
docs(design): record the vocabulary-collision criterion
derek73 commentedon Aug 24, 2026
Two things for whoever picks this up, both from the #291 close-out (2026-08-23).
1. This issue's collision is not a one-off — carry the measurement
raiis not an isolated bad entry. Measured across the whole set:SUFFIX_ACRONYMSentries leavefamilyempty in"John <word>".ma,do,ed,jd.ba(West African, Vietnamese),cha(Korean 차 — the corpus hasAhmad Jayadi, CHA),sa,se,om,mc.That is consistent with this issue's own provenance note — the list arrived in
af5bdabas a bulk Wikipedia import and was never reviewed against surname collisions. Whichever of option A or B is chosen forrai, the choice is a precedent for the others, so it is worth stating the criterion rather than decidingraialone.decisions.md#vocabulary-collisions(C-i, with the positional qualifier from #360) is the criterion that already exists.The
ba/cha/sa/se/omclaims are model recall, not corpus-attested — per the #360 lesson, they need a human before they move.2. Please carry this
docs/design/decisions.mdamendment#291 closed working-as-designed, and the comma-suffix-arc Declined entry needs an amendment rather than a deletion. Suggested text for the entry beginning "Splitting the dead multi-word suffix entries into single-word entries":
And the Excluded (MAIDEN_MARKERS) entry for Polish "z domu" should repoint from #291 to #434 — markers have no run predicate, so that question does not dissolve the way the suffix one did.
Per Derek: this amendment rides with whatever PR takes this issue, rather than landing as a separate docs PR.
fix(differential,guards): give the two NOT-WANTED regressions their o…
docs(decisions): record the fields-only ledger arc
derek73 commentedon Sep 8, 2026
Shipped in 2.3.0 via #515.
raiandchaleftSUFFIX_ACRONYMS, andbajoinedSUFFIX_ACRONYMS_AMBIGUOUSbesidema,do,edandjd.HumanName("Aishwarya Rai")reads lastRai, which is 1.4.0's own answer — the 2.x releases read suffixRaiwith no last name at all.Lala Lajpat Raireads middleLajpat, lastRai;Kim Chareads lastCha;Anna Bareads lastBawith a suffix-or-name flag.The criterion, since your comment asked for one rather than a decision about
raialone. C-i (borne as a name in the position the claim acts on) is only the entry ticket. What decides among the three answers is a comparison of frequencies: how common the word is as a borne name in the trailing position against how common it is as a credential. Where the name reading dominates, the entry is removed — Rai and Cha are far more common as surnames than RAI ("RETA Authorized Instructor") and CHA (Certified Hotel Administrator) are as credentials — and a caller who needs the credential adds it back:Lexicon.default().add(suffix_acronyms={"cha"}). Where the two are roughly balanced, the word takes the ambiguous marking and the parse reports the fork: Ba is about as common a surname as BA is a credential, thema/Mashape. Where the credential dominates, the entry stays unambiguous. Length is a correlate, not the test. This supersedes thedecisions.md#vocabulary-collisionsline "rai — Rai IS a borne surname, so it earns the marking rather than moving", which now carries a dated supersession note.Of the other words your comment listed:
batook the marking.sastays where #296's audit put it — title and suffix dual, position decides.seandomstay unambiguous; OM is the Order of Merit and neither has surname evidence worth standing behind.mcis #454's word and closed by design there. All were treated as model recall rather than corpus-attested, per the #360 lesson, and none moved without a human.The accepted cost, pinned as case rows so the reversal is one measurement away.
John Smith RAIreads middleSmith, lastRAI, and the comma forms swap ends:John Smith, RAIreads firstRAI, lastJohn Smith, andAhmad Jayadi, CHAfirstCHA, lastAhmad Jayadi— once nothing after the comma is credential vocabulary, it is an ordinary family comma. The marking has a comma cost too:Smith, BAreads firstBA, asSmith, Edalready did. #516 asks whether shape and position could recover the credential reading without a wordlist.One curiosity:
John Smith R.A.I.still reads suffix, but by accident — S3 splits a token with interior periods into its chunks and the last chunkiis a Roman numeral in the suffix words, soX.Y.I.andR.A.V.read suffix whileR.A.X.andC.H.A.do not. Nothing is pinned on it.Your
decisions.mdamendment rode in verbatim on the comma-suffix-arc Declined entry. The Excluded (MAIDEN_MARKERS) "z domu" bullet you asked to repoint to #434 turned out to still call the marker pending while it has shipped since 2026-08-26, so it now records the exclusion as lifted. Rationale:decisions.md#suffix-acronym-collisions.docs(design+release): Indic honorific vocabulary, recorded
fix(suffixes): rai and cha leave SUFFIX_ACRONYMS
feat(suffixes): ba joins the ambiguous acronyms
docs(design+release): suffix-acronym collisions, recorded
docs(derek73#535/derek73#538): scope the new claims to what holds