Skip to content

Commit f0fbf65

Browse files
derek73claude
andcommitted
feat: Hebrew honorifics + post-nominals, Devanagari titles (#269 follow-up)
Hebrew titles גברת/פרופ'/פרופ׳/פרופסור/עו"ד/עו״ד/הרב join מר as plain titles (Israeli convention: family follows), each abbreviation in both geresh/gershayim spellings per the ד"ר precedent. Hebrew gains the suffix category Arabic deferred: ז"ל and שליט"א (both spellings) -- post-nominals ubiquitous in genealogical data, never names, mid-word quotes inert in extraction. Devanagari becomes a #269 script: श्री/श्रीमती/डॉ (डॉ. matches via edge-period normalization). Latin sri/shri deliberately NOT added -- the transliterations collide with real given names (Sri Mulyani); the native script cannot. Deferred under the collision rule, recorded in the data-module comments: bare רב (the ordinary word 'many') and בר as a particle (Bar is a common modern Israeli given name; the surname spelling is hyphenated anyway). TDD: 15 rows red first across title/suffix/script categories. Differential exit 0 unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 00b73b8 commit f0fbf65

4 files changed

Lines changed: 57 additions & 0 deletions

File tree

docs/release_log.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Release Log
88
- The CLI gains ``--locale CODE`` (``python -m nameparser --locale ru "..."``)
99
- Add non-Latin vocabulary to the default lexicon (#269): Cyrillic, Greek, Arabic and Hebrew titles, conjunctions, and name particles -- native-script entries cannot collide with Latin-script names. Deferred pending vetting: Cyrillic ``мл``/``ст`` suffixes and the bare Greek ``κ`` title (it collides with the initial+surname shape). Behavior note: ``محمد بن سلمان`` now chains ``بن`` onto the family name where 1.x read it as a middle name
1010
- Add the Arabic-script bound given names (#269 follow-up): ``عبد``, the kunya pair ``أبو``/``ابو``, and ``أم``/``ام`` join the following word into the given name like their transliterations (``abdul``, ``abu``, ``umm``) always did -- ``عبد الرحمن محمد`` now parses given ``عبد الرحمن``, family ``محمد``, where 1.x split it into given + middle (``tests/v2/cases.py`` rows ``arabic_bound_given_*``). Not present in the differential corpus
11+
- Add Hebrew honorifics, Hebrew post-nominals, and Devanagari titles (#269 follow-up): the Israeli honorifics ``גברת``, ``פרופ'``/``פרופ׳``, ``פרופסור``, ``עו"ד``/``עו״ד``, and ``הרב`` as plain titles; the post-nominals ``ז"ל``/``ז״ל`` and ``שליט"א``/``שליט״א`` as suffixes (both gershayim spellings each); and a new #269 script -- Devanagari ``श्री``, ``श्रीमती``, and ``डॉ`` (``डॉ.`` matches via edge-period normalization). Latin ``sri``/``shri`` deliberately NOT added (they collide with real given names; the native script cannot). Deferred: bare ``רב`` (ordinary word "many") and ``בר`` as a particle (Bar is a common modern given name). Not present in the differential corpus
1112
- Add Arabic honorific titles and the conjunction ``و`` (#269 follow-up): the doctor/professor/hajj/sheikha/engineer forms (``الدكتور``/``الدكتورة``/``دكتور``/``دكتورة``, ``الأستاذ``/``الأستاذة``/``أستاذ``/``أستاذة``, ``الحاج``/``الحاجة``, ``الشيخة``, ``مهندس``) as given-name titles -- Arabic honorifics precede the given name, like ``الشيخ``. Deferred under the collision rule: bare ``سيد``/``شيخ``/``أمير``/``سلطان`` (all common given names), the ``د.`` abbreviation (bare ``د`` would swallow initials), and the Ottoman post-nominals ``باشا``/``بك``/``أفندي`` (survive as family names). Not present in the differential corpus
1213

1314
**Behavior Changes (draft)**

nameparser/config/suffixes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
# literally instead of going through nickname/suffix disambiguation).
2727
'ret',
2828
'vet',
29+
30+
# #269 follow-up: Hebrew post-nominals, both gershayim spellings
31+
# (ASCII '"' and U+05F4); the mid-word quote is inert in
32+
# extraction, like the ד"ר title. Neither is ever a name.
33+
'ז"ל', # "of blessed memory" (deceased), ASCII quote
34+
'ז״ל', # same, U+05F4 gershayim
35+
'שליט"א', # honorific for a living rabbi, ASCII quote
36+
'שליט״א', # same, U+05F4 gershayim
2937
}
3038
"""
3139

nameparser/config/titles.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,4 +748,25 @@
748748
"גב'",
749749
'ד״ר',
750750
'גב׳',
751+
# #269 follow-up: the rest of the common Israeli honorifics, same
752+
# plain-title bucket (family follows) and the same dual geresh/
753+
# gershayim spelling rule as above. Deferred under the collision
754+
# rule: bare 'רב' (also the ordinary word "many"); 'בר' as a
755+
# particle (Bar is a common modern given name, and the surname
756+
# spelling is hyphenated anyway).
757+
'גברת', # Mrs./Ms., full form
758+
"פרופ'", # professor abbreviation, ASCII apostrophe
759+
'פרופ׳', # professor abbreviation, U+05F3 geresh
760+
'פרופסור', # professor, full form
761+
'עו"ד', # advocate/lawyer, ASCII quote
762+
'עו״ד', # advocate/lawyer, U+05F4 gershayim
763+
'הרב', # "the rabbi" (article form; bare רב deferred)
764+
765+
# #269 follow-up: Devanagari (hi/mr). NO Latin twins on purpose:
766+
# transliterated sri/shri collide with real given names (Sri
767+
# Mulyani); the native-script forms cannot. "डॉ." matches via the
768+
# edge-period normalization, like Latin "Dr.".
769+
'श्री', # Shri (Mr.)
770+
'श्रीमती', # Shrimati (Mrs.)
771+
'डॉ', # Dr. abbreviation
751772
}

tests/v2/test_locales.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,33 @@ def test_non_interference_all_packs_combined() -> None:
449449
# Hebrew "מר" title (plain title, not FIRST_NAME_TITLES -- like
450450
# 'mr', the following name reads as family).
451451
("מר דוד לוי", "title", "מר"),
452+
# Hebrew title/suffix sweep (#269 follow-up): plain titles (Israeli
453+
# convention: family follows, the מר precedent); both geresh/
454+
# gershayim spellings ship where an abbreviation carries one.
455+
("גברת רות כהן", "title", "גברת"),
456+
("פרופ' דוד לוי", "title", "פרופ'"),
457+
("פרופ׳ דוד לוי", "title", "פרופ׳"),
458+
("פרופסור רות כהן", "title", "פרופסור"),
459+
('עו"ד דוד לוי', "title", 'עו"ד'),
460+
("עו״ד דוד לוי", "title", "עו״ד"),
461+
("הרב עובדיה יוסף", "title", "הרב"),
462+
# post-nominal Hebrew suffixes: ז"ל ("of blessed memory") and
463+
# שליט"א (honorific for living rabbis) -- suffix words, exact
464+
# token incl. the mid-word gershayim (inert in extraction, like
465+
# the ד"ר title)
466+
('משה כהן ז"ל', "suffix", 'ז"ל'),
467+
("משה כהן ז״ל", "suffix", "ז״ל"),
468+
('הרב משה פיינשטיין שליט"א', "suffix", 'שליט"א'),
469+
("הרב משה פיינשטיין שליט״א", "title", "הרב"),
470+
# Devanagari (hi/mr) titles -- a new #269 script: श्री/श्रीमती are
471+
# the Mr./Mrs. analogs, डॉ the Dr. abbreviation (edge-period
472+
# normalization makes "डॉ." match too). NO Latin twins on purpose:
473+
# transliterated sri/shri collide with real given names (Sri
474+
# Mulyani); the native script cannot.
475+
("श्री राम शर्मा", "title", "श्री"),
476+
("श्रीमती सीता शर्मा", "title", "श्रीमती"),
477+
("डॉ राम शर्मा", "title", "डॉ"),
478+
("डॉ. राम शर्मा", "title", "डॉ."),
452479
# Geresh/gershayim gate (#269 step 2): probed live against
453480
# extract_delimited's _open_ok/_close_ok boundary rules. Both the
454481
# ASCII-quote spelling and the typographic Unicode spelling of

0 commit comments

Comments
 (0)