Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions docs/design/decisions.md

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions docs/design/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ H2. Rationale: before a name, an abbreviation is almost always a
letters, so an abbreviation in a script whose letters carry
combining vowel signs (Bengali, Devanagari) never reads as a
title by shape — an unlisted abugida honorific stays a name
word, and only vocabulary (#343) can recognize it.
"প্রফেসর. Sen" → given="প্রফেসর."
word, and only vocabulary can recognize it — which is what #343
and #344 supply for Bengali and Devanagari.
"প্রকৌশলী. Sen" → given="প্রকৌশলী."
Accepted: before a family comma the pre-comma text is wholly the
family name (C1), so no shape or vocabulary reading makes a
title there.
Expand Down
10 changes: 7 additions & 3 deletions docs/locales.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ What works without a pack
--------------------------

Most international names need no pack at all. The default vocabulary
covers five scripts — Latin, Cyrillic, Greek, Arabic and Hebrew, plus
Devanagari titles — so honorifics, conjunctions and name particles in
those scripts are recognized out of the box:
covers seven scripts — Latin, Cyrillic, Greek, Arabic, Hebrew,
Devanagari and Bengali. Honorifics, conjunctions and name particles
written in them are recognized out of the box, as far as each script's
vocabulary reaches: all seven ship honorifics, while conjunctions and
particles reach fewer — Cyrillic and Greek ship conjunctions and no
particle, Hebrew particles and no conjunction, Devanagari and Bengali
honorifics only.

.. doctest::

Expand Down
10 changes: 10 additions & 0 deletions docs/release_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ Release Log

- **Fix Parser.revise() splitting a space-separated suffix value into comma-separated entries.** ``Parser().revise(n, suffix="MD PhD").suffix`` is ``MD PhD`` and was ``MD, PhD``, and a name's own rendered suffix now revises back to itself for all but one of the 38 differential-corpus names that failed to on 2026-09-06 (368 of the 1117 carry a suffix) (recipe in the ``C1`` entry of ``docs/design/decisions.md``; the one left is a Korean honorific glued to an initial, which the value's own parse peels where the whole name kept it glued -- a word read on its own, not an entry boundary). A suffix value's entries are now derived from the value's own commas by the same rule a whole name uses: a comma parts two credentials and a space joins them, so ``revise(n, suffix="MD, PhD")`` is still two entries. ``revise(n, suffix="Ph. D.")`` renders ``Ph. D.`` where the 2.2.0 note below accepted ``Ph., D.``; the head-position merge that note describes still does not fire, the pair joining under the entry rule instead. One limit: a delimiter configured through ``extra_suffix_delimiters`` parts a value only where the value's own words read as a name with a tail segment, so in a run of post-nominals it stays a word; write a comma at the boundary instead. ``ParsedName.replace()`` is unchanged (closes #511)

**Additions**

- **Add the renunciate titles to the given-name title list, so a renunciate's one name is a given name.** ``HumanName("Swami Vivekananda")`` gives first ``Vivekananda`` with an empty last name, where every release since 1.4.0 gave last ``Vivekananda``; ``Guru Nanak``, ``Baba Ramdev`` and ``Lama Zopa`` move the same way, and so do the Devanagari and Bengali spellings added below. Two name words behind the title are unchanged -- ``Swami Vivekananda Saraswati`` keeps last ``Saraswati`` -- and a surname-retaining title is untouched: ``Rabbi Cohen`` still gives last ``Cohen``. ``venerable`` is deliberately not in the list, the traditions using it splitting on whether the family name survives. See the ``indic-honorifics`` entry of ``docs/design/decisions.md`` (closes #346)

- **Add trailing honorifics as post-nominal vocabulary:** Latin ``rinpoche``, Devanagari ``जी``, ``साहब``, ``साहिब``, ``साहेब``, ``महाराज``, and Bengali ``সাহেব``, ``বাবু``, ``মহারাজ``. ``HumanName("Lama Zopa Rinpoche")`` reads title ``Lama``, first ``Zopa``, suffix ``Rinpoche``; ``नरेन्द्र मोदी जी`` reads last ``मोदी``, suffix ``जी``. They are recognized SPACED only and are deliberately absent from ``Lexicon.honorific_tails``: Banerjee, Mukherjee and Chatterjee end in the ``जी`` substring (``बनर्जी``, ``मुखर्जी``, ``चटर्जी``), so a glued peel would cut a real family name in two, and ``गांधीजी`` staying unpeeled is the accepted cost. Bengali ``বাবু`` is trailing where Devanagari ``बाबू`` is a leading title (#344, #343)

- **Add Devanagari honorifics (#344):** ``डॉक्टर``, ``डा``, ``प्रो``, ``प्रोफेसर``, ``प्राध्यापक``, ``प्रा``, ``पंडित``, ``पं``, ``सरदार``, ``सुश्री``, ``श्रीयुत``, ``श्रीमान``, ``सौ``, ``बाबू``, ``महात्मा``, ``न्यायमूर्ति``, ``मौलाना``, ``जनाब`` and ``महाराजा`` as titles, beside the ``श्री``/``श्रीमती``/``डॉ`` that shipped in 2.1.0, and ``स्वामी``, ``गुरु``, ``बाबा``, ``संत`` as given-name titles. ``डॉक्टर शर्मा`` reads title ``डॉक्टर``, last ``शर्मा``; ``स्वामी विवेकानंद`` reads first ``विवेकानंद`` with no last name. Dotted spellings (``प्रो.``, ``पं.``) match the same entries. Excluded under the collision rule: ``कुमारी`` (Kumari is a given and a family name), ``बेगम``, ``शेख``, ``आचार्य``, ``राजा``/``रानी`` and ``ठाकुर``, all borne as ordinary names (closes #344)

- **Add Bengali honorifics -- the first Bengali vocabulary in the default lexicon (#343):** ``ড``, ``ডঃ``, ``ডক্টর``, ``ডাঃ``, ``ডা``, ``ডাক্তার``, ``শ্রী``, ``শ্রীমতী``, ``জনাব``, ``অধ্যাপক``, ``প্রফেসর``, ``বিচারপতি``, ``মাওলানা``, ``মুফতি``, ``আলহাজ্ব``, ``আলহাজ``, ``মিঃ``, ``মি``, ``মিসেস``, ``মোঃ``, ``মো``, ``মোসাঃ``, ``মোসা``, ``মোছাঃ`` and ``মোছা`` as titles, and ``স্বামী``, ``শ্রীল``, ``গুরু``, ``বাবা`` as given-name titles. ``ড. মুহাম্মদ ইউনূস`` reads title ``ড.``, first ``মুহাম্মদ``, last ``ইউনূস`` -- the vocabulary beats the initial reading -- while real initials are untouched: ``র. কে. নারায়ণ`` is unchanged. ``মোঃ আবদুল করিম`` reads title ``মোঃ``, first ``আবদুল``, last ``করিম``, the mirror of Latin ``Md``; the visarga spelling and the ``মো.`` period spelling both match, and the women's ``মোসাঃ``/``মোসা.`` rides the same pair of entries. ``ঠাকুর`` stays out, being Tagore. Latin transliterations (``Sri``, ``Pandit``, ``Mst``) are not added -- they collide with real given names where the native scripts cannot -- and belong to the opt-in packs of #345 (closes #343)

* 2.2.0 - August 31, 2026

nameparser 2.2 is a rename plus about thirty parsing fixes.
Expand Down
27 changes: 27 additions & 0 deletions nameparser/config/suffixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,28 @@
'さま', # ja the kana spelling of 様
'くん', # ja the kana spelling of 君
'ちゃん', # ja familiar/diminutive
# #346/#344/#343: spaced trailing honorifics, South Asian and
# Tibetan. SPACED ONLY -- none of these is in GLUED_HONORIFICS
# below, and none may be added to it. जी is the reason and the
# reason generalizes: Banerjee, Mukherjee and Chatterjee are
# written बनर्जी, मुखर्जी, चटर्जी, so a glued peel would strand a
# fragment on a bare virama (बनर् + जी) -- the 殿 criterion in a
# non-CJK script. गांधीजी therefore stays unpeeled, which is the
# accepted trade (decisions.md#indic-honorifics).
# NOTE the leading/trailing split across the two scripts, which is
# real and must not be "harmonized": Devanagari बाबू is a LEADING
# honorific -- a TITLES entry (#344), not a suffix -- while Bengali
# বাবু is TRAILING (অমল বাবু). Different codepoints, so the two
# entries cannot interact.
'rinpoche', # bo postpositional (Sogyal Rinpoche, Lama Zopa Rinpoche)
'जी', # hi/mr the universal respect particle (मोदी जी)
'साहब', # hi Sahib
'साहिब', # hi/pa the Sahib spelling with the i-matra
'साहेब', # mr the Marathi Saheb spelling
'महाराज', # hi Maharaj, trailing; the leading महाराजा is a TITLES entry (#344)
'সাহেব', # bn Saheb (রহমান সাহেব)
'বাবু', # bn Babu -- TRAILING; see the note above
'মহারাজ', # bn Maharaj
})
"""

Expand Down Expand Up @@ -158,6 +180,11 @@
(Madono) with four-figure populations, so peeling it would cut a real
family name in two. Spaced 殿 is safe for the reason 양/군 are: a
殿-surnamed person's name LEADS, and the suffix gate is trailing-only.
* The Indic trailing set (जी, साहब, साहिब, साहेब, महाराज, সাহেব, বাবু,
মহারাজ) and Latin rinpoche are spaced-only for the same reason 殿 is:
जी ends Banerjee/Mukherjee/Chatterjee (बनर्जी, मुखर्जी, चटर्जी) and a
glued peel would strand बनर् on a bare virama. The criterion is not
CJK-specific, which is the point (decisions.md#indic-honorifics).

Three more are in NEITHER set, so neither spelling is recognized. 君: 王君 is
a complete Chinese name (君 is a common given-name final), so the honorific
Expand Down
122 changes: 118 additions & 4 deletions nameparser/config/titles.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,35 @@
GIVEN_NAME_TITLES = frozenset({
'aunt',
'auntie',
# #346: the renunciate class -- 'baba' here, and 'guru', 'lama',
# 'swami' in their own alphabetical places below. All four were in
# the TITLES-only block until 2026-09-06. Two separate criteria
# both say yes (rules.md#H Background): the title addresses by the
# GIVEN name, which is what membership here means, and the
# traditions renounce the surname, which is what makes the empty
# family the right output for "Swami Vivekananda". 'rabbi' and
# 'imam' address by TITLE rather than by given name ('Rabbi
# Cohen'), so they fail the first criterion and stay out, and the
# second agrees, those traditions keeping surnames;
# 'venerable' stays in TITLES only, because the traditions using it
# split on surname retention (Buddhist monastics drop the family
# name, Anglican archdeacons keep it) and this set has no way to
# say "sometimes".
'baba',
'brother',
'dame',
'father',
'guru',
'king',
'lama',
'maid',
'master',
'mother',
'pope',
'queen',
'sir',
'sister',
'swami',
'uncle',
'sheikh',
'sheik',
Expand Down Expand Up @@ -48,6 +66,31 @@
'الحاجة', # hajj honorific (f)
'الشيخة', # female counterpart of الشيخ
'مهندس', # engineer (a genuine title in Egyptian usage)

# #344: Devanagari renunciate titles, the native-script twins of
# baba/guru/swami above. NO Latin twins for संत on purpose. No NEW
# Latin transliterations here: Sri and Sant collide with real
# given names (and Pandit, in the civil block below, with a
# surname) where the native script cannot (the sri/shri
# precedent in the TITLES block below); baba/guru/swami/lama are
# the pre-existing Latin entries above. Being in this literal puts
# them in TITLES too, TITLES being GIVEN_NAME_TITLES | {...}, which
# is what makes them titles at all -- Lexicon does not validate one
# set against the other.
'स्वामी', # Swami
'गुरु', # Guru
'बाबा', # Baba
'संत', # Sant

# #343: Bengali renunciate titles. Same two criteria as the Latin
# and Devanagari sets (rules.md#H Background), and no NEW Latin
# transliterations -- srila has none; baba/guru/swami already ship
# above. শ্রীল is the Vaishnava honorific (শ্রীল প্রভুপাদ);
# unprefixed শ্রী is civil and sits in TITLES below.
'স্বামী', # Swami
'শ্রীল', # Srila
'গুরু', # Guru
'বাবা', # Baba
})
"""
When these titles appear with a single other name, that name is a given name, e.g.
Expand Down Expand Up @@ -142,7 +185,6 @@
'author',
'award-winning',
'ayatollah',
'baba',
'bailiff',
'ballet',
'bandleader',
Expand Down Expand Up @@ -355,7 +397,6 @@
'großfürst',
'group',
'guitarist',
'guru',
'gyani',
'gysgt',
'hajji',
Expand Down Expand Up @@ -400,7 +441,6 @@
'kingdom',
'knowledge',
'lady',
'lama',
'lamido',
'law',
'lawyer',
Expand Down Expand Up @@ -664,7 +704,6 @@
'superior',
'supreme',
'surgeon',
'swami',
'swordbearer',
'sysselmann',
'tax',
Expand Down Expand Up @@ -776,6 +815,81 @@
'श्री', # Shri (Mr.)
'श्रीमती', # Shrimati (Mrs.)
'डॉ', # Dr. abbreviation
# #344: the civil set, same no-NEW-Latin-transliterations rule as
# the three above.
# Excluded under the collision rule and recorded here so a sweep
# does not ship them -- ठाकुर (Tagore, the surname), कुमारी, बेगम,
# शेख, आचार्य, राजा/रानी are all borne as ordinary names. Full
# argument: decisions.md Excluded (TITLES).
'डॉक्टर', # Doctor, full form
'डा', # Dr. -- the डा. abbreviation (Nepali and older Hindi),
# edge-period normalized
'प्रो', # Prof. abbreviation
'प्रोफेसर', # Professor, full form
'प्राध्यापक', # Professor (the Sanskritic form)
'प्रा', # Prof. abbreviation, Marathi
'पंडित', # Pandit
'पं', # Pandit abbreviation
'सरदार', # Sardar
'सुश्री', # Ms.
'श्रीयुत', # Shriyut (Mr.)
'श्रीमान', # Shriman (Mr.)
'सौ', # Marathi Sau. (Mrs.)
'बाबू', # Babu -- LEADING in Hindi; Bengali বাবু is trailing
# and lives in suffixes.py. Different codepoints.
'महात्मा', # Mahatma -- civil, not renunciate: it addresses by
# surname ("महात्मा गांधी"), so TITLES only
'न्यायमूर्ति', # Justice
'मौलाना', # Maulana
'जनाब', # Janab (Mr.)
'महाराजा', # Maharaja, LEADING (trailing महाराज is a suffix word)

# #343: Bengali (bn). NO Latin twins, for the reason the
# Devanagari block above gives -- transliterated Sri/Md/Mst
# collide with real given names where the native script cannot.
# No NEW Latin transliterations here (sri, mst); Latin md already
# ships, and for the medical degree
# (decisions.md#indic-honorifics). Doctor abbreviations
# split by profession: ড./ডঃ is the PhD's, ডাঃ/ডা. the Bangladeshi
# physician's. Abbreviation marks are spelled as written -- the
# visarga ঃ (U+0983) is a spacing combining mark, and the lookup
# fold strips only edge periods and whitespace, so it reaches the
# lexicon intact -- while period spellings (মো., ডা.) match the
# bare stem through the edge-period normalization, which is why
# each stem is listed once and the dotted form is not listed at
# all.
# Excluded under the collision rule and recorded here so a sweep
# does not ship them -- ঠাকুর (Tagore, the surname), কুমারী, বেগম
# and শেখ are all borne as ordinary names. Full argument:
# decisions.md Excluded (TITLES).
'ড', # Dr. abbreviation (PhD)
'ডঃ', # Dr. abbreviation, visarga spelling
'ডক্টর', # Doctor, full form
'ডাঃ', # Dr. abbreviation (physician), visarga spelling
'ডা', # Dr. abbreviation (physician)
'ডাক্তার', # Doctor, full form (physician)
'শ্রী', # Shri (Mr.)
'শ্রীমতী', # Shrimati (Mrs.)
'জনাব', # Janab (Mr.)
'অধ্যাপক', # Professor
'প্রফেসর', # Professor, borrowed form
'বিচারপতি', # Justice
'মাওলানা', # Maulana
'মুফতি', # Mufti (Latin mufti ships too)
'আলহাজ্ব', # Alhaj
'আলহাজ', # Alhaj, the spelling without the ব-phala
'মিঃ', # Mr., borrowed
'মি', # the same, period spelling মি.
'মিসেস', # Mrs., borrowed
'মোঃ', # Md. (Mohammad) -- a name PREFIX, not a title
# semantically; TITLES is the functional home
# because `given` must stay the name the person is
# addressed by (decisions.md#indic-honorifics)
'মো', # the same, period spelling মো.
'মোসাঃ', # Mst. (Mosammat), the women's counterpart
'মোসা', # the same, period spelling মোসা.
'মোছাঃ', # the same, ছ spelling
'মোছা', # the same, period spelling মোছা.
}


Expand Down
Loading