diff --git a/docs/design/decisions/T8-word-glued-to-the-next-at-its-full-stop.md b/docs/design/decisions/T8-word-glued-to-the-next-at-its-full-stop.md index a1b8f6d3b..6e4664c01 100644 --- a/docs/design/decisions/T8-word-glued-to-the-next-at-its-full-stop.md +++ b/docs/design/decisions/T8-word-glued-to-the-next-at-its-full-stop.md @@ -12,7 +12,7 @@ Elsewhere: which words divide at all, and what a divided word reads as, decisions/period-joined-words' 2026-11-09 #1255 entries; a run of single letters, which stays one word, decisions/T7. Open: [#1306](https://github.com/derek73/python-nameparser/issues/1306), which field a Mongolian glued initial takes under the default order or a Mongolian choice (moved from #1235, which this division closed): the pack question the spaced `Ц. Сандаг-Очир` already raises. -Open: a chunk, or a name after the stop, that writes a vowel sign other than Thai's or a mark of the Arabic script's (counted since #1149, in the gate as on both sides of the stop: `أ.محمد` and `أ.د.أحمد` divide in NFD as in NFC; a zero-width joiner or non-joiner between two letters of the name is counted too, one right after the stop is not), a name of plain letters dividing in any script (`ড.করম খান`) (`डा.राम शर्मा` keeps title 'डा.राम', where `डा. राम शर्मा` reads title 'डा.', given 'राम'; `ড.রহিম` keeps title 'ড.রহিম', the listed `ড` found but রহিম's U+09BF not, #1166): the shape's letter class counts no such mark (decisions/nfd-shapes), and #1166 added Thai's on the name side alone, so no division is found there, moved here from decisions/period-joined-words' Open line. The local corpora hold almost no such title (nepal-candidates' glued Devanagari words are runs of initials, `के.सी.`, which stay whole anyway, and `मो.`, #1178's), so no issue is filed. +Open: a chunk, or a name after the stop, that writes a vowel sign other than Thai's or a mark of the Arabic script's (counted since #1149, in the gate as on both sides of the stop: `أ.محمد` and `أ.د.أحمد` divide in NFD as in NFC; a zero-width joiner or non-joiner between two letters of the name is counted too, one right after the stop is not), a name of plain letters dividing in any script (`ড.করম খান`) (`डा.राम शर्मा` keeps title 'डा.राम', where `डा. राम शर्मा` reads title 'डा.', given 'राम'; `ড.রহিম` keeps title 'ড.রহিম', the listed `ড` found but রহিম's U+09BF not, #1166): the shape's letter class counts no such mark (decisions/nfd-shapes), and #1166 added Thai's on the name side alone, so no division is found there, moved here from decisions/period-joined-words' Open line. The local corpora hold almost no such title (nepal-candidates' glued Devanagari words are runs of initials, `के.सी.`, which stay whole anyway, and `मो.`, which, with the Latin `Mo.` (10 words glued to the next in the local corpora, #1178's third comment), no issue holds once #1178 closes, answered for `Ab` and `Md`), so no issue is filed. Open: a word glued at a full stop other than the ASCII one, in Latin names, as the ideographic stop in `Wenzhao Zhong, Ph。D` (one name in the local corpora, 2026-11-10). The fullwidth stop between Han names was #1312, which rules/T3 reads as the transcription dot. Open: [#1311](https://github.com/derek73/python-nameparser/issues/1311), a glued word after a family comma, the given part the comma names (`ARTHUR, L.MICHAEL`, 111 in fec-individuals), which the division would reach only once the comma's decision is asked first. Open: [#1313](https://github.com/derek73/python-nameparser/issues/1313), a particle glued to its surname at its full stop (`Alaa A. El.Baz` reads suffix 'El.Baz'), which the division does not read as a chunk. diff --git a/docs/design/decisions/indic-honorifics.md b/docs/design/decisions/indic-honorifics.md index 4b86b8886..3b6817571 100644 --- a/docs/design/decisions/indic-honorifics.md +++ b/docs/design/decisions/indic-honorifics.md @@ -65,7 +65,7 @@ Open: #514 (whether the Tibetan prefix titles Tulku, Khenpo, Geshe, Kyabje and J - Implementation choice, recorded with this PR, the comma (#1393, fixed in the same change): rules/C13 gains an Except, `Md` opening the given part after a family comma being the given name where its writing says so (`Uddin, Md Karim`, `Rahman, Md.`, `RAHMAN, MD ABDUL` → given 'Md'), and the postnominal part elsewhere (`Smith, MD PhD`, `Smith, Md PhD`, `Smith, Md XYZ`, `Uddin, Mr Md`, `Dr. Rahman, Md`); its conditions, as narrowed by the change's second review, are rules/C13's and decisions/C13's to state, not restated here. - 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). + - 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; `Ab` answered 2026-11-21, decisions/vocabulary-collisions' #1178 entry, the Bengali `মোঃ` unchanged). - 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 --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. diff --git a/docs/design/decisions/name-matching.md b/docs/design/decisions/name-matching.md index 7c7e7aee5..943ea3e11 100644 --- a/docs/design/decisions/name-matching.md +++ b/docs/design/decisions/name-matching.md @@ -85,7 +85,7 @@ Elsewhere: `matches()` and `comparison_key()` stay exact, one casefolded compone - Accepted: not transitive across two long spellings. `Mohammad Rahman` and `Muhammad Rahman` are each consistent with `Md Rahman` and not with each other by default, the long pair being an opt-in `alternate-spelling`, the shape of `J. Smith` against `John Smith` and `Jane Smith` (`test_muhammad_written_short_is_not_transitive_across_long_spellings`). A long spelling a short form does not list reads as before against the others' links: `Md Rahman` / `Mohamad Rahman` moves from `conflict` (master 3dadc263, `md` holding no given reading) to `alternate-spelling`, refused by default, `md` listing no `mohamad`; `Mohd` and `Moh` against `Muhammed Rahman` stay `conflict`, `muhammed` being in neither list, and `Md` against it reads `listed-spelling` since `md` lists it (decided 2026-11-14, vocabulary-model's 2026-11-14 #1383 `md` ALSO LISTS entry; the entries give the counts). Every other short-and-long pair of the three short forms and the six spellings reads `listed-spelling`, consistent by default: `Md` with `muhammad`, `mohammad`, `mohammed`, `mohamed` (each a `conflict` on master), and `Mohd` and `Moh` with all five they list (`muhammad` already `listed-spelling` on master, `mohamad` a `conflict` and the other three `alternate-spelling`). - Measured, 2026-11-13, `uv run python tools/differential/match_diff.py --base ` from this branch: 31,267 pairs under 22 settings; the key guarantee holds; 2,310 of 687,874 rows move, 105 under each setting, every one a pair holding `Md.`, `Md`, `Mohd` or `Moh`: the parse's move (`Md. Rahman` reads given `Md.` where master read title `Md.`) moves its keys (`rahman;` to `rahman;m`, 1,826 rows, no other name's keys moving), its title row (`noted` to `same`, 1,804) and its given row against a name with another given name (`given-one-side` to `conflict`, 1,694, inconsistent before and after); the new links read `listed-spelling` where master read `conflict` (286), `alternate-spelling` (176) or `given-one-side` (110), and 458 verdicts go from not consistent to consistent, none the other way. - Measured, 2026-11-14, after the second review's changes (#1393's comma narrowed and reporting, decisions/C13; `md`'s credential in `mul.toml`; `md` listing `muhammed`): `uv run python tools/differential/match_diff.py --base ` from this branch, `NAMEPARSER_TOOLS_CACHE` a folder of its own holding the jrc-names and tse-donors corpora: 31,376 pairs under 22 settings; the key guarantee holds; 10,074 of 690,272 rows move, 458 under each setting but `-listed-spelling` and `-one-side` (457), every one a pair holding `Md.`, `Md`, `Mohd` or `Moh`. 783 verdicts go from not consistent to consistent and 45 the other way, each read: 33 are the Accepted pairs below (`Md. Rahman` / `RAHMAN, MD` 16, a `Mohammed.` title 17); 4 under the lenient settings, where `Md` is now a given name on both sides and conflicts with another given name (`J. R.` / `Dr. Md. Rahman`, `Smith J. R. R.` / `Rahman, Md Abdul`), consistent on aad9ca8e because neither `Md` read as one; and 8 need an outcome the caller refused (`-folded`: `Md.` against `Md`; `-one-side`: the middle name `Abdul` on one side). - - #1393 (fixed with this change, decisions/C13 and decisions/indic-honorifics' 2026-11-14 #1383 entry): the name written both ways is consistent (`Md. Rahman` / `Rahman, Md`, `Dr. Md. Rahman` / `Rahman, Md`, `Md Abdul Rahman` / `RAHMAN, MD ABDUL`; `test_md_opening_the_part_after_a_family_comma_matches_its_own_name`). Accepted (`test_md_left_to_the_credential_or_a_title_shape_is_accepted`): `Md. Rahman` / `RAHMAN, MD`, capitals alone after the comma staying the degree, and `Md. Rahman` / `Mohammed. Rahman`, a full spelling written with a full stop being a title by rules/H2's shape (#1178 asks the wider question of a name's head). #1394 leaves `SITI AMINAH MD.NOOR`'s glued `MD.` in the suffix, so its match is not settled here. + - #1393 (fixed with this change, decisions/C13 and decisions/indic-honorifics' 2026-11-14 #1383 entry): the name written both ways is consistent (`Md. Rahman` / `Rahman, Md`, `Dr. Md. Rahman` / `Rahman, Md`, `Md Abdul Rahman` / `RAHMAN, MD ABDUL`; `test_md_opening_the_part_after_a_family_comma_matches_its_own_name`). Accepted (`test_md_left_to_the_credential_or_a_title_shape_is_accepted`): `Md. Rahman` / `RAHMAN, MD`, capitals alone after the comma staying the degree, and `Md. Rahman` / `Mohammed. Rahman`, a full spelling written with a full stop being a title by rules/H2's shape (#1178 asked the wider question of a name's head, answered for `Ab` on 2026-11-21 in decisions/vocabulary-collisions). #1394 leaves `SITI AMINAH MD.NOOR`'s glued `MD.` in the suffix, so its match is not settled here. - Merged with #1351 (2026-11-14): `MD` in capitals is both Muhammad written short and a capitals word, and #1351's rule is asked only where a pair is not otherwise consistent, so `MD Rahman` / `Mohammad Dewan Rahman` reads `listed-spelling` and `one-side` rather than #1351's `initial` row, and `MD Rahman` / `Mary Dawn Rahman` reads `initial`; the two readings meet in no third name, the shape of the triples #1351 accepts (`test_md_in_capitals_reads_as_its_long_spellings_or_as_two_initials`). `_CAPITALS`' negative control moves from 16 rows to 15. - **2026-11-13 #1351 A GIVEN NAME OF CAPITALS READS AS THE INITIALS THE OTHER SIDE'S NAMES SPELL EXACTLY.** `JP Smith` matched `J. P. Smith`, which matched `John Paul Smith`, while `JP Smith` / `John Paul Smith` conflicted (given `JP` / `John`), the parse reading `JP` as one given word. diff --git a/docs/design/decisions/period-joined-words.md b/docs/design/decisions/period-joined-words.md index 9b5b561e1..666863037 100644 --- a/docs/design/decisions/period-joined-words.md +++ b/docs/design/decisions/period-joined-words.md @@ -12,11 +12,11 @@ Elsewhere: a run of single letters spelling a title at the front of a name, deci Elsewhere: the division itself and the name test that left it open, answered by position (a chunk read alone and a name before any comma divide, nothing after a comma does), with the one-case, caseless-script and unlisted-credential writings the Open lines here named, decisions/T8's 2026-11-10 #1230/#1235 entry. Elsewhere: a given name written as a run of single letters, parted into its initials once roles are final (`E.T. Smith` → given 'E.', middle 'T.'), decisions/T7's 2026-11-10 #1296 entry. Elsewhere: a title listed with its stops, read whole before any division too (`Univ.Prof`, `Dott.ssa`, and the degrees written with their field's initial, `Dr.C.`, `Mgr.A.`), decisions/T8's 2026-11-10 #1305 entry. -Open: [#1178](https://github.com/derek73/python-nameparser/issues/1178), a given name written short and glued to the next given name (`Gio.Batta`, `Alex.John`; in the local corpora `Gio.Batta` occurs not at all and `Md.Delowar` 278 times, with Devanagari `मो.` 46, which #1178 asks to list as written short so rules/T8 divides it; `Md.Karim Uddin` (a made-up name) divides since 2026-11-14, `md` being a given name written short by #1383, and `मो.` does not). An unlisted stub is not divided, because its spaced twin reads it as a title by rules/H2 (`Gio. Batta Rossi` → title 'Gio.'). The Italian contraction `Fr.co` keeps its title reading through its listed first chunk. Open: [#1306](https://github.com/derek73/python-nameparser/issues/1306), which field a Mongolian glued initial takes under the default order. This is a pack question, the same one the spaced `Ц. Сандаг-Очир` already raises; it moved from #1235, closed by decisions/T8's division. ## Log +- 2026-11-21 #1178 — `Ab.` IS LISTED AS WRITTEN SHORT, SO A GLUED `Ab.Ghani` DIVIDES; THE OPEN LINE FOR #1178 IS RETIRED. The Open line read: a given name written short and glued to the next given name (`Gio.Batta`, `Alex.John`), `Md.Delowar` 278 times in the local corpora and Devanagari `मो.` 46, which #1178 asked to list as written short so rules/T8 divides it. `md` was listed so by #1383 (2026-11-14), and `ab` by #1178 (ms.toml's Abdul written short, decisions/vocabulary-collisions' entry of this date), so `Ab.Ghani Harun` reads given 'Ab.', middle 'Ghani', as `Ab. Ghani Harun` does. What the line also named stays as it was, with no issue: an unlisted stub is not divided, its spaced twin reading it as a title by rules/H2 (`Gio. Batta Rossi` → title 'Gio.'; `Gio.Batta` occurs in no local corpus), and `मो.` and the Latin `Mo.` are listed as no given name (decisions/T8's Open line). - 2026-11-10 (Derek), #1230, #1235 — THE DIVISION SHIPPED, THE NAME TEST ANSWERED BY POSITION: decisions/T8 holds the test, its measures and what it leaves whole. The second Standing line is amended to point there, and four Open lines move: the name test, the one-case and caseless writings and the unlisted credentials are answered there, #1230's `Dr.J.` and `Gen.Ademola` divide as listed title chunks, and the caseless script's question moves to decisions/T8's Open line. - 2026-11-09 #1136 — A TRANSLITERATION DIGRAPH IS A CHUNK READ ON ITS OWN, THE ONES rules/H2 NAMES AND ONLY THOSE. This file's Open line for #1136 asked whether a digraph is an initial, a yes adding it to the chunks read on its own. decisions/H2's entry of this date answered it for the spaced word: the digraphs that are no title in any corpus read (`Yu`, `Ya`, `Ye`, `Yo`, `Zh`, `Kh`, `Shch`, `Dzh`) are no title by shape, while `Ts`, `Ch` and `Sh`, each also a title written short, still are. The glued word follows its spaced twin, as this file's 2026-11-09 #1255 entry decides every divided word does, so the division takes the same set: `Yu.A.Chibrikova` is to read as `Yu. A. Chibrikova`. The Open line's own example, `Ts.Sandag-Ochir`, is no such word, since `Ts. Sandag-Ochir` reads title 'Ts.': it does not divide, and what it should read is left to the Open lines for #1230 and #1235. diff --git a/docs/design/decisions/vocabulary-collisions.md b/docs/design/decisions/vocabulary-collisions.md index 23dc86543..4c17a19af 100644 --- a/docs/design/decisions/vocabulary-collisions.md +++ b/docs/design/decisions/vocabulary-collisions.md @@ -33,9 +33,15 @@ Elsewhere: C-i reaches the titles through a `given` reading, which makes a title - `u` and `daw` (my.toml) are Burmese salutations written `default = false`, which `locales.MY`, a pack choosing `my` and nothing else, turns on; a list of nothing but Burmese names is read with the strict choice, `parser_for(locales.MY, strict=True)`, which reads Burmese name syllables (`san`, `van`, `pe`, `ei`) as name words by reading no other language's file, and my.toml copies `en.toml`'s readings of the English ranks and `sir` such lists write, `default = false`, so the strict choice keeps them — 2026-11-19 #1483; `ko`, `ma`, `maung` and the ethnic prefixes stay name words, and the military and religious styles stay out; `U.` written with its full stop is read as the title vocabulary reads `U` under the pack, so an initial can be the title (`U. S. Grant` → title 'U.', `Smith, U.` → title 'U.', no given name), which no rule vetoes — 2026-11-19 #1231. - German `aus` is a particle by default with a `given` reading beside it, keeping `Aus` positional where it opens a name; the accepted cost is that anywhere after the head it starts the family (`Kevin Aus Smith`, `Rahman, Mohammed Aus`, and under FAMILY_FIRST `Rahman Mohammed Aus`), that case repair writes it lower case, and that a capital `Aus` opening a family-first name is placed like `Van` — 2026-11-20 #1284. - `ra` carries a `family` and a `given` reading in ko.toml, the Korean surname and given name, so en.toml's credential and de.toml's credential are gated (rules/S4) and de.toml's academic title is a title only inside a title phrase (rules/H9): `Kim Ra` and `Sang Hak Ra` keep `Ra` a name word, `Ra Mi Kim` and `RA Müller` read it as the given name, and `John Smith, RA`, `Jane Doe, PT, RA` and `Jane Doe, R.A.` keep the credential; de.toml's own credential keeps it after the name under a plain German choice, which turns en.toml's off — 2026-11-21 #1483. +- `ab` carries a `given` reading in ms.toml, Abdul written short (`same_as = "abdul"`), and one in nl.toml, the Dutch given name of its own, so it is a given name written short that rules/H2's shape yields to and a name whose link to Abdul the name match follows only where it is written with its full stop (`SAME_AS_NAMED`); en.toml's military reading, Airman Basic, is written `default = false`, read only under a choice of English and ungated only under a strict one: `Ab Faizal Mohd Qirwan`, `Ab. Ghani Harun`, `Ab Jansen`, `Jansen, Ab` and `AB Jansen` read it as the given name, by default and under a plain English choice, and a strict English choice reads `AB John Smith` as the rank — 2026-11-21 #1178. ## Log +- 2026-11-21 #1178 — `AB` IS ABDUL WRITTEN SHORT AND A DUTCH GIVEN NAME BY DEFAULT, AND AIRMAN BASIC IS READ ONLY UNDER A CHOICE OF ENGLISH. Decided 2026-11-21. `ab` was en.toml's military title (Airman Basic, a US Air Force rank) with no name reading, so it was the title opening every name and the part after every family comma (`Ab Faizal Mohd Qirwan`, `Ab Jansen`, `Jansen, Ab`, `AB Jansen` → title), and rules/H2's shape made the written-short `Ab.` a title too. It is borne in that position as Abdul written short in Malaysia (and in Kashmiri names) and as a Dutch given name of its own, short for Abraham or Albert. #1383 had settled the same question for `Md.` (decisions/indic-honorifics' 2026-11-14 entry), so this entry answers the half of #1178 left. + - **The readings.** ms.toml gives `ab` a `given` reading with `same_as = "abdul"`, a given name written short, which rules/H2's shape yields to (`Ab. Ghani Harun` → given 'Ab.') and rules/T8 divides glued (`Ab.Ghani Harun` → given 'Ab.', middle 'Ghani'); nl.toml gives it a plain `given` reading, the Dutch name, which also reads initials written without stops as older Tweede Kamer records do (`AB Jansen` → given 'AB'). A word with both is in `SAME_AS_NAMED`, so the name match follows its link to Abdul only where it is written with its full stop (`Ab. Rahman` / `Abdul Rahman` consistent, `Ab Rahman` / `Abdul Rahman` a conflict), as for `jo`. mul.toml was declined: every strict choice reads it, `en` among them, and a name reading there would gate the rank under a strict English choice. The bearer counts are on the entries (`tools/name_usage.py ab --boxes`, with `--country MY` and `--country NL`, 2026-11-21): ORCID's given box holds it 332 times (Malaysia 30, India 25, Indonesia 13), its family box 796 (Malaysia 323, the father's name after bin), PatentsView's boxes 14 and 13, Wikidata 81 given names (the Netherlands 48), US SSA 380 male births, nam_dict band 4 in the Netherlands alone. + - **Airman Basic.** en.toml's military reading is written `default = false`, so the default reads no title for `ab`. A plain English choice turns it on and the two given readings gate it (rules/H9), a plain choice never dropping a name reading, so outside a title phrase the fields read as the default's, the gated rank adding a `title-or-name` report where it opens a name (28 of the 413 names below differ under a plain English choice by that report alone); inside one rules/H9 reads it as the title (`Chief Ab Smith` → title 'Chief Ab', under every choice of English). A strict English choice reads neither ms.toml nor nl.toml and reads `AB John Smith` → title 'AB' and `John Smith, AB` → title 'AB', given 'John', family 'Smith', which is what the rank is kept for, a list of US military names; a strict choice of English that also chooses `ms` or `nl` reads their given reading and gates it as a plain one does. `ab` joins `en`'s row of tests/v2/test_reading_index.py's `STRICT_UNGATED`. A strict Malay choice keeps Abdul written short, its period too, and with no nl.toml read the name match follows the link written bare too (`Ab Rahman` / `Abdul Rahman` listed-spelling); a strict Dutch choice reads the name of its own and not the short form, so its `Ab.` is rules/H2's shape again (`Ab. Ghani Harun` → title 'Ab.'), T8 leaves `Ab.Ghani` whole, and the match follows no link to Abdul. The phrase `chief ab` (Chief Airman Basic) goes with the rank: `Chief Ab Smith` reads title 'Chief', given 'Ab' by default, title 'Chief Ab' under any choice of English. + - **Accepted costs.** (1) `AB`, `Ab` or `AB.` alone after a full name and a comma, the A.B. degree, is the given name Ab, the fields an unlisted pair of capitals gives, and the name reverses (`John Smith, AB` → given 'AB', family 'John Smith'; 2.2.0 through 3.1.0 read title 'AB', given 'John', family 'Smith', 1.4.0 title 'AB', first 'John Smith'): 4 ClinicalTrials.gov names. `AB.` reverses where an unlisted `XY.` stays a title, rules/H2's shape yielding to a given name written short. No credential reading is added; NPPES writes the degree 14 times of 4,824,544 credentialed providers. In a run of credentials it joins the suffix instead, which is a gain (`John Smith, MD, AB` → suffix 'MD, AB', as 1.4.0 through 2.3.0 read it; 2.4.0 through master read title 'AB'), and past a second comma it is the suffix (`Smith, John, AB`, as 1.4.0 read it). Ending a name with no comma it stays the family, as on master (`John Smith AB`). (2) `Ab` does not join the word after it as `Abdul` does (rules/P5): `Ab Faizal Mohd Qirwan` → given 'Ab', middle 'Faizal Mohd', where `Abdul Faizal Mohd Qirwan` reads given 'Abdul Faizal', so `Ab. Hamid Rahman` / `Abdul Hamid Rahman` is a conflict in the name match. A `bound_given` reading in ms.toml would join it (`Ab Hamid` → given 'Ab Hamid') and would join a Dutch `Ab` to a second given name or a middle name the same way (`Ab Pieter Jansen` → given 'Ab Pieter'); it was not decided. (3) A trailing `AB.`, which rules/H5 read as the title, is the family (`Aminah Siti AB.` → family 'AB.', as 1.4.0 read it): 1 name. (4) Under a strict Dutch choice the period-written `Ab.` is a title again, by shape, as above. (5) A word glued at its stops whose last chunk is `AB` is rules/S3's unlisted dotted suffix, no chunk being a title now (`Ali Budi Santoso.AB` → family 'Budi', suffix 'Santoso.AB'; 1.4.0 and master family 'Santoso.AB'): 1 name. (6) C4's count asks rules/H2's shape, which now yields to `Ab.`, as #789 made it yield to `Chas.`: `Ab. Smith, Ed` → given 'Ab.', family 'Smith', suffix 'Ed' (master title 'Ab.', given 'Ed'), and a title modifier before it, having no title after it, is a name word (`Vice Ab. Smith, Ed` → given 'Vice', middle 'Ab.'; master title 'Vice Ab.'). (7) Initials written without stops are read as the given name Ab, not as two initials, so `AB Jansen`'s `initials()` gives 'A. J.'. (8) No familiar pair links the Dutch `Ab` to Abraham or Albert, so `Ab Jansen` / `Abraham Jansen` is a conflict in the name match. The Bengali `মোঃ` and `মোছাঃ` (#1178's first comment) are unchanged. + - **Measured** on 2026-11-21 against master 6ff048fe, `config_diff.py diff default plain:en strict:en plain:MS strict:MS plain:NL strict:NL --committed --local all --match '(?i)(?>> as_31.parse("Sang Hak Ra").suffix 'Ra' + +Ab as a given name +^^^^^^^^^^^^^^^^^^ + +``Ab``, Abdul written short in Malay names and a Dutch given name, reads +as the given name where it opens a name, written bare, in capitals or +with its full stop, where 1.4.0 through 3.1.0 read it as the title AB +(Airman Basic). After a family comma it is the given name Ab too, so +``AB``, ``Ab`` or ``AB.`` alone after a full name and a comma reverses +the name, as an unlisted pair of capitals does: + +.. doctest:: + + >>> parse("Ab. Ghani Harun").given + 'Ab.' + >>> parse("Jansen, Ab").given + 'Ab' + >>> parse("John Smith, AB").family + 'John Smith' + +The rank is read alone only under a choice of English with +``strict=True`` that chooses neither ``ms`` nor ``nl``; any choice of +English reads it inside a title phrase (``Chief Ab Smith``). A strict choice without ``ms`` +reads ``Ab.`` opening a name as a title by its shape, as it reads any +unlisted abbreviation there. To read it as 3.1 did, remove its given +readings and add the rank: + +.. doctest:: + + >>> ab_31 = Parser(lexicon=Lexicon.default().remove("ab", kind="given") + ... .add("ab", kind="military")) + >>> ab_31.parse("Ab Jansen").title + 'Ab' diff --git a/docs/release_log.rst b/docs/release_log.rst index 646f78b37..45398110b 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -5,6 +5,7 @@ Release Log nameparser 3.2 is under development. - **Fix a title or suffix typed with a zero-width non-joiner or joiner at its edge, which read as a name word.** ``parse("Dr\u200c John Smith")`` gives title ``Dr\u200c``, given ``John``, where 1.4.0 through 3.1.0 gave given ``Dr\u200c``, middle ``John``; the Persian ``مهندس`` typed with a ZWNJ after it is the title the same way, and the name match reads a name typed with one as ``folded``. The field keeps the character, and one inside a word is still part of its spelling. A ``Lexicon`` pickled with a word added with one at its edge is refused on load. :issue:`1335` + - **Read Ab opening a name as the given name, Abdul written short or the Dutch name, not the title Airman Basic.** ``parse("Ab. Ghani Harun")`` gives given ``Ab.``, middle ``Ghani``, where 1.4.0 through 3.1.0 gave title ``Ab.``, given ``Ghani``; ``Ab``, ``AB`` or ``AB.`` alone after a full name and a comma is now the given name, which reverses the name (``John Smith, AB`` gives given ``AB``, family ``John Smith``, where 1.4.0 through 3.1.0 gave title ``AB``). The rank is read alone only under a choice of English with ``strict=True``, choosing neither ``ms`` nor ``nl``; any choice of English reads it inside a title phrase (``Chief Ab Smith``). :issue:`1178` - **Read Ra as a Korean family name and given name, not only as a credential and a title.** ``parse("Sang Hak Ra")`` gives middle ``Hak``, family ``Ra``, where 1.4.0 through 3.1.0 gave family ``Hak``, suffix ``Ra``; ``RA`` ending a name after a comma in a name of mixed case, or written ``R.A.``, is still the credential, while ``Ra`` alone after a family comma (``Kim, Ra``), ``RA`` opening the part after a family comma in a name written wholly in capitals (``KING, RA``), ``RA`` in the given part after a family comma ahead of a name word (``Smith, RA John``) and ``RA`` opening a German name (Rechtsanwalt) are now the given name. :issue:`1483` - **Keep Cheikh and Sultan as given names under a strict Arabic or Malay choice.** With ``languages=frozenset({"ar"})`` chosen and ``strict=True``, ``Cheikh Kaddari`` gives given ``Cheikh``, family ``Kaddari``, where 3.0.0 through 3.1.0 gave title ``Cheikh``, given ``Kaddari``; ``Sultan Zulkarnain`` under a strict ``ms`` choice reads given ``Sultan`` the same way. The default and every plain choice read both as before. :issue:`1463` - **Read the Cyrillic doctorate д-р ending a name as a credential, and the Bulgarian д.м. under a Bulgarian choice.** ``parse("Іван Петренко д-р")`` gives family ``Петренко``, suffix ``д-р``, where 1.4.0 through 3.1.0 gave middle ``Петренко``, family ``д-р``; in front of the name ``д-р`` stays the title, and after a comma it is the suffix too (``Іван Петренко, д-р``). With Bulgarian chosen (``languages=frozenset({"bg"})``), ``доц. д-р Мария Петрова, д.м.`` gives title ``доц. д-р``, family ``Петрова``, suffix ``д.м.``; by default it gives given ``д.м.``, family ``доц. Мария Петрова``, suffix ``д-р``, where 1.4.0 through 3.1.0 kept ``д-р`` in the family. :issue:`1128` diff --git a/nameparser/config/_compiled.py b/nameparser/config/_compiled.py index 774c1a5d5..e85c13f32 100644 --- a/nameparser/config/_compiled.py +++ b/nameparser/config/_compiled.py @@ -325,7 +325,6 @@ '8th', '9th', 'a1c', - 'ab', 'abbess', 'abbot', 'abolitionist', @@ -1851,7 +1850,6 @@ 'chief 2lt', 'chief 2ndlt', 'chief a1c', - 'chief ab', 'chief adjutant', 'chief adm', 'chief administrator', @@ -2626,6 +2624,7 @@ }) GIVEN_NAME_ABBREVIATIONS: frozenset[str] = frozenset({ + 'ab', 'ach', 'benj', 'chas', @@ -4844,6 +4843,7 @@ '’t': ("'t",), }, 'given': { + 'ab': ('abdul',), 'abdal': ('abdul',), 'abdel': ('abdul',), 'abou': ('abu',), @@ -5168,6 +5168,7 @@ 'family': frozenset({ }), 'given': frozenset({ + 'ab', 'jas', 'jo', 'ma', diff --git a/nameparser/config/_index.py b/nameparser/config/_index.py index affd56782..23f9fb7c4 100644 --- a/nameparser/config/_index.py +++ b/nameparser/config/_index.py @@ -41,7 +41,7 @@ ('a1c', (('en', 'military', ()),)), ('aan', (('nl', 'preposition', ()), ('nl', 'given', ()))), ('aas', (('en', 'credential', ()),)), - ('ab', (('en', 'military', ()),)), + ('ab', (('en', 'military', (('default', False),)), ('ms', 'given', (('same_as', 'abdul'),)), ('nl', 'given', ()))), ('aba', (('en', 'credential', ()), ('en', 'given', ()), ('en', 'family', ()))), ('abbess', (('en', 'religious', ()),)), ('abbey', (('en', 'familiar', (('short_for', ('abigail',)),)),)), diff --git a/nameparser/vocab/en.toml b/nameparser/vocab/en.toml index 397ea67c3..6aff45c2c 100644 --- a/nameparser/vocab/en.toml +++ b/nameparser/vocab/en.toml @@ -483,7 +483,7 @@ military = { expands = "Airman First Class" } [[word]] text = "ab" -military = { expands = "Airman Basic" } +military = { default = false, issue = 1178, decided = 2026-11-21, expands = "Airman Basic", note = "off by default, read only under a choice of English: Ab is Abdul written short in Malay (ms.toml) and a Dutch given name (nl.toml), whose name readings gate it under a plain choice of English, so only a strict choice of English that chooses neither ms nor nl reads it alone as the rank, before a name or after a comma; any choice of English reads it inside a title phrase, Chief Ab Smith (#1178). ORCID's given box holds it 332 times (Malaysia 30, India 25, Indonesia 13), PatentsView's 14, Wikidata 81 given names (the Netherlands 48); NPPES writes the A.B. degree 14 times, after the name (tools/name_usage.py ab --boxes, 2026-11-21)" } [[word]] text = "adjutant" diff --git a/nameparser/vocab/ms.toml b/nameparser/vocab/ms.toml index e3193c9f6..75f3eb04c 100644 --- a/nameparser/vocab/ms.toml +++ b/nameparser/vocab/ms.toml @@ -140,3 +140,7 @@ text = "bte" [word.excluded.patronymic] reason = "the abbreviation of binte, not reviewed" issue = 604 + +[[word]] +text = "ab" +given = { wikidata = 1, as_of = 2026-11-21, same_as = "abdul", note = "decided 2026-11-21 (#1178): Abdul written short (Ab Hamid, Ab. Ghani), at the head of a name and in a father's name after bin; ORCID's given box 30 and family box 323 of 62,996 Malaysian holders (the family box holding the father's name, bin Ab Rahman), PatentsView's Malaysian inventors 3 and 4, against Abdul's 482 and 1,544 in ORCID; my-candidates writes it 12 times (tools/name_usage.py ab --boxes --country MY, 2026-11-21). Until #1178 en.toml's Airman Basic read it as a title opening a name or the part after a comma, and, written with its full stop (AB.), as the title ending one" } diff --git a/nameparser/vocab/nl.toml b/nameparser/vocab/nl.toml index 3bdf3fec0..d38327bbc 100644 --- a/nameparser/vocab/nl.toml +++ b/nameparser/vocab/nl.toml @@ -185,6 +185,10 @@ article = { may_be_given = false, issue = 18, expands = "the" } text = "geboren" birth_marker = { issue = 274 } +[[word]] +text = "ab" +given = { us_ssa = 380, wikidata = 48, as_of = 2026-11-21, note = "decided 2026-11-21 (#1178): a Dutch given name in its own right, short for Abraham or Albert, not Abdul: nam_dict band 4 in the Netherlands, its only country; Wikidata's given names with Dutch citizenship 48 of 81; US SSA male births; ORCID's given box 3 of 85,119 Dutch holders (tools/name_usage.py ab --boxes --country NL, 2026-11-21). Older Tweede Kamer records write a member's initials undotted (AB Jansen), which this reading reads as the given name too, its initials() giving A. alone" } + # -- BEGIN generated by tools/vocab/familiar.py; edit the tool, not this block -- [[word]] diff --git a/tests/v2/cases.py b/tests/v2/cases.py index 936d3fab1..bcc928dd0 100644 --- a/tests/v2/cases.py +++ b/tests/v2/cases.py @@ -1743,6 +1743,201 @@ def _check_cjk_shape_purity(self) -> None: notes="the suffix reading had taken the marker's name, leaving " "'née' the family; 1.4.0 through 3.1.0 read middle 'Doe', " "family 'née', suffix 'Ra'"), + # #1178: `ab` is Abdul written short (ms.toml) and a Dutch given name + # (nl.toml), and en.toml's Airman Basic is read only under a choice of + # English, so `Ab` opening a name is the given name (rules/H2's given + # name written short, rules/H9). Each row's notes checked against the + # 1.4.0 and 3.1.0 wheels, and the 2.x ones where a note names them, on + # 2026-11-21 (master 6ff048fe reads as 3.1.0 here); the feat rows fail + # on master + Case("ab_opening_a_malay_name_is_the_given_name", + "Ab Faizal Mohd Qirwan", + {"given": "Ab", "middle": "Faizal Mohd", "family": "Qirwan"}, + classification="feat(#1178)", + notes="Abdul written short; not joined to the next word as " + "Abdul is (rules/P5), its reading being a given one, not a " + "bound_given one; 1.4.0 and 3.1.0 read title 'Ab', given " + "'Faizal'"), + Case("ab_written_short_with_its_period_is_the_given_name", + "Ab. Ghani Harun", + {"given": "Ab.", "middle": "Ghani", "family": "Harun"}, + classification="feat(#1178)", + notes="a given name written short outranks rules/H2's shape; " + "1.4.0 through 3.1.0 read title 'Ab.'"), + Case("ab_glued_at_its_period_divides_there", + "Ab.Ghani Harun", + {"given": "Ab.", "middle": "Ghani", "family": "Harun"}, + classification="feat(#1178)", + notes="rules/T8 divides a listed given name written short; 1.4.0 " + "read title 'Ab.Ghani', 3.1.0 title 'Ab.', given 'Ghani'"), + Case("ab_behind_a_malay_salutation_is_the_given_name", + "Encik Ab. Ghani Harun", + {"title": "Encik", "given": "Ab.", "middle": "Ghani", + "family": "Harun"}, + classification="feat(#1178)", + notes="1.4.0 read given 'Encik', middle 'Ab. Ghani'; 3.1.0 title " + "'Encik Ab.', given 'Ghani'"), + Case("a_dutch_ab_is_the_given_name", + "Ab Jansen", + {"given": "Ab", "family": "Jansen"}, + classification="feat(#1178)", + notes="1.4.0 through 3.1.0 read title 'Ab', no given name"), + Case("a_dutch_ab_before_a_particle_is_the_given_name", + "Ab van Qelder", + {"given": "Ab", "family": "van Qelder"}, + classification="feat(#1178)", + notes="1.4.0 read title 'Ab', family 'van Qelder'; 3.1.0 title " + "'Ab', given 'van', family 'Qelder'"), + Case("ab_after_a_family_comma_is_the_given_name", + "Jansen, Ab", + {"given": "Ab", "family": "Jansen"}, + classification="feat(#1178)", + notes="1.4.0 read title 'Ab', given 'Jansen'; 3.1.0 title 'Ab'"), + Case("ab_behind_a_salutation_is_the_given_name", + "Mr Ab Jansen", + {"title": "Mr", "given": "Ab", "family": "Jansen"}, + classification="feat(#1178)", + notes="1.4.0 through 3.1.0 read title 'Mr Ab'"), + Case("undotted_capital_initials_ab_are_the_given_name", + "AB Jansen", + {"given": "AB", "family": "Jansen"}, + classification="feat(#1178)", + notes="initials written without stops, as older Tweede Kamer " + "records write them; 1.4.0 through 3.1.0 read title 'AB'"), + Case("undotted_initials_ab_after_a_family_comma_are_the_given_name", + "Jansen, AB", + {"given": "AB", "family": "Jansen"}, + classification="feat(#1178)", + notes="1.4.0 read title 'AB', given 'Jansen'; 3.1.0 title 'AB'"), + Case("ab_in_lower_case_is_the_given_name", + "ab jansen", + {"given": "ab", "family": "jansen"}, + classification="feat(#1178)", + notes="1.4.0 through 3.1.0 read title 'ab'"), + Case("ab_opening_the_family_before_a_comma_joins_the_family", + "Ab Rahman, Siti", + {"given": "Siti", "family": "Ab Rahman"}, + notes="no title reading for rules/H6 to peel; 1.4.0 read the same " + "fields, 3.1.0 title 'Ab', family 'Rahman'"), + Case("ab_inside_a_name_stays_a_name_word", + "Siti Ab Rahman", + {"given": "Siti", "middle": "Ab", "family": "Rahman"}, + notes="boundary: the title claim acted only at the head, so " + "nothing moved here"), + Case("ab_ending_a_name_stays_the_family", + "John Smith AB", + {"given": "John", "middle": "Smith", "family": "AB"}, + notes="boundary: no credential reading, the A.B. degree being " + "unlisted; unchanged"), + Case("ab_in_a_credential_run_joins_the_run", + "John Smith, MD, AB", + {"given": "John", "family": "Smith", "suffix": "MD, AB"}, + ambiguities=("comma-structure",), + notes="the A.B. degree as the run's last word, rules/C2 reading the " + "part after the second comma; 1.4.0 through 2.3.0 read the " + "same fields, 2.4.0 through 3.1.0 title 'AB', suffix 'MD'"), + Case("ab_alone_after_a_comma_reverses_the_name", + "John Smith, AB", + {"given": "AB", "family": "John Smith"}, + classification="feat(#1178)", + notes="Accepted (decisions/vocabulary-collisions, 2026-11-21 " + "#1178): the A.B. degree alone after a full name is the " + "given name Ab, the fields an unlisted pair of capitals " + "gives; 1.4.0 read title 'AB', given 'John Smith'; 2.0.0 " + "and 2.1.0 title 'AB', family 'John Smith'; 2.2.0 through " + "3.1.0 title 'AB', given 'John', family 'Smith'"), + Case("ab_written_short_alone_after_a_comma_reverses_the_name", + "John Smith, AB.", + {"given": "AB.", "family": "John Smith"}, + classification="feat(#1178)", + notes="Accepted with the row above: the shape no longer reads it " + "as a title, where an unlisted `XY.` still is one (rules/" + "H2); 1.4.0 read title 'AB.', given 'John Smith', 3.1.0 " + "title 'AB.', given 'John', family 'Smith'"), + Case("ab_in_capitals_after_three_commas_parts_is_the_suffix", + "Smith, John, AB", + {"given": "John", "family": "Smith", "suffix": "AB"}, + ambiguities=("comma-structure",), + notes="the part past the second comma holds no name word (rules/" + "C2); 1.4.0 read the same fields, 3.1.0 title 'AB'"), + Case("ab_written_short_counts_as_one_name_word_before_a_comma", + "Ab. Smith, Ed", + {"given": "Ab.", "family": "Smith", "suffix": "Ed"}, + classification="feat(#1178)", + ambiguities=("suffix-or-name",), + notes="C4's count asks rules/H2's shape, which yields to a given " + "name written short, as `Chas. Smith, Ed` reads (#789); " + "1.4.0 read title 'Ab.', given 'Smith', suffix 'Ed', 3.1.0 " + "title 'Ab.', given 'Ed', family 'Smith'"), + Case("a_title_modifier_before_ab_written_short_is_a_name_word", + "Vice Ab. Smith, Ed", + {"given": "Vice", "middle": "Ab.", "family": "Smith", + "suffix": "Ed"}, + classification="feat(#1178)", + ambiguities=("suffix-or-name",), + notes="Accepted: a modifier with no title after it is a name " + "word (rules/H9); 1.4.0 read title 'Vice Ab.', given " + "'Smith', 3.1.0 title 'Vice Ab.', given 'Ed', family " + "'Smith'"), + Case("ab_written_short_ending_the_given_part_is_a_middle_name", + "Smith, John Ab.", + {"given": "John", "middle": "Ab.", "family": "Smith"}, + notes="a given name, so no trailing title (rules/H5); 1.4.0 read " + "the same fields, 3.1.0 title 'Ab.'"), + Case("ab_written_short_ending_a_name_is_the_family", + "Aminah Siti AB.", + {"given": "Aminah", "middle": "Siti", "family": "AB."}, + notes="Accepted (decisions/vocabulary-collisions, 2026-11-21 " + "#1178): no trailing title (rules/H5); 1.4.0 read the same " + "fields, 3.1.0 title 'AB.', family 'Siti'"), + Case("ab_ending_a_word_glued_at_its_stops_is_read_by_shape", + "Ali Budi Santoso.AB", + {"given": "Ali", "family": "Budi", "suffix": "Santoso.AB"}, + classification="feat(#1178)", + ambiguities=("suffix-or-name",), + notes="Accepted (decisions/vocabulary-collisions, 2026-11-21 " + "#1178): with no title chunk the word is rules/S3's " + "unlisted dotted suffix; 1.4.0 and 3.1.0 read middle " + "'Budi', family 'Santoso.AB'"), + Case("ab_before_a_malay_patronymic_is_the_given_name", + "Ab bin Hassan", + {"given": "Ab", "family": "bin Hassan"}, + classification="feat(#1178)", + notes="1.4.0 read title 'Ab', family 'bin Hassan'; 3.1.0 title " + "'Ab', given 'bin', family 'Hassan'"), + Case("a_dutch_ab_before_a_second_given_name_keeps_it_apart", + "Ab Pieter Jansen", + {"given": "Ab", "middle": "Pieter", "family": "Jansen"}, + classification="feat(#1178)", + notes="boundary: no bound_given reading (decisions/vocabulary-" + "collisions, 2026-11-21 #1178); 1.4.0 and 3.1.0 read title " + "'Ab', given 'Pieter'"), + Case("ab_after_chief_is_the_given_name", + "Chief Ab Smith", + {"title": "Chief", "given": "Ab", "family": "Smith"}, + classification="feat(#1178)", + notes="the phrase `chief ab` (Chief Airman Basic) is read only " + "where Airman Basic is; 1.4.0 and 3.1.0 read title 'Chief " + "Ab', family 'Smith'"), + Case("ab_opening_a_family_first_name_is_the_family", + "Ab Jansen", + {"given": "Jansen", "family": "Ab"}, + policy=Policy(name_order=FAMILY_FIRST), + classification="feat(#1178)", + notes="placed by the order once no title takes it; 3.1.0 read " + "title 'Ab', family 'Jansen'"), + Case("ab_opening_a_family_first_given_last_name_is_the_family", + "Ab Faizal Mohd Qirwan", + {"given": "Qirwan", "middle": "Faizal Mohd", "family": "Ab"}, + policy=Policy(name_order=FAMILY_FIRST_GIVEN_LAST), + classification="feat(#1178)", + notes="placed by the order once no title takes it; 3.1.0 read " + "title 'Ab'"), + Case("ab_after_the_family_in_family_first_order_is_the_given_name", + "Qirwan Ab Faizal", + {"given": "Ab", "middle": "Faizal", "family": "Qirwan"}, + policy=Policy(name_order=FAMILY_FIRST), + notes="boundary: no title claim after the head; unchanged"), # #1231: the Burmese pack. Burmese names have no family name, so the # last word lands in family by position. Each row's notes checked # against the 1.4.0, 2.0.0, 2.4.0, 2.8.2 and 3.1.0 wheels on diff --git a/tests/v2/test_cases.py b/tests/v2/test_cases.py index 2953dc943..90e878ca4 100644 --- a/tests/v2/test_cases.py +++ b/tests/v2/test_cases.py @@ -533,9 +533,11 @@ def test_the_field_sweep_sees_the_claims_it_checks() -> None: # reporting rows; 2330 -> 2342 the same day, #1483's `ra` rows # reporting suffix-or-name; 2342 -> 2367 the same day, its review's # comma, order and spelling rows; 2367 -> 2373 the same day, its - # second review's 'SMITH, RA MD' and 'Smith, RA John'. - assert claims == 2373, ( - f"the field sweep checks {claims} claims, recorded as 2373 on " + # second review's 'SMITH, RA MD' and 'Smith, RA John'; 2373 -> 2382 + # the same day, #1178's review's `ab` rows reporting suffix-or-name + # ('Ab. Smith, Ed', 'Vice Ab. Smith, Ed', 'Ali Budi Santoso.AB'). + assert claims == 2382, ( + f"the field sweep checks {claims} claims, recorded as 2382 on " f"2026-11-21") @@ -1039,8 +1041,8 @@ def test_the_alternative_sweep_sees_the_fields_it_checks() -> None: # 'Smith, M.B. ChB' being a stand-in reread; 647 -> 669 the same # day, its test review's rows; 669 -> 672 the same day, #1483's # `ra` rows reporting suffix-or-name; 672 -> 675 the same day, its - # review's rows - assert (checked, skipped) == (675, 512), (checked, skipped) + # review's rows; 675 -> 684 the same day, #1178's review's `ab` rows + assert (checked, skipped) == (684, 512), (checked, skipped) def test_every_case_name_is_unique() -> None: diff --git a/tests/v2/test_local_agreement.py b/tests/v2/test_local_agreement.py index 43a53ec68..5fb286a15 100644 --- a/tests/v2/test_local_agreement.py +++ b/tests/v2/test_local_agreement.py @@ -566,8 +566,10 @@ def test_a_box_the_parse_cuts_after_its_full_stops_agrees(given: str) -> None: @pytest.mark.parametrize(("given", "family", "got"), [ - # The box's letters read as a title: no field holds them. - ("AB", "Lee", {"given+middle": ""}), + # The box's letters read as a title: no field holds them (`AB` + # stood here until #1178 made it a given name by default, Airman + # Basic read ungated only under a strict choice of English). + ("LT", "Lee", {"given+middle": ""}), # A word of the family box read into the given box's field. ("K.S", "Perera Silva", {"given+middle": "K. S Perera", "family": "Silva"}), # A title glued before the box's letters or name, peeled to a field diff --git a/tests/v2/test_match.py b/tests/v2/test_match.py index a4cf2af30..d9487f5dd 100644 --- a/tests/v2/test_match.py +++ b/tests/v2/test_match.py @@ -1659,8 +1659,10 @@ def _choice(languages: set[str], strict: bool) -> Parser: # measured 2026-11-08: the mark follows the chosen vocabulary @pytest.mark.parametrize("languages, strict, named, jo, jas", [ - (None, False, {"jas", "jo", "ma"}, False, False), - ({"fil"}, False, {"jas", "jo", "ma"}, False, False), + # `ab` joined the default's mark with #1178: ms.toml's Abdul written + # short beside nl.toml's Dutch name; a plain choice keeps both + (None, False, {"ab", "jas", "jo", "ma"}, False, False), + ({"fil"}, False, {"ab", "jas", "jo", "ma"}, False, False), ({"en", "fil"}, True, {"jo", "ma"}, False, True), ({"en", "pa"}, True, {"jas"}, False, False), # Filipino alone: Jo has no reading as a name of its own (ruling) @@ -4474,6 +4476,58 @@ def test_the_default_keys_hold_no_maiden_word(name: str) -> None: assert m.keys(name) == m.keys(without) +# -- Abdul written short (#1178) ---------------------------------------------- + +#: `ab` is Abdul written short in ms.toml and a Dutch name of its own in +#: nl.toml (SAME_AS_NAMED), so its link to Abdul is followed only where +#: it is written with its period, as `jo`'s to José is. +_ABDUL: tuple[tuple[str, str, Outcome], ...] = ( + ("Ab. Rahman", "Abdul Rahman", Outcome.LISTED_SPELLING), + ("Rahman, Ab.", "Abdul Rahman", Outcome.LISTED_SPELLING), + ("AB. RAHMAN", "ABDUL RAHMAN", Outcome.LISTED_SPELLING), + ("Ab.Rahman", "Abdul Rahman", Outcome.LISTED_SPELLING), + # written bare it is the Dutch name too, which is not Abdul + ("Ab Rahman", "Abdul Rahman", Outcome.CONFLICT), + # Accepted: no familiar pair links the Dutch name to Abraham or + # Albert, its long forms + ("Ab Jansen", "Abraham Jansen", Outcome.CONFLICT), + # Accepted: Abdul joins the word after it (rules/P5) and `ab` does + # not, so the given names compared are `Ab.` and `Abdul Hamid` + ("Ab. Hamid Rahman", "Abdul Hamid Rahman", Outcome.CONFLICT), +) + + +@pytest.mark.parametrize("a, b, outcome", _ABDUL) +def test_abdul_written_short_matches_abdul_with_its_period( + a: str, b: str, outcome: Outcome) -> None: + # Negative control (2026-11-21): on master 6ff048fe every row but the + # last reads `given-one-side`, `Ab` and `Ab.` read as a title (en.toml's + # Airman Basic, rules/H2's shape), and the last reads `conflict`; no + # row's two names share a key there + for x, y in ((a, b), (b, a)): + r = m.check(x, y) + assert r["given"].outcome is outcome, (x, y) + assert r.consistent is (outcome in m.accept), (x, y) + assert m.keys(x) & m.keys(y), (x, y) + + +@pytest.mark.parametrize("tags, bare, dotted", [ + # a strict Malay choice reads no nl.toml, so `ab` is Abdul written + # short alone and its link is followed written bare too + (("ms",), Outcome.LISTED_SPELLING, Outcome.LISTED_SPELLING), + # a strict Dutch choice reads no ms.toml: no link, and `Ab.` is a + # title by rules/H2's shape + (("nl",), Outcome.CONFLICT, Outcome.GIVEN_ONE_SIDE), +]) +def test_abdul_written_short_under_a_strict_choice( + tags: tuple[str, ...], bare: Outcome, dotted: Outcome) -> None: + parser = _choice(set(tags), True) + assert "ab" not in parser.lexicon._same_as_named["given"] + matching = parser.matching() + for a, outcome in (("Ab Rahman", bare), ("Ab. Rahman", dotted)): + assert matching.check(a, "Abdul Rahman")["given"].outcome is outcome, a + + # -- Muhammad written short (#1383) ------------------------------------------- #: The short forms of Muhammad against its long spellings and each other: diff --git a/tests/v2/test_parser.py b/tests/v2/test_parser.py index 67a14bbbe..d56620a34 100644 --- a/tests/v2/test_parser.py +++ b/tests/v2/test_parser.py @@ -3639,6 +3639,77 @@ def test_a_german_choice_reads_ra_after_the_name_as_the_credential( assert got == fields +@pytest.mark.parametrize("tags, strict, text, fields", [ + # #1178: en.toml's Airman Basic is written default = false, so only a + # choice of English reads it; under a plain one ms.toml's and + # nl.toml's given readings gate it (rules/H9), so a plain choice + # reads the fields as the default does + (("en",), False, "Ab Faizal Mohd Qirwan", + {"given": "Ab", "middle": "Faizal Mohd", "family": "Qirwan"}), + (("en",), False, "Ab. Ghani Harun", + {"given": "Ab.", "middle": "Ghani", "family": "Harun"}), + (("en",), False, "Jansen, Ab", {"given": "Ab", "family": "Jansen"}), + (("en",), False, "AB John Smith", + {"given": "AB", "middle": "John", "family": "Smith"}), + # a strict choice reads no ms.toml or nl.toml: the rank, ungated, for + # a list of US military names (STRICT_UNGATED in test_reading_index) + (("en",), True, "AB John Smith", + {"title": "AB", "given": "John", "family": "Smith"}), + (("en",), True, "Ab Faizal Mohd Qirwan", + {"title": "Ab", "given": "Faizal", "middle": "Mohd", + "family": "Qirwan"}), + (("en",), True, "John Smith, AB", + {"title": "AB", "given": "John", "family": "Smith"}), + # inside a title phrase rules/H9 reads the gated rank as the title, + # under any choice of English + (("en",), False, "Chief Ab Smith", {"title": "Chief Ab", "family": "Smith"}), + (("en", "ms"), True, "Chief Ab Smith", + {"title": "Chief Ab", "family": "Smith"}), + # a strict choice of English that also chooses ms or nl reads their + # given reading, which gates the rank as a plain one does + (("en", "ms"), True, "AB John Smith", + {"given": "AB", "middle": "John", "family": "Smith"}), + # a strict Malay choice keeps Abdul written short, its period too + (("ms",), True, "Ab. Ghani Harun", + {"given": "Ab.", "middle": "Ghani", "family": "Harun"}), + (("ms",), True, "AB John Smith", + {"given": "AB", "middle": "John", "family": "Smith"}), + # a strict Dutch choice reads the name of its own, not written short: + # its period is rules/H2's shape again, and T8 does not divide it + (("nl",), True, "Ab Jansen", {"given": "Ab", "family": "Jansen"}), + (("nl",), True, "Ab. Ghani Harun", + {"title": "Ab.", "given": "Ghani", "family": "Harun"}), + (("nl",), True, "Ab.Ghani Harun", + {"given": "Ab.Ghani", "family": "Harun"}), +]) +def test_only_a_strict_english_choice_reads_ab_as_the_rank( + tags: tuple[str, ...], strict: bool, text: str, + fields: dict[str, str]) -> None: + name = parser_for(_choosing(*tags), strict=strict).parse(text) + got = {f: getattr(name, f) for f in + ("title", "given", "middle", "family", "suffix") if getattr(name, f)} + assert got == fields + + +@pytest.mark.parametrize("tags, strict, reported", [ + # the gated rank is reported where a choice turns it on (rules/H9's + # title-or-name); the default reads no rank and reports nothing, and + # a strict English choice reads it ungated, deciding nothing + ((), False, False), + (("en",), False, True), + (("en", "ms"), True, True), + (("en",), True, False), +]) +@pytest.mark.parametrize("text", [ + "Ab Jansen", "Ab. Ghani Harun", "AB John Smith"]) +def test_the_gated_rank_is_reported_where_a_choice_turns_it_on( + tags: tuple[str, ...], strict: bool, reported: bool, + text: str) -> None: + parser = parser_for(_choosing(*tags), strict=strict) if tags else Parser() + kinds = [a.kind.value for a in parser.parse(text).ambiguities] + assert kinds == (["title-or-name"] if reported else []), kinds + + def test_a_packs_fragment_is_unioned_on_after_the_strict_compile() -> None: # a word no file holds, so only the fragment can read it ('ra' stood # here until #1483 gave it ko.toml's name readings, which gate it) diff --git a/tests/v2/test_reading_index.py b/tests/v2/test_reading_index.py index 4e799cdd4..470337b24 100644 --- a/tests/v2/test_reading_index.py +++ b/tests/v2/test_reading_index.py @@ -396,7 +396,8 @@ def test_a_file_holding_only_familiar_readings_is_chosen_only_strictly( #: en's ra, whose name readings only ko.toml writes, #1483 on #: 2026-11-21, a strict German or English choice reading the #: credential as master's default did, and a strict German one the -#: title in front). A +#: title in front; en's ab, #1178, decisions/vocabulary-collisions' +#: 2026-11-21 #1178 entry). A #: word leaves this table when a name reading is written in the chosen #: file whose names carry it, and joins it when a chosen file's #: vocabulary reading loses its gate: review each move. @@ -405,7 +406,7 @@ def test_a_file_holding_only_familiar_readings_is_chosen_only_strictly( "ca": {"del", "la"}, "cs": {"st"}, "de": {"ra"}, - "en": {"ra"}, + "en": {"ab", "ra"}, "fil": {"del", "la", "san"}, "fr": {"la", "marquis", "marquise", "saint", "st"}, "ga": {"mac"}, diff --git a/tools/differential/corpus_rules.jsonl b/tools/differential/corpus_rules.jsonl index 520480761..19fbf31cb 100644 --- a/tools/differential/corpus_rules.jsonl +++ b/tools/differential/corpus_rules.jsonl @@ -79,6 +79,8 @@ "ARENT VAN 'S-GRAVESANDE" "ARMEN DER KIUREGHIAN" "Aaron 'T-Bone Walker" +"Ab. Ghani Harun" +"Ab.Ghani Harun" "Abd El Kader Haddou" "Abdul E.T. Smith" "Abdul MA Smith" diff --git a/tools/differential/snapshot.jsonl b/tools/differential/snapshot.jsonl index bd86e565e..c2ab83ed9 100644 --- a/tools/differential/snapshot.jsonl +++ b/tools/differential/snapshot.jsonl @@ -101,6 +101,8 @@ {"name": "ARMEN DER KIUREGHIAN", "given": "ARMEN", "family": "DER KIUREGHIAN", "initials": "A. K.", "capitalized": "Armen Der Kiureghian"} {"name": "Aaron 'T-Bone Walker", "given": "Aaron", "middle": "'T-Bone", "family": "Walker", "initials": "A. '. W.", "capitalized_force": "Aaron 't-Bone Walker"} {"name": "Aarón Padilla Gutiérrez", "given": "Aarón", "middle": "Padilla", "family": "Gutiérrez", "initials": "A. P. G."} +{"name": "Ab. Ghani Harun", "given": "Ab.", "middle": "Ghani", "family": "Harun", "initials": "A. G. H."} +{"name": "Ab.Ghani Harun", "given": "Ab.", "middle": "Ghani", "family": "Harun", "initials": "A. G. H."} {"name": "Abd Berg", "given": "Abd", "family": "Berg", "initials": "A. B."} {"name": "Abd Berg née Jones", "given": "Abd", "family": "Berg", "maiden": "Jones", "initials": "A. B."} {"name": "Abd El Kader Haddou", "given": "Abd", "family": "El Kader Haddou", "initials": "A. K. H."}