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
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ the patronymic in Russian. See `Locale packs
>>> ivan.given, ivan.patronymic, ivan.family
('Иван', 'Петрович', 'Сидоров')
>>> locales.available() # every pack that ships
('ar', 'bn', 'cs', 'es', 'es_ar', 'ga', 'gd', 'he', 'hi', 'hr', 'ja', 'mn', 'my', 'ne', 'nl', 'pt', 'pt_br', 'pt_pt', 'ru', 'sk', 'sl', 'tr_az', 'vi', 'zh')
('ar', 'bn', 'cs', 'es', 'es_ar', 'ga', 'gd', 'he', 'hi', 'hr', 'ja', 'mn', 'ms', 'my', 'ne', 'nl', 'pt', 'pt_br', 'pt_pt', 'ru', 'sk', 'sl', 'tr_az', 'vi', 'zh')
When a reading is wrong for your data
-------------------------------------
Expand Down
14 changes: 12 additions & 2 deletions docs/design/decisions/salutation-titles.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/design/decisions/vocabulary-exclusions.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Excluded (Lexicon.honorific_tails — a glued tail peels only if it could never

Excluded (TITLES):

- The per-word refusals are data since #750 (2026-10-19): each word refused a title reading — the Indic ঠাকুর/ठाकुर, कुमारी/কুমারী, बेगम/বেগম, शेख/শেখ, आचार्य and राजा/रानी (#343, #344), and #606's ông/bà, thiru, puan, pan, rodina, gróf, cik, paron, tikin, marshal and justice, #662's malam (Derek's decline) and bay, #660's shehu, and #789's wm (2026-10-22) — is an `excluded` entry in its language's file with its reason, and with its counts as name readings where they were taken. `uv run python tools/vocab/query.py --excluded title` lists them. A contributor who adds one back meets the reason as a build error.
- The per-word refusals are data since #750 (2026-10-19): each word refused a title reading — the Indic ঠাকুর/ठाकुर, कुमारी/কুমারী, बेगम/বেগম, शेख/শেখ, आचार्य and राजा/रानी (#343, #344), and #606's ông/bà, thiru, puan, pan, rodina, gróf, cik, paron, tikin, marshal and justice, #662's malam (Derek's decline) and bay, #660's shehu, #1179's tuan (2026-11-19), and #789's wm (2026-10-22) — is an `excluded` entry in its language's file (save `pan`, `puan` and `cik`, each since a reading off by default for a language's choice to turn on, decisions/salutation-titles' 2026-10-30 #753, phase 3f and 2026-11-19 #1179 entries) with its reason, and with its counts as name readings where they were taken. `uv run python tools/vocab/query.py --excluded title` lists them. A contributor who adds one back meets the reason as a build error.
- shehu's counts do not settle a graf-class weighing, and must not be read as if they did: its one leading-position figure, the Wikidata given-name count on its entry, is a lower bound (Shagari's own entry has no given-name statement), and its other counts are family-name bearers, a position C-i does not ask about. The evidence that Shehu leads a name is not a count. It is Shagari himself, and CLDR's Hausa sample data, whose six renderings carrying the word all file it as the given name (`grep '"given": "Shehu"' tools/differential/cldr_fields.jsonl`). It arrived with an early bulk import (1a51555f) and was never put to C-i before #660. Whoever re-argues it counts Hausa given-name use first; the accepted cost is the honorific use, `Shehu Abubakar` reading given Shehu as any untitled name does, and the reading belongs in an opt-in pack if anyone asks for it. malam is the opposite case: CLDR's Hausa data files Malam as the title (`grep '"title": "Malam"' tools/differential/cldr_fields.jsonl`), so its refusal is a decline on the counts, not a shehu-style removal.
- The class-level half of the Indic refusals stays here: the divergence on शेख/শেখ is deliberate and is the sri/shri case run backwards — the Latin sheikh cluster SHIPS as given-name titles for the Arabic addressing form, while the Indic spellings name the family. Since 2026-10-27 the Latin spellings but `shaykh` are titles only inside a title phrase (decisions/H9), so at the head of a name `Shekh Ahmed` and `शेख अहमद` both read the word as the given name, and the divergence stands only where a style, a modifier or `of` makes the Latin word a title, or a period does at the front by rules/H2's shape (`Sheikh. Ahmed` reads title 'Sheikh.', `शेख. अहमद` given 'शेख.'). shehu's removal moved three CLDR corpus names (`Shehu Muhammed`, `Muhammed, Shehu`, `Modibbo, Shehu Bello`), all three now agreeing with CLDR on every role (moves: `uv run python tools/differential/snapshot.py --since v2.4.1`).
- The trailing-position rule that must NOT be adopted, and 2026-09-08 says what the line is: TITLES holds hundreds of words in no suffix set, at least nineteen of them ordinary English surnames (king, judge, bishop, baron, sheriff, ...; `king` has since left TITLES, a title only inside a title phrase by decisions/H9's #752 phase 2j, so `Mary Jane King.` now reads family 'King.', while `Mary Jane Pope.` still reads title 'Pope.'), so a blanket "vocabulary outranks position in the trailing slot" reading would turn "Mary Jane King" into title="King" with the family name gone. The leading half of this argument is AGENTS.md's "Titles permanently shadow first names" gotcha, whose example is Dean; this is the trailing half, and it shadows the family name rather than the given (#316). What #316 settled is that the prohibition is on BARE words: "Mary Jane King" still reads family King, while "John Smith Prof." reads title Prof. **The second half of that argument is RETRACTED 2026-09-09**, in review of the docs commit: "a period-marked trailing word being one nobody writes as a surname" claimed the period keeps the collision out of the trailing slot, and it does not. Measured on the branch tree — "Mary Jane King." reads title "King.", given Mary, family Jane, the family name shadowed exactly as the bare reading would have shadowed it, and "John Smith Judge." reads title "Judge." The reach is the vocabulary rather than a handful: of the 746 titles in no suffix set, 627 read as a trailing title once a period is written behind them, and every one of the 119 that do not is kept out by the abbreviation SHAPE — a digit, a hyphen, an apostrophe, or a script whose letters carry combining marks (rules/H2 records that half) — no plain ASCII-letter title missing at all. So king, judge, bishop, baron and sheriff ARE reachable in the trailing slot; what the prohibition above buys is the bare spelling and nothing more. The period is a WRITING convention the rule can read, not evidence about the word, and reading it is an ACCEPTED COST under the premise that the input is a name (rules.md H Background): someone who ends a name with a period-marked word has written an abbreviation. rules/H5 carries it as an Accepted clause with "Mary Jane King." as the executable example. (Since 2026-10-26 `king` is a title only inside a title phrase, decisions/H9, #752 phase 2j: "Mary Jane King." reads family "King." and the surnames this paragraph names are pope, judge, bishop, baron and sheriff, rules/H5's example "Mary Jane Pope.".) Recompute the reach with `L = Parser().lexicon; ws = [w for w in L.titles - L.suffix_acronyms - L.suffix_words if " " not in w]; len([w for w in ws if parse("Mary Jane %s." % w).title])` against `len(ws)` — 627 of 746 on 2026-09-09 — the digits move as the vocabulary grows and neither argument does. See #H5. (Since 2026-11-06, decisions/H5's #1116 entry, a hyphen or a period inside the word no longer keeps a word out: 718 of 820 reach the trailing slot, 688 before, the 30 added including whole hyphenated words as well as abbreviations (`co-founder`, `senior-judge`, `singer-songwriter`, `priv.-doz`, `sig.ra`), and the recipe reads `Parser().lexicon._sets` since 3.0's 4i-b. Of the 102 still kept out, 35 hold a digit, 5 an apostrophe and 54 combining marks, and 8 are kept out by what the list above does not name: a slash (`mag/judge`), the Hebrew geresh and gershayim (`ד"ר`, `פרופ׳`), and the single letter `ড`.) The bare prohibition has one exception since #835 (decisions/H8): a listed salutation ending the given part after a family comma is the title, the comma having marked the surname's place and the salutations borne as names being excluded.
Expand Down
78 changes: 77 additions & 1 deletion docs/languages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ subset with its own parser, or pass several packs to ``parser_for``:
The sections below cover Czech, Slovak, Slovenian and Croatian names,
Spanish and Portuguese titles and family names, romanized Indic titles,
Vietnamese, Mongolian and Thai names, Maghrebi, Amazigh, Hebrew and
Dutch particles, and Burmese names. Other languages are described where their mechanism is:
Dutch particles, and Burmese and Malay names. Other languages are described where their mechanism is:

- **East Slavic patronymics** (``ru``): :ref:`east-slavic-patronymics`.
- **Turkic patronymic markers** (``tr_az``):
Expand Down Expand Up @@ -1430,3 +1430,79 @@ Minjun`` keeps it as the family name. Chosen strictly, the pack also
reads a run of initials holding ``U`` as the title (``U.S. Grant``
gives title ``U.S.``, family ``Grant``). Keep the pack to a parser of
its own for the Burmese names in your data.

.. _malay-names:

Malay names
-----------

Turn on ``locales.MS`` when your data is Malaysian names, Malay ones
written with the titles Malaysian lists put in front of them. ``ms`` is
the language tag of Malay (Burmese is ``my``, :ref:`burmese-names`).

A Malay name has no family name either: a given name, then ``bin``
(son of) or ``binti`` (daughter of) and the father's name, which the
default reads as the family already. What the pack adds is the words
written before the name. ``Encik`` (Mr.) is a title by default; the
pack reads ``Puan`` (Mrs.), ``Cik`` (Miss), ``Ustaz`` and ``Ustazah``
(a religious teacher) and ``Cikgu`` (teacher) as titles too:

.. doctest::

>>> parse("Puan Siti binti Ahmad").given
'Puan'
>>> malay = parser_for(locales.MS)
>>> siti = malay.parse("Puan Siti binti Ahmad")
>>> siti.title, siti.given, siti.family
('Puan', 'Siti', 'binti Ahmad')
>>> hafiz = malay.parse("USTAZ HAFIZ BIN OMAR")
>>> hafiz.title, hafiz.given, hafiz.family
('USTAZ', 'HAFIZ', 'BIN OMAR')

Each is off by default, because a name elsewhere is written with it or
because only Malaysian lists write it: ``Puan`` is an Indonesian given
name, so the default keeps ``Puan Maharani``'s given name, and the pack
does not. Choose the pack
for Malaysian lists, not Indonesian ones.

On Malaysia's election candidates, 3,077 distinct names written in
capitals, the pack reads 117 differently from the default, each a title
the default read as the given name: ``USTAZ`` 69, ``CIKGU`` 41,
``USTAZAH`` 4, ``CIK`` 2 and ``PUAN`` 1. The two ``CIK`` are ``Cikgu``
written in two words (``CIK GU``), and read given ``GU``, and the
``PUAN`` opens ``Puan Sri``, the wife of a Tan Sri, and reads given
``SRI`` until the phrase is a title (:issue:`1180`). Among the records ORCID, PatentsView and
Companies House hold of Malaysians, Indonesians, Singaporeans and
Vietnamese, each split into boxes by the person or the filer, the share
whose boxes the parse matches does not move (measured 2026-11-19,
:issue:`1179`).

What the pack leaves as it is
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

``Tuan`` (Mr., Sir) stays a name word. Malaysians who file their own
names write it first as a hereditary prefix, repeated before the
father's name, and a Vietnamese given name is written so too:

.. doctest::

>>> aminah = malay.parse("Tuan Aminah binti Tuan Yusof")
>>> aminah.title, aminah.given, aminah.family
('', 'Tuan', 'binti Tuan Yusof')

``Dato'``, ``Datuk``, ``Tan Sri`` and ``Haji`` are not titles yet
(:issue:`1180`), and a title written after one stays a name word
(``Dato' Ustaz Idris`` gives given ``Dato'``, middle ``Ustaz``).
``bt``, written short for ``binti``, stays a credential (Baronet), as
by default; :doc:`customize` shows how to remove it.

Plain, not strict
~~~~~~~~~~~~~~~~~

Choose the pack plainly. Malaysian lists mix Malay, Chinese and Indian
names with English and Arabic titles, and a strict choice of ``ms``
reads only the words of ``ms`` and those shared by every language, so
it drops ``Abdul``'s join and English titles such as ``Sir``: it matches the boxes of 76.16% of ORCID's
Malaysian holders, against 76.72% for the plain choice (measured
2026-11-19).

15 changes: 12 additions & 3 deletions docs/locales.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ shape covers much:
the order moves every name a family comma does not fix, and its
titles and removed readings reach the comma names too.
- ``mn`` may read any name written wholly in Cyrillic differently.
- ``ms`` may read any name holding ``Puan``, ``Cik``, ``Ustaz``,
``Ustazah`` or ``Cikgu`` as a word differently.
- ``my`` may read any name holding ``U`` or ``Daw`` as a word
differently, with or without its full stop, or ``U`` as a letter of
a word joined by full stops. Chosen strictly, it may read any name
Expand Down Expand Up @@ -186,7 +188,7 @@ look one up dynamically by its lowercase code with
.. doctest::

>>> locales.available()
('ar', 'bn', 'cs', 'es', 'es_ar', 'ga', 'gd', 'he', 'hi', 'hr', 'ja', 'mn', 'my', 'ne', 'nl', 'pt', 'pt_br', 'pt_pt', 'ru', 'sk', 'sl', 'tr_az', 'vi', 'zh')
('ar', 'bn', 'cs', 'es', 'es_ar', 'ga', 'gd', 'he', 'hi', 'hr', 'ja', 'mn', 'ms', 'my', 'ne', 'nl', 'pt', 'pt_br', 'pt_pt', 'ru', 'sk', 'sl', 'tr_az', 'vi', 'zh')
>>> locales.get("ru") is locales.RU
True

Expand Down Expand Up @@ -296,6 +298,13 @@ says which parts each pack is made of.
name last, so the father's name, written first, is the family.
See :ref:`Mongolian names <mongolian-names>`.
- ``Батын Сүхээ`` → family ``Батын``, given ``Сүхээ``
* - ``ms``
- Malay: Malaysian titles
- Chooses ``ms``, which reads the salutations ``Puan`` (Mrs.) and
``Cik`` (Miss), and ``Ustaz``, ``Ustazah`` and ``Cikgu``, as
titles, where the default reads a name word. See
:ref:`malay-names`.
- ``Puan Siti binti Ahmad`` → title ``Puan``
* - ``my``
- Burmese
- Chooses ``my``, which reads the honorifics ``U`` and ``Daw``
Expand Down Expand Up @@ -391,8 +400,8 @@ says what it can change:
- Chooses a language
- Policy fields
- Word list
* - ``ar``, ``bn``, ``ga``, ``gd``, ``he``, ``hi``, ``hr``, ``nl``,
``pt``, ``sl``
* - ``ar``, ``bn``, ``ga``, ``gd``, ``he``, ``hi``, ``hr``, ``ms``,
``nl``, ``pt``, ``sl``
- yes
- none
- none
Expand Down
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 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`
- **Change Parser.suggest() to read where a Russian-style patronymic stands as a vote on the order, and add Signal.PATRONYMIC_POSITION, the signal that casts it.** ``Parser().suggest(["Sidorov Ivan Petrovich", "Volkov Pavel Sergeevich", "Orlova Anna Ivanovna", "Zaitsev Oleg Nikolaevich", "Belova Vera Andreevna"]).patch`` gives ``PolicyPatch(name_order=FAMILY_FIRST, patronymic_rules=...)``, where 3.1.0 gave the rule with the given-first order, which misread any name of two words in such a list (``Sidorov Ivan`` gave family ``Ivan``); a patronymic in the middle votes given-first. :issue:`1447`
- **Fix ud inside a South Asian compound name, which read as a credential and took the rest of the name.** ``parse("NADIR ZIA UD DIN")`` gives middle ``ZIA UD``, family ``DIN``, as 1.4.0 through 2.3.0 did, where 2.4.0 through 3.1.0 gave family ``ZIA``, suffix ``UD DIN``; ``UD`` alone after a name and a comma now reads as initials (``Anke Vissering, UD`` gives given ``UD``, family ``Anke Vissering``, where 1.4.0 through 3.1.0 gave suffix ``UD``). ``bt`` stays a credential: for Malay names remove it, as :doc:`customize` shows. :issue:`1467`
- **Fix the surname1 and surname2 views, which left a family of two surnames whole before a family comma, opening with a particle, or behind a given name a particle completes.** Under ``two_family_names``, as ``locales.ES``, ``ES_AR``, ``CS``, ``SK``, ``PT_BR`` and ``PT_PT`` turn it on, ``parser_for(locales.ES).parse("García Márquez, Gabriel")`` gives surname1 ``García``, surname2 ``Márquez``, as ``Gabriel García Márquez`` does, where 3.0.0 through 3.1.0 gave surname1 ``García Márquez``, surname2 ``''``. No field moves; a family joined by ``y`` or written as one hyphenated word stays whole, and so, where 3.0.0 through 3.1.0 divided them, do a lone particle and the word after it under a family-first order (``Van Gogh``) and a Turkic father's name with its marker; with ``capitals_as_family`` on too, the family the capitals name is divided. :issue:`1456`, :issue:`1479`
Expand Down
5 changes: 5 additions & 0 deletions nameparser/config/_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,8 @@
('ciccio', (('it', 'familiar', (('short_for', ('francesco',)),)),)),
('cie', (('en', 'credential', ()),)),
('cig', (('en', 'credential', ()),)),
('cik', (('ms', 'salutation', (('after_given', True), ('default', False))),)),
('cikgu', (('ms', 'occupation', (('default', False),)),)),
('cindy', (('en', 'familiar', (('short_for', ('cynthia',)),)),)),
('cip', (('en', 'credential', ()),)),
('cipm', (('en', 'credential', ()),)),
Expand Down Expand Up @@ -2306,6 +2308,7 @@
('pta', (('en', 'credential', ()),)),
('pta/l', (('en', 'credential', ()),)),
('ptech', (('en', 'credential', (('cased', 'PTech'),)),)),
('puan', (('ms', 'salutation', (('after_given', True), ('default', False))),)),
('publisher', (('en', 'occupation', ()),)),
('pursuivant', (('en', 'office', ()),)),
('pv2', (('en', 'military', ()),)),
Expand Down Expand Up @@ -2774,6 +2777,8 @@
('usmc', (('en', 'credential', ()),)),
('usn', (('en', 'credential', ()),)),
('usnr', (('en', 'credential', ()),)),
('ustaz', (('ms', 'religious', (('default', False),)),)),
('ustazah', (('ms', 'religious', (('default', False), ('same_as', 'ustaz'))),)),
('uxc', (('en', 'credential', ()),)),
('uxmc', (('en', 'credential', ()),)),
('uí', (('ga', 'clan', (('cased', 'Uí'), ('default', False), ('same_as', 'ó'))),)),
Expand Down
1 change: 1 addition & 0 deletions nameparser/locales/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"HR": ("nameparser.locales.hr", "HR"),
"JA": ("nameparser.locales.ja", "JA"),
"MN": ("nameparser.locales.mn", "MN"),
"MS": ("nameparser.locales.ms", "MS"),
"MY": ("nameparser.locales.my", "MY"),
"NE": ("nameparser.locales.ne", "NE"),
"NL": ("nameparser.locales.nl", "NL"),
Expand Down
Loading