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
25 changes: 25 additions & 0 deletions docs/customize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,31 @@ falls through to nickname parsing (``"John Smith (Ba)"``,
``"Jeffrey (JD) Bricken"``), reported as a ``suffix-or-nickname``
ambiguity.

Malay names and bt
^^^^^^^^^^^^^^^^^^

``bt`` is listed as a credential, Baronet (``Sir John Smith Bt``),
and Malay names write it for *binti*, between a woman's name and her
father's. Written any way but in Title case, the credential reading
takes the father's name into the suffix. A caller reading Malay names
removes the reading:

.. doctest::

>>> parse("Nur Aina bt Rosli").suffix
'bt Rosli'
>>> malay = Parser(lexicon=Lexicon.default().remove("bt", kind="credential"))
>>> aina = malay.parse("Nur Aina bt Rosli")
>>> aina.suffix, aina.family
('', 'Rosli')

Removing it costs a baronet his post-nominal: ``Sir John Smith Bt``
then reads family ``Bt``, and ``Sir John Smith, Bt`` reads given
``Bt``, the name before the comma the family. The default keeps the
reading because ``bt`` is rare on the lists measured, a Malaysian one
included (:issue:`1467`), and ``Bt`` written in Title case reads as a
name word already (``Nur Aina Bt Rosli``).

Generation words that are also surnames
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
2 changes: 2 additions & 0 deletions docs/design/decisions/suffix-acronym-collisions.md

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions docs/migrate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2276,3 +2276,20 @@ name). To read such a word as a name, remove its reading:
>>> as_31 = Parser(lexicon=Lexicon.default().remove("student", kind="occupation"))
>>> as_31.parse("Student Mary Jones").given
'Student'

ud inside a compound name
^^^^^^^^^^^^^^^^^^^^^^^^^

``ud`` is no longer a credential, so a South Asian compound name
holding it reads as 1.4 and 2.0 through 2.3 read it, where 2.4 through
3.1 read ``ud`` and every word after it as the suffix. Alone after a
name and a comma it now reads as initials run together, as any
unlisted pair of capitals does there:

.. doctest::

>>> zia = parse("NADIR ZIA UD DIN")
>>> zia.middle, zia.family, zia.suffix
('ZIA UD', 'DIN', '')
>>> parse("Anke Vissering, UD").given
'UD'
1 change: 1 addition & 0 deletions docs/release_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Release Log
nameparser 3.2 is under development.

- **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`
- **Change Parser.suggest() to read common surnames beyond the Chinese, Korean and Vietnamese ones, most of them Spanish.** ``Parser().suggest(["García Zorvan", "Quispe Qelliot"]).patch`` gives ``PolicyPatch(name_order=FAMILY_FIRST)``, where 3.1.0 found no evidence in either name and suggested nothing; a list of two to five Spanish names written family first now moves a given-first parser more often. :issue:`1364`
- **Fix a job or degree written out after a name and a comma, which took the name over.** ``parse("Nadir Qassoumi, Bachelor")`` gives title ``Bachelor``, given ``Nadir``, family ``Qassoumi``, where 1.4.0 through 3.1.0 gave given ``Bachelor``, family ``Nadir Qassoumi``; ``Medical Doctor`` and ``Clinical Research Coordinator`` read as one title. A name the word opens reads it as the title too (``Student Mary Jones`` gives title ``Student``), and the possessive ``Master's degree`` still takes the name over. :issue:`1457`
Expand Down
1 change: 0 additions & 1 deletion nameparser/config/_compiled.py
Original file line number Diff line number Diff line change
Expand Up @@ -3700,7 +3700,6 @@
'td',
'thd',
'thm',
'ud',
'usa',
'usaf',
'usar',
Expand Down
1 change: 0 additions & 1 deletion nameparser/config/_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -2742,7 +2742,6 @@
('ty', (('en', 'familiar', (('short_for', ('tyler',)),)),)),
('u', (('my', 'salutation', (('default', False),)),)),
('ua', (('ga', 'clan', (('cased', 'Ua'), ('same_as', 'ó'))), ('ga', 'given', ()))),
('ud', (('en', 'credential', ()),)),
('uk', (('en', 'modifier', (('dotted', True),)),)),
('ul-', (('ar', 'article', (('same_as', 'al-'),)), ('ur', 'article', (('same_as', 'al-'),)))),
('ula', (('pl', 'familiar', (('short_for', ('urszula',)),)),)),
Expand Down
2 changes: 1 addition & 1 deletion nameparser/vocab/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5866,7 +5866,7 @@ credential = { cased = "ThM" }

[[word]]
text = "ud"
credential = {}
excluded = { credential = { reason = "the Urdu and Arabic connective of a compound name (Zia ud Din, Mohi ud Din): between name words in 121 distinct names of eight local corpora (ctgov-officials, ctgov-contacts, govuk-people, ukec-individuals, psc-individuals, fec-individuals, orcid-researchers, my-candidates), the words split at spaces with commas and full stops removed, as the vocabulary matches an acronym, 2026-11-19, against 7 ending a name, where the credential reading started a run that took the rest of the name (NADIR ZIA UD DIN read suffix 'UD DIN'). The 7 write no credential: initials written U.D (four: three ORCID holders', now read as the family, as an unlisted pair of initials ending a name is, and an FEC donor's after a comma, read as initials before and after), the compound written surname first (one; DIN, NADIR UD-shape, now middle 'UD'), and a Dutch study chair in two ClinicalTrials.gov records writing the rank universitair docent after the name and a comma, which now reads as an unlisted pair of capitals there does, as initials run together, given 'UD' and the name before the comma the family (Anke Vissering, UD, an invented name of that shape), the accepted cost. Never reviewed as a credential, having come with the bulk list (decisions/suffix-acronym-collisions)", issue = 1467, decided = 2026-11-19 } }

[[word]]
text = "usa"
Expand Down
32 changes: 32 additions & 0 deletions tests/v2/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -21532,4 +21532,36 @@ def _check_cjk_shape_purity(self) -> None:
"family": "Nadir Qassoumi"},
notes="boundary: the possessive is left unlisted (#1457), so "
"the part still takes the name over"),
# #1467: `ud` loses its credential reading; `bt` keeps its own.
Case("ud_inside_a_compound_name_in_capitals_is_a_name_word",
"NADIR ZIA UD DIN",
{"given": "NADIR", "middle": "ZIA UD", "family": "DIN"},
notes="#1467 restores 1.4.0's reading: 2.4.0 through 3.1.0 "
"read family 'ZIA', suffix 'UD DIN', reported "
"suffix-or-name, the credential reading starting a run "
"that took the rest of the name"),
Case("ud_in_lower_case_inside_a_compound_name_is_a_name_word",
"Nadir Zia ud Din",
{"given": "Nadir", "middle": "Zia ud", "family": "Din"},
notes="#1467 restores 1.4.0's reading: 2.4.0 through 3.1.0 "
"read family 'Zia', suffix 'ud Din', reported "
"suffix-or-name; the compound is not joined (decided on "
"#1467)"),
Case("ud_after_a_full_name_and_a_comma_reads_as_initials",
"Anke Vissering, UD",
{"given": "UD", "family": "Anke Vissering"},
classification="fix(#1467)",
notes="the accepted cost: an unlisted pair of capitals after the "
"name and a comma reads as initials run together, as 'XQ' "
"does; read suffix 'UD' 1.4.0 through 3.1.0"),
Case("bt_in_lower_case_before_the_last_word_stays_the_credential",
"Nur Aina bt Rosli",
{"given": "Nur", "family": "Aina", "suffix": "bt Rosli"},
ambiguities=("suffix-or-name",),
classification="fix(#602)",
notes="boundary: #1467 decided `bt` keeps its credential "
"reading, whose run here came with #602's in 2.4.0 "
"(1.4.0 through 2.3.0 read middle 'Aina bt', family "
"'Rosli'); a caller with Malay names removes it "
"(docs/customize.rst)"),
)
13 changes: 8 additions & 5 deletions tests/v2/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,10 @@ def test_the_field_sweep_sees_the_claims_it_checks() -> None:
# its declared policy; 2192 -> 2195 the same day, #1471's 'Emerita
# Smith' reporting title-or-name under three orders; 2195 -> 2198 the
# same day, #1457's 'Mr Masters' reporting title-or-name under three
# orders.
assert claims == 2198, (
f"the field sweep checks {claims} claims, recorded as 2198 on "
# orders; 2198 -> 2201 the same day, #1467's 'Nur Aina bt Rosli'
# reporting suffix-or-name under three orders.
assert claims == 2201, (
f"the field sweep checks {claims} claims, recorded as 2201 on "
f"2026-11-19")


Expand Down Expand Up @@ -985,8 +986,10 @@ def test_the_alternative_sweep_sees_the_fields_it_checks() -> None:
# #1468's 'Kwame Mensah Anak' under FAMILY_FIRST, a `name` stand-in;
# the 'Anak Agung Made Putra' reports name a patronymic alternative,
# which has no stand-in; 604 -> 605 the same day, its review's
# FAMILY_FIRST row of that name
assert (checked, skipped) == (605, 494), (checked, skipped)
# FAMILY_FIRST row of that name; 494 -> 497 the same day, #1467's
# 'Nur Aina bt Rosli' under the three orders, its suffix-or-name
# reports all skipped
assert (checked, skipped) == (605, 497), (checked, skipped)


def test_every_case_name_is_unique() -> None:
Expand Down