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
13 changes: 11 additions & 2 deletions docs/design/decisions/indic-honorifics.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Closes #346, #344 and #343 as one bundle: each CLASS is decided once, and each s
- Latin `mst` is a credential and no title, as `md` is: a leading `Mst` is the given name its filers type it as (`Mrs Mst Nasima Akther` → title 'Mrs', given 'Mst'), at the cost `md` carried until 2026-11-14, the given part of a family comma it opens reading as a credential (`Begum, Mst Amina` → suffix 'Mst Amina'), `mst` holding no given reading for rules/C13's given-name Except to read; after a name it is the degree (`Mary Smith, Mst` → suffix 'Mst'); `Mst.` with its period opening a name is a title by rules/H2's shape (`Mst. Nasima Akther` → title 'Mst.'), but opening the given part of a family comma it is a credential like the bare form (`Akther, Mst. Nasima` → suffix 'Mst. Nasima') — 2026-11-06 (Derek), #1130.
- An abbreviation carrying a mark is spelled with it, and the Bengali ones ship as the visarga form and the bare stem while the Devanagari ones ship as the bare stem alone, the dotted form listed in neither script — 2026-09-06 #346.
- Title vocabulary beats the one-letter-plus-period initial shape, measured and pinned by rows and not a rule: `ড. মুহাম্মদ ইউনূস` reads title 'ড.' while `র. কে. নারায়ণ`, with no entry behind it, keeps its initials — 2026-09-06 #346.
- An unlisted abugida honorific stays a name word, and rules/H2's executable example of it is `প্রকৌশলী. Sen`, so whoever ships প্রকৌশলী moves the example first; the Tier 4 candidates in the Indic scripts (transliterated military ranks, Advocate, Engineer, Marhum, the kinship forms, मां/माता/মা, the hafiz/syed/shahid forms) are skipped pending a corpus check and not declined — 2026-09-06 #346.
- An unlisted abugida honorific stays a name word, and rules/H2's executable example of it is `প্রকৌশলী. Sen`, so whoever ships প্রকৌশলী moves the example first; the Tier 4 candidates in the Indic scripts (transliterated military ranks, Advocate, Engineer, Marhum, the kinship forms, मां/माता/মা, the hafiz/syed/shahid forms) are skipped pending a corpus check and not declined — 2026-09-06 #346 (the hafiz and syed forms counted since, 2026-11-19 #1469, below).
- `qari`, `moulana`, `alhaj` and `alhajj` are titles by default, each opening a name as the title in every name counted but one surname-first byline (`Qari Ahmed Khan` → title 'Qari', given 'Ahmed'); `hafiz`, `hafez`, `haji` and the spelling `maulana`, borne as given names, stay name words by default, their title reading wanting a choice of Bengali (`locales.BN` could turn on a `default = false` reading in bn.toml) or of Urdu, which this entry writes for neither; `syed`, `mian`, `chaudhry` and `makhdoom` are name words — 2026-11-19 #1469.
- Latin `md` is a credential and no title: a leading `Md` is the given name it abbreviates (`Md Abdul Karim` → given 'Md', middle 'Abdul'; `Mr Md Karim Uddin` → title 'Mr', given 'Md', middle 'Karim'), at the accepted cost of a particle behind it starting the family (`Md Abu Sayed` → family 'Abu Sayed'), and the Bengali মোঃ/মো entries stay titles — 2026-10-23 #853.
- `md` is Muhammad written short as well as the medical degree, so the period-marked `Md.` opening a name is the given name (`Md. Karim Uddin` → given 'Md.', middle 'Karim'; `Mr Md. Karim Uddin` → title 'Mr', given 'Md.'), and `Md` opening the given part after a family comma is the given name where rules/C13's given-name Except reads it so (`Uddin, Md Karim` and `Uddin, Mr Md Karim` → given 'Md', middle 'Karim'; `Rahman, Md.` → given 'Md.'), the degree elsewhere (`RAHMAN, MD`, `Smith, Md PhD`, `Uddin, Mr Md` → suffix), the conditions stated in that rule and decisions/C13's Standing line — 2026-11-14 #1383.
- The romanized `pandit`, `sardar`, `kumari`, `babu`, `acharya` and `begum` are titles under no pack and no strict choice, each opening far more names as a given name or a surname than as the title (`Kumari Selja`, `Sardar Ahmad`, `Babu Joseph`), and each is an `excluded` entry carrying its counts — 2026-11-03 (Derek), #345.
Expand All @@ -23,7 +24,7 @@ Closes #346, #344 and #343 as one bundle: each CLASS is decided once, and each s

Elsewhere: the bundle's class-level refusals are recorded under decisions/vocabulary-exclusions, not here: the Latin forms of the Indic titles belonging to the opt-in packs of #345 (2026-09-06, #344), the native spelling shipping alone where a transliteration collides with real names (sri/shri, sant, pandit), the ban on the spaced trailing set becoming glued honorifics, and the per-word title refusals (ঠাকুর/ठाकुर, कुमारी/কুমারী, बेगम/বেগম, শেখ/शेख, आचार्य, राजा/रानी), each an `excluded` entry (`uv run python tools/vocab/query.py --excluded title`).

Open: #514 (whether the Tibetan prefix titles Tulku, Khenpo, Geshe, Kyabje and Jetsun fold like `Lama Zopa`).
Open: #514 (whether the Tibetan prefix titles Tulku, Khenpo, Geshe, Kyabje and Jetsun fold like `Lama Zopa`); #1469 (whether a choice of Bengali or Urdu reads `hafiz`, `hafez`, `haji` and `maulana` as titles; no reading is written for either).

## Log

Expand Down Expand Up @@ -65,4 +66,12 @@ Open: #514 (whether the Tibetan prefix titles Tulku, Khenpo, Geshe, Kyabje and J
- Measured, 2026-11-14, on this branch against master 3dadc263, whose parse #1390 did not change, over every local corpus's `corpus.jsonl` (the entries holding the word `md` after a comma, `,[^,]*\bmd\b`, case-insensitive, each corpus's distinct texts): 149,226 names, 19 move (re-taken after the second review's changes, 2026-11-14: the same 149,226 and 19; with the committed corpora, which this change's rule examples and case rows join, 149,359 and 27 after the third review), 5 of them #1383's leading `Md.` (ctgov) and 14 the comma's: fec-individuals 9 (`UDDIN, MD KARIM` shapes, given 'MD'), psc-individuals 3 (the forename box holding `Md` behind a title typed in the surname box), orcid-researchers 2 (`Uddin, Md. Karim`, `Hossain, Md`), and 13 of the 14 read right. The writing behind the design: after one word and a comma, `X, MD` in capitals alone is the degree in ClinicalTrials.gov (107, `Novak, MD`, `BERGER, MD`), while FEC's 10 (a Bangladeshi surname alone, then `MD`) are likely Muhammad, which no writing tells apart; `X, Md` written with a lower-case letter was the given name in all 3 found (ORCID 1, PSC 2). Recompute: each entry of a `corpus.jsonl` under `~/.cache/nameparser-tools/local/` matching `^\s*([^\s,]+),\s*(md\.?)(?:\s+(\S.*))?\s*$`, case-insensitive, grouped by the word's case, a word after it or none, and the head in capitals or not; the moves by parsing every entry matching the first pattern in both checkouts and comparing the seven name fields.
- Accepted: `MD` in capitals alone after a family comma stays the degree (`RAHMAN, MD` → suffix 'MD'), so `Md. Rahman` / `RAHMAN, MD` does not match; the degree written before a given name reads as Muhammad written short, the writing being the same (`SMITH, MD JANE` → given 'MD', 1 of FEC's 9 movers); a name in one case writes no case that tells (`rahman, md` → suffix 'md'); and `mst`, which holds no given reading, keeps the cost the 2026-11-06 #1130 entry recorded (`Begum, Mst Amina` → suffix 'Mst Amina'). A full spelling of Muhammad written with a full stop is still a title by rules/H2's shape (`Mohammed. Rahman` → title 'Mohammed.'): 10 of the 22,986 ORCID names opening with one of the five long spellings write it so, and no other local corpus does (2026-11-14: in orcid-researchers' `corpus.jsonl`, `grep -ciE '^"(muhammad|mohammad|mohammed|mohamed|mohamad)\. '` gives 10 and the same pattern with a space for the stop, `'^"(…) '`, 22,986; the second review's own count, by another recipe, gave 23,028).
- Left to their own issues: #1394 (a stop gluing `MD.` to the next word ends a Malay name in a suffix, `SITI AMINAH MD.NOOR` → suffix 'MD. NOOR') and #1178 (`Ab` and `Md.` at the head of a name, the wider question this entry answers for `Md.` alone).
- 2026-11-19 #1469 — QARI, MOULANA, ALHAJ AND ALHAJJ ARE TITLES; HAFIZ, HAFEZ, HAJI AND MAULANA ARE LEFT OUT, WANTING A CHOICE; SYED, MIAN, CHAUDHRY AND MAKHDOOM STAY NAME WORDS. Decided on 2026-11-19, each word by its counts, as rules/H9's batches are: the religious honorifics written before a name in Pakistan and Bangladesh, which 1.4.0 through 3.1.0 read as the given name (`mufti` and `hajji` were titles already, in ar.toml). It takes up the 2026-09-06 bundle's hafiz and syed forms, "skipped pending a corpus check"; `shahid` is not counted here.
- THE COUNTS, as borne names. ORCID's 2025 extract (24,990,909 people; `tools/name_usage.py <word> --boxes --country PK --country BD --country IN --country MY --country ID`), given box / family box: `hafiz` 2,300 / 371 (given: Pakistan 600, Malaysia 192, Indonesia 71, Bangladesh 29); `hafez` 245 / 564 (given: Iran 30, Egypt 28; family: Egypt 169); `haji` 232 / 1,178 (given: Iraq 20, Pakistan 15, Tanzania 13, Malaysia 10; family: Iran 156, Iraq 72, Brunei 50); `maulana` 971 / 1,231 (Indonesia 531 / 504, an Indonesian given name and surname); `qari` 9 / 43 (given: Pakistan 4); `moulana` 6 / 16; `alhaj` 17 / 269 (given: Sudan 5; the family box a surname written last); `alhajj` 5 / 47; `syed` 9,229 / 2,725 (given: Pakistan 1,810, India 907); `mian` 753 / 319 (given: China 130, Pakistan 103); `chaudhry` 81 / 814; `makhdoom` 16 / 57. US SSA given-name births: `syed` 6,043, `hafiz` 136, `mian` 110, `haji` 105, `hafez` 11, `qari` 10, the rest under 5 a year.
- THE NAMES OPENING WITH THE WORD, read by hand in the local corpora: `maulana`'s 18 in orcid-researchers are all given names (16 Indonesian), and JRC-Names' 69 the Pakistani cleric's title; `haji`'s 29 in orcid-researchers are mostly given names (Tanzania 12, Ethiopia 3, Azerbaijan 2), psc-individuals' 34 mostly the title, and my-candidates' 26 and opensanctions-parliaments' 7 (`pk_na_members` 3, `in_sansad` 4) the title; `qari` (orcid-researchers 1, psc-individuals 5, JRC-Names 53), `moulana` (`pk_na_members` 2, psc-individuals 3, JRC-Names 1) and `alhaj` (psc-individuals 2, JRC-Names 1, orcid-researchers 1 of 2) are the title in every one but one: an orcid-researchers byline writing its family name `Alhaj` first and its given name as initials, which master read given 'Alhaj' and this change title 'Alhaj', both missing the filer's boxes; no name opens with `alhajj`. Read as a title by default, `hafiz` would move 630 names in the local corpora, 266 in orcid-researchers and 237 in psc-individuals, nearly all filed in the forename box.
- BOX AGREEMENT DOES NOT DECIDE A TITLE: filers type the honorific in the forename box, so a title reading scores as a miss (`tools/differential/config_diff.py score default 'expr:Parser(lexicon=Lexicon.default().add("qari", kind="religious"))' --group PK --group BD --group MY --group ID --group TZ --group EG --group Pakistani --group Bangladeshi --group Malaysian --group Indonesian --cap 20000`, one spec per word). Each word read as a default title kept or lowered every group: `qari`, `moulana` and `alhaj` by at most 0.01 points; `maulana` ORCID ID 89.36 → 89.29; `haji` ORCID TZ 94.13 → 94.02; `hafiz` ORCID PK 93.59 → 92.94 and PSC Pakistani 94.27 → 93.35. So the four titles are decided on the lists that write a name as its bearer is addressed, and the four left out on the names their bearers file.
- LEFT OUT, NOT EXCLUDED: `hafiz`, `hafez`, `haji` and `maulana` are the title in Pakistani, Bangladeshi, Indian and Malaysian lists and a given name in Pakistan, Indonesia, Tanzania, Iran and Egypt, so their title reading is right in its language and wrong as a default. An `excluded` entry says a reading is wrong in every language (nameparser/vocab/README.md, Exclusions), so none is written; the reading they want is `default = false`, turned on by a choice of the language: in bn.toml, which `locales.BN` would turn on, or in ur.toml, which a caller's own choice of `ur` turns on, Urdu having no pack. Neither is written here; the Bangladeshi and Pakistani lists that would weigh it are counted above, and the question stays open (Open, above). `haji` under `locales.MS` belongs with #1180's Malay honorifics. `maulana` read only inside a title phrase (rules/H9) was weighed and not taken: no listed phrase holds it, so it would move only a name a style opens (`Her Excellency Maulana Ahmad Ali` → title 'Her Excellency Maulana', given 'Ahmad'), and neither the Indonesian given names nor the cleric's title opening a name.
- UNDER A STRICT CHOICE (`parser_for(locales.BN, strict=True)`, and HI's and MS's) the four read as the given name again, ar.toml not being chosen, as `mufti` and `hajji` already do.
- THE NAME WORDS: `syed`, `mian`, `chaudhry` and `makhdoom` open far more names as a given name or a surname than as an honorific, and the boxes agree with today's reading, so no reading is written for them.
- MEASURED (`tools/differential/measure.py --base <master checkout>`, master `34771e2d`): the committed snapshot, CLDR and GND agreement and every local corpus but four read as master did. JRC-Names moved 55 names (`qari` 53, `alhaj` 1, `moulana` 1), opensanctions-parliaments 2 (`moulana`, both `pk_na_members`), orcid-researchers 7 and psc-individuals 10 (`qari` 5, `moulana` 3, `alhaj` 2): in every one the word left the given name for the title, the words after it reading as a name without it (where one name word was left, in 14 names, 12 of two words and 2 written behind `Mr`, it is the family, rules/H1: `Qari Khan` → title 'Qari', family 'Khan'), save the byline above and two of orcid-researchers' that open with `Lama`, an Arabic given name that is also a listed title (rules/H1's renunciate class): one written `Lama Alhaj` and a surname, which master read title 'Lama', given 'Alhaj', now reads title 'Lama Alhaj' and the surname as the family, and one holding `Lama` and `Alhajj` and nothing else keeps title 'Lama', given 'Alhajj' and now reports `title-or-name`, its one name word being title vocabulary. Neither reading is the filer's; the cost is `lama`'s, which master paid already. Scored against the filers' boxes, psc-individuals loses 10 records, each a forename box holding the honorific (behind `Mr` in the title box in nine), and orcid-researchers moves 3; JRC-Names reads 8 persons' spellings apart that master read alike, the spellings with the title against those without it. my-candidates, FEC and ClinicalTrials.gov move nothing.

28 changes: 27 additions & 1 deletion docs/migrate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,8 @@ list, with reasoning, is in each release's section of
``Md``, Thai names, credentials after a comma
- :ref:`migrate-3-1`
* - 3.2
- Dutch ``Oude``, Malaysian ``a/l``, ``a/p`` and ``anak``
- Dutch ``Oude``, Malaysian ``a/l``, ``a/p`` and ``anak``,
religious titles before a name
- :ref:`migrate-3-2`

Each entry says what it compares with. The lists of readings through
Expand Down Expand Up @@ -2352,3 +2353,28 @@ title reading:
>>> as_31 = Parser(lexicon=Lexicon.default().remove("د", kind="academic"))
>>> as_31.parse("د. أحمد علي حسن").given
'د.'

Religious titles before a name
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

``Qari``, ``Moulana``, ``Alhaj`` and ``Alhajj``, written before a name
in Pakistan and Bangladesh, are titles, where 1.4 through 3.1 read them
as the given name. ``Hafiz``, ``Hafez``, ``Haji`` and the spelling
``Maulana`` are still read as given names, since many people bear them
as names:

.. doctest::

>>> qari = parse("Qari Ahmed Khan")
>>> qari.title, qari.given, qari.family
('Qari', 'Ahmed', 'Khan')
>>> parse("Hafiz Ahmed Khan").given
'Hafiz'

To read one of the four as a name, remove its reading:

.. doctest::

>>> as_31 = Parser(lexicon=Lexicon.default().remove("qari", kind="religious"))
>>> as_31.parse("Qari Ahmed Khan").given
'Qari'
1 change: 1 addition & 0 deletions docs/release_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Release Log

nameparser 3.2 is under development.

- **Add Qari, Moulana, Alhaj and Alhajj as titles, the religious titles written before a name in Pakistan and Bangladesh.** ``parse("Qari Ahmed Khan")`` gives title ``Qari``, given ``Ahmed``, where 1.4.0 through 3.1.0 gave given ``Qari``, middle ``Ahmed``. ``Hafiz``, ``Hafez``, ``Haji`` and the spelling ``Maulana``, often borne as given names, still read as the given name. :issue:`1469`
- **Fix Abdel, Abd and Abou past the first word of a name, which read as a middle name of their own.** ``parse("Tariq Abdel Aziz")`` gives family ``Abdel Aziz``, where 1.4.0 through 3.1.0 gave middle ``Abdel``, family ``Aziz``. ``Abdul`` joins only in a name of four words or more, titles and suffixes not counted, so ``Tariq Abdul Aziz`` keeps middle ``Abdul``; and after a family comma ``Abd`` before a name word is no longer the credential ABD. :issue:`1464`
- **Add locales.MS, a Malay pack, which reads Malaysian titles written before a name: Puan, Cik, Ustaz, Ustazah and Cikgu.** ``parser_for(locales.MS).parse("Puan Siti binti Ahmad")`` gives title ``Puan``, given ``Siti``, family ``binti Ahmad``, where the default, as 1.4.0 through 3.1.0, gives given ``Puan``; ``Tuan`` stays a name word, being a hereditary prefix and a Vietnamese given name, and the pack reads the Indonesian given name ``Puan`` as the title too (``Puan Maharani``): keep it to Malaysian names. See :ref:`malay-names`. :issue:`1179`
- **Fix Arabic titles written short, which read as the given name, and stop giving initials for Arabic-script names.** ``parse("د. أحمد علي حسن")`` gives title ``د.``, given ``أحمد``, where 1.4.0 through 3.1.0 gave given ``د.``; ``أ.د.``, ``م.م.``, a title glued to the name and the ranks ``اللواء`` and ``المستشار`` read as titles too, and ``initials()`` gives nothing for a word in Arabic script, as for Thai and Burmese, nor does the name match read its letter as an initial. A title written with a slash (``د/``) still reads as the given name. :issue:`1149`
Expand Down
7 changes: 7 additions & 0 deletions nameparser/config/_compiled.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@
'air',
'akhoond',
'alderman',
'alhaj',
'alhajj',
'almoner',
'ambassador',
'amn',
Expand Down Expand Up @@ -813,6 +815,7 @@
'monsignor',
'most',
'mother',
'moulana',
'mountaineer',
'mpco-cg',
'mr',
Expand Down Expand Up @@ -944,6 +947,7 @@
'pursuivant',
'pv2',
'pvt',
'qari',
"queen's",
'ra',
'rabbi',
Expand Down Expand Up @@ -1763,6 +1767,8 @@
})

TITLE_STYLES: frozenset[str] = frozenset({
'alhaj',
'alhajj',
'ch.ma',
'ch.mo',
'cheikh',
Expand Down Expand Up @@ -4783,6 +4789,7 @@
'2ndlt': ('2lt',),
'adm': ('admiral',),
'adv': ('advocate',),
'alhajj': ('alhaj',),
'assist': ('assistant',),
'assoc': ('associate',),
'asst': ('assistant',),
Expand Down
Loading