From f1e38e07ce004b4eede63c187f5473e1357ae360 Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Fri, 20 Nov 2026 15:38:24 -0800 Subject: [PATCH 1/8] =?UTF-8?q?Add=20four=20vocabulary=20spellings:=20vand?= =?UTF-8?q?en,=20hyphenated=20ranks,=20=EC=96=B4=20and=20=EB=9D=BC,=20?= =?UTF-8?q?=D8=B9=D8=A8=D8=AF's=20=D9=89=20completions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - nl.toml: vanden, a preposition and a given reading, as vander has (#1239). - en.toml: thirteen ranks written with a hyphen as military readings (#966); a split at the hyphen is declined (decisions/salutation-titles). - config/_ko_surnames.py: 어 and 라, hangul read as Korean at the cost of a foreign name in hangul (#1215; decisions/W1, with the removal recipe in docs/east-asian.rst). - ar.toml: the ى spelling of each ي-final completion of عبد, and المولي (#1337; decisions/P12). Each word's vetting is on its entry; the rules, decisions, release log, case rows, CJK corpus and snapshot move with it. Co-Authored-By: Claude Opus 5.5 --- ...ven-name-and-the-word-that-completes-it.md | 3 +- .../decisions/W1-unspaced-cjk-division.md | 2 + docs/design/decisions/salutation-titles.md | 3 + ...ven-name-and-the-word-that-completes-it.md | 3 +- docs/east-asian.rst | 16 ++ docs/release_log.rst | 4 + nameparser/config/_compiled.py | 49 ++++++ nameparser/config/_index.py | 16 +- nameparser/config/_ko_surnames.py | 9 +- nameparser/vocab/ar.toml | 26 ++- nameparser/vocab/en.toml | 52 ++++++ nameparser/vocab/nl.toml | 5 + tests/v2/cases.py | 148 ++++++++++++++++++ tests/v2/test_cases.py | 14 +- tools/differential/corpus_cjk.jsonl | 3 + tools/differential/corpus_rules.jsonl | 1 + tools/differential/snapshot.jsonl | 4 + 17 files changed, 346 insertions(+), 12 deletions(-) diff --git a/docs/design/decisions/P12-bound-given-name-and-the-word-that-completes-it.md b/docs/design/decisions/P12-bound-given-name-and-the-word-that-completes-it.md index 4e19b53bd..f8d192d9e 100644 --- a/docs/design/decisions/P12-bound-given-name-and-the-word-that-completes-it.md +++ b/docs/design/decisions/P12-bound-given-name-and-the-word-that-completes-it.md @@ -3,7 +3,7 @@ ## Standing - A bound given-name word past the first name word joins the word after it where its reading lists that word in `completed_by`, the pair one name unit that position places: `طارق عبد العزيز` gives family 'عبد العزيز' — 2026-11-04 #694. -- For Arabic-script `عبد` the license is a closed list on the bound word's reading, not a shape of the word after it: `عبد` lists 217 spellings of 139 words, the 97 one-word names of God, `الله`, 27 other divine epithets and 14 devotional completions, each with its hamza-less and Persian spellings, and `الله` with the Urdu heh too — 2026-11-04 #694. +- For Arabic-script `عبد` the license is a closed list on the bound word's reading, not a shape of the word after it: `عبد` lists 239 spellings of 139 words (217 on 2026-11-04), the 97 one-word names of God, `الله`, 27 other divine epithets and 14 devotional completions, each with its hamza-less and Persian spellings, and `الله` with the Urdu heh too — 2026-11-04 #694; each word ending in `ي` with its `ى` spelling too, and `المولى` with its `ي` spelling, so `سامر عبد القوى` gives family 'عبد القوى' — 2026-11-20 #1337. - The Latin `abd`, `abdel`, `abdal` and `abou` are written `completes_any`: past the first name word each joins any plain name word after it, one the vocabulary reads no other way, the pair placed by position, the family where it ends the name and one middle name inside it (`Tariq Abdel Aziz` → family 'Abdel Aziz') — 2026-11-19 #1464, reversing 2026-11-04 #694's decline. - `abdul` is written `long_names_only` beside it, joining only in a name of four name words or more, counted part by part before a maiden clause: a word with no letter and each part's leading title run (a listed title, a title phrase H9 reads with the word its connective joins, a dotted title, a title by H2's shape) counting as none, and after the pair only a plain word, a bound given name or a pair of initials in a script with case up to the next comma, a numeral `VI` to `X` written other than in Title case counting as none (`Tariq Abdul Aziz` → middle 'Abdul'; `Nadia Ali Abdul Rahim` → family 'Abdul Rahim'): the writers of a three-word `X Abdul Y` split it both ways by population — 2026-11-19 #1464. - `abu` keeps its particle and teknonymic readings and no `completes_any`; Arabic-script `عبد` keeps its list — 2026-11-19 #1464. @@ -76,3 +76,4 @@ Open: `آية الله` (Ayatollah) is no title (2026-11-19 #1072). Today's voca - **A second round on the fix commits** (2026-11-19) found the guard's count narrowed: counting after the pair only a plain word, as `abdul`'s four-word gate does, left a bare title ending the name uncounted, though the parse reads it as the family (`عز الدين الحاج` read given 'عز', middle 'الدين'); the guard now counts it, and the given part after a family comma. It also found the pair cut before a family comma under `two_family_names` (`حداد عز الدين، سامر` left undivided while `سامر حداد عز الدين` divided `حداد` | `عز الدين`): group stripped the pair's tag where a family comma's part joins nothing, and the unit readers then saw two words; the tag stays now, as `vocab:bound-given` does, and classify joins no pair written across a comma. The review of that fix found the widened count wider than the parse: a bare title behind a credential was counted though the trailing run takes it (`عز الدين PhD الحاج` joined the pair into the whole name), and every comma part past the first was counted, a suffix comma's included; the count stops at the first suffix word, numeral or period-marked title after the pair, and reads only the given part after a family comma, and only where it opens with no suffix word. A third review found that this count narrowed again, refusing a pair before a word the trailing run then left a middle name (`عز الدين الابن حداد`, `عز الدين V حداد`): classify cannot know what the trailing run will take, so every count there approximates a later stage's reading. The guard was moved to that reading: classify tags every candidate pair, and post_rules splits a pair holding every name word the parse read, after P5's exceptions, a family comma and a given-name title, which the classify-time guards had missed too (`، عز الدين` and `الدكتور عز الدين` read given 'عز الدين', as `، عبد الله` and `الدكتور عبد الله` do). `abdul`'s four-word gate keeps its own count, measured under #1464: whether it should count a bare trailing title too is left to a change that measures it. - **The real build** reads the 857 corpus names holding a second word as prototype A does, save one: a JRC-Names `عبد الغني` of two words, which the prototype joined at the first word, keying its exception on the second word's text, and the build keys on the pair's tag, reading it as master does. - **Frames:** a name holding no word of `BOUND_SECONDS` pays nothing (the reference row 196, `Smith, John` 98, `سعيد حسن` 126); a name holding one pays the pair test, and a pair that joins 10 or 11 (`ليلى عز الدين` 171 → 181, `نور الدين سامر حداد` 195 → 206), and a name of two name words pays nothing for the split unless its first word carries the pair's tag, counted with `sys.setprofile` over 20 parses each on py3.11, on the branch's build. +- 2026-11-20 #1337 — EACH `ي`-FINAL COMPLETION OF `عبد` IS LISTED WITH ITS `ى` SPELLING TOO. Egyptian writing ends a word with the alif maqsura `ى` where other writing has `ي`, so `سامر عبد القوى` read middle 'عبد', family 'القوى', where `سامر عبد القوي` read family 'عبد القوي'. The 21 completions ending in `ي` gain their `ى` spelling, and `المولى`, listed with `ى`, its `ي` spelling `المولي`: 22 spellings, 239 in all. A spelling, not a new word, so no rule moves: P12's list still names the same words. Measured 2026-11-20 against master `cb5088a9` with `uv run python tools/differential/measure.py --base `: opensanctions-parliaments moves 4 members of Egypt's House, each from middle 'عبد' to family 'عبد القوى' or 'عبد الهادى', all four right; no other local corpus moves. The issue's title example is no miss (`الدكتور على حسن` already reads the title), and the completions it names that no spelling lists (`ربه`, `الجيد`) are a question of which words to list, left to the issue. diff --git a/docs/design/decisions/W1-unspaced-cjk-division.md b/docs/design/decisions/W1-unspaced-cjk-division.md index 21f4c2d41..7d70c53fe 100644 --- a/docs/design/decisions/W1-unspaced-cjk-division.md +++ b/docs/design/decisions/W1-unspaced-cjk-division.md @@ -17,6 +17,7 @@ - A pack holding every ranked surname, a stricter divide-after-the-first-character mode, the unlicensed or copyrighted sources and the unattested Hundred Family Surnames compounds are declined — 2026-10-18 #695. - Six simplified forms Wikidata's labels do not give a ranked traditional surname (买盖篮诸谌芈, of 買蓋籃諸諶羋) are entered by hand in `tools/zh_surnames.py`'s `BY_HAND`, each a fact the PRC's character standards state, so `谌龙` and `芈月` under `locales.ZH` read family '谌' and '芈', as 2.5.0 through 3.0.1 read them; 厐, which no standard writes, stays out, so `厐建国` reads family '厐建国' — 2026-11-16 #1445. - A name the interpunct divides stands division down, vocabulary and segmenter alike (decisions/T3, #298), and rules/W1 states it as an Except rather than an Accepted cost: `安东尼·陈志明` under `locales.ZH` → family '陈志明', given '安东尼' — 2026-10-20 (Derek), #761. +- `어` and `라` are listed past the census cut, read as Korean surnames at the cost of a foreign name in hangul opening with either (`라르스` → family '라'); a caller removes one from `Lexicon.surnames` — 2026-11-20 #1215. Elsewhere: a segmenter is asked only of a name its writer left undivided, decisions/W3's 2026-08 entry; the Japanese surnames and married doubles kept out of the ZH list, decisions/vocabulary-exclusions' #695 lines. @@ -48,6 +49,7 @@ Open: [#981](https://github.com/derek73/python-nameparser/issues/981) (a mainlan - 2026-11-08 #1193 — `ja_segmenter`'s adapter declines a token with no Han character. namedivider divides by kanji statistics, and a token with none gives it nothing to read: its `kanji_feature` path returned the first character as the family every time, so `あいさわいちろう` read family 'あ', given 'いさわいちろう', and `なかやめぐ` family 'な', each with a SEGMENTATION report (measured on master 51d36a31 with namedivider-python 0.4.x). The issue measured (2026-11-08) the House of Representatives' member list (shugiin.go.jp, 457 members, each with the family and given readings in hiragana): `BasicNameDivider` cut all 457 unspaced readings after the first character, scoring 0.11 to 0.33, while it divided the same members' unspaced kanji names right in 450 of 457. One member writes her name wholly in hiragana (`なかや めぐ`), so the shape is a name's as well as a reading's. The decline is a fact about the content, as the repertoire and 〆 declines are, and so declines rather than raising (root AGENTS.md's segmenter contract). Its reach is every token with no Han character, hiragana and katakana mixed included, not only a wholly hiragana one: what makes the answer worthless is the missing kanji, whatever kana stand in their place. Han is the script table's, which holds 々 and 〆, so kana beside 々 (`さ々き`, a spelling names write with ゝ instead) still reaches namedivider. And a wholly katakana token never reaches the adapter, KATAKANA being in no activation set (#594). A token holding a kanji is passed on unchanged: `山田たろう` divides at the kana boundary by namedivider's rule path, scored 1.0, and is right. The decline also retires a consequence pinned since #272: a lone hiragana token, which the whole-name presumption gated in, was cut `みなみ` → 'み' + 'なみ' with a SEGMENTATION report, wrong where the writer meant the given name alone; it now stays whole, as with no segmenter. The kanji version of the presumption (`田中` → '田' + '中') stands, namedivider having kanji to read there. - 2026-11-12 — THE SIMPLIFIED FORMS `tools/zh_surnames.py` ADDS COME FROM WIKIDATA'S FAMILY-NAME ITEMS, NOT UNIHAN'S VARIANT TABLE. (Six of its seven forms restored by the 2026-11-16 #1445 entry below, so `谌龙` divides again.) A form gains the one simplified form that the simplified-Chinese labels of the family-name items labelled with it give; 7 of the 19 forms Unihan alone had added are not attested so (买厐盖篮芈诸谌) and left the block, so `谌龙` under `locales.ZH` reads family '谌龙' where it read family '谌', given '龙', while `諶龍` still divides. Measured over 322,895 corpus names holding a Han character: 9 moved, all transliterated foreign names the pack had cut after 盖. The source, the rule and the measurement are decisions/shipped-data-licences' 2026-11-12 UNIHAN REPLACED. - 2026-11-16 #1445 — SIX OF THE SEVEN SIMPLIFIED FORMS ARE ENTERED BY HAND, AS FACTS THE PRC'S CHARACTER STANDARDS STATE. 买, 盖, 篮, 诸, 谌 and 芈 join the block beside 買, 蓋, 籃, 諸, 諶 and 羋 through `tools/zh_surnames.py`'s `BY_HAND`, applied after the Wikidata rule and only where the data gives a selected form none; 厐 stays out, no standard writing it. The block holds 323 forms where it held 317. `谌龙`, `盖丽丽`, `芈月` and every other name opening with one of the six, in either script, read as 2.5.0 through 3.0.1 read them; `厐建国` stays whole where those releases divided it, and `龎建國` divides. The cost returns with 盖 and 买: a transliteration written without the 间隔号 that opens with either is cut (`盖尔哈尔德` → family '盖', `买买提` → family '买'), while `买买提·艾力` stays undivided under the interpunct Except. The sources per pair, the licence footing and the measurement are decisions/shipped-data-licences' 2026-11-16 #1445 entry. +- 2026-11-20 #1215 — `어` AND `라` JOIN THE KOREAN SURNAMES, HANGUL BEING READ AS KOREAN. Both are borne surnames past the census cut, and an unspaced name opening with either stayed whole (`어수선`, `라미란` → family whole), where it now divides (family '어', given '수선'). Decided 2026-11-20: hangul is read as Korean, as this file's 2026-07-27 #271 entry decided, so a Korean name is read right at the cost of a foreign name written in hangul, a cost the default already carries for every listed surname (`김벌리 스미스` reads family '김'). `라` costs more than most, few native words opening with ㄹ, so the foreign names opening with it are a larger share of the hangul names that do. Measured 2026-11-20 against master `cb5088a9` (a `git archive` export) with `uv run python tools/differential/measure.py --base `: jrc-names moves 15 spellings, every one a foreign name written in hangul (14 opening with `라`, 1 with `어`). 14 read wrong before as well, hangul reading family first and so putting the given name in the family field, and now also divide their first word (shape: `라르스 한센` family '라르스' → family '라', given '르스'); 1, a regnal name of two words (shape: `라마 9세`), read the given name right and now divides it. opensanctions-parliaments moves 1, a member surnamed `어`, now right. orcid-researchers moves 1, a Korean given name opening with `어` written before the surname, read wrong before (given and family swapped) and wrong after; no other local corpus moves. A caller whose data holds such names takes the surname out of the list: `dataclasses.replace(lexicon, surnames=lexicon.surnames - {"라"})`, which docs/east-asian.rst shows under "Teaching the splitter a surname". The two join `config/_ko_surnames.py` past the census rows, at the tail where the module's comment asks for additions. Declined: diff --git a/docs/design/decisions/salutation-titles.md b/docs/design/decisions/salutation-titles.md index 52b8a1efa..3942d1f50 100644 --- a/docs/design/decisions/salutation-titles.md +++ b/docs/design/decisions/salutation-titles.md @@ -84,3 +84,6 @@ Elsewhere: `justice` and `marshal`, excluded here as common leading-position nam - **MEASURED** (`config_diff.py diff default plain:MS`, 2026-11-19): my-candidates 117 of 3,077 names move, each a word above becoming the title (`USTAZ` 69, `CIKGU` 41, `USTAZAH` 4, `CIK` 2, `PUAN` 1; accepted: the two `CIK GU`, cikgu written in two words, reading given 'GU', and `PUAN SRI BIBI SHARLIZA`, the wife of a Tan Sri, reading given 'SRI' until `Puan Sri` is a title, #1180); `opensanctions-parliaments` 2 of 26,400, `CIK UJANG` and Indonesia's `PUAN MAHARANI`, the cost of choosing the pack for Indonesian names; the committed corpora none and ClinicalTrials.gov 1 of 713,175 (`Puan Jue`). Scored against the boxes of ORCID's, PatentsView's and Companies House's Malaysian, Indonesian, Singaporean and Vietnamese records, no group's share moves. - **WEIGHED AND KEPT: positional H1, and `after_given` on `puan` and `cik`.** A Malay title addresses by the given name, so a title and one name word could read the word as the given name (`addresses = "given"`, as th.toml's titles do); it is not set, as `encik`, and my.toml's `u` and `daw` set it not, `Cikgu Zakri` reading family 'Zakri' by rules/H1, and setting it on `encik` would move the default. `puan` and `cik` carry `after_given`, as `encik` and hi.toml's salutations do, so `Ahmad, Siti Puan` reads title 'Puan' under the pack (rules/H8). - **`Abdul`'s join (#1464)** is left to the change building it; once it lands as a property of the bound word, an ms.toml reading of `abdul` written `default = false` would let this pack turn it on, copying every other file's vocabulary reading of the word with it, as my.toml's `lt` copies its credential (decisions/vocabulary-collisions, the 2026-11-19 #1483 entry). +- 2026-11-20 #966 — RANKS WRITTEN WITH A HYPHEN ARE TITLES: EIGHT, THEN FIVE MORE ON REVIEW. `vice-admiral`, `rear-admiral`, `vice-marshal`, `air-marshal`, `lieutenant-colonel`, `lieutenant-general`, `major-general` and `brigadier-general` join en.toml as `military` readings, `co-chair` the precedent for an entry holding a hyphen: tokenize keeps a hyphenated word whole, so `Air Vice-Marshal Ann Reed` read given 'Air', middle 'Vice-Marshal Ann', the spaced rank's phrase never reaching it, and reads title 'Air Vice-Marshal' now, the modifier `air` finding its head after it (rules/H9). Each reads as its spaced twin does at the head, after a family comma and after a second comma, under all three orders, save where the twin is two words: a bare rank ending a name stays a name word either way (`John Smith Vice-Admiral` keeps it one family word), and after a second comma `vice-marshal`, `air-marshal` and `major-general` report no comma fork where their spaced twins do, the twin holding a title that may be a given name (`marshal`, `major`, rules/H9) and the hyphenated word holding none (`Smith, John, Major General` reports `comma-structure`, `Smith, John, Major-General` nothing). None of the eight is borne as a name in any source tools/name_usage.py reads. Measured 2026-11-20 against master `cb5088a9` with `uv run python tools/differential/measure.py --base `: govuk-people moves 6, every one `Air Vice-Marshal` gaining the title, and no other local corpus moves (ukec-individuals 0 of 15,214). DECLINED: splitting a hyphenated word at its hyphen to find a title in it, which would reach every hyphenated name holding a title word (`Smith-Major`) and every hyphenated rank the vocabulary does not list; listing the ranks reaches the shape written, and an unlisted one stays a name word, as before. + - **Five more, added on the PR's review** (2026-11-20): `field-marshal`, `lieutenant-commander`, `wing-commander`, `chief-marshal` (`Air Chief-Marshal`) and `sergeant-major`, the British ranks the review found still read as name words. Each reads as its spaced twin does at the head, after a family comma and after a second comma, save the same two shapes: a bare rank ending a name, and after a second comma no comma fork where the twin holds a title that may be a given name (`marshal`, `wing`, `major`). None is borne as a name in any source tools/name_usage.py reads, and none moves a name in govuk-people (0 of 6,021) or ukec-individuals (0 of 15,214), measured against the eight with `uv run python tools/differential/snapshot.py --local --base `. + - **Where no twin is promised:** a rank that is the whole part before a family comma (`Field-Marshal, Ann` gives family 'Field-Marshal', `Field Marshal, Ann` title 'Field', family 'Marshal'), a rank written alone, and a rank ending a name with a full stop (`John Smith Wing-Commander.` gives title 'Wing-Commander.', the spaced twin title 'Commander.', family 'Wing') read otherwise than the spaced words, which split there; the first eight read the same way (the PR's review, 2026-11-20). diff --git a/docs/design/rules/P12-bound-given-name-and-the-word-that-completes-it.md b/docs/design/rules/P12-bound-given-name-and-the-word-that-completes-it.md index c63f97108..498cf070a 100644 --- a/docs/design/rules/P12-bound-given-name-and-the-word-that-completes-it.md +++ b/docs/design/rules/P12-bound-given-name-and-the-word-that-completes-it.md @@ -4,9 +4,10 @@ **Then:** the two words are one name unit, past the first name word or, for a pair read from its second word, at it too, a unit that position places. -- **The completing word is one a reading lists** (`completed_by` on the bound word's reading): for Arabic-script `عبد`, the one-word names of God, the other divine epithets and the devotional completions written after it, each in its hamza-less and Persian spellings. +- **The completing word is one a reading lists** (`completed_by` on the bound word's reading): for Arabic-script `عبد`, the one-word names of God, the other divine epithets and the devotional completions written after it, each in its hamza-less and Persian spellings, and a word ending in `ي` also with the final `ى` Egyptian names write, and `المولى` with `ي` too. ``` "سعيد عبد الله" → family="عبد الله" + "سامر عبد القوى" → family="عبد القوى" "طارق عبد العزيز" → family="عبد العزيز" "محمد عبد الله أحمد" → middle="عبد الله" "عبد اللطيف عبد الحميد" → family="عبد الحميد" diff --git a/docs/east-asian.rst b/docs/east-asian.rst index 9b25fa118..95bebc87a 100644 --- a/docs/east-asian.rst +++ b/docs/east-asian.rst @@ -159,6 +159,22 @@ Korean name that divided at 김 divides at 김민 once that is listed: >>> Parser(lexicon=lex).parse("김민준").family '김민' +A listed surname also divides a foreign name written in hangul, since +hangul is read as Korean: 라르스 (Lars) opens with the surname 라. If +your data holds such names, take the surname out of the list, and +Korean names opening with it stay whole too: + +.. doctest:: + + >>> import dataclasses + >>> parse("라르스").family + '라' + >>> ko_lexicon = Lexicon.default() + >>> no_ra = dataclasses.replace( + ... ko_lexicon, surnames=ko_lexicon.surnames - {"라"}) + >>> Parser(lexicon=no_ra).parse("라르스").family + '라르스' + For a Chinese name, add the surname to the parser the ``zh`` pack is folded onto. 庹 is a rare surname the pack does not list, so the name stays whole until it is added: diff --git a/docs/release_log.rst b/docs/release_log.rst index d1926ae13..7ff917480 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -4,6 +4,10 @@ Release Log nameparser 3.2 is under development. + - **Fix Vanden, the Dutch and Flemish van den written as one word, which read as a middle name.** ``parse("Pieter Vanden Broeck")`` gives family ``Vanden Broeck``, as ``Vander Broeck`` reads, where 1.4.0 through 3.1.0 gave middle ``Vanden``, family ``Broeck``. :issue:`1239` + - **Add thirteen military ranks written with a hyphen, such as Vice-Admiral, Air Vice-Marshal and Major-General, as titles.** ``parse("Air Vice-Marshal Ann Reed")`` gives title ``Air Vice-Marshal``, given ``Ann``, where 3.1.0 gave given ``Air``, middle ``Vice-Marshal Ann`` and 1.4.0 title ``Air``, first ``Vice-Marshal``. A hyphenated rank not listed, such as Squadron-Leader, still reads as a name word. :issue:`966` + - **Add 어 and 라 to the Korean surnames.** ``parse("어수선")`` gives family ``어``, given ``수선``, where 1.4.0 through 3.1.0 kept the name whole. A foreign name written in hangul that begins with 라 is now divided too; a caller who reads such names removes the surname from the ``Lexicon``'s ``surnames``. :issue:`1215` + - **Fix a word completing عبد written with a final ى, as Egyptian names write it, which read as a name of its own.** ``parse("سامر عبد القوى")`` gives family ``عبد القوى``, as ``عبد القوي`` reads, where 1.4.0 through 3.1.0 gave middle ``عبد``, family ``القوى``. :issue:`1337` - **Add familiar forms in Central and Eastern European and Balkan languages, found in Wikidata.** With ``familiar-form`` accepted, ``Erzsi Nagy`` / ``Erzsébet Nagy`` and ``Jára Novák`` / ``Jaroslav Novák`` are consistent, where 3.1.0 read a conflict, Czech and Hungarian gaining the most; the Russian, Ukrainian, Belarusian, Bulgarian and most Serbian pairs are written in Cyrillic, so a name romanized in Latin letters does not reach them. :issue:`1387` - **Read a second name written after @ or urf as the nickname.** ``parse("Rahim @ Jaki bin Osman")`` gives given ``Rahim``, nickname ``Jaki``, family ``bin Osman``, where 1.4.0 through 3.1.0 gave middle ``@ Jaki``; the alias runs to a patronymic particle, another marker or a comma, and a one-word alias before the family name takes the family name with it (``Rahim @ Jaki Osman`` gives no family name). ``alias`` and ``aka`` are read so only where you add them (``Lexicon.add("aka", kind="alias_marker")``); an ``@`` glued to a word is part of it. :issue:`1164` - **Fix an Arabic-script name written with الدين or الله second, which read as two names.** ``parse("نور الدين سامر حداد")`` gives given ``نور الدين``, where 1.4.0 through 3.1.0 gave given ``نور``, middle ``الدين سامر``; ending the name the pair is the family name, and ``الدین``, ``اله`` and ``اللہ`` read the same way; a name of two name words keeps them apart. ``Lexicon.add`` accepts a new kind, ``bound_second``, for such a word. :issue:`1072` diff --git a/nameparser/config/_compiled.py b/nameparser/config/_compiled.py index fa8a88ebe..8bf551a73 100644 --- a/nameparser/config/_compiled.py +++ b/nameparser/config/_compiled.py @@ -341,6 +341,7 @@ 'adviser', 'advocate', 'air', + 'air-marshal', 'akhoond', 'alderman', 'alhaj', @@ -420,6 +421,7 @@ 'botanist', 'bp', 'brigadier', + 'brigadier-general', 'briggen', 'british', 'broadcaster', @@ -453,6 +455,7 @@ 'chef', 'chemist', 'chief', + 'chief-marshal', 'chieftain', 'child', 'choreographer', @@ -610,6 +613,7 @@ 'fellow', 'fh-prof', 'field', + 'field-marshal', 'film', 'financial', 'first', @@ -740,6 +744,9 @@ 'licenciada', 'licenciado', 'lieutenant', + 'lieutenant-colonel', + 'lieutenant-commander', + 'lieutenant-general', 'linguist', 'literary', 'lord', @@ -763,6 +770,7 @@ 'maharani', 'maid', 'majgen', + 'major-general', 'manager', 'marcher', 'marchess', @@ -957,6 +965,7 @@ 'rangatira', 'rdml', 'rear', + 'rear-admiral', 'rebbe', 'registered', 'registrar', @@ -995,6 +1004,7 @@ 'senior', 'senior-judge', 'sergeant', + 'sergeant-major', 'servant', 'señor', 'señora', @@ -1099,6 +1109,8 @@ 'verderer', 'vicar', 'vice', + 'vice-admiral', + 'vice-marshal', 'viscount', 'vizier', 'vocalist', @@ -1106,6 +1118,7 @@ 'vrouwe', 'warden', 'warrant', + 'wing-commander', 'wo-1', 'wo1', 'wo2', @@ -1833,6 +1846,7 @@ 'chief adm', 'chief administrator', 'chief admiral', + 'chief air-marshal', 'chief alderman', 'chief almoner', 'chief ambassador', @@ -1845,6 +1859,7 @@ 'chief bgen', 'chief brig', 'chief brigadier', + 'chief brigadier-general', 'chief briggen', 'chief burgess', 'chief capt', @@ -1858,6 +1873,7 @@ 'chief chancellor', 'chief charge', 'chief chargé', + 'chief chief-marshal', 'chief clerk', 'chief cllr', 'chief cmsaf', @@ -1900,6 +1916,7 @@ 'chief ens', 'chief envoy', 'chief fadm', + 'chief field-marshal', 'chief gaf', 'chief gen', 'chief general', @@ -1916,6 +1933,9 @@ 'chief lcpl', 'chief leader', 'chief lieutenant', + 'chief lieutenant-colonel', + 'chief lieutenant-commander', + 'chief lieutenant-general', 'chief lt', 'chief ltc', 'chief ltcol', @@ -1930,6 +1950,7 @@ 'chief maj', 'chief majgen', 'chief major', + 'chief major-general', 'chief marshal', 'chief mayor', 'chief mcpo', @@ -1964,6 +1985,7 @@ 'chief pvt', 'chief radm', 'chief rdml', + 'chief rear-admiral', 'chief registrar', 'chief rep', 'chief representative', @@ -1972,6 +1994,7 @@ 'chief senator', 'chief senior-judge', 'chief sergeant', + 'chief sergeant-major', 'chief sfc', 'chief sgm', 'chief sgt', @@ -1995,8 +2018,11 @@ 'chief vadm', 'chief vc', 'chief verderer', + 'chief vice-admiral', + 'chief vice-marshal', 'chief vizier', 'chief warden', + 'chief wing-commander', 'chief wo-1', 'chief wo1', 'chief wo2', @@ -2524,6 +2550,7 @@ 'ul-', 'van', 'vande', + 'vanden', 'vander', 'vd', 'vel', @@ -4476,12 +4503,14 @@ 'عبد الاول', 'عبد الاکرم', 'عبد البارئ', + 'عبد البارى', 'عبد الباري', 'عبد الباری', 'عبد الباسط', 'عبد الباطن', 'عبد الباعث', 'عبد الباقر', + 'عبد الباقى', 'عبد الباقي', 'عبد الباقی', 'عبد البديع', @@ -4510,6 +4539,7 @@ 'عبد الحلیم', 'عبد الحميد', 'عبد الحمید', + 'عبد الحى', 'عبد الحي', 'عبد الحکم', 'عبد الحکیم', @@ -4543,6 +4573,7 @@ 'عبد السميع', 'عبد السمیع', 'عبد السند', + 'عبد الشافى', 'عبد الشافي', 'عبد الشافی', 'عبد الشكور', @@ -4554,9 +4585,11 @@ 'عبد الصمد', 'عبد الضار', 'عبد الظاهر', + 'عبد العاطى', 'عبد العاطي', 'عبد العاطی', 'عبد العال', + 'عبد العالى', 'عبد العالي', 'عبد العالی', 'عبد العباس', @@ -4566,12 +4599,14 @@ 'عبد العظيم', 'عبد العظیم', 'عبد العفو', + 'عبد العلى', 'عبد العلي', 'عبد العليم', 'عبد العلی', 'عبد العلیم', 'عبد الغفار', 'عبد الغفور', + 'عبد الغنى', 'عبد الغني', 'عبد الغنی', 'عبد الفتاح', @@ -4581,11 +4616,13 @@ 'عبد القدير', 'عبد القدیر', 'عبد القهار', + 'عبد القوى', 'عبد القوي', 'عبد القوی', 'عبد القيوم', 'عبد القیوم', 'عبد الكاظم', + 'عبد الكافى', 'عبد الكافي', 'عبد الكبير', 'عبد الكريم', @@ -4600,8 +4637,10 @@ 'عبد المالک', 'عبد المانع', 'عبد المبدئ', + 'عبد المبدى', 'عبد المبدي', 'عبد المبدی', + 'عبد المتعالى', 'عبد المتعالي', 'عبد المتعالی', 'عبد المتكبر', @@ -4613,9 +4652,11 @@ 'عبد المجیب', 'عبد المجید', 'عبد المحسن', + 'عبد المحصى', 'عبد المحصي', 'عبد المحصی', 'عبد المحمود', + 'عبد المحيى', 'عبد المحيي', 'عبد المحیی', 'عبد المذل', @@ -4625,10 +4666,12 @@ 'عبد المطلب', 'عبد المعبود', 'عبد المعز', + 'عبد المعطى', 'عبد المعطي', 'عبد المعطی', 'عبد المعيد', 'عبد المعید', + 'عبد المغنى', 'عبد المغني', 'عبد المغنی', 'عبد المقتدر', @@ -4644,6 +4687,7 @@ 'عبد المنان', 'عبد المنتقم', 'عبد المنعم', + 'عبد المهدى', 'عبد المهدي', 'عبد المهدی', 'عبد المهيمن', @@ -4651,23 +4695,28 @@ 'عبد الموجود', 'عبد الموخر', 'عبد المولى', + 'عبد المولي', 'عبد المولی', 'عبد المومن', 'عبد الناصر', 'عبد النافع', + 'عبد النبى', 'عبد النبي', 'عبد النبی', 'عبد النور', + 'عبد الهادى', 'عبد الهادي', 'عبد الهادی', 'عبد الواجد', 'عبد الواحد', 'عبد الوارث', 'عبد الواسع', + 'عبد الوالى', 'عبد الوالي', 'عبد الوالی', 'عبد الودود', 'عبد الوكيل', + 'عبد الولى', 'عبد الولي', 'عبد الولی', 'عبد الوهاب', diff --git a/nameparser/config/_index.py b/nameparser/config/_index.py index 5f5e9f574..6d2bb6f90 100644 --- a/nameparser/config/_index.py +++ b/nameparser/config/_index.py @@ -109,6 +109,7 @@ ('aia', (('en', 'credential', ()),)), ('aicp', (('en', 'credential', ()),)), ('air', (('en', 'modifier', ()),)), + ('air-marshal', (('en', 'military', ()),)), ('ait', (('ber', 'clan', (('cased', 'Ait'),)),)), ('ajay', (('mul', 'familiar', (('short_for', ('ajaykumar',)),)),)), ('aka', (('en', 'alias_marker', (('default', False),)),)), @@ -395,6 +396,7 @@ ('brie', (('en', 'familiar', (('short_for', ('brianne',)),)),)), ('brig', (('en', 'military', (('abbreviation', True), ('attaches', ('gen', 'general', 'sir')), ('same_as', 'brigadier'))), ('en', 'given', ()), ('my', 'military', (('abbreviation', True), ('attaches', ('gen', 'general', 'sir')), ('default', False), ('same_as', 'brigadier'))))), ('brigadier', (('en', 'military', (('attaches', ('gen',)),)), ('my', 'military', (('attaches', ('gen',)), ('default', False))))), + ('brigadier-general', (('en', 'military', ()),)), ('briggen', (('en', 'military', (('same_as', 'bg'),)),)), ('brit', (('en', 'familiar', (('short_for', ('brittany',)),)),)), ('british', (('en', 'modifier', ()),)), @@ -578,6 +580,7 @@ ('chi', (('en', 'credential', ()), ('en', 'given', ()), ('en', 'family', ()))), ('chico', (('pt-BR', 'familiar', (('short_for', ('francisco',)),)),)), ('chief', (('en', 'nobility', (('attaches', ('military', 'office')),)),)), + ('chief-marshal', (('en', 'military', ()),)), ('chieftain', (('en', 'nobility', ()),)), ('child', (('en', 'modifier', ()),)), ('chip', (('en', 'familiar', (('short_for', ('charles',)),)),)), @@ -1116,6 +1119,7 @@ ('ficf', (('en', 'credential', ()),)), ('fieee', (('en', 'credential', ()),)), ('field', (('en', 'modifier', ()),)), + ('field-marshal', (('en', 'military', ()),)), ('fiet', (('en', 'credential', ()), ('en', 'family', ()))), ('filh', (('pt-BR', 'agnomen', (('same_as', 'filho'),)), ('pt-BR', 'family', ()))), ('filha', (('pt', 'agnomen', ()), ('pt', 'family', ()))), @@ -1681,6 +1685,9 @@ ('licsw', (('en', 'credential', ()),)), ('lidiya', (('ru', 'spelling', (('spelling_of', ('lidia', 'lidiia')),)),)), ('lieutenant', (('en', 'military', (('attaches', ('gen',)),)), ('my', 'military', (('attaches', ('gen',)), ('default', False))))), + ('lieutenant-colonel', (('en', 'military', ()),)), + ('lieutenant-commander', (('en', 'military', ()),)), + ('lieutenant-general', (('en', 'military', ()),)), ('lili', (('hu', 'familiar', (('short_for', ('lídia', 'lívia')),)),)), ('liliia', (('ru', 'spelling', (('spelling_of', ('lilia',)),)), ('uk', 'spelling', (('spelling_of', ('lilia',)),)))), ('liliya', (('ru', 'spelling', (('spelling_of', ('lilia', 'liliia')),)), ('uk', 'spelling', (('spelling_of', ('liliia',)),)))), @@ -1835,6 +1842,7 @@ ('majesty', (('en', 'style', ()), ('en', 'given', ()))), ('majgen', (('en', 'military', (('same_as', 'mg'),)),)), ('major', (('en', 'military', (('attaches', ('gen', 'general')),)), ('en', 'given', ()), ('en', 'family', ()), ('my', 'military', (('attaches', ('gen', 'general')), ('default', False))))), + ('major-general', (('en', 'military', ()),)), ('mal', (('en', 'familiar', (('short_for', ('malcolm',)),)),)), ('malam', (('ha', 'given', ()), ('ha', 'family', ()))), ('manaes', (('en', 'credential', (('cased', 'MAnaes'),)),)), @@ -2475,6 +2483,7 @@ ('rdms', (('en', 'credential', ()),)), ('rdn', (('en', 'credential', ()),)), ('rear', (('en', 'modifier', ()), ('my', 'modifier', (('default', False),)))), + ('rear-admiral', (('en', 'military', ()),)), ('rebbe', (('yi', 'religious', ()),)), ('reggie', (('en', 'familiar', (('short_for', ('reginald',)),)),)), ('registered', (('en', 'modifier', ()),)), @@ -2632,6 +2641,7 @@ ('senior-judge', (('en', 'office', ()),)), ('sepideh', (('fa', 'spelling', (('spelling_of', ('sepide',)),)),)), ('sergeant', (('en', 'military', (('attaches', ('maj', 'major')),)),)), + ('sergeant-major', (('en', 'military', ()),)), ('sergey', (('de', 'spelling', (('spelling_of', ('sergej',)),)), ('ru', 'spelling', (('spelling_of', ('sergei', 'sergej')),)))), ('sergiy', (('ru', 'spelling', (('spelling_of', ('sergii',)),)), ('uk', 'spelling', (('spelling_of', ('sergii',)),)))), ('serguei', (('mul', 'spelling', (('spelling_of', ('sergei',)),)),)), @@ -2949,6 +2959,7 @@ ('valle', (('es', 'given', (('after_particle', True),)),)), ('van', (('nl', 'preposition', ()), ('nl', 'given', ()))), ('vande', (('nl', 'preposition', ()), ('nl', 'given', ()))), + ('vanden', (('nl', 'preposition', ()), ('nl', 'given', ()))), ('vander', (('nl', 'preposition', ()), ('nl', 'given', ()))), ('vangelis', (('el', 'familiar', (('short_for', ('evangelos',)),)),)), ('vanhempi', (('fi', 'generation', ()),)), @@ -2976,6 +2987,8 @@ ('vic', (('en', 'familiar', (('short_for', ('victor', 'victoria')),)),)), ('vicar', (('en', 'religious', (('attaches', ('gen',)),)),)), ('vice', (('en', 'modifier', ()), ('my', 'modifier', (('default', False),)))), + ('vice-admiral', (('en', 'military', ()),)), + ('vice-marshal', (('en', 'military', ()),)), ('vicki', (('en', 'familiar', (('short_for', ('victoria',)),)),)), ('vickie', (('mul', 'familiar', (('short_for', ('victoria',)),)),)), ('vicky', (('el', 'familiar', (('short_for', ('vasiliki',)),)), ('en', 'familiar', (('short_for', ('vasiliki', 'victoria')),)))), @@ -3023,6 +3036,7 @@ ('willie', (('en', 'familiar', (('short_for', ('william',)),)),)), ('wim', (('nl', 'familiar', (('short_for', ('willem',)),)),)), ('wing', (('en', 'modifier', ()), ('en', 'given', ()), ('en', 'family', ()))), + ('wing-commander', (('en', 'military', ()),)), ('winnie', (('mul', 'familiar', (('short_for', ('winifred',)),)),)), ('wlodek', (('en', 'familiar', (('short_for', ('wlodzimierz',)),)),)), ('wm', (('en', 'given', (('same_as', 'william'),)),)), @@ -3278,7 +3292,7 @@ ('سینئر', (('sd', 'generation', ()), ('ur', 'generation', ()))), ('سینیئر', (('sd', 'generation', ()), ('ur', 'generation', ()))), ('سینیور', (('fa', 'generation', ()),)), - ('عبد', (('ar', 'bound_given', (('completed_by', ('الآخر', 'الأحد', 'الأكرم', 'الأمير', 'الأمیر', 'الأول', 'الأکرم', 'الإله', 'الاحد', 'الاخر', 'الاكرم', 'الاله', 'الامير', 'الامیر', 'الاول', 'الاکرم', 'البارئ', 'الباري', 'الباری', 'الباسط', 'الباطن', 'الباعث', 'الباقر', 'الباقي', 'الباقی', 'البديع', 'البدیع', 'البر', 'البصير', 'البصیر', 'التواب', 'الجامع', 'الجبار', 'الجليل', 'الجلیل', 'الجواد', 'الحافظ', 'الحسن', 'الحسيب', 'الحسين', 'الحسیب', 'الحسین', 'الحفيظ', 'الحفیظ', 'الحق', 'الحكم', 'الحكيم', 'الحليم', 'الحلیم', 'الحميد', 'الحمید', 'الحي', 'الحکم', 'الحکیم', 'الحی', 'الخافض', 'الخالق', 'الخبير', 'الخبیر', 'الدائم', 'الدايم', 'الدایم', 'الرؤوف', 'الرازق', 'الرافع', 'الرب', 'الرحمان', 'الرحمن', 'الرحيم', 'الرحیم', 'الرزاق', 'الرسول', 'الرشيد', 'الرشید', 'الرضا', 'الرقيب', 'الرقیب', 'الرووف', 'الزهرة', 'الستار', 'السلام', 'السميع', 'السمیع', 'السند', 'الشافي', 'الشافی', 'الشكور', 'الشهيد', 'الشهید', 'الشکور', 'الصادق', 'الصبور', 'الصمد', 'الضار', 'الظاهر', 'العاطي', 'العاطی', 'العال', 'العالي', 'العالی', 'العباس', 'العدل', 'العزيز', 'العزیز', 'العظيم', 'العظیم', 'العفو', 'العلي', 'العليم', 'العلی', 'العلیم', 'الغفار', 'الغفور', 'الغني', 'الغنی', 'الفتاح', 'القابض', 'القادر', 'القدوس', 'القدير', 'القدیر', 'القهار', 'القوي', 'القوی', 'القيوم', 'القیوم', 'الكاظم', 'الكافي', 'الكبير', 'الكريم', 'اللطيف', 'اللطیف', 'الله', 'اللہ', 'المؤخر', 'المؤمن', 'الماجد', 'المالك', 'المالک', 'المانع', 'المبدئ', 'المبدي', 'المبدی', 'المتعالي', 'المتعالی', 'المتكبر', 'المتين', 'المتکبر', 'المتین', 'المجيب', 'المجيد', 'المجیب', 'المجید', 'المحسن', 'المحصي', 'المحصی', 'المحمود', 'المحيي', 'المحیی', 'المذل', 'المسيح', 'المسیح', 'المصور', 'المطلب', 'المعبود', 'المعز', 'المعطي', 'المعطی', 'المعيد', 'المعید', 'المغني', 'المغنی', 'المقتدر', 'المقدم', 'المقسط', 'المقصود', 'المقيت', 'المقیت', 'الملك', 'الملک', 'المميت', 'الممیت', 'المنان', 'المنتقم', 'المنعم', 'المهدي', 'المهدی', 'المهيمن', 'المهیمن', 'الموجود', 'الموخر', 'المولى', 'المولی', 'المومن', 'الناصر', 'النافع', 'النبي', 'النبی', 'النور', 'الهادي', 'الهادی', 'الواجد', 'الواحد', 'الوارث', 'الواسع', 'الوالي', 'الوالی', 'الودود', 'الوكيل', 'الولي', 'الولی', 'الوهاب', 'الوکیل', 'الکاظم', 'الکافی', 'الکبیر', 'الکریم')),)),)), + ('عبد', (('ar', 'bound_given', (('completed_by', ('الآخر', 'الأحد', 'الأكرم', 'الأمير', 'الأمیر', 'الأول', 'الأکرم', 'الإله', 'الاحد', 'الاخر', 'الاكرم', 'الاله', 'الامير', 'الامیر', 'الاول', 'الاکرم', 'البارئ', 'البارى', 'الباري', 'الباری', 'الباسط', 'الباطن', 'الباعث', 'الباقر', 'الباقى', 'الباقي', 'الباقی', 'البديع', 'البدیع', 'البر', 'البصير', 'البصیر', 'التواب', 'الجامع', 'الجبار', 'الجليل', 'الجلیل', 'الجواد', 'الحافظ', 'الحسن', 'الحسيب', 'الحسين', 'الحسیب', 'الحسین', 'الحفيظ', 'الحفیظ', 'الحق', 'الحكم', 'الحكيم', 'الحليم', 'الحلیم', 'الحميد', 'الحمید', 'الحى', 'الحي', 'الحکم', 'الحکیم', 'الحی', 'الخافض', 'الخالق', 'الخبير', 'الخبیر', 'الدائم', 'الدايم', 'الدایم', 'الرؤوف', 'الرازق', 'الرافع', 'الرب', 'الرحمان', 'الرحمن', 'الرحيم', 'الرحیم', 'الرزاق', 'الرسول', 'الرشيد', 'الرشید', 'الرضا', 'الرقيب', 'الرقیب', 'الرووف', 'الزهرة', 'الستار', 'السلام', 'السميع', 'السمیع', 'السند', 'الشافى', 'الشافي', 'الشافی', 'الشكور', 'الشهيد', 'الشهید', 'الشکور', 'الصادق', 'الصبور', 'الصمد', 'الضار', 'الظاهر', 'العاطى', 'العاطي', 'العاطی', 'العال', 'العالى', 'العالي', 'العالی', 'العباس', 'العدل', 'العزيز', 'العزیز', 'العظيم', 'العظیم', 'العفو', 'العلى', 'العلي', 'العليم', 'العلی', 'العلیم', 'الغفار', 'الغفور', 'الغنى', 'الغني', 'الغنی', 'الفتاح', 'القابض', 'القادر', 'القدوس', 'القدير', 'القدیر', 'القهار', 'القوى', 'القوي', 'القوی', 'القيوم', 'القیوم', 'الكاظم', 'الكافى', 'الكافي', 'الكبير', 'الكريم', 'اللطيف', 'اللطیف', 'الله', 'اللہ', 'المؤخر', 'المؤمن', 'الماجد', 'المالك', 'المالک', 'المانع', 'المبدئ', 'المبدى', 'المبدي', 'المبدی', 'المتعالى', 'المتعالي', 'المتعالی', 'المتكبر', 'المتين', 'المتکبر', 'المتین', 'المجيب', 'المجيد', 'المجیب', 'المجید', 'المحسن', 'المحصى', 'المحصي', 'المحصی', 'المحمود', 'المحيى', 'المحيي', 'المحیی', 'المذل', 'المسيح', 'المسیح', 'المصور', 'المطلب', 'المعبود', 'المعز', 'المعطى', 'المعطي', 'المعطی', 'المعيد', 'المعید', 'المغنى', 'المغني', 'المغنی', 'المقتدر', 'المقدم', 'المقسط', 'المقصود', 'المقيت', 'المقیت', 'الملك', 'الملک', 'المميت', 'الممیت', 'المنان', 'المنتقم', 'المنعم', 'المهدى', 'المهدي', 'المهدی', 'المهيمن', 'المهیمن', 'الموجود', 'الموخر', 'المولى', 'المولي', 'المولی', 'المومن', 'الناصر', 'النافع', 'النبى', 'النبي', 'النبی', 'النور', 'الهادى', 'الهادي', 'الهادی', 'الواجد', 'الواحد', 'الوارث', 'الواسع', 'الوالى', 'الوالي', 'الوالی', 'الودود', 'الوكيل', 'الولى', 'الولي', 'الولی', 'الوهاب', 'الوکیل', 'الکاظم', 'الکافی', 'الکبیر', 'الکریم')),)),)), ('لواء', (('ar', 'military', (('addresses', 'given'), ('same_as', 'اللواء'))),)), ('م', (('ar', 'academic', (('addresses', 'given'),)),)), ('م.د', (('ar', 'academic', (('addresses', 'given'),)),)), diff --git a/nameparser/config/_ko_surnames.py b/nameparser/config/_ko_surnames.py index 536305794..b08666a2f 100644 --- a/nameparser/config/_ko_surnames.py +++ b/nameparser/config/_ko_surnames.py @@ -22,6 +22,9 @@ "옥", "육", "인", "맹", "제", "모", "탁", "국", "은", "편", "용", "예", "경", "봉", "사", "부", "가", "복", "태", "목", "형", "계", "피", "두", + # past the cut, each a borne surname whose names stayed whole + # without it (#1215; decisions/W1, 2026-11-20) + "어", "라", # the two-syllable surnames in current use (census-complete); # longest-first matching splits 남궁민수 as 남궁+민수, not 남+궁민수 "남궁", "황보", "제갈", "사공", "선우", "서문", "독고", "동방", @@ -32,8 +35,10 @@ segmentation (``Lexicon.default().surnames``): a hangul token like "김민준" splits into surname + given name by longest match. This ships as DEFAULT vocabulary because it is self-selecting -- a hangul entry -can only ever match hangul text -- and hangul text is unambiguously -Korean. Chinese surnames deliberately live in ``nameparser.locales.zh`` +can only ever match hangul text -- and hangul text is read as +Korean, a foreign name written in hangul that opens with a listed +surname being the accepted cost (decisions/W1, 2026-11-20 #1215; +docs/east-asian.rst shows how to remove one). Chinese surnames deliberately live in ``nameparser.locales.zh`` instead (Han segmentation is opt-in; a zh list corrupts Japanese kanji names). diff --git a/nameparser/vocab/ar.toml b/nameparser/vocab/ar.toml index 4c56a50aa..52c113580 100644 --- a/nameparser/vocab/ar.toml +++ b/nameparser/vocab/ar.toml @@ -697,12 +697,14 @@ completed_by = [ "الاول", "الاکرم", "البارئ", + "البارى", "الباري", "الباری", "الباسط", "الباطن", "الباعث", "الباقر", + "الباقى", "الباقي", "الباقی", "البديع", @@ -731,6 +733,7 @@ completed_by = [ "الحلیم", "الحميد", "الحمید", + "الحى", "الحي", "الحکم", "الحکیم", @@ -764,6 +767,7 @@ completed_by = [ "السميع", "السمیع", "السند", + "الشافى", "الشافي", "الشافی", "الشكور", @@ -775,9 +779,11 @@ completed_by = [ "الصمد", "الضار", "الظاهر", + "العاطى", "العاطي", "العاطی", "العال", + "العالى", "العالي", "العالی", "العباس", @@ -787,12 +793,14 @@ completed_by = [ "العظيم", "العظیم", "العفو", + "العلى", "العلي", "العليم", "العلی", "العلیم", "الغفار", "الغفور", + "الغنى", "الغني", "الغنی", "الفتاح", @@ -802,11 +810,13 @@ completed_by = [ "القدير", "القدیر", "القهار", + "القوى", "القوي", "القوی", "القيوم", "القیوم", "الكاظم", + "الكافى", "الكافي", "الكبير", "الكريم", @@ -821,8 +831,10 @@ completed_by = [ "المالک", "المانع", "المبدئ", + "المبدى", "المبدي", "المبدی", + "المتعالى", "المتعالي", "المتعالی", "المتكبر", @@ -834,9 +846,11 @@ completed_by = [ "المجیب", "المجید", "المحسن", + "المحصى", "المحصي", "المحصی", "المحمود", + "المحيى", "المحيي", "المحیی", "المذل", @@ -846,10 +860,12 @@ completed_by = [ "المطلب", "المعبود", "المعز", + "المعطى", "المعطي", "المعطی", "المعيد", "المعید", + "المغنى", "المغني", "المغنی", "المقتدر", @@ -865,6 +881,7 @@ completed_by = [ "المنان", "المنتقم", "المنعم", + "المهدى", "المهدي", "المهدی", "المهيمن", @@ -872,23 +889,28 @@ completed_by = [ "الموجود", "الموخر", "المولى", + "المولي", "المولی", "المومن", "الناصر", "النافع", + "النبى", "النبي", "النبی", "النور", + "الهادى", "الهادي", "الهادی", "الواجد", "الواحد", "الوارث", "الواسع", + "الوالى", "الوالي", "الوالی", "الودود", "الوكيل", + "الولى", "الولي", "الولی", "الوهاب", @@ -898,8 +920,8 @@ completed_by = [ "الکبیر", "الکریم", ] -note = "\"abd\" (servant of): the script writes Abdul Rahman as two words, عبد + الرحمن, the article attaching to the word after it, so عبد alone covers the abdul/abdel/abdal spellings -- عبد الرحمن -> given \"عبد الرحمن\". completed_by lists the words that make it one name unit past the first name word (rules/P12): the 97 one-word names of God, الله, 27 other divine epithets and 14 devotional completions (المطلب, النبي, الحسين, المسيح) found after it in ORCID and JRC-Names, each with its hamza-less and Persian spellings -- سعيد عبد الله -> family \"عبد الله\". An unlisted word after it is left alone: a short given name stands alone there (نوال عبد هاشم), and a nisba surname opens with the article too (عبد القريشي; 2026-11-04, #694, decisions/P12). The Latin spellings list none, being written completes_any instead (#1464), and a word written second joins the word before it from its own bound_second reading (الدين, الله, #1072; decisions/P12)" -issue = [269, 694] +note = "\"abd\" (servant of): the script writes Abdul Rahman as two words, عبد + الرحمن, the article attaching to the word after it, so عبد alone covers the abdul/abdel/abdal spellings -- عبد الرحمن -> given \"عبد الرحمن\". completed_by lists the words that make it one name unit past the first name word (rules/P12): the 97 one-word names of God, الله, 27 other divine epithets and 14 devotional completions (المطلب, النبي, الحسين, المسيح) found after it in ORCID and JRC-Names, each with its hamza-less and Persian spellings and, for each word ending in ي, the spelling with a final ى that Egyptian names write, with المولي for المولى, the converse (#1337) -- سعيد عبد الله -> family \"عبد الله\". An unlisted word after it is left alone: a short given name stands alone there (نوال عبد هاشم), and a nisba surname opens with the article too (عبد القريشي; 2026-11-04, #694, decisions/P12). The Latin spellings list none, being written completes_any instead (#1464), and a word written second joins the word before it from its own bound_second reading (الدين, الله, #1072; decisions/P12)" +issue = [269, 694, 1337] [[word]] text = "الدين" diff --git a/nameparser/vocab/en.toml b/nameparser/vocab/en.toml index f702c9c0c..111cbb49e 100644 --- a/nameparser/vocab/en.toml +++ b/nameparser/vocab/en.toml @@ -497,6 +497,10 @@ military = {} text = "adm" military = { same_as = "admiral" } +[[word]] +text = "air-marshal" +military = { issue = 966, note = "the rank written with its hyphen, which tokenize keeps inside one word, so the spaced rank's phrase never reaches it. Measured with the other seven hyphenated ranks (#966, 2026-11-20): no local corpus name moves on this word (govuk-people's 6 moves are all vice-marshal); no source tools/name_usage.py reads has a bearer of any of the eight" } + [[word]] text = "amn" military = { expands = "Airman" } @@ -522,6 +526,10 @@ text = "brig" military = { same_as = "brigadier", abbreviation = true, attaches = ["gen", "general", "sir"], issue = 999, decided = 2026-11-03, note = "a title only inside a title phrase, its given reading the clash (rules/H9): 'Brig Gen Mark Kimmitt' and 'Brig General John Smith' read the title, 'Brig Klyce' the given name, and 'Brig. Saeed Akhtar' the title by H2's shape; written with its period at the end it is H5's trailing title ('JENKINS, ROBERT G. BRIG. GEN.'); no title before #999, so a bare 'Brig John Smith' reads given 'Brig' as it did" } given = { us_ssa = 72, as_of = 2026-11-03, note = "a rare given name: US SSA 72 births; PatentsView inventors 12 (US 11), ORCID given boxes 11 (India 3, likely the rank typed into the box); Wikidata none found; nam_dict not listed" } +[[word]] +text = "brigadier-general" +military = { issue = 966, note = "the rank written with its hyphen, which tokenize keeps inside one word, so the spaced rank's phrase never reaches it. Measured with the other seven hyphenated ranks (#966, 2026-11-20): no local corpus name moves on this word (govuk-people's 6 moves are all vice-marshal); no source tools/name_usage.py reads has a bearer of any of the eight" } + [[word]] text = "captain" military = {} @@ -539,6 +547,10 @@ credential = {} text = "ccmsgt" military = { expands = "Command Chief Master Sergeant" } +[[word]] +text = "chief-marshal" +military = { issue = 966, note = "the rank written with its hyphen, which tokenize keeps inside one word, so the spaced rank's phrase never reaches it. One of five added after the PR's review (#966, 2026-11-20): govuk-people 0 of 6,021 and ukec-individuals 0 of 15,214 names move; no source tools/name_usage.py reads has a bearer of it" } + [[word]] text = "cmsaf" military = { expands = "Chief Master Sergeant of the Air Force" } @@ -634,6 +646,10 @@ military = { expands = "Ensign" } text = "fadm" military = { expands = "Fleet Admiral" } +[[word]] +text = "field-marshal" +military = { issue = 966, note = "the rank written with its hyphen, which tokenize keeps inside one word, so the spaced rank's phrase never reaches it. One of five added after the PR's review (#966, 2026-11-20): govuk-people 0 of 6,021 and ukec-individuals 0 of 15,214 names move; no source tools/name_usage.py reads has a bearer of it" } + [[word]] text = "gaf" military = { expands = "General of the Air Force" } @@ -673,6 +689,18 @@ text = "lt" military = { same_as = "lieutenant", attaches = ["gen"], note = "attaches: Lt Gen (rules/H9, #999), the rank written short being a title only in a phrase" } credential = {} +[[word]] +text = "lieutenant-colonel" +military = { issue = 966, note = "the rank written with its hyphen, which tokenize keeps inside one word, so the spaced rank's phrase never reaches it. Measured with the other seven hyphenated ranks (#966, 2026-11-20): no local corpus name moves on this word (govuk-people's 6 moves are all vice-marshal); no source tools/name_usage.py reads has a bearer of any of the eight" } + +[[word]] +text = "lieutenant-commander" +military = { issue = 966, note = "the rank written with its hyphen, which tokenize keeps inside one word, so the spaced rank's phrase never reaches it. One of five added after the PR's review (#966, 2026-11-20): govuk-people 0 of 6,021 and ukec-individuals 0 of 15,214 names move; no source tools/name_usage.py reads has a bearer of it" } + +[[word]] +text = "lieutenant-general" +military = { issue = 966, note = "the rank written with its hyphen, which tokenize keeps inside one word, so the spaced rank's phrase never reaches it. Measured with the other seven hyphenated ranks (#966, 2026-11-20): no local corpus name moves on this word (govuk-people's 6 moves are all vice-marshal); no source tools/name_usage.py reads has a bearer of any of the eight" } + [[word]] text = "ltc" military = { expands = "Lieutenant Colonel" } @@ -705,6 +733,10 @@ military = { issue = 752, decided = 2026-10-25, attaches = ["gen", "general"], n given = { us_ssa = 21749, wikidata = 65, as_of = 2026-10-25, note = "US SSA: female and male births added" } family = { us_census_2010 = 20977, wikidata = 400, as_of = 2026-10-25 } +[[word]] +text = "major-general" +military = { issue = 966, note = "the rank written with its hyphen, which tokenize keeps inside one word, so the spaced rank's phrase never reaches it. Measured with the other seven hyphenated ranks (#966, 2026-11-20): no local corpus name moves on this word (govuk-people's 6 moves are all vice-marshal); no source tools/name_usage.py reads has a bearer of any of the eight" } + [[word]] text = "marshal" military = { issue = 752, decided = 2026-10-26, note = "a title only inside a title phrase, its given reading the clash (rules/H9): 'Field Marshal Bernard Montgomery' reads the title, 'Marshal Yanda' the given name; until 2026-10-26 excluded as a given name (#606)" } @@ -787,6 +819,10 @@ military = { expands = "Rear Admiral" } text = "rdml" military = { same_as = "radm" } +[[word]] +text = "rear-admiral" +military = { issue = 966, note = "the rank written with its hyphen, which tokenize keeps inside one word, so the spaced rank's phrase never reaches it. Measured with the other seven hyphenated ranks (#966, 2026-11-20): no local corpus name moves on this word (govuk-people's 6 moves are all vice-marshal); no source tools/name_usage.py reads has a bearer of any of the eight" } + [[word]] text = "sa" family = { us_census_2010 = 1600, wikidata = 182, as_of = 2026-10-24, note = "The Census writes no diacritics, so its 1,600 is Sa and Sá together (37.88% Asian/PI, so much of it is Korean, Chinese or Vietnamese Sa); Wikidata is a lower bound: 110 as Sá (Portugal, Brazil) plus 72 as Sa" } @@ -805,6 +841,10 @@ military = { attaches = ["maj", "major"], issue = 752, decided = 2026-10-26, not text = "sgt" military = { attaches = ["maj", "major"], issue = 752, decided = 2026-10-26, note = "attaches: Sergeant Major (rules/H9), and since #999 Sgt Maj; a word, not the military kind, which made Sgt Marshal Smith a title", same_as = "sergeant" } +[[word]] +text = "sergeant-major" +military = { issue = 966, note = "the rank written with its hyphen, which tokenize keeps inside one word, so the spaced rank's phrase never reaches it. One of five added after the PR's review (#966, 2026-11-20): govuk-people 0 of 6,021 and ukec-individuals 0 of 15,214 names move; no source tools/name_usage.py reads has a bearer of it" } + [[word]] text = "sfc" military = { expands = "Sergeant First Class" } @@ -858,6 +898,18 @@ military = { expands = "Technical Sergeant" } text = "vadm" military = { expands = "Vice Admiral" } +[[word]] +text = "vice-admiral" +military = { issue = 966, note = "the rank written with its hyphen, which tokenize keeps inside one word, so the spaced rank's phrase never reaches it. Measured with the other seven hyphenated ranks (#966, 2026-11-20): no local corpus name moves on this word (govuk-people's 6 moves are all vice-marshal); no source tools/name_usage.py reads has a bearer of any of the eight" } + +[[word]] +text = "vice-marshal" +military = { issue = 966, note = "the rank written with its hyphen, which tokenize keeps inside one word, so the spaced rank's phrase never reaches it. Measured with the other seven hyphenated ranks (#966, 2026-11-20): govuk-people 6 of 6,021 names gain a title, every one Air Vice-Marshal, the word they moved on; ukec-individuals 0 of 15,214 move; no source tools/name_usage.py reads has a bearer of any of the eight" } + +[[word]] +text = "wing-commander" +military = { issue = 966, note = "the rank written with its hyphen, which tokenize keeps inside one word, so the spaced rank's phrase never reaches it. One of five added after the PR's review (#966, 2026-11-20): govuk-people 0 of 6,021 and ukec-individuals 0 of 15,214 names move; no source tools/name_usage.py reads has a bearer of it" } + [[word]] text = "wo1" military = { expands = "Warrant Officer 1" } diff --git a/nameparser/vocab/nl.toml b/nameparser/vocab/nl.toml index 0c367043b..eb67f5932 100644 --- a/nameparser/vocab/nl.toml +++ b/nameparser/vocab/nl.toml @@ -121,6 +121,11 @@ text = "vande" given = { note = "declared on the conservative default (decisions/vocabulary-collisions C-i): not examined, and no source counts it as a given name (2026-10-25)" } preposition = { issue = 18, expands = "van de contracted: \"Vande Casteele\"" } +[[word]] +text = "vanden" +given = { us_ssa = 154, as_of = 2026-11-20, note = "male births only; Wikidata lists no given-name bearer" } +preposition = { issue = 1239, expands = "van den contracted", note = "read as vander is: Pieter Vanden Broeck reads family Vanden Broeck, Vanden Broeck Pieter reports PARTICLE_OR_GIVEN under a family-first order. Scored against the filed boxes: ORCID 41 records fixed, none broken; PatentsView 22 fixed, 7 broken (Belgian names whose filer boxed Vanden with the given name); PSC 6 fixed, 2 broken (British names whose filers boxed Vanden as a middle name) (2026-11-20). Case repair writes it in lower case, as it writes vander and vande; Wikidata 6 family (France 2)" } + [[word]] text = "vander" given = { us_ssa = 1828, wikidata = 18, as_of = 2026-10-25, note = "male births only; Wikidata is a lower bound" } diff --git a/tests/v2/cases.py b/tests/v2/cases.py index 66bb5ed03..07d8946f1 100644 --- a/tests/v2/cases.py +++ b/tests/v2/cases.py @@ -22930,4 +22930,152 @@ def _check_cjk_shape_purity(self) -> None: "nickname": "Jack"}, classification="fix(#1164)", notes="a title followed by another opens the trailing run"), + Case("vanden_contracts_van_den_as_vander_does", + "Pieter Vanden Broeck", + {"given": "Pieter", "family": "Vanden Broeck"}, + classification="fix(#1239)"), + Case("vanden_before_a_family_comma", + "Vanden Broeck, Pieter", + {"given": "Pieter", "family": "Vanden Broeck"}, + notes="a guard: the comma fixed the family before #1239"), + Case("vanden_in_capitals_before_a_family_comma", + "VANDEN BROECK, PIETER", + {"given": "PIETER", "family": "VANDEN BROECK"}, + notes="a guard: the comma fixed the family before #1239"), + Case("vanden_after_a_family_comma_reports_the_particle", + "Broeck, Pieter Vanden", + {"given": "Pieter", "family": "Vanden Broeck"}, + ambiguities=("particle-or-given",), + classification="fix(#1239)", + notes="read as 'Broeck, Pieter Vander' is"), + Case("vanden_opening_a_family_first_name_reports_the_particle", + "Vanden Broeck Pieter", + {"given": "Broeck", "middle": "Pieter", "family": "Vanden"}, + policy=Policy(name_order=FAMILY_FIRST), + ambiguities=("particle-or-given",), + classification="fix(#1239)", + notes="a particle that may be a given name opening the name is " + "left to position and reported, as 'Vander Broeck Pieter' " + "is; the fields are 3.1.0's, the report is new"), + Case("hyphenated_rank_after_its_modifier", + "Air Vice-Marshal Ann Reed", + {"title": "Air Vice-Marshal", "given": "Ann", "family": "Reed"}, + classification="fix(#966)"), + Case("hyphenated_rank_before_another_title", + "Vice-Admiral Sir John Smith", + {"title": "Vice-Admiral Sir", "given": "John", "family": "Smith"}, + classification="fix(#966)"), + Case("hyphenated_rank_in_capitals", + "MAJOR-GENERAL JOHN SMITH", + {"title": "MAJOR-GENERAL", "given": "JOHN", "family": "SMITH"}, + classification="fix(#966)"), + Case("hyphenated_rank_after_a_family_comma", + "Reed, Air Vice-Marshal Ann", + {"title": "Air Vice-Marshal", "given": "Ann", "family": "Reed"}, + classification="fix(#966)"), + Case("hyphenated_rank_after_a_second_comma", + "Smith, John, Major-General", + {"title": "Major-General", "given": "John", "family": "Smith"}, + classification="fix(#966)", + notes="was suffix 'Major-General', reported"), + Case("hyphenated_rank_family_first", + "Lieutenant-General Cave Ian", + {"title": "Lieutenant-General", "given": "Ian", "family": "Cave"}, + policy=Policy(name_order=FAMILY_FIRST), + classification="fix(#966)"), + Case("korean_surname_eo_splits_an_unspaced_name", + "어수선", + {"given": "수선", "family": "어"}, + classification="fix(#1215)"), + Case("korean_surname_ra_splits_an_unspaced_name", + "라미란", + {"given": "미란", "family": "라"}, + classification="fix(#1215)"), + Case("korean_surname_ra_splits_a_foreign_name_in_hangul", + "라르스", + {"given": "르스", "family": "라"}, + classification="fix(#1215)", + notes="the accepted cost, decisions/W1 2026-11-20: hangul is " + "read as Korean"), + Case("abd_completed_by_the_alif_maqsura_spelling", + "سامر عبد القوى", + {"given": "سامر", "family": "عبد القوى"}, + classification="fix(#1337)", + notes="read as 'سامر عبد القوي' is"), + Case("abd_completed_by_the_alif_maqsura_spelling_family_first", + "سامر عبد القوى حسن", + {"given": "عبد القوى", "middle": "حسن", "family": "سامر"}, + policy=Policy(name_order=FAMILY_FIRST), + classification="fix(#1337)"), + Case("abd_completed_by_al_mawli", + "سامر عبد المولي", + {"given": "سامر", "family": "عبد المولي"}, + classification="fix(#1337)", + notes="المولى written with a final ي"), + Case("vanden_family_first_reads_the_particle_with_its_word", + "Pieter Vanden Broeck", + {"given": "Vanden Broeck", "family": "Pieter"}, + policy=Policy(name_order=FAMILY_FIRST), + classification="fix(#1239)"), + Case("vanden_in_lower_case_opening_a_family_first_name", + "vanden Broeck Pieter", + {"given": "Pieter", "family": "vanden Broeck"}, + policy=Policy(name_order=FAMILY_FIRST), + classification="fix(#1239)", + notes="a lower-case particle in a mixed-case name opens the family"), + Case("hyphenated_rank_alone_after_a_family_comma", + "Smith, Vice-Admiral", + {"title": "Vice-Admiral", "family": "Smith"}, + classification="fix(#966)"), + Case("hyphenated_rank_after_an_empty_head", + ", Rear-Admiral John Smith", + {"title": "Rear-Admiral", "given": "John", "middle": "Smith"}, + classification="fix(#966)"), + Case("hyphenated_rank_opening_the_part_before_a_family_comma", + "Vice-Admiral Smith, John", + {"title": "Vice-Admiral", "given": "John", "family": "Smith"}, + classification="fix(#966)", + notes="a listed title opening the part before a family comma"), + Case("hyphenated_rank_after_a_full_name_and_a_comma", + "John Smith, Lieutenant-Colonel", + {"title": "Lieutenant-Colonel", "given": "John", "family": "Smith"}, + classification="fix(#966)"), + Case("hyphenated_rank_ending_a_name_bare_stays_a_name_word", + "John Smith Rear-Admiral", + {"given": "John", "middle": "Smith", "family": "Rear-Admiral"}, + notes="a bare title word ending the name is a name word"), + Case("hyphenated_rank_unlisted_stays_a_name_word", + "Squadron-Leader Ann Reed", + {"given": "Squadron-Leader", "middle": "Ann", "family": "Reed"}, + notes="#966 lists thirteen ranks and splits no hyphen"), + Case("hyphenated_rank_british_after_its_modifier", + "Air Chief-Marshal Sir Hugh Dowding", + {"title": "Air Chief-Marshal Sir", "given": "Hugh", + "family": "Dowding"}, + classification="fix(#966)"), + Case("hyphenated_rank_field_marshal", + "Field-Marshal Bernard Lowe", + {"title": "Field-Marshal", "given": "Bernard", "family": "Lowe"}, + classification="fix(#966)"), + Case("hyphenated_rank_wing_commander_family_first", + "Wing-Commander Lau Wing Kin", + {"title": "Wing-Commander", "given": "Wing", "middle": "Kin", + "family": "Lau"}, + policy=Policy(name_order=FAMILY_FIRST), + classification="fix(#966)"), + Case("hyphenated_rank_sergeant_major_reports_no_fork_after_a_second_comma", + "Reed, Ann, Sergeant-Major", + {"title": "Sergeant-Major", "given": "Ann", "family": "Reed"}, + classification="fix(#966)", + notes="the spaced 'Sergeant Major' reports comma-structure here, " + "through major's given reading"), + Case("hyphenated_rank_british_naval", + "Lieutenant-Commander Ann Reed", + {"title": "Lieutenant-Commander", "given": "Ann", "family": "Reed"}, + classification="fix(#966)"), + Case("abd_completed_by_the_alif_maqsura_spelling_given_last", + "سامر عبد القوى", + {"given": "عبد القوى", "family": "سامر"}, + policy=Policy(name_order=FAMILY_FIRST_GIVEN_LAST), + classification="fix(#1337)"), ) diff --git a/tests/v2/test_cases.py b/tests/v2/test_cases.py index 1e678bb39..3e703f0ba 100644 --- a/tests/v2/test_cases.py +++ b/tests/v2/test_cases.py @@ -516,9 +516,12 @@ def test_the_field_sweep_sees_the_claims_it_checks() -> None: # the same day, #1164's alias rows ('Rahim Osman @ Jaki V', 'Ali @ X # @ Y Z V', 'Osman, Rahim @ Jaki PhD Ali', 'Jane née Jones @ JJ V', # 'Dr née Jones @ JJ V', 'Rahim Osman @ Jaki Jr. née Smith', 'Jane - # Smith @ JJ Jr. née') under three orders. - assert claims == 2238, ( - f"the field sweep checks {claims} claims, recorded as 2238 on " + # Smith @ JJ Jr. née') under three orders; 2238 -> 2242 the same day, + # #1239's 'Broeck, Pieter Vanden' under three orders and 'Vanden + # Broeck Pieter' under its declared policy, each reporting + # particle-or-given. + assert claims == 2242, ( + f"the field sweep checks {claims} claims, recorded as 2242 on " f"2026-11-20") @@ -1008,8 +1011,9 @@ def test_the_alternative_sweep_sees_the_fields_it_checks() -> None: # Jaki V', 'Ali @ X @ Y Z V'); 611 -> 614 and 497 -> 500 the same # day, from its fix review's three suffix-or-name rows; 500 -> 509 # the same day, its second fix review's two rows, their reports all - # skipped - assert (checked, skipped) == (614, 509), (checked, skipped) + # skipped; 614 -> 617 the same day, #1239's 'Broeck, Pieter Vanden' + # under three orders + assert (checked, skipped) == (617, 509), (checked, skipped) def test_every_case_name_is_unique() -> None: diff --git a/tools/differential/corpus_cjk.jsonl b/tools/differential/corpus_cjk.jsonl index 0304d84ec..063bd90fe 100644 --- a/tools/differential/corpus_cjk.jsonl +++ b/tools/differential/corpus_cjk.jsonl @@ -175,6 +175,8 @@ "남궁" "남궁민수" "남궁민수, 지훈" +"라르스" +"라미란" "로버트 다우니 주니어" "마이클·잭슨" "마이클.잭슨" @@ -186,6 +188,7 @@ "양 지훈" "양 지훈." "양. 지훈" +"어수선" "이, J.씨" "이, J.씨." "지훈, 남궁민수" diff --git a/tools/differential/corpus_rules.jsonl b/tools/differential/corpus_rules.jsonl index 6d5f73980..cdb066e5d 100644 --- a/tools/differential/corpus_rules.jsonl +++ b/tools/differential/corpus_rules.jsonl @@ -2108,6 +2108,7 @@ "د/أحمد علي حسن" "سامر بن الله" "سامر ذو الغنى" +"سامر عبد القوى" "سامر عز الدين" "سامر نور الدين حداد" "سعيد عبد الله" diff --git a/tools/differential/snapshot.jsonl b/tools/differential/snapshot.jsonl index d155f6298..f5a87633c 100644 --- a/tools/differential/snapshot.jsonl +++ b/tools/differential/snapshot.jsonl @@ -6196,6 +6196,7 @@ {"name": "سامانتا", "order": "FAMILY_FIRST", "given": "سامانتا", "ambiguities": ["GIVEN_OR_FAMILY"], "alternatives": ["GIVEN_OR_FAMILY: name as family (position)"]} {"name": "سامر بن الله", "given": "سامر", "family": "بن الله", "patronymic": "بن الله"} {"name": "سامر ذو الغنى", "given": "سامر", "family": "ذو الغنى"} +{"name": "سامر عبد القوى", "given": "سامر", "family": "عبد القوى"} {"name": "سامر عز الدين", "given": "سامر", "family": "عز الدين"} {"name": "سامر نور الدين حداد", "given": "سامر", "middle": "نور الدين", "family": "حداد"} {"name": "سامي الكيالي", "given": "سامي", "family": "الكيالي"} @@ -7654,6 +7655,8 @@ {"name": "남다름", "given": "다름", "family": "남"} {"name": "노유상", "given": "유상", "family": "노"} {"name": "도민호", "given": "민호", "family": "도"} +{"name": "라르스", "given": "르스", "family": "라"} +{"name": "라미란", "given": "미란", "family": "라"} {"name": "로버트 다우니 주니어", "given": "다우니", "family": "로버트", "suffix": "주니어", "generation": "주니어"} {"name": "류효영", "given": "효영", "family": "류"} {"name": "마이클·잭슨", "given": "마이클", "family": "잭슨"} @@ -7698,6 +7701,7 @@ {"name": "양 지훈", "given": "지훈", "family": "양"} {"name": "양 지훈.", "given": "지훈.", "family": "양"} {"name": "양. 지훈", "given": "지훈", "family": "양."} +{"name": "어수선", "given": "수선", "family": "어"} {"name": "에이다 코넬리아 세사르 마르틴 폰 볼프 박사", "given": "코넬리아", "middle": "세사르 마르틴 폰 볼프", "family": "에이다", "suffix": "박사"} {"name": "오정숙", "given": "정숙", "family": "오"} {"name": "유명희", "given": "명희", "family": "유"} From d71c3a974f724f99542cbdb15e6fe5db18a17388 Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Fri, 20 Nov 2026 15:41:03 -0800 Subject: [PATCH 2/8] Add the Mexican dotted degrees L.A.E., L.C.P., L.E.M. and M.A.P. as titles (#979) es.toml academic readings written with their stops, so rules/T7's vocabulary Except keeps the run whole and it reads as the title at the head of a name. Kept apart from the other four fixes: letters spelling a degree are a person's initials too, and after a family comma or before a single surname they now lose the given name (Perez, M.A.P.), a cost the boxed corpora cannot count (decisions/H10, 2026-11-20; decisions/H6 gains a head note). Co-Authored-By: Claude Opus 5.5 --- .../H10-title-written-as-a-run-of-letters.md | 5 +- .../H6-title-before-a-family-comma.md | 2 +- docs/design/decisions/period-joined-words.md | 2 +- ...given-name-written-as-a-run-of-initials.md | 1 + docs/release_log.rst | 1 + nameparser/config/_compiled.py | 4 ++ nameparser/config/_index.py | 4 ++ nameparser/vocab/es.toml | 16 +++++++ tests/v2/cases.py | 46 +++++++++++++++++++ tools/differential/corpus_rules.jsonl | 1 + tools/differential/snapshot.jsonl | 1 + 11 files changed, 80 insertions(+), 3 deletions(-) diff --git a/docs/design/decisions/H10-title-written-as-a-run-of-letters.md b/docs/design/decisions/H10-title-written-as-a-run-of-letters.md index 862f72913..d78df2679 100644 --- a/docs/design/decisions/H10-title-written-as-a-run-of-letters.md +++ b/docs/design/decisions/H10-title-written-as-a-run-of-letters.md @@ -6,7 +6,9 @@ - Where the comma's decision reports paired initials opening the part after it (rules/C11), the report stands on a run this rule reads as the title (`Smith, U.S. Senator John`) — 2026-11-09 #490. - Only the titles that abbreviate several words are marked, so initials spelling a title of one word stay a name with a title word behind them (`D.R. Judge Smith` → given names 'D.R. Judge' (rules/T7 parting the run)); the cost kept is a person whose initials spell a marked title and whose next name is a title word (`P.D. Judge Smith` → title 'P.D. Judge') — 2026-11-09 #490, DECIDED. -Open: which vocabulary reads a degree acronym written this way at the front of a name in the `es` pack (`L.C.P.`) is [#979](https://github.com/derek73/python-nameparser/issues/979)'s, which can now mark its titles `dotted` or ask for more. +- The three-letter Mexican degrees `L.C.P.`, `L.A.E.`, `L.E.M.` and `M.A.P.` are listed in `es.toml` written with their stops, as default readings, not marked `dotted`, so `L.C.P. Ana Ruiz Paz` reads title 'L.C.P.' with no title behind it — 2026-11-20 #979. + +Open: the two-letter degrees (`C.P.`, `L.C.`, `L.A.`, `D.I.`), written as initials too (`C.P. Martínez`), stay initials; [#979](https://github.com/derek73/python-nameparser/issues/979) holds them. Elsewhere: why a run of single letters joined by full stops stays one word while the name is read, decisions/period-joined-words; its parting into initials once roles are final where it is the given name (`U.S. Grant` → given 'U.', middle 'S.'), decisions/T7's 2026-11-10 #1296 entry, which also answered the other half of #490, left out of #490's fix as its 2026-10-02 comment proposed (`E.T. Smith` → given 'E.', middle 'T.'). @@ -18,3 +20,4 @@ Elsewhere: why a run of single letters joined by full stops stays one word while THE MECHANISM. classify tags the run (`vocab:dotted-title`) where its folded spelling without stops is in the set and its text is a run of two or more single letters joined by stops, the last stop optional (`_vocab.is_dotted_title`). `_pieces.leading_titles`, the given part's leading run, counts a tagged piece as a title word, applies H3's floor, then gives back a tagged piece the run ends on, and asks the one before it again (`Hon. U.S. Grant` keeps title 'Hon.'). H6's run before a family comma, which reads by vocabulary only, does the same, so `U.S. Senator Smith, John` reads as `US Senator Smith, John` does; it now counts its run before setting roles. The run is read as the title it spells by the other readers of the head too: by H9's phrase test, so a gated title behind it has its partner (`U.S. Marshal John Smith` reads as `US Marshal John Smith`), and by C4's count of name words before a comma, which counts it as a title only where it opens the part (behind any titles) and a title, listed or by H2's shape, follows it with a word behind (a word of any kind, so `U.S. Senator Jr., Ed` counts it, and the floor then gives 'Senator' back and the run after it, reading as master did), so `U.S. Senator Smith, Ed` keeps given 'Ed' as its undotted twin does (both found by the code review: the first build read `U.S. Marshal` as given 'U.S.' and `U.S. Senator Smith, Ed` as title 'U.S. Senator', suffix 'Ed', no given name). A run a connective joins to another (`U.S. and U.K. Ambassador`) is one unit of several words and stays a name, an accepted gap. H9's phrase test reads the run as the modifier it spells wherever it stands, as it reads the undotted twin, so `John Smith U.S. Dean.` reads title 'Dean.', family 'U.S.' as `John Smith US Dean.` does (master and 1.4.0 read family 'Dean.'), the run then reporting `suffix-or-name` as rules/S3's unlisted dotted shape ending the name, which its undotted twin cannot raise, and `U.S. Vice Smith`, two modifiers with no head, keeps given 'U.S.' (both found by the review of the fix commit; accepted as the twin's reading, rules/H10's Accepted clause). The fold runs only where the name holds a word H9 reads, so a name with a run and no such word (`U.S. Grant`) pays no phrase test for it. Where the count reads the run as a title and H6 then gives it back (`U.S. Insp. Smith, Ed`, H6 reading by vocabulary only, and `U.S. St. Smith, Ed`, a title-particle stopping H6's run), the comma decision is the one the undotted twin makes and the run lands in the family, as H10 reads it with no title kept behind it. The run is read as a title only at the head of a part: at the end of a name H5's chain takes neither the run nor its spelling without stops (`John Smith US Senator` keeps family 'Senator'). THE SWEEP (2026-11-09, re-run after the code review and again after the review of its fix). Twenty-two bases (`{D} District Judge Marc Treadwell`, `{D} Senator John Smith`, `{D} Grant`, `Hon. {D} Grant`, `{D} Senator`, `{D} Senator Jr`, `Mr {D} Ambassador Jane Smith`, `{D} Senator John Smith Jr.`, `{D} Senator John de la Vega`, `{D} Senator Smith`, `Freiherr {D} Senator Smith`, `St {D} Senator Smith`, `Rev. Sr. {D} Senator Smith`, `(Bob) {D} Senator Smith`, `{D} Senator Smith PhD`, `{D} Dr. Smith`, `{D} Marshal John Smith`, `{D} Marshal`, `{D} Dean Smith`, `{D} Senator Smith V`, `{D} Vice Smith`, `John Smith {D} Dean.`) in six comma shapes (none, `Doe Ray, ` and `Doe, ` and `, ` before the base, and `, Mary` and `, Ed` after it) and four spellings (`U.S.`, `U.S`, `u.s.`, `P.D.`), under all three orders, 1,584 rows, each compared with its twin written without stops. Fields differ on 351, every one a row where nothing the run keeps follows it (`{D} Grant`, a lone `{D} Senator` or `{D} Marshal`, `{D} Senator Jr`, where the floor gives 'Senator' back, and `P.D.` before `Marshal`, `Dean` or `Vice`, which take no academic title as their partner or head), which the run's spelling without stops reads as a title where the dotted run stays initials. Every other difference is the `suffix-or-name` report the comma's decision gives paired initials opening the part after it (rules/C11, C5's shape), which master gave the same run read as the given name. It stands now on a run this rule reads as the title, the report naming the title field and the credential as its other reading: accepted rather than dropped, since the comma decides before the title run is read and dropping it would have the comma predict H10's run (rules/H10's Accepted clause). The same sweep made rules/H10 state its precedence over rules/C5, whose given part the run opens. THE CORPORA (measured 2026-11-09 against master b89c5482, py3.11). The snapshot moves one name, the Treadwell row. Local corpora by `snapshot.py --local --base`: ukec-individuals, govuk-people, dof-signatures, fec-individuals and nepal-candidates match the base; ctgov-officials moves the two Privatdozent rows the simulation found, each from given 'P.D.' to title 'P.D. Dr.' (`Edgar Santos-Marcial, P.D. Dr. med` and `Martin Beiderlinden, P.D. dr. - med.`, whose given names, 'med' and '-', were no better before). opensanctions-parliaments was not read: its cached fetch predates the datasets the tool now reads, and refreshing it rewrites the cache every session shares. +- 2026-11-20 #979 — THE THREE-LETTER MEXICAN DEGREES ARE LISTED WRITTEN WITH THEIR STOPS, NOT MARKED `dotted`. `L.C.P.`, `L.A.E.`, `L.E.M.` and `M.A.P.` open Mexican signatures, and since rules/T7 parted a run of initials `L.C.P. Ana Ruiz Paz` read given 'L.', middle 'C.P. Ana Ruiz'. Marking them `dotted` would not reach them: this rule reads a marked run only where a title the run keeps follows it, and a degree stands straight before the name. Written with their stops in `es.toml` they are T7's vocabulary Except, a run the vocabulary lists as a word of its own, and read as the title they are listed as at the head of a name, after a family comma, and, as any listed title, after a second comma or ending the name (rules/C2, rules/H5; `Ana Ruiz Paz, L.C.P.` reads title 'L.C.P.', where it read the suffix); the undotted spellings are untouched (`MAP` stays out, decisions/H6). Default readings, not `default = false` under ES: measured 2026-11-20 against master `cb5088a9` with `uv run python tools/differential/measure.py --base `, dof-signatures moves 34 distinct names, every one gaining the title (33 moving the given and middle names, 1 the family too), and the whole of orcid-researchers, patentsview-inventors and psc-individuals moves 1, a Sri Lankan name whose initials are `M.A.P.`, now the degree. THE COST THAT COUNT CANNOT SEE: those three hold names composed given first from filed boxes, so none writes initials after a family comma or after a single surname, where the degree's letters are a person's initials: `Perez, M.A.P.` reads title 'M.A.P.', family 'Perez', with no given name and no report, where it read given 'M.', middle 'A.P.' with a `suffix-or-name` report; `M.A.P. Perera` and `L.E.M. Smith` lose their given initials the same way; and `Perez M.A.P.` under `FAMILY_FIRST`, read right before, reads the title. A choice of Spanish would narrow who pays, not remove it, Spanish names being written as initials too (found by the PR's review, 2026-11-20). The two-letter degrees (`C.P.` 422 signatures, `L.C.` 91, `L.A.` 38) stay out: they are written as initials too (`C.P. Martínez`), and #979 holds them. diff --git a/docs/design/decisions/H6-title-before-a-family-comma.md b/docs/design/decisions/H6-title-before-a-family-comma.md index a80421f56..0a9b943f1 100644 --- a/docs/design/decisions/H6-title-before-a-family-comma.md +++ b/docs/design/decisions/H6-title-before-a-family-comma.md @@ -32,7 +32,7 @@ Left out: `mo`, which 45 names write as Muhammad with its period at the head (`MO. IBRAR KHAN`, 42 of them Nepalese candidates). Bare `Mo` is mostly the Chinese and Korean name (ORCID family boxes 3,478, China 952; given 1,546, China 252), and a `given` reading would report a Mo Yan's given name as read in the file holding it (`Reading.languages`). `md` keeps its 2026-10-27 reading (decisions/indic-honorifics: `Md.` a title by the shape, an accepted cost; decisions/C3's 2026-11-02 #1017 entry declined its given reading because of its credential). The titles, the pack-only degrees on by default and the exclusions of `bc`, `mst` and `sig` are #1115's later batches. - 2026-11-06, #1115, the second batch — THE TITLES WITH NO NAME BEARERS, LISTED. From the same mining, the words that open names as titles and that no source counts as a name (under 100 US Census bearers, under 5 US SSA births a year, Wikidata 2 or fewer, `tools/name_usage.py --boxes` on 2026-11-06): `engr`, `adv` and the modifier `assist` (en.toml, beside `engineer`, `advocate` and `assistant`), `ir` and `drs` (mul.toml: the Dutch and Indonesian degrees, Hong Kong's and Malaysia's registered engineer, and the English plural of Dr), `excm` and `excma` (ca.toml) and `excmo` and `excma` (es.toml). Listing reaches what H2's shape could not: the bare spelling (`Engr Ahsen Ali` → title 'Engr', given 'Engr', middle 'Ahsen' before), a title run behind a listed title (`Prof dr ir Simon Peeters` → title 'Prof dr ir', given 'ir' before), the part after a comma, where a part of titles alone fixes no family boundary (rules/C8; `Esra Oz, Assist Prof` → title 'Assist Prof', given 'Esra', family 'Esra Oz' before), the given part's end after a family comma (`BAXTER, JENNIFER DRS.`) and H6's run (`Excm. Sr. Lloret Palol, Josep Antoni` → title 'Excm. Sr.', family 'Lloret Palol'). Measured with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)(^|[^\w])(engr|adv|ir|drs|assist|excm|excma|excmo)\b' '' default` on 2026-11-06 against `e76cdad3`: 246 of 662 matching names move, ClinicalTrials.gov officials 175 of them (`Name, Assist Prof`), every move read by eye, nearly all a title leaving a name field. The costs among them: four tokens gluing a title to a name word with a period take the word into the title, as `Dr.` already does (`Engr.Nurunnabi` → title 'Engr.Nurunnabi' and no name, `Engr.Wlla Al-Mhairat`, `Engr.Gamachu Busa Meskele`, `DAVIDSON, DRS.PAULA DMARY`); one credential run splits (`…, PGCert HE, Reg Engr, MIMechE` → title 'Dr Engr', suffix '…, Reg, MIMechE'); eleven ClinicalTrials.gov officials writing `Res. Assist` or `Res Assist.` read title 'Assist', suffix 'Res.', as the listed `Res. Asst.` already did, and two writing it glued (`Res.Assist.`) move whole from suffix to title; and one ORCID record holds three names in a list. A lone `Assist` reads as `Asst` does (rules/H9): a title opening a name only before a head title (`Assist John Smith` keeps given 'Assist'), and a title alone ending a name or after a comma (`John Smith Assist.` → title 'Assist.'). Left out, each borne as a name: `eng` (US Census 2010 10,682 surname bearers; ORCID given boxes 468, Malaysia 63, Singapore 49), `er` (ORCID family boxes 1,087), `doc` (US SSA 1,391 births, Wikidata 130 given names: Doc Rivers), `ven` (Wikidata 448 given names, ORCID family boxes 214) and `em` (US Census 885). Their dotted spelling opening a name stays a title by H2's shape. The Spanish and Czech titles the mining found unlisted (`Licda.`, `Gral.`, `Tte.`, `RSDr.`, `plk.`) wait for the batch that decides which pack-only titles the default reads, with those listed `default = false` already (`ThDr.`, `MUDr.`, `Lic.`), since listing them so would move no default parse. -- 2026-11-07, #1129 — #1115's CANDIDATES CARRIED FORWARD: THREE LISTED BY DEFAULT, ONE FOR THE CZECH PACK, THE REST LEFT OUT. Each candidate's bearers were counted with `uv run python tools/name_usage.py --boxes` and its incidence with `uv run python tools/vocab/word_report.py --rank` (2026-11-07, against `54318d78`). Listed by default: `sk` (bn.toml), Sheikh written short, as a `given` reading with `same_as`, so `Sk. Monirul Islam` reads given 'Sk.' as `Sheikh Ahmed Khan` reads given 'Sheikh' since #912 (title 'Sk.', given 'Monirul' before), no source counting it as a name of its own and ORCID's given boxes holding it 1,008 times (India 351, Bangladesh 119), some of them the initials S. K.; `biól` and `mgtr` (es.toml), Mexico's biologist and the Andean magíster, which no source counts as a name. Measured with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)(^|[^\w])(sk|bi[oó]l|mgtr|mjr|mtr|lcp|mvz|act|map)\b' 'expr:Parser(lexicon=Lexicon.default().remove("biól", kind="academic").remove("mgtr", kind="academic").remove("sk", kind="given"))' default` (the comparator the default without the three readings; `mjr` was also removed in the run, before it went to the pack): 20 of 258 matching names move, every one `sk` from the title to the given name (`Mr Sk. Mazamel Islam`, `Dr. Sk. Md. Masudul Ahsan`, `Sk. Nahid`), and in two of them a `Md.` behind it from the title to the middle name, since H2's shape chains only from the head (`Sk. Md. Atiqur Rahman` → given 'Sk.', middle 'Md. Atiqur', title 'Sk. Md.' before): the #1115 entry's `Md.` title by the shape holds where it opens the name or follows a title; `biól` and `mgtr` move none, their corpus spellings being the dotted head H2's shape already read. `local_agreement.py --base` on a checkout of `54318d78`: ORCID 12 records closer to the boxes and none further, 6 changed (the filer typed the whole name in the given box), PSC 1 closer (`Mr Sk. Mazamel Islam`, `Sk.` typed in the forename box). +- 2026-11-07, #1129 (its reason for leaving `lcp` out, that `L.C.P.` reads as initials whatever the vocabulary says, superseded by decisions/H10's 2026-11-20 #979 entry: a run listed with its stops reads as that word, rules/T7's vocabulary Except) — #1115's CANDIDATES CARRIED FORWARD: THREE LISTED BY DEFAULT, ONE FOR THE CZECH PACK, THE REST LEFT OUT. Each candidate's bearers were counted with `uv run python tools/name_usage.py --boxes` and its incidence with `uv run python tools/vocab/word_report.py --rank` (2026-11-07, against `54318d78`). Listed by default: `sk` (bn.toml), Sheikh written short, as a `given` reading with `same_as`, so `Sk. Monirul Islam` reads given 'Sk.' as `Sheikh Ahmed Khan` reads given 'Sheikh' since #912 (title 'Sk.', given 'Monirul' before), no source counting it as a name of its own and ORCID's given boxes holding it 1,008 times (India 351, Bangladesh 119), some of them the initials S. K.; `biól` and `mgtr` (es.toml), Mexico's biologist and the Andean magíster, which no source counts as a name. Measured with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)(^|[^\w])(sk|bi[oó]l|mgtr|mjr|mtr|lcp|mvz|act|map)\b' 'expr:Parser(lexicon=Lexicon.default().remove("biól", kind="academic").remove("mgtr", kind="academic").remove("sk", kind="given"))' default` (the comparator the default without the three readings; `mjr` was also removed in the run, before it went to the pack): 20 of 258 matching names move, every one `sk` from the title to the given name (`Mr Sk. Mazamel Islam`, `Dr. Sk. Md. Masudul Ahsan`, `Sk. Nahid`), and in two of them a `Md.` behind it from the title to the middle name, since H2's shape chains only from the head (`Sk. Md. Atiqur Rahman` → given 'Sk.', middle 'Md. Atiqur', title 'Sk. Md.' before): the #1115 entry's `Md.` title by the shape holds where it opens the name or follows a title; `biól` and `mgtr` move none, their corpus spellings being the dotted head H2's shape already read. `local_agreement.py --base` on a checkout of `54318d78`: ORCID 12 records closer to the boxes and none further, 6 changed (the filer typed the whole name in the given box), PSC 1 closer (`Mr Sk. Mazamel Islam`, `Sk.` typed in the forename box). For the Czech pack: `mjr` (cs.toml, `default = false`), the rank, since an ORCID researcher in Sri Lanka files `MJR` as the given name, initials, which a default title reading took (1 record further from the boxes); the class #1115's pack batch kept off (`MgA`, `GS`). Excluded, each also a credential written after names, which a title reading after a comma takes from the suffix or the given name (rules/C2 past a second comma, rules/C8 in the part after the first, and a lone word ending the given part after a family comma), measured under `plain:ES` against the same command run in both trees (`--readings`, compared line by line): `mtr` (5 ClinicalTrials.gov officials, `Shana McCormack, MD, MTR` → title 'MTR', and a one-comma `John Smith, MTR` alike; against them 5 UK PSC names opening with a bare `Mtr`, which their filers typed in the title box, read the title, gains a Spanish choice is not the place for), `act` (`Terry L Grindstaff, PhD, PT, ACT`) and `map` (also an English word and a filed given name, FEC's `SAN, MAP` → title 'MAP' with no given name; `Jorge Luis Loáiciga Gutiérrez, MAP, Lic` → title 'PhD. MAP Lic' from the part after the first comma; 1 of its 3 moves the title meant). Not listed, with nothing to gain: `lcp` and `mvz`, because Mexico's DOF signatures write them as `L.C.P.` and `M.V.Z.`, which read as initials whatever the vocabulary says, and their dotted head `LCP.` is a title by H2's shape already; listed in the Spanish pack, they moved no corpus name. Nor the unaccented `biol`, written after a comma as the field of a diploma (`Dipl. Biol.`, ClinicalTrials.gov officials 11), the decisions/H6 2026-11-06 Diplom entry's shape. Left out as borne names: `sen` (US Census 2010 3,059; ORCID given boxes 2,337; and `Sen.` ending a name is also Senior), `ku` (US Census 4,888; Wikidata 2,396 family names), `cor` (nam_dict band 6 in the Netherlands; Wikidata 260 given names), `prim` (US Census 2,019; US SSA 245 births), `dip` (US Census 337; nam_dict band 2 in India and Sri Lanka), `lae` (US Census 144; nam_dict band 3), `med` (ORCID given boxes 232, Med being Mohamed written short) and `jan`. Left out, ambiguous or too rare to weigh: `sh` (Sheikh, and India's Shri, which hi.toml refuses as a title because it opens given names), `kh` (several names it shortens), `th` and `ph` (2 names each; `Ph.` also opens a spaced `Ph. D.`), `rr` (ORCID given boxes 195, initials), `ass` (`Ass. Prof.` reads as a title through H2's chain already) and `akad` (needs `Akad. mal.` as a phrase, 10 names). `mt` stays out, and no issue tracks it: a particle reading would need the period, which no reading can require, and the property that would let one is not worth building for the one corpus name it would fix (#1129's measurement: 6 corpus names write `Mt.`, 1 of them a surname head, `Gregory G. Mt. Pleasant`). A caller whose names hold it adds a particle reading to a `Lexicon` of their own; reconsider if a new corpus writes it more often. diff --git a/docs/design/decisions/period-joined-words.md b/docs/design/decisions/period-joined-words.md index 9b5b561e1..d010b8fc1 100644 --- a/docs/design/decisions/period-joined-words.md +++ b/docs/design/decisions/period-joined-words.md @@ -6,7 +6,7 @@ - Otherwise, a word may divide after a full stop only where two things hold. The chunk before the stop must be one the parser reads on its own (a single letter, a transliteration digraph rules/H2 names since #1136, a listed title, a listed given name written short, or a saint particle), and what follows must be a name. A divided word is to read as it does with a space there: `Dr.John Smith` as `Dr. John Smith`, `J.Smith` as `J. Smith`, `Mark Jhon Sta.Ana` as `Mark Jhon Sta. Ana`, `Lt.Gov.John` as `Lt.Gov. John`. That target is decided. The test that tells a name after the stop from a field or a title written without its own stop (`Dr.Med`, `A.Professor`) was left open here; decisions/T8 answers it by position, dividing before any comma only, and shipped the division; a saint particle glued to a name is one name word there, divided only as the part's last name word (`Mark Jhon Sta.Ana`, #1071) — 2026-11-09 #1255, amended 2026-11-10 #1230, #1235. - Two kinds of word do not divide, and keep today's reading. The first has a lowercase letter after the stop (`G.ppe`, `Dr.philol.`, `Dott.ssa`, `Fr.co`). The second is a degree written with its field and closed by its own full stop (`Dipl.Ing.`, `Dr.Med.`, `Lt.Gen.`). What tells that field from a glued name closed by a stop (`Mrs.Smith.`) decisions/T8 answers by keeping both whole. Which other first chunks the parser reads on its own was #1230's question, answered there: a listed title divides, an unlisted one does not — 2026-11-09 #1255, amended 2026-11-10 #1230. - A transliteration digraph is a chunk the parser reads on its own, the ones rules/H2 names and only those (`Yu`, `Ya`, `Ye`, `Yo`, `Zh`, `Kh`, `Shch`, `Dzh`), so `Yu.A.Chibrikova` is to divide as `Yu. A. Chibrikova` reads. `Ts`, `Ch` and `Sh` are not: rules/H2 reads each as a title by shape, since each is also a title written short, so under the default vocabulary, where `ts` is unlisted, `Ts.Sandag-Ochir` does not divide and keeps today's reading; what it should read was #1230's question for an unlisted first chunk rules/H2 reads as a title, answered by decisions/T8 (it keeps its one word), and stays #1306's for a Mongolian `Ts.`. Under a choice that lists `ts` as a title (`vi`), it is a listed title chunk, and the second Standing line applies to it — 2026-11-09 #1136. -- A run of single letters joined by full stops stays one word wherever the division acts (`E.T.`, `U.S.`, `L.C.P.`, `B.K.`). The division does not decide how it reads. At the front of a name, rules/H10 reads it as a title marked `dotted` where a title follows it (decisions/H10, #490), and #979 asks which `es` degree acronyms join that set. What reads it at the end stays open (rules/S3, #864) — 2026-11-09 #1255. +- A run of single letters joined by full stops stays one word wherever the division acts (`E.T.`, `U.S.`, `L.C.P.`, `B.K.`). The division does not decide how it reads. At the front of a name, rules/H10 reads it as a title marked `dotted` where a title follows it (decisions/H10, #490), and a run listed whole with its stops reads as that word (rules/T7's vocabulary Except), as the three-letter Mexican degrees are since #979 (`L.C.P.`; decisions/H10, 2026-11-20). What reads it at the end stays open (rules/S3, #864) — 2026-11-09 #1255. Elsewhere: a run of single letters spelling a title at the front of a name, decisions/H10's 2026-11-09 #490 entry. 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. diff --git a/docs/design/rules/T7-given-name-written-as-a-run-of-initials.md b/docs/design/rules/T7-given-name-written-as-a-run-of-initials.md index 06d274322..4f8d738b2 100644 --- a/docs/design/rules/T7-given-name-written-as-a-run-of-initials.md +++ b/docs/design/rules/T7-given-name-written-as-a-run-of-initials.md @@ -39,6 +39,7 @@ ``` "J.R. Smith" → given="J." "K.T. Smith" → given="K." + "L.C.P. Ana Ruiz Paz" → title="L.C.P." ``` - **A run in another field** keeps its one word: a middle name's run, and the family name some surnames are written as (B.K.). ``` diff --git a/docs/release_log.rst b/docs/release_log.rst index 7ff917480..3a5f6f870 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -6,6 +6,7 @@ Release Log - **Fix Vanden, the Dutch and Flemish van den written as one word, which read as a middle name.** ``parse("Pieter Vanden Broeck")`` gives family ``Vanden Broeck``, as ``Vander Broeck`` reads, where 1.4.0 through 3.1.0 gave middle ``Vanden``, family ``Broeck``. :issue:`1239` - **Add thirteen military ranks written with a hyphen, such as Vice-Admiral, Air Vice-Marshal and Major-General, as titles.** ``parse("Air Vice-Marshal Ann Reed")`` gives title ``Air Vice-Marshal``, given ``Ann``, where 3.1.0 gave given ``Air``, middle ``Vice-Marshal Ann`` and 1.4.0 title ``Air``, first ``Vice-Marshal``. A hyphenated rank not listed, such as Squadron-Leader, still reads as a name word. :issue:`966` + - **Add the Mexican degrees L.C.P., L.A.E., L.E.M. and M.A.P. as titles.** ``parse("L.C.P. Ana Ruiz Paz")`` gives title ``L.C.P.``, given ``Ana``, where 3.1.0 gave given ``L.``, middle ``C.P. Ana Ruiz`` and 1.4.0 first ``L.C.P.``. Letters that spell one are read as the degree wherever they stand, so ``Perez, M.A.P.`` gives title ``M.A.P.`` and no given name; the two-letter degrees, such as C.P., still read as initials. :issue:`979` - **Add 어 and 라 to the Korean surnames.** ``parse("어수선")`` gives family ``어``, given ``수선``, where 1.4.0 through 3.1.0 kept the name whole. A foreign name written in hangul that begins with 라 is now divided too; a caller who reads such names removes the surname from the ``Lexicon``'s ``surnames``. :issue:`1215` - **Fix a word completing عبد written with a final ى, as Egyptian names write it, which read as a name of its own.** ``parse("سامر عبد القوى")`` gives family ``عبد القوى``, as ``عبد القوي`` reads, where 1.4.0 through 3.1.0 gave middle ``عبد``, family ``القوى``. :issue:`1337` - **Add familiar forms in Central and Eastern European and Balkan languages, found in Wikidata.** With ``familiar-form`` accepted, ``Erzsi Nagy`` / ``Erzsébet Nagy`` and ``Jára Novák`` / ``Jaroslav Novák`` are consistent, where 3.1.0 read a conflict, Czech and Hungarian gaining the most; the Russian, Ukrainian, Belarusian, Bulgarian and most Serbian pairs are written in Cyrillic, so a name romanized in Latin letters does not reach them. :issue:`1387` diff --git a/nameparser/config/_compiled.py b/nameparser/config/_compiled.py index 8bf551a73..fdf3bf43f 100644 --- a/nameparser/config/_compiled.py +++ b/nameparser/config/_compiled.py @@ -725,6 +725,9 @@ 'knowledge', 'krahv', 'kreivi', + 'l.a.e', + 'l.c.p', + 'l.e.m', 'lady', 'lama', 'lamido', @@ -757,6 +760,7 @@ 'ltgen', 'ltjg', 'lyricist', + 'm.a.p', 'madam', 'madame', 'mademoiselle', diff --git a/nameparser/config/_index.py b/nameparser/config/_index.py index 6d2bb6f90..bb5058b5d 100644 --- a/nameparser/config/_index.py +++ b/nameparser/config/_index.py @@ -1614,6 +1614,9 @@ ('kája', (('cs', 'familiar', (('short_for', ('karel',)),)),)), ('kássia', (('pt', 'given', (('after_particle', True),)),)), ("l'", (('fr', 'article', ()), ('it', 'article', ()))), + ('l.a.e', (('es', 'academic', ()),)), + ('l.c.p', (('es', 'academic', ()),)), + ('l.e.m', (('es', 'academic', ()),)), ('la', (('ca', 'article', ()), ('es', 'article', ()), ('es', 'given', ()), ('fil', 'article', ()), ('fr', 'article', ()), ('it', 'article', ()))), ('lac', (('en', 'credential', ()), ('en', 'family', ()))), ('lachie', (('en', 'familiar', (('short_for', ('lachlan',)),)),)), @@ -1768,6 +1771,7 @@ ('léo', (('pt-BR', 'familiar', (('short_for', ('leonardo',)),)),)), ('lída', (('cs', 'familiar', (('short_for', ('ludmila',)),)), ('sk', 'familiar', (('short_for', ('ludmila',)),)))), ('l’', (('fr', 'article', (('same_as', "l'"),)), ('it', 'article', (('same_as', "l'"),)))), + ('m.a.p', (('es', 'academic', ()),)), ('ma', (('en', 'credential', ()), ('en', 'given', ()), ('en', 'family', ()), ('fil', 'given', (('same_as', 'maría'),)))), ('maaa', (('en', 'credential', ()),)), ('mac', (('en', 'clan', ()), ('en', 'given', ()), ('en', 'familiar', (('short_for', ('mackenzie',)),)), ('ga', 'clan', ()), ('gd', 'clan', ()))), diff --git a/nameparser/vocab/es.toml b/nameparser/vocab/es.toml index 8b1515af4..cb9457dc5 100644 --- a/nameparser/vocab/es.toml +++ b/nameparser/vocab/es.toml @@ -101,6 +101,18 @@ academic = { gender = "m", issue = 753, expands = "Ingeniero, engineer, a form o text = "ingeniera" academic = { gender = "f", issue = 753, same_as = "ingeniero", expands = "Ingeniera, the feminine of ingeniero", note = "no name bearer in any source tools/name_usage.py reads (2026-10-30)" } +[[word]] +text = "l.a.e" +academic = { issue = 979, expands = "Licenciado en Administración de Empresas", note = "a Mexican degree written before the name, its three letters joined by full stops; without the reading T7 cut it into initials (L.C.P. Ana Ruiz Paz read given L.). measured with the other three degrees (#979, 2026-11-20): dof-signatures 34 distinct names gain a title, by default and under locales.ES; over the whole of ORCID, PatentsView and PSC no name moves but one ORCID record. Letters spelling it are a person's initials too, which a family comma or a single surname behind them leaves without a given name (Perez, X.Y.Z.; decisions/H10, 2026-11-20). The two-letter degrees (C.P., L.C.) stay out, being written as initials too" } + +[[word]] +text = "l.c.p" +academic = { issue = 979, expands = "Licenciado en Contaduría Pública", note = "a Mexican degree written before the name, its three letters joined by full stops; without the reading T7 cut it into initials (L.C.P. Ana Ruiz Paz read given L.). measured with the other three degrees (#979, 2026-11-20): dof-signatures 34 distinct names gain a title, by default and under locales.ES; over the whole of ORCID, PatentsView and PSC no name moves but one ORCID record. Letters spelling it are a person's initials too, which a family comma or a single surname behind them leaves without a given name (Perez, X.Y.Z.; decisions/H10, 2026-11-20). The two-letter degrees (C.P., L.C.) stay out, being written as initials too" } + +[[word]] +text = "l.e.m" +academic = { issue = 979, note = "its expansion unconfirmed by the corpus; a Mexican degree written before the name, its three letters joined by full stops; without the reading T7 cut it into initials (L.C.P. Ana Ruiz Paz read given L.). measured with the other three degrees (#979, 2026-11-20): dof-signatures 34 distinct names gain a title, by default and under locales.ES; over the whole of ORCID, PatentsView and PSC no name moves but one ORCID record. Letters spelling it are a person's initials too, which a family comma or a single surname behind them leaves without a given name (Perez, X.Y.Z.; decisions/H10, 2026-11-20). The two-letter degrees (C.P., L.C.) stay out, being written as initials too" } + [[word]] text = "licenciado" academic = { gender = "m", issue = 753, expands = "Licenciado, the holder of a licenciatura, a form of address in Mexico and Central America", note = "no name bearer in any source tools/name_usage.py reads; 1 ORCID name opens with it (2026-10-30); ORCID's family box holds it once, written last (Abraham Licenciado, Venezuela), so a name written family first that opens with it reads it as the title, read by default since #1115 (2026-11-06)" } @@ -125,6 +137,10 @@ academic = { gender = "f", issue = 753, same_as = "licenciada", expands = "Lcda. text = "licda" academic = { gender = "f", same_as = "licenciada", issue = 1115, expands = "Licda., Licenciada abbreviated, in Central America and Mexico (Licda. Gabriela Morales Valdivia)", note = "no name bearer in any source tools/name_usage.py reads; ORCID's given box 4 records, the title typed in; Mexico's DOF signatures 14 (2026-11-06)" } +[[word]] +text = "m.a.p" +academic = { issue = 979, expands = "Maestro en Administración Pública", note = "the one ORCID record is a Sri Lankan name whose initials are M.A.P.; a Mexican degree written before the name, its three letters joined by full stops; without the reading T7 cut it into initials (L.C.P. Ana Ruiz Paz read given L.). measured with the other three degrees (#979, 2026-11-20): dof-signatures 34 distinct names gain a title, by default and under locales.ES; over the whole of ORCID, PatentsView and PSC no name moves but one ORCID record. Letters spelling it are a person's initials too, which a family comma or a single surname behind them leaves without a given name (Perez, X.Y.Z.; decisions/H10, 2026-11-20). The two-letter degrees (C.P., L.C.) stay out, being written as initials too" } + [[word]] text = "maestra" academic = { default = false, gender = "f", issue = 980, expands = "Maestra, the holder of a master's degree, a form of address in Mexico: Maestra Ana Ruiz Paz", note = "off by default and turned on by a Spanish choice: also the word for a schoolteacher in Spanish and Italian, and borne as a family name, ORCID's family box 9 records (2 in Spain, 1 in Italy, 6 with no country), PatentsView's 1 (Spain), FEC 1 (MAESTRA, SUSAN M.); no US Census or US SSA bearer, and Wikidata's zero proves nothing. Mexico's DOF writes it in 39 signatures (Maestra 35, MAESTRA 4), 38 opening the name; 3 of those, 2 names, continue with a complement (Maestra en Derecho, MAESTRA EN ADMINISTRACION), which the title run does not take; ORCID 1 (2026-11-03). Its masculine, maestro, is excluded, a family name" } diff --git a/tests/v2/cases.py b/tests/v2/cases.py index 07d8946f1..3b3ca23cb 100644 --- a/tests/v2/cases.py +++ b/tests/v2/cases.py @@ -23078,4 +23078,50 @@ def _check_cjk_shape_purity(self) -> None: {"given": "عبد القوى", "family": "سامر"}, policy=Policy(name_order=FAMILY_FIRST_GIVEN_LAST), classification="fix(#1337)"), + Case("dotted_degree_opens_the_name", + "L.C.P. Ana Ruiz Paz", + {"title": "L.C.P.", "given": "Ana", "middle": "Ruiz", + "family": "Paz"}, + classification="fix(#979)", + notes="was given 'L.', middle 'C.P. Ana Ruiz' (rules/T7)"), + Case("dotted_degree_opens_the_name_under_es", + "M.A.P. Juan Pérez Ruiz", + {"title": "M.A.P.", "given": "Juan", "family": "Pérez Ruiz"}, + locale="es", classification="fix(#979)"), + Case("dotted_degree_after_a_family_comma", + "Ruiz Paz, L.A.E. Ana", + {"title": "L.A.E.", "given": "Ana", "family": "Ruiz Paz"}, + classification="fix(#979)"), + Case("dotted_degree_in_lower_case", + "l.e.m. ana ruiz", + {"title": "l.e.m.", "given": "ana", "family": "ruiz"}, + classification="fix(#979)"), + Case("dotted_two_letter_degree_stays_initials", + "C.P. Ana Ruiz", + {"given": "C.", "middle": "P. Ana", "family": "Ruiz"}, + classification="fix(#1296)", + notes="#979 leaves the two-letter degrees out, being written as " + "initials too"), + Case("dotted_degree_letters_as_initials_after_a_family_comma", + "Perez, M.A.P.", + {"title": "M.A.P.", "family": "Perez"}, + classification="fix(#979)", + notes="the cost decisions/H10 records: these letters are a " + "person's initials here, read as the degree with no given " + "name; was given 'M.', middle 'A.P.'"), + Case("dotted_degree_letters_as_initials_before_one_surname", + "M.A.P. Perera", + {"title": "M.A.P.", "family": "Perera"}, + classification="fix(#979)", + notes="the same cost before a single surname"), + Case("dotted_degree_after_a_full_name_and_a_comma", + "Ana Ruiz Paz, L.C.P.", + {"title": "L.C.P.", "given": "Ana", "middle": "Ruiz", + "family": "Paz"}, + classification="fix(#979)", + notes="was suffix 'L.C.P.'"), + Case("dotted_degree_undotted_spelling_is_unlisted", + "MAP Juan Pérez", + {"given": "MAP", "middle": "Juan", "family": "Pérez"}, + notes="map stays out (decisions/H6)"), ) diff --git a/tools/differential/corpus_rules.jsonl b/tools/differential/corpus_rules.jsonl index cdb066e5d..748b14629 100644 --- a/tools/differential/corpus_rules.jsonl +++ b/tools/differential/corpus_rules.jsonl @@ -1213,6 +1213,7 @@ "Konstantin VII." "Kumar a/l Rajan" "Kumar a/l Rajan Naidu" +"L.C.P. Ana Ruiz Paz" "LAKSHMI R S" "LE GRAND Hugo" "LEVON TER PETROSYAN" diff --git a/tools/differential/snapshot.jsonl b/tools/differential/snapshot.jsonl index f5a87633c..845449e72 100644 --- a/tools/differential/snapshot.jsonl +++ b/tools/differential/snapshot.jsonl @@ -2827,6 +2827,7 @@ {"name": "Kőrösi, Albin", "given": "Albin", "family": "Kőrösi", "initials": "A. K."} {"name": "L'Aubespine, François de", "given": "François", "family": "de L'Aubespine", "initials": "F. L."} {"name": "L. U. P. O.", "given": "L.", "middle": "U. P.", "family": "O.", "initials": "L. U. P. O."} +{"name": "L.C.P. Ana Ruiz Paz", "title": "L.C.P.", "given": "Ana", "middle": "Ruiz", "family": "Paz", "initials": "A. R. P."} {"name": "LAKSHMI R S", "given": "LAKSHMI", "middle": "R", "family": "S", "ambiguities": ["ORDER"], "initials": "L. R. S.", "capitalized": "Lakshmi R S"} {"name": "LE GRAND Hugo", "given": "LE", "middle": "GRAND", "family": "Hugo", "ambiguities": ["PARTICLE_OR_GIVEN"], "alternatives": ["PARTICLE_OR_GIVEN: particle as family (vocabulary)"], "initials": "L. G. H.", "capitalized_force": "Le Grand Hugo"} {"name": "LEED AP", "given": "LEED", "family": "AP", "initials": "L. A.", "capitalized": "Leed Ap"} From 99f33c215ae979939fd246109673c653557f96c9 Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Fri, 20 Nov 2026 17:33:45 -0800 Subject: [PATCH 3/8] Revert "Add the Mexican dotted degrees L.A.E., L.C.P., L.E.M. and M.A.P. as titles (#979)" This reverts commit d71c3a974f724f99542cbdb15e6fe5db18a17388. The dotted degrees leave 3.2: their cost falls on initials written as a dotted run, which no fielded corpus counts (decisions/H10, 2026-11-20). Co-Authored-By: Claude Opus 5.5 --- .../H10-title-written-as-a-run-of-letters.md | 5 +- .../H6-title-before-a-family-comma.md | 2 +- docs/design/decisions/period-joined-words.md | 2 +- ...given-name-written-as-a-run-of-initials.md | 1 - docs/release_log.rst | 1 - nameparser/config/_compiled.py | 4 -- nameparser/config/_index.py | 4 -- nameparser/vocab/es.toml | 16 ------- tests/v2/cases.py | 46 ------------------- tools/differential/corpus_rules.jsonl | 1 - tools/differential/snapshot.jsonl | 1 - 11 files changed, 3 insertions(+), 80 deletions(-) diff --git a/docs/design/decisions/H10-title-written-as-a-run-of-letters.md b/docs/design/decisions/H10-title-written-as-a-run-of-letters.md index d78df2679..862f72913 100644 --- a/docs/design/decisions/H10-title-written-as-a-run-of-letters.md +++ b/docs/design/decisions/H10-title-written-as-a-run-of-letters.md @@ -6,9 +6,7 @@ - Where the comma's decision reports paired initials opening the part after it (rules/C11), the report stands on a run this rule reads as the title (`Smith, U.S. Senator John`) — 2026-11-09 #490. - Only the titles that abbreviate several words are marked, so initials spelling a title of one word stay a name with a title word behind them (`D.R. Judge Smith` → given names 'D.R. Judge' (rules/T7 parting the run)); the cost kept is a person whose initials spell a marked title and whose next name is a title word (`P.D. Judge Smith` → title 'P.D. Judge') — 2026-11-09 #490, DECIDED. -- The three-letter Mexican degrees `L.C.P.`, `L.A.E.`, `L.E.M.` and `M.A.P.` are listed in `es.toml` written with their stops, as default readings, not marked `dotted`, so `L.C.P. Ana Ruiz Paz` reads title 'L.C.P.' with no title behind it — 2026-11-20 #979. - -Open: the two-letter degrees (`C.P.`, `L.C.`, `L.A.`, `D.I.`), written as initials too (`C.P. Martínez`), stay initials; [#979](https://github.com/derek73/python-nameparser/issues/979) holds them. +Open: which vocabulary reads a degree acronym written this way at the front of a name in the `es` pack (`L.C.P.`) is [#979](https://github.com/derek73/python-nameparser/issues/979)'s, which can now mark its titles `dotted` or ask for more. Elsewhere: why a run of single letters joined by full stops stays one word while the name is read, decisions/period-joined-words; its parting into initials once roles are final where it is the given name (`U.S. Grant` → given 'U.', middle 'S.'), decisions/T7's 2026-11-10 #1296 entry, which also answered the other half of #490, left out of #490's fix as its 2026-10-02 comment proposed (`E.T. Smith` → given 'E.', middle 'T.'). @@ -20,4 +18,3 @@ Elsewhere: why a run of single letters joined by full stops stays one word while THE MECHANISM. classify tags the run (`vocab:dotted-title`) where its folded spelling without stops is in the set and its text is a run of two or more single letters joined by stops, the last stop optional (`_vocab.is_dotted_title`). `_pieces.leading_titles`, the given part's leading run, counts a tagged piece as a title word, applies H3's floor, then gives back a tagged piece the run ends on, and asks the one before it again (`Hon. U.S. Grant` keeps title 'Hon.'). H6's run before a family comma, which reads by vocabulary only, does the same, so `U.S. Senator Smith, John` reads as `US Senator Smith, John` does; it now counts its run before setting roles. The run is read as the title it spells by the other readers of the head too: by H9's phrase test, so a gated title behind it has its partner (`U.S. Marshal John Smith` reads as `US Marshal John Smith`), and by C4's count of name words before a comma, which counts it as a title only where it opens the part (behind any titles) and a title, listed or by H2's shape, follows it with a word behind (a word of any kind, so `U.S. Senator Jr., Ed` counts it, and the floor then gives 'Senator' back and the run after it, reading as master did), so `U.S. Senator Smith, Ed` keeps given 'Ed' as its undotted twin does (both found by the code review: the first build read `U.S. Marshal` as given 'U.S.' and `U.S. Senator Smith, Ed` as title 'U.S. Senator', suffix 'Ed', no given name). A run a connective joins to another (`U.S. and U.K. Ambassador`) is one unit of several words and stays a name, an accepted gap. H9's phrase test reads the run as the modifier it spells wherever it stands, as it reads the undotted twin, so `John Smith U.S. Dean.` reads title 'Dean.', family 'U.S.' as `John Smith US Dean.` does (master and 1.4.0 read family 'Dean.'), the run then reporting `suffix-or-name` as rules/S3's unlisted dotted shape ending the name, which its undotted twin cannot raise, and `U.S. Vice Smith`, two modifiers with no head, keeps given 'U.S.' (both found by the review of the fix commit; accepted as the twin's reading, rules/H10's Accepted clause). The fold runs only where the name holds a word H9 reads, so a name with a run and no such word (`U.S. Grant`) pays no phrase test for it. Where the count reads the run as a title and H6 then gives it back (`U.S. Insp. Smith, Ed`, H6 reading by vocabulary only, and `U.S. St. Smith, Ed`, a title-particle stopping H6's run), the comma decision is the one the undotted twin makes and the run lands in the family, as H10 reads it with no title kept behind it. The run is read as a title only at the head of a part: at the end of a name H5's chain takes neither the run nor its spelling without stops (`John Smith US Senator` keeps family 'Senator'). THE SWEEP (2026-11-09, re-run after the code review and again after the review of its fix). Twenty-two bases (`{D} District Judge Marc Treadwell`, `{D} Senator John Smith`, `{D} Grant`, `Hon. {D} Grant`, `{D} Senator`, `{D} Senator Jr`, `Mr {D} Ambassador Jane Smith`, `{D} Senator John Smith Jr.`, `{D} Senator John de la Vega`, `{D} Senator Smith`, `Freiherr {D} Senator Smith`, `St {D} Senator Smith`, `Rev. Sr. {D} Senator Smith`, `(Bob) {D} Senator Smith`, `{D} Senator Smith PhD`, `{D} Dr. Smith`, `{D} Marshal John Smith`, `{D} Marshal`, `{D} Dean Smith`, `{D} Senator Smith V`, `{D} Vice Smith`, `John Smith {D} Dean.`) in six comma shapes (none, `Doe Ray, ` and `Doe, ` and `, ` before the base, and `, Mary` and `, Ed` after it) and four spellings (`U.S.`, `U.S`, `u.s.`, `P.D.`), under all three orders, 1,584 rows, each compared with its twin written without stops. Fields differ on 351, every one a row where nothing the run keeps follows it (`{D} Grant`, a lone `{D} Senator` or `{D} Marshal`, `{D} Senator Jr`, where the floor gives 'Senator' back, and `P.D.` before `Marshal`, `Dean` or `Vice`, which take no academic title as their partner or head), which the run's spelling without stops reads as a title where the dotted run stays initials. Every other difference is the `suffix-or-name` report the comma's decision gives paired initials opening the part after it (rules/C11, C5's shape), which master gave the same run read as the given name. It stands now on a run this rule reads as the title, the report naming the title field and the credential as its other reading: accepted rather than dropped, since the comma decides before the title run is read and dropping it would have the comma predict H10's run (rules/H10's Accepted clause). The same sweep made rules/H10 state its precedence over rules/C5, whose given part the run opens. THE CORPORA (measured 2026-11-09 against master b89c5482, py3.11). The snapshot moves one name, the Treadwell row. Local corpora by `snapshot.py --local --base`: ukec-individuals, govuk-people, dof-signatures, fec-individuals and nepal-candidates match the base; ctgov-officials moves the two Privatdozent rows the simulation found, each from given 'P.D.' to title 'P.D. Dr.' (`Edgar Santos-Marcial, P.D. Dr. med` and `Martin Beiderlinden, P.D. dr. - med.`, whose given names, 'med' and '-', were no better before). opensanctions-parliaments was not read: its cached fetch predates the datasets the tool now reads, and refreshing it rewrites the cache every session shares. -- 2026-11-20 #979 — THE THREE-LETTER MEXICAN DEGREES ARE LISTED WRITTEN WITH THEIR STOPS, NOT MARKED `dotted`. `L.C.P.`, `L.A.E.`, `L.E.M.` and `M.A.P.` open Mexican signatures, and since rules/T7 parted a run of initials `L.C.P. Ana Ruiz Paz` read given 'L.', middle 'C.P. Ana Ruiz'. Marking them `dotted` would not reach them: this rule reads a marked run only where a title the run keeps follows it, and a degree stands straight before the name. Written with their stops in `es.toml` they are T7's vocabulary Except, a run the vocabulary lists as a word of its own, and read as the title they are listed as at the head of a name, after a family comma, and, as any listed title, after a second comma or ending the name (rules/C2, rules/H5; `Ana Ruiz Paz, L.C.P.` reads title 'L.C.P.', where it read the suffix); the undotted spellings are untouched (`MAP` stays out, decisions/H6). Default readings, not `default = false` under ES: measured 2026-11-20 against master `cb5088a9` with `uv run python tools/differential/measure.py --base `, dof-signatures moves 34 distinct names, every one gaining the title (33 moving the given and middle names, 1 the family too), and the whole of orcid-researchers, patentsview-inventors and psc-individuals moves 1, a Sri Lankan name whose initials are `M.A.P.`, now the degree. THE COST THAT COUNT CANNOT SEE: those three hold names composed given first from filed boxes, so none writes initials after a family comma or after a single surname, where the degree's letters are a person's initials: `Perez, M.A.P.` reads title 'M.A.P.', family 'Perez', with no given name and no report, where it read given 'M.', middle 'A.P.' with a `suffix-or-name` report; `M.A.P. Perera` and `L.E.M. Smith` lose their given initials the same way; and `Perez M.A.P.` under `FAMILY_FIRST`, read right before, reads the title. A choice of Spanish would narrow who pays, not remove it, Spanish names being written as initials too (found by the PR's review, 2026-11-20). The two-letter degrees (`C.P.` 422 signatures, `L.C.` 91, `L.A.` 38) stay out: they are written as initials too (`C.P. Martínez`), and #979 holds them. diff --git a/docs/design/decisions/H6-title-before-a-family-comma.md b/docs/design/decisions/H6-title-before-a-family-comma.md index 0a9b943f1..a80421f56 100644 --- a/docs/design/decisions/H6-title-before-a-family-comma.md +++ b/docs/design/decisions/H6-title-before-a-family-comma.md @@ -32,7 +32,7 @@ Left out: `mo`, which 45 names write as Muhammad with its period at the head (`MO. IBRAR KHAN`, 42 of them Nepalese candidates). Bare `Mo` is mostly the Chinese and Korean name (ORCID family boxes 3,478, China 952; given 1,546, China 252), and a `given` reading would report a Mo Yan's given name as read in the file holding it (`Reading.languages`). `md` keeps its 2026-10-27 reading (decisions/indic-honorifics: `Md.` a title by the shape, an accepted cost; decisions/C3's 2026-11-02 #1017 entry declined its given reading because of its credential). The titles, the pack-only degrees on by default and the exclusions of `bc`, `mst` and `sig` are #1115's later batches. - 2026-11-06, #1115, the second batch — THE TITLES WITH NO NAME BEARERS, LISTED. From the same mining, the words that open names as titles and that no source counts as a name (under 100 US Census bearers, under 5 US SSA births a year, Wikidata 2 or fewer, `tools/name_usage.py --boxes` on 2026-11-06): `engr`, `adv` and the modifier `assist` (en.toml, beside `engineer`, `advocate` and `assistant`), `ir` and `drs` (mul.toml: the Dutch and Indonesian degrees, Hong Kong's and Malaysia's registered engineer, and the English plural of Dr), `excm` and `excma` (ca.toml) and `excmo` and `excma` (es.toml). Listing reaches what H2's shape could not: the bare spelling (`Engr Ahsen Ali` → title 'Engr', given 'Engr', middle 'Ahsen' before), a title run behind a listed title (`Prof dr ir Simon Peeters` → title 'Prof dr ir', given 'ir' before), the part after a comma, where a part of titles alone fixes no family boundary (rules/C8; `Esra Oz, Assist Prof` → title 'Assist Prof', given 'Esra', family 'Esra Oz' before), the given part's end after a family comma (`BAXTER, JENNIFER DRS.`) and H6's run (`Excm. Sr. Lloret Palol, Josep Antoni` → title 'Excm. Sr.', family 'Lloret Palol'). Measured with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)(^|[^\w])(engr|adv|ir|drs|assist|excm|excma|excmo)\b' '' default` on 2026-11-06 against `e76cdad3`: 246 of 662 matching names move, ClinicalTrials.gov officials 175 of them (`Name, Assist Prof`), every move read by eye, nearly all a title leaving a name field. The costs among them: four tokens gluing a title to a name word with a period take the word into the title, as `Dr.` already does (`Engr.Nurunnabi` → title 'Engr.Nurunnabi' and no name, `Engr.Wlla Al-Mhairat`, `Engr.Gamachu Busa Meskele`, `DAVIDSON, DRS.PAULA DMARY`); one credential run splits (`…, PGCert HE, Reg Engr, MIMechE` → title 'Dr Engr', suffix '…, Reg, MIMechE'); eleven ClinicalTrials.gov officials writing `Res. Assist` or `Res Assist.` read title 'Assist', suffix 'Res.', as the listed `Res. Asst.` already did, and two writing it glued (`Res.Assist.`) move whole from suffix to title; and one ORCID record holds three names in a list. A lone `Assist` reads as `Asst` does (rules/H9): a title opening a name only before a head title (`Assist John Smith` keeps given 'Assist'), and a title alone ending a name or after a comma (`John Smith Assist.` → title 'Assist.'). Left out, each borne as a name: `eng` (US Census 2010 10,682 surname bearers; ORCID given boxes 468, Malaysia 63, Singapore 49), `er` (ORCID family boxes 1,087), `doc` (US SSA 1,391 births, Wikidata 130 given names: Doc Rivers), `ven` (Wikidata 448 given names, ORCID family boxes 214) and `em` (US Census 885). Their dotted spelling opening a name stays a title by H2's shape. The Spanish and Czech titles the mining found unlisted (`Licda.`, `Gral.`, `Tte.`, `RSDr.`, `plk.`) wait for the batch that decides which pack-only titles the default reads, with those listed `default = false` already (`ThDr.`, `MUDr.`, `Lic.`), since listing them so would move no default parse. -- 2026-11-07, #1129 (its reason for leaving `lcp` out, that `L.C.P.` reads as initials whatever the vocabulary says, superseded by decisions/H10's 2026-11-20 #979 entry: a run listed with its stops reads as that word, rules/T7's vocabulary Except) — #1115's CANDIDATES CARRIED FORWARD: THREE LISTED BY DEFAULT, ONE FOR THE CZECH PACK, THE REST LEFT OUT. Each candidate's bearers were counted with `uv run python tools/name_usage.py --boxes` and its incidence with `uv run python tools/vocab/word_report.py --rank` (2026-11-07, against `54318d78`). Listed by default: `sk` (bn.toml), Sheikh written short, as a `given` reading with `same_as`, so `Sk. Monirul Islam` reads given 'Sk.' as `Sheikh Ahmed Khan` reads given 'Sheikh' since #912 (title 'Sk.', given 'Monirul' before), no source counting it as a name of its own and ORCID's given boxes holding it 1,008 times (India 351, Bangladesh 119), some of them the initials S. K.; `biól` and `mgtr` (es.toml), Mexico's biologist and the Andean magíster, which no source counts as a name. Measured with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)(^|[^\w])(sk|bi[oó]l|mgtr|mjr|mtr|lcp|mvz|act|map)\b' 'expr:Parser(lexicon=Lexicon.default().remove("biól", kind="academic").remove("mgtr", kind="academic").remove("sk", kind="given"))' default` (the comparator the default without the three readings; `mjr` was also removed in the run, before it went to the pack): 20 of 258 matching names move, every one `sk` from the title to the given name (`Mr Sk. Mazamel Islam`, `Dr. Sk. Md. Masudul Ahsan`, `Sk. Nahid`), and in two of them a `Md.` behind it from the title to the middle name, since H2's shape chains only from the head (`Sk. Md. Atiqur Rahman` → given 'Sk.', middle 'Md. Atiqur', title 'Sk. Md.' before): the #1115 entry's `Md.` title by the shape holds where it opens the name or follows a title; `biól` and `mgtr` move none, their corpus spellings being the dotted head H2's shape already read. `local_agreement.py --base` on a checkout of `54318d78`: ORCID 12 records closer to the boxes and none further, 6 changed (the filer typed the whole name in the given box), PSC 1 closer (`Mr Sk. Mazamel Islam`, `Sk.` typed in the forename box). +- 2026-11-07, #1129 — #1115's CANDIDATES CARRIED FORWARD: THREE LISTED BY DEFAULT, ONE FOR THE CZECH PACK, THE REST LEFT OUT. Each candidate's bearers were counted with `uv run python tools/name_usage.py --boxes` and its incidence with `uv run python tools/vocab/word_report.py --rank` (2026-11-07, against `54318d78`). Listed by default: `sk` (bn.toml), Sheikh written short, as a `given` reading with `same_as`, so `Sk. Monirul Islam` reads given 'Sk.' as `Sheikh Ahmed Khan` reads given 'Sheikh' since #912 (title 'Sk.', given 'Monirul' before), no source counting it as a name of its own and ORCID's given boxes holding it 1,008 times (India 351, Bangladesh 119), some of them the initials S. K.; `biól` and `mgtr` (es.toml), Mexico's biologist and the Andean magíster, which no source counts as a name. Measured with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)(^|[^\w])(sk|bi[oó]l|mgtr|mjr|mtr|lcp|mvz|act|map)\b' 'expr:Parser(lexicon=Lexicon.default().remove("biól", kind="academic").remove("mgtr", kind="academic").remove("sk", kind="given"))' default` (the comparator the default without the three readings; `mjr` was also removed in the run, before it went to the pack): 20 of 258 matching names move, every one `sk` from the title to the given name (`Mr Sk. Mazamel Islam`, `Dr. Sk. Md. Masudul Ahsan`, `Sk. Nahid`), and in two of them a `Md.` behind it from the title to the middle name, since H2's shape chains only from the head (`Sk. Md. Atiqur Rahman` → given 'Sk.', middle 'Md. Atiqur', title 'Sk. Md.' before): the #1115 entry's `Md.` title by the shape holds where it opens the name or follows a title; `biól` and `mgtr` move none, their corpus spellings being the dotted head H2's shape already read. `local_agreement.py --base` on a checkout of `54318d78`: ORCID 12 records closer to the boxes and none further, 6 changed (the filer typed the whole name in the given box), PSC 1 closer (`Mr Sk. Mazamel Islam`, `Sk.` typed in the forename box). For the Czech pack: `mjr` (cs.toml, `default = false`), the rank, since an ORCID researcher in Sri Lanka files `MJR` as the given name, initials, which a default title reading took (1 record further from the boxes); the class #1115's pack batch kept off (`MgA`, `GS`). Excluded, each also a credential written after names, which a title reading after a comma takes from the suffix or the given name (rules/C2 past a second comma, rules/C8 in the part after the first, and a lone word ending the given part after a family comma), measured under `plain:ES` against the same command run in both trees (`--readings`, compared line by line): `mtr` (5 ClinicalTrials.gov officials, `Shana McCormack, MD, MTR` → title 'MTR', and a one-comma `John Smith, MTR` alike; against them 5 UK PSC names opening with a bare `Mtr`, which their filers typed in the title box, read the title, gains a Spanish choice is not the place for), `act` (`Terry L Grindstaff, PhD, PT, ACT`) and `map` (also an English word and a filed given name, FEC's `SAN, MAP` → title 'MAP' with no given name; `Jorge Luis Loáiciga Gutiérrez, MAP, Lic` → title 'PhD. MAP Lic' from the part after the first comma; 1 of its 3 moves the title meant). Not listed, with nothing to gain: `lcp` and `mvz`, because Mexico's DOF signatures write them as `L.C.P.` and `M.V.Z.`, which read as initials whatever the vocabulary says, and their dotted head `LCP.` is a title by H2's shape already; listed in the Spanish pack, they moved no corpus name. Nor the unaccented `biol`, written after a comma as the field of a diploma (`Dipl. Biol.`, ClinicalTrials.gov officials 11), the decisions/H6 2026-11-06 Diplom entry's shape. Left out as borne names: `sen` (US Census 2010 3,059; ORCID given boxes 2,337; and `Sen.` ending a name is also Senior), `ku` (US Census 4,888; Wikidata 2,396 family names), `cor` (nam_dict band 6 in the Netherlands; Wikidata 260 given names), `prim` (US Census 2,019; US SSA 245 births), `dip` (US Census 337; nam_dict band 2 in India and Sri Lanka), `lae` (US Census 144; nam_dict band 3), `med` (ORCID given boxes 232, Med being Mohamed written short) and `jan`. Left out, ambiguous or too rare to weigh: `sh` (Sheikh, and India's Shri, which hi.toml refuses as a title because it opens given names), `kh` (several names it shortens), `th` and `ph` (2 names each; `Ph.` also opens a spaced `Ph. D.`), `rr` (ORCID given boxes 195, initials), `ass` (`Ass. Prof.` reads as a title through H2's chain already) and `akad` (needs `Akad. mal.` as a phrase, 10 names). `mt` stays out, and no issue tracks it: a particle reading would need the period, which no reading can require, and the property that would let one is not worth building for the one corpus name it would fix (#1129's measurement: 6 corpus names write `Mt.`, 1 of them a surname head, `Gregory G. Mt. Pleasant`). A caller whose names hold it adds a particle reading to a `Lexicon` of their own; reconsider if a new corpus writes it more often. diff --git a/docs/design/decisions/period-joined-words.md b/docs/design/decisions/period-joined-words.md index d010b8fc1..9b5b561e1 100644 --- a/docs/design/decisions/period-joined-words.md +++ b/docs/design/decisions/period-joined-words.md @@ -6,7 +6,7 @@ - Otherwise, a word may divide after a full stop only where two things hold. The chunk before the stop must be one the parser reads on its own (a single letter, a transliteration digraph rules/H2 names since #1136, a listed title, a listed given name written short, or a saint particle), and what follows must be a name. A divided word is to read as it does with a space there: `Dr.John Smith` as `Dr. John Smith`, `J.Smith` as `J. Smith`, `Mark Jhon Sta.Ana` as `Mark Jhon Sta. Ana`, `Lt.Gov.John` as `Lt.Gov. John`. That target is decided. The test that tells a name after the stop from a field or a title written without its own stop (`Dr.Med`, `A.Professor`) was left open here; decisions/T8 answers it by position, dividing before any comma only, and shipped the division; a saint particle glued to a name is one name word there, divided only as the part's last name word (`Mark Jhon Sta.Ana`, #1071) — 2026-11-09 #1255, amended 2026-11-10 #1230, #1235. - Two kinds of word do not divide, and keep today's reading. The first has a lowercase letter after the stop (`G.ppe`, `Dr.philol.`, `Dott.ssa`, `Fr.co`). The second is a degree written with its field and closed by its own full stop (`Dipl.Ing.`, `Dr.Med.`, `Lt.Gen.`). What tells that field from a glued name closed by a stop (`Mrs.Smith.`) decisions/T8 answers by keeping both whole. Which other first chunks the parser reads on its own was #1230's question, answered there: a listed title divides, an unlisted one does not — 2026-11-09 #1255, amended 2026-11-10 #1230. - A transliteration digraph is a chunk the parser reads on its own, the ones rules/H2 names and only those (`Yu`, `Ya`, `Ye`, `Yo`, `Zh`, `Kh`, `Shch`, `Dzh`), so `Yu.A.Chibrikova` is to divide as `Yu. A. Chibrikova` reads. `Ts`, `Ch` and `Sh` are not: rules/H2 reads each as a title by shape, since each is also a title written short, so under the default vocabulary, where `ts` is unlisted, `Ts.Sandag-Ochir` does not divide and keeps today's reading; what it should read was #1230's question for an unlisted first chunk rules/H2 reads as a title, answered by decisions/T8 (it keeps its one word), and stays #1306's for a Mongolian `Ts.`. Under a choice that lists `ts` as a title (`vi`), it is a listed title chunk, and the second Standing line applies to it — 2026-11-09 #1136. -- A run of single letters joined by full stops stays one word wherever the division acts (`E.T.`, `U.S.`, `L.C.P.`, `B.K.`). The division does not decide how it reads. At the front of a name, rules/H10 reads it as a title marked `dotted` where a title follows it (decisions/H10, #490), and a run listed whole with its stops reads as that word (rules/T7's vocabulary Except), as the three-letter Mexican degrees are since #979 (`L.C.P.`; decisions/H10, 2026-11-20). What reads it at the end stays open (rules/S3, #864) — 2026-11-09 #1255. +- A run of single letters joined by full stops stays one word wherever the division acts (`E.T.`, `U.S.`, `L.C.P.`, `B.K.`). The division does not decide how it reads. At the front of a name, rules/H10 reads it as a title marked `dotted` where a title follows it (decisions/H10, #490), and #979 asks which `es` degree acronyms join that set. What reads it at the end stays open (rules/S3, #864) — 2026-11-09 #1255. Elsewhere: a run of single letters spelling a title at the front of a name, decisions/H10's 2026-11-09 #490 entry. 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. diff --git a/docs/design/rules/T7-given-name-written-as-a-run-of-initials.md b/docs/design/rules/T7-given-name-written-as-a-run-of-initials.md index 4f8d738b2..06d274322 100644 --- a/docs/design/rules/T7-given-name-written-as-a-run-of-initials.md +++ b/docs/design/rules/T7-given-name-written-as-a-run-of-initials.md @@ -39,7 +39,6 @@ ``` "J.R. Smith" → given="J." "K.T. Smith" → given="K." - "L.C.P. Ana Ruiz Paz" → title="L.C.P." ``` - **A run in another field** keeps its one word: a middle name's run, and the family name some surnames are written as (B.K.). ``` diff --git a/docs/release_log.rst b/docs/release_log.rst index d6d9ba763..1c25ec05e 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -6,7 +6,6 @@ Release Log - **Fix Vanden, the Dutch and Flemish van den written as one word, which read as a middle name.** ``parse("Pieter Vanden Broeck")`` gives family ``Vanden Broeck``, as ``Vander Broeck`` reads, where 1.4.0 through 3.1.0 gave middle ``Vanden``, family ``Broeck``. :issue:`1239` - **Add thirteen military ranks written with a hyphen, such as Vice-Admiral, Air Vice-Marshal and Major-General, as titles.** ``parse("Air Vice-Marshal Ann Reed")`` gives title ``Air Vice-Marshal``, given ``Ann``, where 3.1.0 gave given ``Air``, middle ``Vice-Marshal Ann`` and 1.4.0 title ``Air``, first ``Vice-Marshal``. A hyphenated rank not listed, such as Squadron-Leader, still reads as a name word. :issue:`966` - - **Add the Mexican degrees L.C.P., L.A.E., L.E.M. and M.A.P. as titles.** ``parse("L.C.P. Ana Ruiz Paz")`` gives title ``L.C.P.``, given ``Ana``, where 3.1.0 gave given ``L.``, middle ``C.P. Ana Ruiz`` and 1.4.0 first ``L.C.P.``. Letters that spell one are read as the degree wherever they stand, so ``Perez, M.A.P.`` gives title ``M.A.P.`` and no given name; the two-letter degrees, such as C.P., still read as initials. :issue:`979` - **Add 어 and 라 to the Korean surnames.** ``parse("어수선")`` gives family ``어``, given ``수선``, where 1.4.0 through 3.1.0 kept the name whole. A foreign name written in hangul that begins with 라 is now divided too; a caller who reads such names removes the surname from the ``Lexicon``'s ``surnames``. :issue:`1215` - **Fix a word completing عبد written with a final ى, as Egyptian names write it, which read as a name of its own.** ``parse("سامر عبد القوى")`` gives family ``عبد القوى``, as ``عبد القوي`` reads, where 1.4.0 through 3.1.0 gave middle ``عبد``, family ``القوى``. :issue:`1337` - **Fix locales.RU reading a Ukrainian patronymic written in Cyrillic as the family name.** ``parser_for(locales.RU).parse("Коваленко Олена Петрівна")`` gives family ``Коваленко``, given ``Олена``, patronymic ``Петрівна``, where 2.0.0 through 3.1.0 gave family ``Петрівна``, given ``Коваленко``; ``-ївна``, ``-євич`` and ``Ілліч`` read the same way, while the Belarusian endings and the Latin spellings (``-ivna``, ``-ovych``) still do not; ``Parser.suggest`` now suggests the East Slavic rule for a list of such names too. :issue:`1212` diff --git a/nameparser/config/_compiled.py b/nameparser/config/_compiled.py index fdf3bf43f..8bf551a73 100644 --- a/nameparser/config/_compiled.py +++ b/nameparser/config/_compiled.py @@ -725,9 +725,6 @@ 'knowledge', 'krahv', 'kreivi', - 'l.a.e', - 'l.c.p', - 'l.e.m', 'lady', 'lama', 'lamido', @@ -760,7 +757,6 @@ 'ltgen', 'ltjg', 'lyricist', - 'm.a.p', 'madam', 'madame', 'mademoiselle', diff --git a/nameparser/config/_index.py b/nameparser/config/_index.py index bb5058b5d..6d2bb6f90 100644 --- a/nameparser/config/_index.py +++ b/nameparser/config/_index.py @@ -1614,9 +1614,6 @@ ('kája', (('cs', 'familiar', (('short_for', ('karel',)),)),)), ('kássia', (('pt', 'given', (('after_particle', True),)),)), ("l'", (('fr', 'article', ()), ('it', 'article', ()))), - ('l.a.e', (('es', 'academic', ()),)), - ('l.c.p', (('es', 'academic', ()),)), - ('l.e.m', (('es', 'academic', ()),)), ('la', (('ca', 'article', ()), ('es', 'article', ()), ('es', 'given', ()), ('fil', 'article', ()), ('fr', 'article', ()), ('it', 'article', ()))), ('lac', (('en', 'credential', ()), ('en', 'family', ()))), ('lachie', (('en', 'familiar', (('short_for', ('lachlan',)),)),)), @@ -1771,7 +1768,6 @@ ('léo', (('pt-BR', 'familiar', (('short_for', ('leonardo',)),)),)), ('lída', (('cs', 'familiar', (('short_for', ('ludmila',)),)), ('sk', 'familiar', (('short_for', ('ludmila',)),)))), ('l’', (('fr', 'article', (('same_as', "l'"),)), ('it', 'article', (('same_as', "l'"),)))), - ('m.a.p', (('es', 'academic', ()),)), ('ma', (('en', 'credential', ()), ('en', 'given', ()), ('en', 'family', ()), ('fil', 'given', (('same_as', 'maría'),)))), ('maaa', (('en', 'credential', ()),)), ('mac', (('en', 'clan', ()), ('en', 'given', ()), ('en', 'familiar', (('short_for', ('mackenzie',)),)), ('ga', 'clan', ()), ('gd', 'clan', ()))), diff --git a/nameparser/vocab/es.toml b/nameparser/vocab/es.toml index cb9457dc5..8b1515af4 100644 --- a/nameparser/vocab/es.toml +++ b/nameparser/vocab/es.toml @@ -101,18 +101,6 @@ academic = { gender = "m", issue = 753, expands = "Ingeniero, engineer, a form o text = "ingeniera" academic = { gender = "f", issue = 753, same_as = "ingeniero", expands = "Ingeniera, the feminine of ingeniero", note = "no name bearer in any source tools/name_usage.py reads (2026-10-30)" } -[[word]] -text = "l.a.e" -academic = { issue = 979, expands = "Licenciado en Administración de Empresas", note = "a Mexican degree written before the name, its three letters joined by full stops; without the reading T7 cut it into initials (L.C.P. Ana Ruiz Paz read given L.). measured with the other three degrees (#979, 2026-11-20): dof-signatures 34 distinct names gain a title, by default and under locales.ES; over the whole of ORCID, PatentsView and PSC no name moves but one ORCID record. Letters spelling it are a person's initials too, which a family comma or a single surname behind them leaves without a given name (Perez, X.Y.Z.; decisions/H10, 2026-11-20). The two-letter degrees (C.P., L.C.) stay out, being written as initials too" } - -[[word]] -text = "l.c.p" -academic = { issue = 979, expands = "Licenciado en Contaduría Pública", note = "a Mexican degree written before the name, its three letters joined by full stops; without the reading T7 cut it into initials (L.C.P. Ana Ruiz Paz read given L.). measured with the other three degrees (#979, 2026-11-20): dof-signatures 34 distinct names gain a title, by default and under locales.ES; over the whole of ORCID, PatentsView and PSC no name moves but one ORCID record. Letters spelling it are a person's initials too, which a family comma or a single surname behind them leaves without a given name (Perez, X.Y.Z.; decisions/H10, 2026-11-20). The two-letter degrees (C.P., L.C.) stay out, being written as initials too" } - -[[word]] -text = "l.e.m" -academic = { issue = 979, note = "its expansion unconfirmed by the corpus; a Mexican degree written before the name, its three letters joined by full stops; without the reading T7 cut it into initials (L.C.P. Ana Ruiz Paz read given L.). measured with the other three degrees (#979, 2026-11-20): dof-signatures 34 distinct names gain a title, by default and under locales.ES; over the whole of ORCID, PatentsView and PSC no name moves but one ORCID record. Letters spelling it are a person's initials too, which a family comma or a single surname behind them leaves without a given name (Perez, X.Y.Z.; decisions/H10, 2026-11-20). The two-letter degrees (C.P., L.C.) stay out, being written as initials too" } - [[word]] text = "licenciado" academic = { gender = "m", issue = 753, expands = "Licenciado, the holder of a licenciatura, a form of address in Mexico and Central America", note = "no name bearer in any source tools/name_usage.py reads; 1 ORCID name opens with it (2026-10-30); ORCID's family box holds it once, written last (Abraham Licenciado, Venezuela), so a name written family first that opens with it reads it as the title, read by default since #1115 (2026-11-06)" } @@ -137,10 +125,6 @@ academic = { gender = "f", issue = 753, same_as = "licenciada", expands = "Lcda. text = "licda" academic = { gender = "f", same_as = "licenciada", issue = 1115, expands = "Licda., Licenciada abbreviated, in Central America and Mexico (Licda. Gabriela Morales Valdivia)", note = "no name bearer in any source tools/name_usage.py reads; ORCID's given box 4 records, the title typed in; Mexico's DOF signatures 14 (2026-11-06)" } -[[word]] -text = "m.a.p" -academic = { issue = 979, expands = "Maestro en Administración Pública", note = "the one ORCID record is a Sri Lankan name whose initials are M.A.P.; a Mexican degree written before the name, its three letters joined by full stops; without the reading T7 cut it into initials (L.C.P. Ana Ruiz Paz read given L.). measured with the other three degrees (#979, 2026-11-20): dof-signatures 34 distinct names gain a title, by default and under locales.ES; over the whole of ORCID, PatentsView and PSC no name moves but one ORCID record. Letters spelling it are a person's initials too, which a family comma or a single surname behind them leaves without a given name (Perez, X.Y.Z.; decisions/H10, 2026-11-20). The two-letter degrees (C.P., L.C.) stay out, being written as initials too" } - [[word]] text = "maestra" academic = { default = false, gender = "f", issue = 980, expands = "Maestra, the holder of a master's degree, a form of address in Mexico: Maestra Ana Ruiz Paz", note = "off by default and turned on by a Spanish choice: also the word for a schoolteacher in Spanish and Italian, and borne as a family name, ORCID's family box 9 records (2 in Spain, 1 in Italy, 6 with no country), PatentsView's 1 (Spain), FEC 1 (MAESTRA, SUSAN M.); no US Census or US SSA bearer, and Wikidata's zero proves nothing. Mexico's DOF writes it in 39 signatures (Maestra 35, MAESTRA 4), 38 opening the name; 3 of those, 2 names, continue with a complement (Maestra en Derecho, MAESTRA EN ADMINISTRACION), which the title run does not take; ORCID 1 (2026-11-03). Its masculine, maestro, is excluded, a family name" } diff --git a/tests/v2/cases.py b/tests/v2/cases.py index 484643bfe..569c33459 100644 --- a/tests/v2/cases.py +++ b/tests/v2/cases.py @@ -23078,52 +23078,6 @@ def _check_cjk_shape_purity(self) -> None: {"given": "عبد القوى", "family": "سامر"}, policy=Policy(name_order=FAMILY_FIRST_GIVEN_LAST), classification="fix(#1337)"), - Case("dotted_degree_opens_the_name", - "L.C.P. Ana Ruiz Paz", - {"title": "L.C.P.", "given": "Ana", "middle": "Ruiz", - "family": "Paz"}, - classification="fix(#979)", - notes="was given 'L.', middle 'C.P. Ana Ruiz' (rules/T7)"), - Case("dotted_degree_opens_the_name_under_es", - "M.A.P. Juan Pérez Ruiz", - {"title": "M.A.P.", "given": "Juan", "family": "Pérez Ruiz"}, - locale="es", classification="fix(#979)"), - Case("dotted_degree_after_a_family_comma", - "Ruiz Paz, L.A.E. Ana", - {"title": "L.A.E.", "given": "Ana", "family": "Ruiz Paz"}, - classification="fix(#979)"), - Case("dotted_degree_in_lower_case", - "l.e.m. ana ruiz", - {"title": "l.e.m.", "given": "ana", "family": "ruiz"}, - classification="fix(#979)"), - Case("dotted_two_letter_degree_stays_initials", - "C.P. Ana Ruiz", - {"given": "C.", "middle": "P. Ana", "family": "Ruiz"}, - classification="fix(#1296)", - notes="#979 leaves the two-letter degrees out, being written as " - "initials too"), - Case("dotted_degree_letters_as_initials_after_a_family_comma", - "Perez, M.A.P.", - {"title": "M.A.P.", "family": "Perez"}, - classification="fix(#979)", - notes="the cost decisions/H10 records: these letters are a " - "person's initials here, read as the degree with no given " - "name; was given 'M.', middle 'A.P.'"), - Case("dotted_degree_letters_as_initials_before_one_surname", - "M.A.P. Perera", - {"title": "M.A.P.", "family": "Perera"}, - classification="fix(#979)", - notes="the same cost before a single surname"), - Case("dotted_degree_after_a_full_name_and_a_comma", - "Ana Ruiz Paz, L.C.P.", - {"title": "L.C.P.", "given": "Ana", "middle": "Ruiz", - "family": "Paz"}, - classification="fix(#979)", - notes="was suffix 'L.C.P.'"), - Case("dotted_degree_undotted_spelling_is_unlisted", - "MAP Juan Pérez", - {"given": "MAP", "middle": "Juan", "family": "Pérez"}, - notes="map stays out (decisions/H6)"), # #1380: the Lao script writes no initials (rules/R7, the # script-property table's lao row), so a Lao letter with a full stop # is a name word to the policy switches, as a Thai one is diff --git a/tools/differential/corpus_rules.jsonl b/tools/differential/corpus_rules.jsonl index 7bbc2084c..6e43cfa7a 100644 --- a/tools/differential/corpus_rules.jsonl +++ b/tools/differential/corpus_rules.jsonl @@ -1213,7 +1213,6 @@ "Konstantin VII." "Kumar a/l Rajan" "Kumar a/l Rajan Naidu" -"L.C.P. Ana Ruiz Paz" "LAKSHMI R S" "LE GRAND Hugo" "LEVON TER PETROSYAN" diff --git a/tools/differential/snapshot.jsonl b/tools/differential/snapshot.jsonl index 2d3d5c572..71d64cd9e 100644 --- a/tools/differential/snapshot.jsonl +++ b/tools/differential/snapshot.jsonl @@ -2827,7 +2827,6 @@ {"name": "Kőrösi, Albin", "given": "Albin", "family": "Kőrösi", "initials": "A. K."} {"name": "L'Aubespine, François de", "given": "François", "family": "de L'Aubespine", "initials": "F. L."} {"name": "L. U. P. O.", "given": "L.", "middle": "U. P.", "family": "O.", "initials": "L. U. P. O."} -{"name": "L.C.P. Ana Ruiz Paz", "title": "L.C.P.", "given": "Ana", "middle": "Ruiz", "family": "Paz", "initials": "A. R. P."} {"name": "LAKSHMI R S", "given": "LAKSHMI", "middle": "R", "family": "S", "ambiguities": ["ORDER"], "initials": "L. R. S.", "capitalized": "Lakshmi R S"} {"name": "LE GRAND Hugo", "given": "LE", "middle": "GRAND", "family": "Hugo", "ambiguities": ["PARTICLE_OR_GIVEN"], "alternatives": ["PARTICLE_OR_GIVEN: particle as family (vocabulary)"], "initials": "L. G. H.", "capitalized_force": "Le Grand Hugo"} {"name": "LEED AP", "given": "LEED", "family": "AP", "initials": "L. A.", "capitalized": "Leed Ap"} From ce5da5882c7d58304a6041dc38a8b120c6ac7308 Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Fri, 20 Nov 2026 17:34:09 -0800 Subject: [PATCH 4/8] Record why the dotted Mexican degrees were declined for 3.2 (#979) Co-Authored-By: Claude Opus 5.5 --- docs/design/decisions/H10-title-written-as-a-run-of-letters.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/design/decisions/H10-title-written-as-a-run-of-letters.md b/docs/design/decisions/H10-title-written-as-a-run-of-letters.md index 862f72913..3437a41a1 100644 --- a/docs/design/decisions/H10-title-written-as-a-run-of-letters.md +++ b/docs/design/decisions/H10-title-written-as-a-run-of-letters.md @@ -6,7 +6,7 @@ - Where the comma's decision reports paired initials opening the part after it (rules/C11), the report stands on a run this rule reads as the title (`Smith, U.S. Senator John`) — 2026-11-09 #490. - Only the titles that abbreviate several words are marked, so initials spelling a title of one word stay a name with a title word behind them (`D.R. Judge Smith` → given names 'D.R. Judge' (rules/T7 parting the run)); the cost kept is a person whose initials spell a marked title and whose next name is a title word (`P.D. Judge Smith` → title 'P.D. Judge') — 2026-11-09 #490, DECIDED. -Open: which vocabulary reads a degree acronym written this way at the front of a name in the `es` pack (`L.C.P.`) is [#979](https://github.com/derek73/python-nameparser/issues/979)'s, which can now mark its titles `dotted` or ask for more. +Open: which vocabulary reads a degree acronym written this way at the front of a name in the `es` pack (`L.C.P.`) is [#979](https://github.com/derek73/python-nameparser/issues/979)'s, which can now mark its titles `dotted` or ask for more. A build listing the three-letter Mexican degrees with their stops was declined on 2026-11-20 (below). Elsewhere: why a run of single letters joined by full stops stays one word while the name is read, decisions/period-joined-words; its parting into initials once roles are final where it is the given name (`U.S. Grant` → given 'U.', middle 'S.'), decisions/T7's 2026-11-10 #1296 entry, which also answered the other half of #490, left out of #490's fix as its 2026-10-02 comment proposed (`E.T. Smith` → given 'E.', middle 'T.'). @@ -18,3 +18,4 @@ Elsewhere: why a run of single letters joined by full stops stays one word while THE MECHANISM. classify tags the run (`vocab:dotted-title`) where its folded spelling without stops is in the set and its text is a run of two or more single letters joined by stops, the last stop optional (`_vocab.is_dotted_title`). `_pieces.leading_titles`, the given part's leading run, counts a tagged piece as a title word, applies H3's floor, then gives back a tagged piece the run ends on, and asks the one before it again (`Hon. U.S. Grant` keeps title 'Hon.'). H6's run before a family comma, which reads by vocabulary only, does the same, so `U.S. Senator Smith, John` reads as `US Senator Smith, John` does; it now counts its run before setting roles. The run is read as the title it spells by the other readers of the head too: by H9's phrase test, so a gated title behind it has its partner (`U.S. Marshal John Smith` reads as `US Marshal John Smith`), and by C4's count of name words before a comma, which counts it as a title only where it opens the part (behind any titles) and a title, listed or by H2's shape, follows it with a word behind (a word of any kind, so `U.S. Senator Jr., Ed` counts it, and the floor then gives 'Senator' back and the run after it, reading as master did), so `U.S. Senator Smith, Ed` keeps given 'Ed' as its undotted twin does (both found by the code review: the first build read `U.S. Marshal` as given 'U.S.' and `U.S. Senator Smith, Ed` as title 'U.S. Senator', suffix 'Ed', no given name). A run a connective joins to another (`U.S. and U.K. Ambassador`) is one unit of several words and stays a name, an accepted gap. H9's phrase test reads the run as the modifier it spells wherever it stands, as it reads the undotted twin, so `John Smith U.S. Dean.` reads title 'Dean.', family 'U.S.' as `John Smith US Dean.` does (master and 1.4.0 read family 'Dean.'), the run then reporting `suffix-or-name` as rules/S3's unlisted dotted shape ending the name, which its undotted twin cannot raise, and `U.S. Vice Smith`, two modifiers with no head, keeps given 'U.S.' (both found by the review of the fix commit; accepted as the twin's reading, rules/H10's Accepted clause). The fold runs only where the name holds a word H9 reads, so a name with a run and no such word (`U.S. Grant`) pays no phrase test for it. Where the count reads the run as a title and H6 then gives it back (`U.S. Insp. Smith, Ed`, H6 reading by vocabulary only, and `U.S. St. Smith, Ed`, a title-particle stopping H6's run), the comma decision is the one the undotted twin makes and the run lands in the family, as H10 reads it with no title kept behind it. The run is read as a title only at the head of a part: at the end of a name H5's chain takes neither the run nor its spelling without stops (`John Smith US Senator` keeps family 'Senator'). THE SWEEP (2026-11-09, re-run after the code review and again after the review of its fix). Twenty-two bases (`{D} District Judge Marc Treadwell`, `{D} Senator John Smith`, `{D} Grant`, `Hon. {D} Grant`, `{D} Senator`, `{D} Senator Jr`, `Mr {D} Ambassador Jane Smith`, `{D} Senator John Smith Jr.`, `{D} Senator John de la Vega`, `{D} Senator Smith`, `Freiherr {D} Senator Smith`, `St {D} Senator Smith`, `Rev. Sr. {D} Senator Smith`, `(Bob) {D} Senator Smith`, `{D} Senator Smith PhD`, `{D} Dr. Smith`, `{D} Marshal John Smith`, `{D} Marshal`, `{D} Dean Smith`, `{D} Senator Smith V`, `{D} Vice Smith`, `John Smith {D} Dean.`) in six comma shapes (none, `Doe Ray, ` and `Doe, ` and `, ` before the base, and `, Mary` and `, Ed` after it) and four spellings (`U.S.`, `U.S`, `u.s.`, `P.D.`), under all three orders, 1,584 rows, each compared with its twin written without stops. Fields differ on 351, every one a row where nothing the run keeps follows it (`{D} Grant`, a lone `{D} Senator` or `{D} Marshal`, `{D} Senator Jr`, where the floor gives 'Senator' back, and `P.D.` before `Marshal`, `Dean` or `Vice`, which take no academic title as their partner or head), which the run's spelling without stops reads as a title where the dotted run stays initials. Every other difference is the `suffix-or-name` report the comma's decision gives paired initials opening the part after it (rules/C11, C5's shape), which master gave the same run read as the given name. It stands now on a run this rule reads as the title, the report naming the title field and the credential as its other reading: accepted rather than dropped, since the comma decides before the title run is read and dropping it would have the comma predict H10's run (rules/H10's Accepted clause). The same sweep made rules/H10 state its precedence over rules/C5, whose given part the run opens. THE CORPORA (measured 2026-11-09 against master b89c5482, py3.11). The snapshot moves one name, the Treadwell row. Local corpora by `snapshot.py --local --base`: ukec-individuals, govuk-people, dof-signatures, fec-individuals and nepal-candidates match the base; ctgov-officials moves the two Privatdozent rows the simulation found, each from given 'P.D.' to title 'P.D. Dr.' (`Edgar Santos-Marcial, P.D. Dr. med` and `Martin Beiderlinden, P.D. dr. - med.`, whose given names, 'med' and '-', were no better before). opensanctions-parliaments was not read: its cached fetch predates the datasets the tool now reads, and refreshing it rewrites the cache every session shares. +- 2026-11-20 #979 — THE DOTTED MEXICAN DEGREES ARE NOT LISTED IN 3.2. A build listed `l.c.p`, `l.a.e`, `m.a.p` and `l.e.m` in `es.toml` as default `academic` readings, so that, as rules/T7's vocabulary Except, `L.C.P. Ana Ruiz Paz` read title 'L.C.P.' where it reads given 'L.', middle 'C.P. Ana Ruiz'. It was declined before merging. Its cost falls on initials, a run of single letters joined by full stops being how initials are written, which T7 reads right today: `Perez, M.A.P.` would read title 'M.A.P.' and no given name, `M.A.P. Perera` and `L.E.M. Smith` would lose their given initials, and `Perez M.A.P.` under `FAMILY_FIRST` would read the degree. Those are initials-only and citation shapes, and the fielded corpora that would count them (orcid-researchers, patentsview-inventors, psc-individuals) compose each name given first from its filed boxes, so none writes initials after a family comma or after a single surname: their count, measured against master `cb5088a9` with `uv run python tools/differential/measure.py --base `, was 1 name moved (a Sri Lankan name whose initials are `M.A.P.`) against dof-signatures' 34 gaining the degree, and a fixed-against-broken count over those corpora does not measure the cost. Shipping them `default = false` under `locales.ES` would narrow who pays, not remove it, Spanish names being written as initials too (`Perez, M.A.P.`, `L.C. García`). #979 stays open. From 68be357eb6f36398a0bfcd12c08180767001adc8 Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Fri, 20 Nov 2026 17:42:04 -0800 Subject: [PATCH 5/8] Read Shri as a title under locales.HI (#1192) hi.toml's excluded:salutation becomes a default = false salutation reading written after_given, the shape shrimati's has, so a Hindi choice reads it as the title and the default and locales.BN leave it to position. Measured against the pack without the reading: 2,243 of in_sansad's 10,650 spellings gain the title, against 25 names broken, 21 of them filed records in populations a Hindi choice is not made for (decisions/vocabulary-model, 2026-11-20 #1192). Sri stays excluded. Co-Authored-By: Claude Opus 5.5 --- .../design/decisions/vocabulary-exclusions.md | 2 +- docs/design/decisions/vocabulary-model.md | 8 +++- docs/languages.rst | 22 +++++++-- docs/locales.rst | 3 +- docs/release_log.rst | 1 + nameparser/config/_index.py | 1 + nameparser/locales/hi.py | 18 +++---- nameparser/vocab/hi.toml | 2 +- tests/v2/cases.py | 47 +++++++++++++++++++ tests/v2/test_locales.py | 27 ++++++++--- 10 files changed, 105 insertions(+), 26 deletions(-) diff --git a/docs/design/decisions/vocabulary-exclusions.md b/docs/design/decisions/vocabulary-exclusions.md index b4797218b..231eb44e7 100644 --- a/docs/design/decisions/vocabulary-exclusions.md +++ b/docs/design/decisions/vocabulary-exclusions.md @@ -43,7 +43,7 @@ Excluded (DEFAULT_NICKNAME_DELIMITERS): Excluded (given-name titles and post-nominals — the 2026-07-19 transliteration deferrals, each living in a data-module comment until now): -- The title refusals are data since #750 (2026-10-19): Arabic bare سيد/شيخ/أمير/سلطان in ar.toml (and the abbreviation د. until decisions/script-properties' 2026-11-19 #1149 entry listed it, Arabic script writing no initials for it to swallow), Greek bare κ in el.toml, Latin sri/shri, sant and pandit in hi.toml, and Latin mst in bn.toml, each an `excluded` entry with its reason (mst's re-reasoned 2026-11-06, #1130: it is typed as the given name, as Md is, decisions/indic-honorifics) (`uv run python tools/vocab/query.py --excluded title`). Two class-level rules stand behind them. A transliteration collides with real names where the native spelling cannot, so the native spelling ships alone (sri/shri, sant, pandit; mst was listed here until #1130 found no name it collides with, and is refused for another reason). The bare Arabic سيد/شيخ/أمير/سلطان are given names; of their article forms only الشيخ ships, and السيد, الأمير and السلطان were never vetted, so the refusal decides nothing about them. And a single-letter abbreviation is the initial trap: the edge-period fold leaves bare د or κ, which matches an initial, so `Κ. Παπαδόπουλος` would read title `Κ.` with an empty given, and Latin titles hold no bare single letter for the same reason. That is decided per word, not per script, save where a script-property row says the script writes no initials, as Arabic's has since decisions/script-properties' 2026-11-19 #1149 entry: the Bengali ড ships, vocabulary beating the initial reading on purpose (decisions/indic-honorifics), and pays exactly that cost (`ড. রহমান` reads an empty given). +- The title refusals are data since #750 (2026-10-19): Arabic bare سيد/شيخ/أمير/سلطان in ar.toml (and the abbreviation د. until decisions/script-properties' 2026-11-19 #1149 entry listed it, Arabic script writing no initials for it to swallow), Greek bare κ in el.toml, Latin sri, sant and pandit in hi.toml (and shri until decisions/vocabulary-model's 2026-11-20 #1192 entry made it a `default = false` salutation a Hindi choice turns on), and Latin mst in bn.toml, each an `excluded` entry with its reason (mst's re-reasoned 2026-11-06, #1130: it is typed as the given name, as Md is, decisions/indic-honorifics) (`uv run python tools/vocab/query.py --excluded title`). Two class-level rules stand behind them. A transliteration collides with real names where the native spelling cannot, so the native spelling ships alone (sri/shri, sant, pandit; mst was listed here until #1130 found no name it collides with, and is refused for another reason). The bare Arabic سيد/شيخ/أمير/سلطان are given names; of their article forms only الشيخ ships, and السيد, الأمير and السلطان were never vetted, so the refusal decides nothing about them. And a single-letter abbreviation is the initial trap: the edge-period fold leaves bare د or κ, which matches an initial, so `Κ. Παπαδόπουλος` would read title `Κ.` with an empty given, and Latin titles hold no bare single letter for the same reason. That is decided per word, not per script, save where a script-property row says the script writes no initials, as Arabic's has since decisions/script-properties' 2026-11-19 #1149 entry: the Bengali ড ships, vocabulary beating the initial reading on purpose (decisions/indic-honorifics), and pays exactly that cost (`ড. রহমান` reads an empty given). - Ottoman post-nominals باشا/بك/أفندي — surname collisions. - Hebrew bare רב (an ordinary word, "many") and בר (Bar is a common modern Israeli given name) — deferred, #269's territory. - The Latin forms of the Indic titles belong, if anywhere, to the opt-in packs of #345 (2026-09-06, #344): TITLES has no ambiguous subset to express a partial answer in. diff --git a/docs/design/decisions/vocabulary-model.md b/docs/design/decisions/vocabulary-model.md index ceeb8aac0..9ac2b0471 100644 --- a/docs/design/decisions/vocabulary-model.md +++ b/docs/design/decisions/vocabulary-model.md @@ -15,7 +15,7 @@ The vocabulary was a set of base sets plus marker subsets (`particles` and `part - `es` turns on `doña`, the courtesy title that leads a Spanish name with no complement and is a family name too, the other titles phase 3g turned on being read by default since 2026-11-06 #1115 (below); `don`, `dona` and `dom` are excluded, the packs included, names opening with each as a name more often than as the title; `maestro`, a family name whose form of address is written `Mtro.`, is excluded too, and so is `h`, the hijo an initial is written as; `sr` keeps a generation reading beside its salutation in both files, so a choice leaves it the dual position decides; no connective continues a title run, the shape unwritten in name data, and the office titles that take a complement stay out — 2026-10-30 #753, phase 3g. - `es` turns on `maestra` too, the form of address written out, `maestro` staying excluded; `profesor` and `profesora`, which phase 3g turned on, are read by default since 2026-11-03 (decisions/salutation-titles) — 2026-11-03 #980. - The titles phase 3f, phase 3g and #1108 wrote `default = false` for neutrality rather than for a collision are read by default, 27 words, 36 readings, the nine doctorates being written in cs.toml and sk.toml both: es `lic`, `licenciado`, `licenciada`, `lcdo`, `lcda`, `ingeniero`, `ingeniera`, `arq`, `mtro`, `mtra`, `doctora`; pt `doutor`, `doutora`, `professora`, `profa`; cs and sk `judr`, `mudr`, `phdr`, `rndr`, `mvdr`, `mddr`, `paeddr`, `pharmdr`, `thdr`; vi `ths`, `đbqh`, `dbqh`. A choice still turns on the titles a name or initials spell: es `maestra` and `doña`, cs `mga` and `bca`, `pan`, `mgr`'s degree, vi `gs`, `ts` and `pgs` — 2026-11-06 #1115. -- Of the romanized titles a pack's phase lists, one whose native spelling is a default title turns on unless, counted in persons and pooled across every population measured, names open with it more often than it opens one as the title; a spelling outside the phase's list (`Shreemati`, `Srimati`) stays open until a phase writes it as a reading: `hi` turns on `smt`, `shrimati` and `shriyut`, `bn` `smt`, `shrimati` and `adhyapak` (`shriyut` with no bearer anywhere, `adhyapak` with family-name bearers only, every one where the title claim, acting at the head, does not reach), while `shri`, opening given names in every population measured, stays excluded, and `sushri`, an Odia given name, is a `default = false` salutation in hi.toml with the Odia name declared in or.toml, so the plain `hi` choice, made for data that holds those names, reads it as a title only inside a title phrase and a strict one as the title (decisions/indic-honorifics, 2026-11-03 #345/#870) — 2026-10-30 #753, phase 3e. +- Of the romanized titles a pack's phase lists, one whose native spelling is a default title turns on unless, counted in persons and pooled across every population measured, names open with it more often than it opens one as the title; a spelling outside the phase's list (`Shreemati`, `Srimati`) stays open until a phase writes it as a reading: `hi` turns on `smt`, `shrimati` and `shriyut`, `bn` `smt`, `shrimati` and `adhyapak` (`shriyut` with no bearer anywhere, `adhyapak` with family-name bearers only, every one where the title claim, acting at the head, does not reach), while `shri`, opening given names in every population measured, stayed excluded until 2026-11-20 #1192 made it a `default = false` salutation in hi.toml for the rolls that write it, `sri` staying excluded, and `sushri`, an Odia given name, is a `default = false` salutation in hi.toml with the Odia name declared in or.toml, so the plain `hi` choice, made for data that holds those names, reads it as a title only inside a title phrase and a strict one as the title (decisions/indic-honorifics, 2026-11-03 #345/#870) — 2026-10-30 #753, phase 3e. - A language pack is a choice of languages on `Locale.languages` selecting which readings compile, a tag choosing its own file and its ancestors', and a reading index, loaded on its first lookup, carries the languages to run time; strict is file-strict, the chosen files, `mul.toml` and native-script words' readings only, `und.toml` not among them, so it needs no 3i; third-party language files are deferred — 2026-10-27 #753 (Derek); 2026-10-29 #753, phase 3a (Derek); 2026-10-29 #753, phase 3b; 2026-10-30 #753, file-strict; 2026-11-02 #1005 (Derek); 2026-11-07 #1148. - A strict choice is `parser_for(..., strict=True)` over the whole choice, filtering the base's readings as a plain choice does, the caller's own edits applying after it, and a chained call keeping its base's strictness unless it passes `strict`, an explicit `False` on a strict base raising and an explicit `True` making a plain base's choice strict; a strict call whose packs choose no language raises; a strict choice accepts a tag whose file holds no reading, which a plain one refuses as changing nothing; a bare choice has no constructor, no `locales.choose`; and the words strict ungates are derived against the plain choice of the same tags and held to a reviewed set by a test — 2026-10-31 #753, phase 3j; 2026-11-02 #754, sub-phase 4i-c. - A choice is matched without regard to case, a tag whose file does not exist selects its ancestors' (`pt-AO` selects `pt`; a region's file holding a `[rules]` table and no reading selects its language's the same way, as `pt-PT.toml` did from decisions/O6's 2026-11-19 entry until #1189 gave it readings), `mul` and `und` are no language to choose, and a vocabulary reading turned on also prefers (a name reading never does, decision 15), so `de`'s generation `i` drops `ca`'s and `pl`'s conjunction under a `de` choice; the `Lexicon` records its choice, so that a choice chained through `base=` unions with the base's, and a caller's own edits apply after the choice, plain or strict, in the order written, a pack's fragment joining before the caller's lexicon — 2026-10-29 #753, phase 3b; 2026-11-02 #754, the `Lexicon` surface (Derek); 2026-11-02 #754, sub-phase 4i-c. @@ -421,7 +421,7 @@ Open: [#1145](https://github.com/derek73/python-nameparser/issues/1145), the dis - **Accepted: a word glued behind the period reads as the title under the pack.** nepal-candidates' `Smt.Nagiya Devi Awadha` (`श्रीमति नगिया देवी आवधा`) reads title `Smt.Nagiya` under either pack, where the default reads given `Smt.Nagiya`: `_vocab.period_joined_vocab` makes a period-joined token a title where any chunk is a title, the shape the phase 3d entry's Open names for `श्री.राम`, here in the other direction. - **Accepted: `SMT` as a US credential reads as the title in every comma part that holds it.** NPPES has 4 of its 4,824,544 credentialed providers writing `SMT` (`tools/name_usage.py smt`, the pinned August 2026 file). Under either pack it leaves the suffix for the title wherever a comma part after the name holds it, alone or in a credential run, before or after the other credentials and past a second comma (`Jane Doe, SMT`, `Jane Doe, MD, SMT`, `Jane Doe, PhD SMT`, `Jane Doe, SMT MD`, each giving title `SMT` and the rest of the suffix, where the default reads it all as the suffix), and where it ends the given part after a family comma (H8, `Doe, Jane SMT`, middle `SMT` by default). Bare after the name with no comma (`Jane Doe SMT`) both read it as a name word. A Hindi or Bengali choice is not made for US healthcare data, and 4 providers in 4.8 million is the measured size of the cost. - **The phase 3d entry's question, a `given` reading of `श्री` in hi.toml or bn.toml, is answered no.** For Hindi the evidence is CLDR's: of the four renderings the phase 3d entry found moving under `ne`, two are `hi` (`givenFirst` and `surnameFirst`), one `kok` and one `mr` (`givenFirst` each), each writing `श्री` as the title, so `श्री` stays a title under `hi` and `hi.toml`'s `श्री` note stays true. For Bengali the answer is unmeasured: no CLDR rendering and no committed corpus holds `শ্রী` (2026-10-30), so `bn` keeps the default's reading of it, a title, by default rather than by measurement. - - **Open: `shri`, and the romanizations outside 3e's list.** Whether `shri` takes phase 2j's route in the default, a `given` reading beside its title one so that it is a title only inside a title phrase, is default work this entry does not do; its counts are on its exclusion. CLDR's `hi_Latn` writes the salutation `Shree`, the spelling nepal-candidates romanizes `श्री` as a name word in 191 pairs (the phase 3d entry); nepal-candidates' romanized names open with `Shreemati` 47 times, three times `Shrimati`'s 16, 6 of them paired with `श्रीमति`, 41 of the 47 paired with `श्रीमती` and none opening an ORCID given box, and with `Srimati`, Bengali's romanization of শ্রীমতী, 12 times, 11 of them paired with the salutation (`श्रीमती` 10, `श्रीमति` 1), against 4 ORCID given boxes holding it alone (Naik, Nayak, Ghosal, Basu), the direction `shrimati`'s counts take; none was measured as a reading here. 18 nepal-candidates pairs open their Devanagari with `श्रीमति`, short i, a spelling of `श्रीमती` hi.toml does not list. + - **Open: `shri`, and the romanizations outside 3e's list** (its `shri` half settled otherwise by the 2026-11-20 #1192 entry: a `default = false` reading under `hi`, not phase 2j's route). Whether `shri` takes phase 2j's route in the default, a `given` reading beside its title one so that it is a title only inside a title phrase, is default work this entry does not do; its counts are on its exclusion. CLDR's `hi_Latn` writes the salutation `Shree`, the spelling nepal-candidates romanizes `श्री` as a name word in 191 pairs (the phase 3d entry); nepal-candidates' romanized names open with `Shreemati` 47 times, three times `Shrimati`'s 16, 6 of them paired with `श्रीमति`, 41 of the 47 paired with `श्रीमती` and none opening an ORCID given box, and with `Srimati`, Bengali's romanization of শ্রীমতী, 12 times, 11 of them paired with the salutation (`श्रीमती` 10, `श्रीमति` 1), against 4 ORCID given boxes holding it alone (Naik, Nayak, Ghosal, Basu), the direction `shrimati`'s counts take; none was measured as a reading here. 18 nepal-candidates pairs open their Devanagari with `श्रीमति`, short i, a spelling of `श्रीमती` hi.toml does not list. - **Recompute:** the commands above from a checkout of this change, against a detached checkout of master; FEC's figure with `snapshot.py --local fec-individuals --base` on that tree; the PSC, ORCID and PatentsView figures with the scratch scorer of the phase 3h entry (`local_agreement.read` per record under `Parser()` and `parser_for(pack)`, over the records whose name holds a word of `changed_words(selected(pack.languages))`), run on a tree that removes `shri`'s exclusion from hi.toml and adds `shri` and `sushri` to hi.toml, and `shri` to bn.toml, as `salutation` readings `default = false` (the build refuses the reading while the exclusion stands); the ORCID box counts by reading `ORCID_2025_10_summaries.v1.jsonl.gz` from the cache and counting the boxes whose first word folds to the word. - **2026-10-30 #753, phase 3g (its titles' `default = false`, all but `doña`'s, superseded by the 2026-11-06 #1115, the pack titles entry, which is the default change this entry left for later; its `locales.PT` waiting for a Portuguese given-name list answered by decisions/O6's 2026-11-19 #1453 entry: `locales.PT` stays off, `locales.PT_BR` and a new `locales.PT_PT` turn the switch on with a list) — THE SPANISH AND PORTUGUESE PACKS, `locales.ES` AND `locales.PT`: THE TITLES THAT LEAD A NAME WITHOUT A COMPLEMENT TURN ON; `don`, `dona`, `dom` AND `maestro` STAY OUT, MEASURED; `sr` KEEPS ITS GENERATION AND `h` IS EXCLUDED; `ES` READS TWO FAMILY NAMES; NO TITLE-RUN CONNECTIVE; THE DEFAULT DOES NOT MOVE.** Carries out 3g of item 11 of the 2026-10-27 #753 entry. - **What each pack turns on.** `locales.ES` chooses `es`, turns `two_family_names` on through es.toml's `[rules]` table (sub-phase 4f's schema, `PACK_RULES` gaining `es`), and carries `nameparser/locales/_es_given_names.py`'s list as its lexicon fragment, `Lexicon(given_names=GIVEN_NAMES)`, as `locales.ZH` carries its surnames; the switch and the list are decisions/O6's, and the decision to turn them on, made in chat, and its measurement are decisions/O6's 2026-10-30 phase 3g entry, which also records why `two_given_names` stays opt-in (decisions/O7's). `locales.PT` chooses `pt`, with an empty fragment and no patch, until a Portuguese given-name list exists (the same entry). es.toml writes `default = false` the academic readings `lic`, `licenciado`, `licenciada`, `lcdo`, `lcda`, `ingeniero`, `ingeniera`, `arq`, `mtro`, `mtra`, `doctora`, `profesor`, `profesora` and the salutation `doña`; pt.toml `doutor`, `doutora`, `professora` and `profa`. Each is `default = false` because phase 3 moves no default parse (item 12), not because another language collides with it; whether some belong in the default is a default change, left for one. Counts are on each reading, from `tools/name_usage.py --boxes` and a count of the names in every local corpus that open with the word or open the part after a comma with it. @@ -631,3 +631,7 @@ Open: [#1145](https://github.com/derek73/python-nameparser/issues/1145), the dis - **Declined: a rule reading the genitive into the patronymic view** (#1253's decision allows one, #1237's option 2). In Cyrillic the view would repeat `family`, the pack's order reading the father first. In Latin, where the order is now the caller's, the rule could ORDER a romanized name the genitive marks (#1237 counted 515 Wikidata `en` labels with it on the first word against 1 on the second) and leave unmarked ones alone, the gain it would add here; but the Latin endings collide with given names written first, JRC's two-word spellings opening with `-yn` including `Mervyn King`, `Carolyn Porco`, `Kathryn Gustafson` and `Martyn Johnson`, and its Cyrillic ones with `-ийн` the Bulgarian spellings of Madeleine, Gene and Dean; and a rule kind is a new `PatronymicRule` member and a `Policy` change (nameparser/vocab/README.md's [rules]). Left for a decision. - **The given name last, at a cost to a Russian name in a Mongolian list.** `FAMILY_FIRST_GIVEN_LAST` reads a three-word Russian name written family first with the given name in the middle backwards (`Сидоров Иван Петрович` → given 'Петрович', middle 'Иван'), where `FAMILY_FIRST` reads given 'Иван'; under `parser_for(locales.MN, locales.RU)` the patronymic lands in `given`, where rules/R9's East Slavic rule, which reads a middle word, does not see it, so the view stays empty; under `FAMILY_FIRST` with RU it is the middle word and the view reads 'Петрович' (O1's rotation stands down under either declared order). Neither shape is measured: every Khural member is written in two words, and the clan name the order was chosen for appears in no source either. Left for a decision, with decisions/W4's open precedence for a patronymic shape over a pack's script order. - **Accepted:** every Cyrillic name reads by the pack's order, Russian, Kazakh and Kyrgyz ones included (`Иван Сидоров` → family 'Иван'), so the pack is for Mongolian data; the given name followed by the father's initial reads backwards in Cyrillic (`Сүхээ Б.` → family 'Сүхээ'), where the default reads it right; a lone Cyrillic word reads as the caller's lone-word setting names, given by default, and reports, the pack's order settling no field (rules/O5, decisions/W4); a word the script test does not read as Cyrillic leaves its name to the caller's order, so initials joined by a full stop (`Б.Б. Сүхээ` → given 'Б.', family 'Сүхээ', where `Б. Б. Сүхээ` reads family 'Б.') and a letter with a stress mark that has no precomposed form (`Ива́н Сидоров`) read as the default does; and the CLDR sample's `Ноён` (Mr.) is no listed title, so `Ноён Азжаргал Төмөр` reads family 'Ноён' under the pack (a vocabulary question, not the pack's); nor are `Доктор` (Dr.) and the honorific `гуай` written after a name, so `Доктор Батын Сүхээ` reads family 'Доктор', given 'Сүхээ', and `Батын Сүхээ гуай` family 'Батын', given 'гуай' under the pack, vocabulary candidates beside `Ноён`, found by the independent review of #1365 (2026-11-12) and not added here; a Latin letter that looks Cyrillic inside a Cyrillic word (`Cүхээ Батын`, its first letter U+0043) leaves the name to the caller's order, given 'Cүхээ'. And the pack's own cost in matching: the father's name written as an initial, the short form Mongolian names are usually written in (`Батын Сүхээ` / `Б. Сүхээ`), is the family under the pack, so the pair reads `family-initial`, an outcome no matcher accepts unless asked, and conflicts, where the default matcher calls it consistent only by reading the father's name as the given name; accepting `family-initial` restores it, and docs/languages.rst's Mongolian section shows the accept. +- 2026-11-20 #1192 — `shri` IS A SALUTATION UNDER A HINDI CHOICE, REVERSING PHASE 3E'S EXCLUSION. hi.toml's `excluded:salutation` becomes a `salutation` reading written `default = false` with `after_given = true`, the shape `shrimati`'s reading has, so `parser_for(locales.HI)` reads `Shri Ravi Kumar Verma` as title 'Shri', given 'Ravi' and `Verma, Ravi Shri` as title 'Shri' (rules/H8), where the default and `locales.BN` read given 'Shri' as before; the dotted `Shri.` was a title at the head already, by rules/H2's shape. Phase 3e weighed the word by the given boxes that open with it, where it broke 20 filed names and fixed none, because no population it read writes the salutation; the 3.2 cycle chooses a pack's reading by its accuracy for the callers who choose the pack, and the list a Hindi choice is made for, India's Lok Sabha roll, writes it before nearly every member's name. `sri` stays excluded: its bearers are Indonesian and Sri Lankan given names (`Sri Wulandari`), a different population, and turning `shri` on does not move it. + MEASURED 2026-11-20 on this branch (master `758c2f8e` with #1239, #966, #1215 and #1337), py3.11, with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)shri' 'expr:Parser(lexicon=parser_for(locales.HI).lexicon.remove("shri", kind="salutation"), policy=parser_for(locales.HI).policy)' plain:HI`, the pack against itself without the reading: 2,275 names moved, none in the committed corpora. opensanctions-parliaments 2,244, 2,243 of them among in_sansad's 10,650 distinct spellings (`--group in_sansad`), each gaining the salutation as the title (`Shri Ravi Kumar Verma`, `Verma, Shri R.K.`, `Ravi Kumar, Shri`, a mononym `Shri Kunjan`), and 1 a Balinese name in Indonesia's regional heads that writes the word inside it, unclear. jrc-names 1, right. nepal-candidates 10, read by their Devanagari: 6 write a spaced `श्री`, which the default reads as the title, so the romanization now reads as its Devanagari does (one of them `Shri Mati`, Shrimati written apart, wrong both ways), and 4 the one word `श्रीनारायण`, a given name, now wrong. Broken by the filed boxes, each a given box opening with the word: fec-individuals 10 (`FAMILY, SHRI` 7 times, and `FAMILY, SHRI L`, `FAMILY, KANU SHRI`, `FAMILY, SHRI K. DR.`), orcid-researchers 5 (1 `Shri` alone, 4 a given name of two words such as `Shri Lal`), patentsview-inventors 4 and psc-individuals 2 (`Mr Shri Ram`, the forename box `Shri`). So about 2,250 fixed against 25 broken, 21 of them in populations a Hindi choice is not made for (US donors and patent filers, UK company filings, ORCID's whole world). + ACCEPTED: a person whose given name is `Shri`, or opens with it, reads the salutation under the pack: `Verma, Shri` gives title 'Shri' and no given name, `Shri Mehra` title 'Shri', family 'Mehra', and `Shri Lal Mehra` given 'Lal'. Nothing written tells `Shri Lal`, a given name of two words, from `Shri Ravi`, the salutation before one. A narrower reading, the title only with two or more name words behind it, keeps `Shri Mehra` and loses the 211 Sansad mononyms (`Shri Kunjan`), so it was not taken. + Recompute: the command above from a checkout of this change; the in_sansad figure with `--local opensanctions-parliaments --group in_sansad` and no `--match`; each moved name read from `--readings `, the two configurations' first field compared line by line. diff --git a/docs/languages.rst b/docs/languages.rst index 2c42a37ad..81c362a8d 100644 --- a/docs/languages.rst +++ b/docs/languages.rst @@ -603,11 +603,23 @@ whose leading use is the title: >>> parser_for(locales.BN).parse("Adhyapak Anisuzzaman Khan").title 'Adhyapak' -Two are left out, because the names that open with them outnumber the -titles even in Indian data. ``Shri`` opens a given name written in two -words (``Shri Kant``, ``Shri Lakshmi``), and ``Sushri`` an Odia one -(``Sushri Sangita``), so both stay name words under the packs. A strict -Hindi choice, which reads no Odia names, reads ``Sushri`` as the title: +``hi`` also reads ``Shri`` as the title, as an Indian parliament's +roll writes it. The cost falls on a person whose given name opens with +it (``Shri Kant``, ``Shri Lakshmi``), who reads the title there, so +``bn`` and the default leave it to position: + +.. doctest:: + + >>> parse("Shri Ravi Kumar Verma").given + 'Shri' + >>> hindi = parser_for(locales.HI).parse("Shri Ravi Kumar Verma") + >>> hindi.title, hindi.given + ('Shri', 'Ravi') + +``Sushri`` opens an Odia given name (``Sushri Sangita``) more often +than it is the title, so it stays a name word under the plain choice. +A strict Hindi choice, which reads no Odia names, reads it as the +title: .. doctest:: diff --git a/docs/locales.rst b/docs/locales.rst index 1d52f8501..d37d69195 100644 --- a/docs/locales.rst +++ b/docs/locales.rst @@ -44,7 +44,8 @@ Native-script entries are safe to enable by default precisely because they cannot collide with Latin-script names. That rules out the reverse: transliterations like ``sri``/``shri`` are *not* in the default vocabulary, because they are also ordinary given names in -Latin script. The same conservatism holds back a handful of native +Latin script (``locales.HI`` turns ``shri`` on, for data where it is +the salutation). The same conservatism holds back a handful of native entries that collide within their own script — bare ``سيد`` and ``شيخ`` (common given names) and Hebrew ``רב`` (an ordinary word). diff --git a/docs/release_log.rst b/docs/release_log.rst index 1c25ec05e..4a23535cd 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -7,6 +7,7 @@ Release Log - **Fix Vanden, the Dutch and Flemish van den written as one word, which read as a middle name.** ``parse("Pieter Vanden Broeck")`` gives family ``Vanden Broeck``, as ``Vander Broeck`` reads, where 1.4.0 through 3.1.0 gave middle ``Vanden``, family ``Broeck``. :issue:`1239` - **Add thirteen military ranks written with a hyphen, such as Vice-Admiral, Air Vice-Marshal and Major-General, as titles.** ``parse("Air Vice-Marshal Ann Reed")`` gives title ``Air Vice-Marshal``, given ``Ann``, where 3.1.0 gave given ``Air``, middle ``Vice-Marshal Ann`` and 1.4.0 title ``Air``, first ``Vice-Marshal``. A hyphenated rank not listed, such as Squadron-Leader, still reads as a name word. :issue:`966` - **Add 어 and 라 to the Korean surnames.** ``parse("어수선")`` gives family ``어``, given ``수선``, where 1.4.0 through 3.1.0 kept the name whole. A foreign name written in hangul that begins with 라 is now divided too; a caller who reads such names removes the surname from the ``Lexicon``'s ``surnames``. :issue:`1215` + - **Read Shri as a title under locales.HI.** ``parser_for(locales.HI).parse("Shri Ravi Kumar Verma")`` gives title ``Shri``, given ``Ravi``, where 3.0.0 through 3.1.0 gave given ``Shri``, middle ``Ravi Kumar``; the default and ``locales.BN`` still read it as a name word. A given name that opens with Shri (``Shri Kant``) reads the title under the pack. :issue:`1192` - **Fix a word completing عبد written with a final ى, as Egyptian names write it, which read as a name of its own.** ``parse("سامر عبد القوى")`` gives family ``عبد القوى``, as ``عبد القوي`` reads, where 1.4.0 through 3.1.0 gave middle ``عبد``, family ``القوى``. :issue:`1337` - **Fix locales.RU reading a Ukrainian patronymic written in Cyrillic as the family name.** ``parser_for(locales.RU).parse("Коваленко Олена Петрівна")`` gives family ``Коваленко``, given ``Олена``, patronymic ``Петрівна``, where 2.0.0 through 3.1.0 gave family ``Петрівна``, given ``Коваленко``; ``-ївна``, ``-євич`` and ``Ілліч`` read the same way, while the Belarusian endings and the Latin spellings (``-ivna``, ``-ovych``) still do not; ``Parser.suggest`` now suggests the East Slavic rule for a list of such names too. :issue:`1212` - **Fix initials() giving a Lao name its first letters.** ``parse("ສົມຊາຍ ໃຈດີ").initials()`` gives ``''``, as a Thai or Burmese name does, where 1.4.0 through 3.1.0 gave ``'ສ. ໃ.'``; the name match reads a Lao letter as a word, so ``ສ. ໃຈດີ`` no longer matches ``ສົມຊາຍ ໃຈດີ``, and a list of Lao names each ending in a letter no longer suggests a family-first order. A Lao title written short (``ດຣ.``) is still a title. :issue:`1380` diff --git a/nameparser/config/_index.py b/nameparser/config/_index.py index 6d2bb6f90..e09ac4557 100644 --- a/nameparser/config/_index.py +++ b/nameparser/config/_index.py @@ -2672,6 +2672,7 @@ ('shekh', (('ar', 'style', (('addresses', 'given'), ('same_as', 'sheikh'))), ('ar', 'given', ()))), ('shelly', (('en', 'familiar', (('short_for', ('michelle',)),)),)), ('sheriff', (('en', 'office', ()),)), + ('shri', (('hi', 'salutation', (('after_given', True), ('default', False))),)), ('shrimati', (('bn', 'salutation', (('after_given', True), ('default', False))), ('hi', 'salutation', (('after_given', True), ('default', False))))), ('shriyut', (('hi', 'salutation', (('after_given', True), ('default', False))),)), ('shrm-cp', (('en', 'credential', ()),)), diff --git a/nameparser/locales/hi.py b/nameparser/locales/hi.py index 8638f41ae..a9e983025 100644 --- a/nameparser/locales/hi.py +++ b/nameparser/locales/hi.py @@ -1,14 +1,14 @@ """The Hindi locale pack: vocabulary-only -- it chooses the language ``hi``, which turns on the readings nameparser/vocab/hi.toml writes -``default = false``: the romanized salutations ``shrimati``, ``smt`` -and ``shriyut``, which the default leaves to position, a Latin spelling -being one a name may have where the Devanagari cannot -(decisions/vocabulary-model, the 2026-10-30 phase 3e entry). Each is -then a title at the head of a name: ``Smt Nirmala Sitharaman`` gives -title ``Smt`` where the default gives given ``Smt``. ``shri`` is not -among them: it opens given names written in two words (``Shri Kant -Tripathi``) more often than it is the salutation, so it stays a name -word under the pack. +``default = false``: the romanized salutations ``shri``, ``shrimati``, +``smt`` and ``shriyut``, which the default leaves to position, a Latin +spelling being one a name may have where the Devanagari cannot +(decisions/vocabulary-model, the 2026-10-30 phase 3e entry, and its +2026-11-20 #1192 entry for ``shri``). Each is then a title at the head +of a name: ``Smt Nirmala Sitharaman`` gives title ``Smt`` where the +default gives given ``Smt``. ``shri`` also opens given names written in +two words (``Shri Kant Tripathi``), which read the title under the +pack, the cost of reading it for a roll that writes the salutation. Data sources: the counts on each reading in hi.toml (tools/name_usage.py, ORCID's given and family boxes by country among them). The pack carries diff --git a/nameparser/vocab/hi.toml b/nameparser/vocab/hi.toml index 397dffa76..2ec3349f9 100644 --- a/nameparser/vocab/hi.toml +++ b/nameparser/vocab/hi.toml @@ -10,7 +10,7 @@ excluded = { salutation = { reason = "Miss, the romanized कुमारी, wh [[word]] text = "shri" -excluded = { salutation = { reason = "the transliteration of श्री collides with real given names where the native script cannot: it opens given names, alone or written in two words (Shri Kant, Shri Lakshmi), 198 of ORCID's given boxes doing so, 52 of them holding it alone (its 2025 extract, 2026-10-30); nam_dict band 2 in India; Wikidata 7 given (2026-10-30). Turned on for Hindi and Bengali it broke 20 filed names and fixed none (decisions/vocabulary-model, the 2026-10-30 phase 3e entry)", issue = [345, 753], decided = 2026-10-30 } } +salutation = { default = false, gender = "m", issue = [345, 753, 1192], expands = "Shri, Mr., the romanized श्री", after_given = true, note = "on only under a Hindi choice, reversing its 2026-10-30 exclusion (decisions/vocabulary-model, 2026-11-20 #1192): the salutation before 2,243 of in_sansad's 10,650 spellings (opensanctions-parliaments, 2026-11-20); borne as a given name, opening ORCID's given boxes 198 times, 52 of them alone (Shri Kant, Shri Lakshmi; its 2025 extract, 2026-10-30), nam_dict band 2 in India, Wikidata 7 given (2026-10-30), which read title Shri under the pack, an accepted cost (Verma, Shri gives no given name): 21 filed records broken (fec-individuals 10, orcid-researchers 5, patentsview-inventors 4, psc-individuals 2) and 4 nepal-candidates names whose Devanagari is the one word श्रीनारायण (2026-11-20)" } [[word]] text = "shrimati" diff --git a/tests/v2/cases.py b/tests/v2/cases.py index 569c33459..619b5e096 100644 --- a/tests/v2/cases.py +++ b/tests/v2/cases.py @@ -23196,4 +23196,51 @@ def _check_cjk_shape_purity(self) -> None: locale="ru", notes="the Latin -ivna stays out with -ovych (decisions/R9's " "Open, #1212)"), + # #1192: shri is a salutation under locales.HI alone, written + # default = false in hi.toml (decisions/vocabulary-model, 2026-11-20) + Case("shri_opens_a_name_under_hi", + "Shri Ravi Kumar Verma", + {"title": "Shri", "given": "Ravi", "middle": "Kumar", + "family": "Verma"}, + locale="hi", classification="fix(#1192)"), + Case("shri_stays_a_given_name_by_default", + "Shri Ravi Kumar Verma", + {"given": "Shri", "middle": "Ravi Kumar", "family": "Verma"}, + notes="the reading is off unless a caller chooses Hindi"), + Case("shri_in_capitals_under_hi", + "SHRI RAVI KUMAR", + {"title": "SHRI", "given": "RAVI", "family": "KUMAR"}, + locale="hi", classification="fix(#1192)"), + Case("shri_before_one_name_under_hi", + "Shri Kunjan Pillai", + {"title": "Shri", "given": "Kunjan", "family": "Pillai"}, + locale="hi", classification="fix(#1192)"), + Case("shri_ending_the_given_part_after_a_family_comma_under_hi", + "Verma, Ravi Shri", + {"title": "Shri", "given": "Ravi", "family": "Verma"}, + locale="hi", classification="fix(#1192)", + notes="a salutation written after_given ends the given part as " + "the title, as smt does"), + Case("shri_after_a_full_name_and_a_comma_under_hi", + "Ravi Kumar, Shri", + {"title": "Shri", "given": "Ravi", "family": "Kumar"}, + locale="hi", classification="fix(#1192)"), + Case("shri_as_a_lone_given_name_after_a_family_comma_under_hi", + "Verma, Shri", + {"title": "Shri", "family": "Verma"}, + locale="hi", classification="fix(#1192)", + notes="the accepted cost: a person whose given name is Shri " + "reads the salutation and no given name under the pack"), + Case("shri_opening_a_given_name_of_two_words_under_hi", + "Shri Lal Mehra", + {"title": "Shri", "given": "Lal", "family": "Mehra"}, + locale="hi", classification="fix(#1192)", + notes="the accepted cost: a given name written in two words " + "that opens with Shri loses it to the title"), + Case("sri_stays_a_given_name_under_hi", + "Sri Ravi Kumar", + {"given": "Sri", "middle": "Ravi", "family": "Kumar"}, + locale="hi", + notes="sri stays excluded (an Indonesian and Sri Lankan given " + "name)"), ) diff --git a/tests/v2/test_locales.py b/tests/v2/test_locales.py index 2959a7cdc..fa7b7b348 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -379,7 +379,7 @@ def test_hi_and_bn_pack_contents() -> None: assert locales.BN == Locale(code="bn", lexicon=Lexicon.empty(), languages=frozenset({"bn"})) assert changed_words(selected(locales.HI.languages)) == { - "shrimati", "shriyut", "smt", "sushri"} + "shri", "shrimati", "shriyut", "smt", "sushri"} assert changed_words(selected(locales.BN.languages)) == { "adhyapak", "shrimati", "smt"} @@ -397,11 +397,17 @@ def test_hi_and_bn_read_the_romanized_salutation_as_the_title() -> None: # after a family comma, a salutation ending the given part is the # title (rules/H8), as its Devanagari spelling is assert packed.parse("Sitharaman, Nirmala Smt").title == "Smt" - # shri is left out (decisions/vocabulary-model, phase 3e): the - # given names written in two words that open with it keep it - assert packed.parse("Shri Kant Tripathi").as_dict() == parse( - "Shri Kant Tripathi").as_dict() assert packed.parse("Sushri Sangita Behera").given == "Sushri" + # shri is the title under hi alone (decisions/vocabulary-model, + # 2026-11-20 #1192); a given name written in two words that opens + # with it loses it there, the accepted cost, and bn leaves it alone + assert hi.parse("Shri Ravi Kumar Verma").title == "Shri" + assert (hi.parse("Shri Kant Tripathi").title, + hi.parse("Shri Kant Tripathi").given) == ("Shri", "Kant") + assert bn.parse("Shri Kant Tripathi").as_dict() == parse( + "Shri Kant Tripathi").as_dict() + # sri stays excluded under the pack + assert hi.parse("Sri Ravi Kumar").given == "Sri" # adhyapak is a title only at the head and only under bn; the Marathi # family name ending a name keeps its place assert bn.parse("Adhyapak Anisuzzaman Khan").title == "Adhyapak" @@ -2439,6 +2445,12 @@ def _default_corpus() -> list[str]: "Shrimati Gandhi, Indira", # shrimati before a family comma (H6) "Smt. Sitharaman, Nirmala", # smt, dotted, before a family comma ", Nirmala Smt.", # smt, dotted, after an empty head + "Shri Ravi Kumar Verma", # shri at the head + "SHRI RAVI KUMAR", # shri, in one case + "Dr. Shri Ravi Kumar", # shri behind a listed title + "Verma, Shri Ravi", # shri after a family comma + "Verma, Ravi Shri", # shri ending the given part (H8) + "Shri Verma, Ravi", # shri before a family comma (H6) # sushri: or.toml's Odia given name gates it under the plain choice, # so it is a title only inside a title phrase, a style's partner # (rules/H9); at the head, behind Dr. and after a family comma it @@ -3643,9 +3655,10 @@ def test_the_sb_mask_keeps_the_degrees_capitals_under_pt_br() -> None: ("הרב משה פיינשטיין שליט״א", "title", "הרב"), # Devanagari (hi/mr) titles -- a new #269 script: श्री/श्रीमती are # the Mr./Mrs. analogs, डॉ the Dr. abbreviation (edge-period - # normalization makes "डॉ." match too). NO Latin twins on purpose: + # normalization makes "डॉ." match too). NO Latin twins by default: # transliterated sri/shri collide with real given names (Sri - # Mulyani); the native script cannot. + # Mulyani); the native script cannot. Shri is one under locales.HI + # alone (#1192). ("श्री राम शर्मा", "title", "श्री"), ("श्रीमती सीता शर्मा", "title", "श्रीमती"), ("डॉ राम शर्मा", "title", "डॉ"), From d90597d7b8edfb783108c8246c6a9ef08ac719a5 Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Fri, 20 Nov 2026 17:53:29 -0800 Subject: [PATCH 6/8] Address the review of the Shri change (#1192) Record shri's after_given against H8's criterion in both decisions files, mark phase 3e's shri bullet superseded, sweep the restatements of its exclusion (vocabulary-exclusions, indic-honorifics, H6, hi.toml's notes, docs/locales.rst's pack table), restore H6's head note on lcp that the degree revert removed, swap two corpus names for invented ones, and add rows and a test for the shapes no test pinned: the three name orders and a strict choice, behind a title, around a family comma, dotted at the end, alone. Co-Authored-By: Claude Opus 5.5 --- .../H6-title-before-a-family-comma.md | 4 +-- .../H8-salutation-ending-the-given-part.md | 2 ++ docs/design/decisions/indic-honorifics.md | 2 +- .../design/decisions/vocabulary-exclusions.md | 2 +- docs/design/decisions/vocabulary-model.md | 9 ++++--- docs/languages.rst | 5 ++-- docs/locales.rst | 2 +- nameparser/vocab/hi.toml | 4 +-- tests/v2/cases.py | 27 +++++++++++++++++-- tests/v2/test_locales.py | 23 ++++++++++++++++ 10 files changed, 65 insertions(+), 15 deletions(-) diff --git a/docs/design/decisions/H6-title-before-a-family-comma.md b/docs/design/decisions/H6-title-before-a-family-comma.md index a80421f56..a09310a17 100644 --- a/docs/design/decisions/H6-title-before-a-family-comma.md +++ b/docs/design/decisions/H6-title-before-a-family-comma.md @@ -32,10 +32,10 @@ Left out: `mo`, which 45 names write as Muhammad with its period at the head (`MO. IBRAR KHAN`, 42 of them Nepalese candidates). Bare `Mo` is mostly the Chinese and Korean name (ORCID family boxes 3,478, China 952; given 1,546, China 252), and a `given` reading would report a Mo Yan's given name as read in the file holding it (`Reading.languages`). `md` keeps its 2026-10-27 reading (decisions/indic-honorifics: `Md.` a title by the shape, an accepted cost; decisions/C3's 2026-11-02 #1017 entry declined its given reading because of its credential). The titles, the pack-only degrees on by default and the exclusions of `bc`, `mst` and `sig` are #1115's later batches. - 2026-11-06, #1115, the second batch — THE TITLES WITH NO NAME BEARERS, LISTED. From the same mining, the words that open names as titles and that no source counts as a name (under 100 US Census bearers, under 5 US SSA births a year, Wikidata 2 or fewer, `tools/name_usage.py --boxes` on 2026-11-06): `engr`, `adv` and the modifier `assist` (en.toml, beside `engineer`, `advocate` and `assistant`), `ir` and `drs` (mul.toml: the Dutch and Indonesian degrees, Hong Kong's and Malaysia's registered engineer, and the English plural of Dr), `excm` and `excma` (ca.toml) and `excmo` and `excma` (es.toml). Listing reaches what H2's shape could not: the bare spelling (`Engr Ahsen Ali` → title 'Engr', given 'Engr', middle 'Ahsen' before), a title run behind a listed title (`Prof dr ir Simon Peeters` → title 'Prof dr ir', given 'ir' before), the part after a comma, where a part of titles alone fixes no family boundary (rules/C8; `Esra Oz, Assist Prof` → title 'Assist Prof', given 'Esra', family 'Esra Oz' before), the given part's end after a family comma (`BAXTER, JENNIFER DRS.`) and H6's run (`Excm. Sr. Lloret Palol, Josep Antoni` → title 'Excm. Sr.', family 'Lloret Palol'). Measured with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)(^|[^\w])(engr|adv|ir|drs|assist|excm|excma|excmo)\b' '' default` on 2026-11-06 against `e76cdad3`: 246 of 662 matching names move, ClinicalTrials.gov officials 175 of them (`Name, Assist Prof`), every move read by eye, nearly all a title leaving a name field. The costs among them: four tokens gluing a title to a name word with a period take the word into the title, as `Dr.` already does (`Engr.Nurunnabi` → title 'Engr.Nurunnabi' and no name, `Engr.Wlla Al-Mhairat`, `Engr.Gamachu Busa Meskele`, `DAVIDSON, DRS.PAULA DMARY`); one credential run splits (`…, PGCert HE, Reg Engr, MIMechE` → title 'Dr Engr', suffix '…, Reg, MIMechE'); eleven ClinicalTrials.gov officials writing `Res. Assist` or `Res Assist.` read title 'Assist', suffix 'Res.', as the listed `Res. Asst.` already did, and two writing it glued (`Res.Assist.`) move whole from suffix to title; and one ORCID record holds three names in a list. A lone `Assist` reads as `Asst` does (rules/H9): a title opening a name only before a head title (`Assist John Smith` keeps given 'Assist'), and a title alone ending a name or after a comma (`John Smith Assist.` → title 'Assist.'). Left out, each borne as a name: `eng` (US Census 2010 10,682 surname bearers; ORCID given boxes 468, Malaysia 63, Singapore 49), `er` (ORCID family boxes 1,087), `doc` (US SSA 1,391 births, Wikidata 130 given names: Doc Rivers), `ven` (Wikidata 448 given names, ORCID family boxes 214) and `em` (US Census 885). Their dotted spelling opening a name stays a title by H2's shape. The Spanish and Czech titles the mining found unlisted (`Licda.`, `Gral.`, `Tte.`, `RSDr.`, `plk.`) wait for the batch that decides which pack-only titles the default reads, with those listed `default = false` already (`ThDr.`, `MUDr.`, `Lic.`), since listing them so would move no default parse. -- 2026-11-07, #1129 — #1115's CANDIDATES CARRIED FORWARD: THREE LISTED BY DEFAULT, ONE FOR THE CZECH PACK, THE REST LEFT OUT. Each candidate's bearers were counted with `uv run python tools/name_usage.py --boxes` and its incidence with `uv run python tools/vocab/word_report.py --rank` (2026-11-07, against `54318d78`). Listed by default: `sk` (bn.toml), Sheikh written short, as a `given` reading with `same_as`, so `Sk. Monirul Islam` reads given 'Sk.' as `Sheikh Ahmed Khan` reads given 'Sheikh' since #912 (title 'Sk.', given 'Monirul' before), no source counting it as a name of its own and ORCID's given boxes holding it 1,008 times (India 351, Bangladesh 119), some of them the initials S. K.; `biól` and `mgtr` (es.toml), Mexico's biologist and the Andean magíster, which no source counts as a name. Measured with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)(^|[^\w])(sk|bi[oó]l|mgtr|mjr|mtr|lcp|mvz|act|map)\b' 'expr:Parser(lexicon=Lexicon.default().remove("biól", kind="academic").remove("mgtr", kind="academic").remove("sk", kind="given"))' default` (the comparator the default without the three readings; `mjr` was also removed in the run, before it went to the pack): 20 of 258 matching names move, every one `sk` from the title to the given name (`Mr Sk. Mazamel Islam`, `Dr. Sk. Md. Masudul Ahsan`, `Sk. Nahid`), and in two of them a `Md.` behind it from the title to the middle name, since H2's shape chains only from the head (`Sk. Md. Atiqur Rahman` → given 'Sk.', middle 'Md. Atiqur', title 'Sk. Md.' before): the #1115 entry's `Md.` title by the shape holds where it opens the name or follows a title; `biól` and `mgtr` move none, their corpus spellings being the dotted head H2's shape already read. `local_agreement.py --base` on a checkout of `54318d78`: ORCID 12 records closer to the boxes and none further, 6 changed (the filer typed the whole name in the given box), PSC 1 closer (`Mr Sk. Mazamel Islam`, `Sk.` typed in the forename box). +- 2026-11-07, #1129 (its reason for leaving `lcp` out, that `L.C.P.` reads as initials whatever the vocabulary says, is not so: a run listed with its stops reads as that word, rules/T7's vocabulary Except; decisions/H10's 2026-11-20 #979 entry records why the dotted degrees were declined all the same) — #1115's CANDIDATES CARRIED FORWARD: THREE LISTED BY DEFAULT, ONE FOR THE CZECH PACK, THE REST LEFT OUT. Each candidate's bearers were counted with `uv run python tools/name_usage.py --boxes` and its incidence with `uv run python tools/vocab/word_report.py --rank` (2026-11-07, against `54318d78`). Listed by default: `sk` (bn.toml), Sheikh written short, as a `given` reading with `same_as`, so `Sk. Monirul Islam` reads given 'Sk.' as `Sheikh Ahmed Khan` reads given 'Sheikh' since #912 (title 'Sk.', given 'Monirul' before), no source counting it as a name of its own and ORCID's given boxes holding it 1,008 times (India 351, Bangladesh 119), some of them the initials S. K.; `biól` and `mgtr` (es.toml), Mexico's biologist and the Andean magíster, which no source counts as a name. Measured with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)(^|[^\w])(sk|bi[oó]l|mgtr|mjr|mtr|lcp|mvz|act|map)\b' 'expr:Parser(lexicon=Lexicon.default().remove("biól", kind="academic").remove("mgtr", kind="academic").remove("sk", kind="given"))' default` (the comparator the default without the three readings; `mjr` was also removed in the run, before it went to the pack): 20 of 258 matching names move, every one `sk` from the title to the given name (`Mr Sk. Mazamel Islam`, `Dr. Sk. Md. Masudul Ahsan`, `Sk. Nahid`), and in two of them a `Md.` behind it from the title to the middle name, since H2's shape chains only from the head (`Sk. Md. Atiqur Rahman` → given 'Sk.', middle 'Md. Atiqur', title 'Sk. Md.' before): the #1115 entry's `Md.` title by the shape holds where it opens the name or follows a title; `biól` and `mgtr` move none, their corpus spellings being the dotted head H2's shape already read. `local_agreement.py --base` on a checkout of `54318d78`: ORCID 12 records closer to the boxes and none further, 6 changed (the filer typed the whole name in the given box), PSC 1 closer (`Mr Sk. Mazamel Islam`, `Sk.` typed in the forename box). For the Czech pack: `mjr` (cs.toml, `default = false`), the rank, since an ORCID researcher in Sri Lanka files `MJR` as the given name, initials, which a default title reading took (1 record further from the boxes); the class #1115's pack batch kept off (`MgA`, `GS`). Excluded, each also a credential written after names, which a title reading after a comma takes from the suffix or the given name (rules/C2 past a second comma, rules/C8 in the part after the first, and a lone word ending the given part after a family comma), measured under `plain:ES` against the same command run in both trees (`--readings`, compared line by line): `mtr` (5 ClinicalTrials.gov officials, `Shana McCormack, MD, MTR` → title 'MTR', and a one-comma `John Smith, MTR` alike; against them 5 UK PSC names opening with a bare `Mtr`, which their filers typed in the title box, read the title, gains a Spanish choice is not the place for), `act` (`Terry L Grindstaff, PhD, PT, ACT`) and `map` (also an English word and a filed given name, FEC's `SAN, MAP` → title 'MAP' with no given name; `Jorge Luis Loáiciga Gutiérrez, MAP, Lic` → title 'PhD. MAP Lic' from the part after the first comma; 1 of its 3 moves the title meant). Not listed, with nothing to gain: `lcp` and `mvz`, because Mexico's DOF signatures write them as `L.C.P.` and `M.V.Z.`, which read as initials whatever the vocabulary says, and their dotted head `LCP.` is a title by H2's shape already; listed in the Spanish pack, they moved no corpus name. Nor the unaccented `biol`, written after a comma as the field of a diploma (`Dipl. Biol.`, ClinicalTrials.gov officials 11), the decisions/H6 2026-11-06 Diplom entry's shape. - Left out as borne names: `sen` (US Census 2010 3,059; ORCID given boxes 2,337; and `Sen.` ending a name is also Senior), `ku` (US Census 4,888; Wikidata 2,396 family names), `cor` (nam_dict band 6 in the Netherlands; Wikidata 260 given names), `prim` (US Census 2,019; US SSA 245 births), `dip` (US Census 337; nam_dict band 2 in India and Sri Lanka), `lae` (US Census 144; nam_dict band 3), `med` (ORCID given boxes 232, Med being Mohamed written short) and `jan`. Left out, ambiguous or too rare to weigh: `sh` (Sheikh, and India's Shri, which hi.toml refuses as a title because it opens given names), `kh` (several names it shortens), `th` and `ph` (2 names each; `Ph.` also opens a spaced `Ph. D.`), `rr` (ORCID given boxes 195, initials), `ass` (`Ass. Prof.` reads as a title through H2's chain already) and `akad` (needs `Akad. mal.` as a phrase, 10 names). `mt` stays out, and no issue tracks it: a particle reading would need the period, which no reading can require, and the property that would let one is not worth building for the one corpus name it would fix (#1129's measurement: 6 corpus names write `Mt.`, 1 of them a surname head, `Gregory G. Mt. Pleasant`). A caller whose names hold it adds a particle reading to a `Lexicon` of their own; reconsider if a new corpus writes it more often. + Left out as borne names: `sen` (US Census 2010 3,059; ORCID given boxes 2,337; and `Sen.` ending a name is also Senior), `ku` (US Census 4,888; Wikidata 2,396 family names), `cor` (nam_dict band 6 in the Netherlands; Wikidata 260 given names), `prim` (US Census 2,019; US SSA 245 births), `dip` (US Census 337; nam_dict band 2 in India and Sri Lanka), `lae` (US Census 144; nam_dict band 3), `med` (ORCID given boxes 232, Med being Mohamed written short) and `jan`. Left out, ambiguous or too rare to weigh: `sh` (Sheikh, and India's Shri, which hi.toml reads as a title only under a Hindi choice because it opens given names), `kh` (several names it shortens), `th` and `ph` (2 names each; `Ph.` also opens a spaced `Ph. D.`), `rr` (ORCID given boxes 195, initials), `ass` (`Ass. Prof.` reads as a title through H2's chain already) and `akad` (needs `Akad. mal.` as a phrase, 10 names). `mt` stays out, and no issue tracks it: a particle reading would need the period, which no reading can require, and the property that would let one is not worth building for the one corpus name it would fix (#1129's measurement: 6 corpus names write `Mt.`, 1 of them a surname head, `Gregory G. Mt. Pleasant`). A caller whose names hold it adds a particle reading to a `Lexicon` of their own; reconsider if a new corpus writes it more often. - 2026-11-06, #1115, the Diplom degrees (its accepted cost of a degree glued to its field ending a name, and the hyphenated degree it left to #1116, superseded by decisions/H5's 2026-11-06 #1116 entry, which reads both as the title) — `dipl` IS LISTED ALONE, AND THE SEPARATOR MATCH #1115's COMMENT PROPOSED IS DECLINED. The German, Czech and Slovak diploma degree is written before its field, which varies (`Dipl.-Ing.`, `Dipl.-Psych.`, `Dipl.-Kfm.`, `Dipl.-Kffr.`, `Dipl.-Phys.`, `Dipl.-Pol.`, `Dipl.-Soz.`, `dipl. um.`, `dipl.ek.`, over the 160 corpus names in which `(?i)(?`, the two configurations' first field compared line by line. diff --git a/docs/languages.rst b/docs/languages.rst index 81c362a8d..f05db8ede 100644 --- a/docs/languages.rst +++ b/docs/languages.rst @@ -591,7 +591,7 @@ The default reads the Devanagari and Bengali salutations as titles (``श्रीमती``, ``শ্রীমতী``), since no Latin name is spelled in those scripts, and leaves their romanizations to position, since a Latin spelling can be a name. ``hi`` and ``bn`` turn on the romanized forms -whose leading use is the title: +whose leading use is the title, and ``hi`` one more, below: .. doctest:: @@ -629,7 +629,8 @@ title: 'Sushri' ``Smt.`` and ``Shri.`` written with their period are titles at the head -of a name by default, packs or no. ``Pandit``, ``Sardar``, ``Kumari``, +of a name by default, packs or no; under ``hi`` they are titles ending +the name too. ``Pandit``, ``Sardar``, ``Kumari``, ``Babu``, ``Acharya`` and ``Begum`` are titles under no pack: each opens far more names as a given name or a surname than as the title. diff --git a/docs/locales.rst b/docs/locales.rst index d37d69195..0bbb84bfd 100644 --- a/docs/locales.rst +++ b/docs/locales.rst @@ -280,7 +280,7 @@ says which parts each pack is made of. * - ``hi`` - Hindi: romanized titles - Chooses ``hi``, which reads the romanized salutations ``Smt`` - and ``Shrimati`` (Mrs.) and ``Shriyut`` (Mr.) as titles, where + and ``Shrimati`` (Mrs.) and ``Shri`` and ``Shriyut`` (Mr.) as titles, where the default reads a name word. See :ref:`Romanized Indic titles `. - ``Shrimati Indira Gandhi`` → title ``Shrimati`` diff --git a/nameparser/vocab/hi.toml b/nameparser/vocab/hi.toml index 2ec3349f9..e0ade2edc 100644 --- a/nameparser/vocab/hi.toml +++ b/nameparser/vocab/hi.toml @@ -51,7 +51,7 @@ excluded = { salutation = { reason = "Begum is a trailing name element far more [[word]] text = "श्री" -salutation = { gender = "m", issue = [269, 870], expands = "Shri, Mr.", note = "no Latin twin: Latin sri and shri are given names (their exclusions in hi.toml); borne as a given name: Wikidata 1 people (2026-10-24); kept here, not as a `given` reading, which would make the title one only inside a title phrase (rules/H9). The Nepali given-name element is ne.toml's reading, off by default: nepal-candidates opens 216 Devanagari names with a spaced श्री (one written श्री.), romanized as a name word in 202 (Shree 194, Shri 6, Sri 2) and as Mr in 3 (Mr. twice, the glued Mr.Chatra once), a cost the default accepts for the Hindi, Marathi and Konkani salutation (rules/H9, #870, 2026-11-03)", excluded = { after_given = "also an element of given names (Sri, Shri), so where it ends the given part it may be one" } } +salutation = { gender = "m", issue = [269, 870], expands = "Shri, Mr.", note = "no Latin twin by default: Latin sri is a given name (its exclusion in hi.toml), and shri is a twin only under a Hindi choice, its reading written default = false (#1192); borne as a given name: Wikidata 1 people (2026-10-24); kept here, not as a `given` reading, which would make the title one only inside a title phrase (rules/H9). The Nepali given-name element is ne.toml's reading, off by default: nepal-candidates opens 216 Devanagari names with a spaced श्री (one written श्री.), romanized as a name word in 202 (Shree 194, Shri 6, Sri 2) and as Mr in 3 (Mr. twice, the glued Mr.Chatra once), a cost the default accepts for the Hindi, Marathi and Konkani salutation (rules/H9, #870, 2026-11-03)", excluded = { after_given = "also an element of given names (Sri, Shri), so where it ends the given part it may be one" } } [[word]] text = "श्रीमती" @@ -99,7 +99,7 @@ academic = { issue = 344, expands = "Dr., the डा. abbreviation (Nepali and o [[word]] text = "डॉ" -academic = { issue = 269, expands = "Dr., abbreviated", note = "डॉ. matches through the edge-period normalization, as Latin Dr. does; no Latin twins, for the reason the sri/shri exclusions in hi.toml give" } +academic = { issue = 269, expands = "Dr., abbreviated", note = "डॉ. matches through the edge-period normalization, as Latin Dr. does; no Latin twins, for the reason the sri exclusion and shri's default = false reading in hi.toml give" } [[word]] text = "डॉक्टर" diff --git a/tests/v2/cases.py b/tests/v2/cases.py index 619b5e096..cb917550d 100644 --- a/tests/v2/cases.py +++ b/tests/v2/cases.py @@ -23212,8 +23212,8 @@ def _check_cjk_shape_purity(self) -> None: {"title": "SHRI", "given": "RAVI", "family": "KUMAR"}, locale="hi", classification="fix(#1192)"), Case("shri_before_one_name_under_hi", - "Shri Kunjan Pillai", - {"title": "Shri", "given": "Kunjan", "family": "Pillai"}, + "Shri Gopalan Nair", + {"title": "Shri", "given": "Gopalan", "family": "Nair"}, locale="hi", classification="fix(#1192)"), Case("shri_ending_the_given_part_after_a_family_comma_under_hi", "Verma, Ravi Shri", @@ -23237,6 +23237,29 @@ def _check_cjk_shape_purity(self) -> None: locale="hi", classification="fix(#1192)", notes="the accepted cost: a given name written in two words " "that opens with Shri loses it to the title"), + Case("shri_behind_a_listed_title_under_hi", + "Dr. Shri Ravi Kumar", + {"title": "Dr. Shri", "given": "Ravi", "family": "Kumar"}, + locale="hi", classification="fix(#1192)"), + Case("shri_after_a_family_comma_under_hi", + "Verma, Shri Ravi", + {"title": "Shri", "given": "Ravi", "family": "Verma"}, + locale="hi", classification="fix(#1192)"), + Case("shri_before_a_family_comma_under_hi", + "Shri Verma, Ravi", + {"title": "Shri", "given": "Ravi", "family": "Verma"}, + locale="hi", classification="fix(#1192)"), + Case("shri_dotted_ending_the_name_under_hi", + "Ravi Kumar Shri.", + {"title": "Shri.", "given": "Ravi", "family": "Kumar"}, + locale="hi", classification="fix(#1192)", + notes="a listed title with a full stop ending the name is the " + "title; the default reads family 'Shri.'"), + Case("shri_alone_under_hi", + "Shri", + {"title": "Shri"}, + locale="hi", classification="fix(#1192)", + notes="as a lone Smt reads; the default reads given 'Shri'"), Case("sri_stays_a_given_name_under_hi", "Sri Ravi Kumar", {"given": "Sri", "middle": "Ravi", "family": "Kumar"}, diff --git a/tests/v2/test_locales.py b/tests/v2/test_locales.py index fa7b7b348..7dd64b063 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -408,6 +408,7 @@ def test_hi_and_bn_read_the_romanized_salutation_as_the_title() -> None: "Shri Kant Tripathi").as_dict() # sri stays excluded under the pack assert hi.parse("Sri Ravi Kumar").given == "Sri" + # adhyapak is a title only at the head and only under bn; the Marathi # family name ending a name keeps its place assert bn.parse("Adhyapak Anisuzzaman Khan").title == "Adhyapak" @@ -417,6 +418,26 @@ def test_hi_and_bn_read_the_romanized_salutation_as_the_title() -> None: assert bn.parse("Shriyut Ram Prasad").title == "" +def test_shri_peels_before_a_declared_order_lays_out_the_rest() -> None: + # #1192: the title is read first under every order, so a family-first + # caller's name words keep their declared places behind it, and a + # strict choice reads shri as the plain one does (no other file reads + # the word, so strict has nothing to gate) + for order, expect in ( + (GIVEN_FIRST, ("Ravi", "Kumar", "Verma")), + (FAMILY_FIRST, ("Kumar", "Verma", "Ravi")), + (FAMILY_FIRST_GIVEN_LAST, ("Verma", "Kumar", "Ravi"))): + for strict in (False, True): + packed = parser_for(locales.HI, strict=strict, + base=Parser(policy=Policy(name_order=order))) + name = packed.parse("Shri Ravi Kumar Verma") + assert (name.title, name.given, name.middle, name.family) == ( + ("Shri",) + expect), (order, strict) + for text in ("Shri Verma", "Verma, Ravi Shri"): + assert packed.parse(text).title == "Shri", (text, order) + assert packed.parse("Verma, Ravi Shri").given == "Ravi" + + def test_sushri_is_the_title_only_under_a_strict_hindi_choice() -> None: # #345: hi.toml's sushri salutation is off by default and or.toml # declares the Odia given name, so the plain choice gates it (a title @@ -2451,6 +2472,8 @@ def _default_corpus() -> list[str]: "Verma, Shri Ravi", # shri after a family comma "Verma, Ravi Shri", # shri ending the given part (H8) "Shri Verma, Ravi", # shri before a family comma (H6) + "Ravi Kumar Shri.", # shri, dotted, ending the name (H5) + ", Ravi Shri.", # shri, dotted, after an empty head # sushri: or.toml's Odia given name gates it under the plain choice, # so it is a title only inside a title phrase, a style's partner # (rules/H9); at the head, behind Dr. and after a family comma it From 892710d45eaf788f0892f764cf4e8f4b49c18782 Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Fri, 20 Nov 2026 18:02:22 -0800 Subject: [PATCH 7/8] Drop after_given from shri, which no Sansad shape asks for (#1192) rules/H8 leaves out a salutation borne as a given name. The Lok Sabha roll writes the salutation before the given name after a family comma, or after a full name and a comma, both read as the title without the property; with it, 2 names read worse. The word records the refusal, and the decisions entry the measurement. Also: the pooled-count clause, one more corpus name swapped for an invented one, and the 211 figure counted as spellings. Co-Authored-By: Claude Opus 5.5 --- .../H8-salutation-ending-the-given-part.md | 2 -- docs/design/decisions/vocabulary-model.md | 10 +++++----- nameparser/config/_index.py | 2 +- nameparser/vocab/hi.toml | 2 +- tests/v2/cases.py | 14 ++++++++++---- tests/v2/test_locales.py | 9 ++++++--- 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/docs/design/decisions/H8-salutation-ending-the-given-part.md b/docs/design/decisions/H8-salutation-ending-the-given-part.md index c16df0cb6..99e9bf436 100644 --- a/docs/design/decisions/H8-salutation-ending-the-given-part.md +++ b/docs/design/decisions/H8-salutation-ending-the-given-part.md @@ -4,7 +4,6 @@ - A salutation ending the given part after a family comma, written bare or with a stop at its edge that H5's abbreviation shape does not take (`Mr..`), is the title, read as its period-marked spelling reads in every comma shape and under every name order: `Doe, Jane Mrs` → title 'Mrs', given 'Jane'; `DOE, JOHN Q MR` → title 'MR', middle 'Q' — 2026-10-24 #835. - Only the salutations marked `after_given` in the vocabulary qualify, and a salutation borne as a given name or a surname is left out by an exclusion carrying its counts, since a middle name may be either (`Doe, John Goodman` keeps middle 'Goodman') — 2026-10-24 #835. -- Under a Hindi choice the romanized `shri`, a `default = false` reading, is marked `after_given` though its Devanagari spelling is left out on the given-name doubt above, the roll that choice is made for writing it after the given name (`Verma, Ravi Shri` → title 'Shri') — 2026-11-20 #1192 (decisions/vocabulary-model). - No other title kind qualifies (`Doe, John Pope` and `Doe, Jane Dr` keep their middle names), a title/suffix dual stays a suffix (`Doe, Jane Ms`), and the comma-less writing is H5's (`Jane Doe Mrs` keeps family 'Mrs') — 2026-10-24 #835. - A salutation that is someone's middle name reads as the title after a family comma, an accepted cost (`Doe, Jane Miss`); so does the empty head's one given word moving to the family as the period-marked spelling moves it (`, Jane Mrs` → family 'Jane') — 2026-10-24 #835. - The rule reads the comma, not a declared order: `Doe Jane Mrs` under FAMILY_FIRST keeps middle 'Mrs', so the family-comma invariant of decisions/two-input-invariants does not hold for a trailing salutation — 2026-10-24 #835. @@ -23,4 +22,3 @@ Open: none in this file. Whether a bare `I` or `V` the salutation leaves ending THE CORPORA (measured 2026-10-24 against master `3f8e29b2`, py3.11). No committed corpus name moved: the snapshot gains only this rule's own examples, and the CLDR, GND and Wikidata agreement views match their records. `snapshot.py --local fec-individuals`, base recorded with `--tree`: 12,381 of 1,893,964 names move, each a salutation leaving the middle name for the title, some with a credential or a generational word behind it: `MR` 9,339, `MRS` 1,908, `MISS` 1,108, `MR..` 24, and two more joining a title already read. Three had read `HR` as the Danish and German abbreviation of Herr, one of them behind a woman's given name: in US data it is more likely two initials run together, so `hr` was excluded on that evidence and those three are not among the moves. 385 of the moves lose a `CONJUNCTION_OR_INITIAL` report (`DOE, JOHN E MR`): with the salutation gone the letter has no name word behind it to connect, which is what P8 asks. In 361 of them the letter stays a middle initial; the other 24 are among the 59 below. `ukec-individuals` does not move. A CONSEQUENCE NOT DECIDED HERE: 59 of the FEC moves end the given part in a lone `V` or `I` once the salutation is the title (`DOE, JANE I MRS`), which then reads as the generational suffix, as `DOE, JANE I` and `DOE, JANE I MRS.` already read on master (#144's lenient tail test after a family comma). In these names it is a middle initial. The bare spelling now reads as its twins read; whether #144's reading should change is its own question. THE FAMILY-FIRST WRITING (the design-docs review). A declared FAMILY_FIRST order fixes the surname as a comma does, but the rule reads only the comma: `Doe Jane Mrs` under FAMILY_FIRST keeps middle 'Mrs' (FAMILY_FIRST_GIVEN_LAST: given 'Mrs'). decisions/two-input-invariants pairs those two writings; over the 82 flagged words written without a stop, an apostrophe or a hyphen, each after three family and three given names, they agree on 738 of 738 pairs on master and on none now. Recorded as an Accepted clause of rules/H8 rather than extended: the declared order says where the surname is, not where the given part ends, and the trailing slot of a comma-less name is H5's. -- 2026-11-20 #1192 — THE ROMANIZED `shri` ENDS THE GIVEN PART UNDER A HINDI CHOICE. hi.toml's new `default = false` salutation is written `after_given`, as `shrimati`'s is, an exception to the standing criterion this file's 2026-10-24 entry applies, which left the Devanagari `श्री` out on the given-name doubt: the Lok Sabha roll a Hindi choice is made for writes the salutation after the given name in its family-comma list (`Verma, Ravi Shri` → title 'Shri' under the pack, where `वर्मा, रवि श्री` keeps middle 'श्री'). Dropping the property would move 2 names of every local corpus holding the word, one of them a filer whose given name of two words ends in it, which the property breaks. The criterion stands for the default; the measurement and the weighing are decisions/vocabulary-model's 2026-11-20 #1192 entry. diff --git a/docs/design/decisions/vocabulary-model.md b/docs/design/decisions/vocabulary-model.md index 4bca079b2..9026b2437 100644 --- a/docs/design/decisions/vocabulary-model.md +++ b/docs/design/decisions/vocabulary-model.md @@ -15,7 +15,7 @@ The vocabulary was a set of base sets plus marker subsets (`particles` and `part - `es` turns on `doña`, the courtesy title that leads a Spanish name with no complement and is a family name too, the other titles phase 3g turned on being read by default since 2026-11-06 #1115 (below); `don`, `dona` and `dom` are excluded, the packs included, names opening with each as a name more often than as the title; `maestro`, a family name whose form of address is written `Mtro.`, is excluded too, and so is `h`, the hijo an initial is written as; `sr` keeps a generation reading beside its salutation in both files, so a choice leaves it the dual position decides; no connective continues a title run, the shape unwritten in name data, and the office titles that take a complement stay out — 2026-10-30 #753, phase 3g. - `es` turns on `maestra` too, the form of address written out, `maestro` staying excluded; `profesor` and `profesora`, which phase 3g turned on, are read by default since 2026-11-03 (decisions/salutation-titles) — 2026-11-03 #980. - The titles phase 3f, phase 3g and #1108 wrote `default = false` for neutrality rather than for a collision are read by default, 27 words, 36 readings, the nine doctorates being written in cs.toml and sk.toml both: es `lic`, `licenciado`, `licenciada`, `lcdo`, `lcda`, `ingeniero`, `ingeniera`, `arq`, `mtro`, `mtra`, `doctora`; pt `doutor`, `doutora`, `professora`, `profa`; cs and sk `judr`, `mudr`, `phdr`, `rndr`, `mvdr`, `mddr`, `paeddr`, `pharmdr`, `thdr`; vi `ths`, `đbqh`, `dbqh`. A choice still turns on the titles a name or initials spell: es `maestra` and `doña`, cs `mga` and `bca`, `pan`, `mgr`'s degree, vi `gs`, `ts` and `pgs` — 2026-11-06 #1115. -- Of the romanized titles a pack's phase lists, one whose native spelling is a default title turns on unless, counted in persons and pooled across every population measured, names open with it more often than it opens one as the title; a spelling outside the phase's list (`Shreemati`, `Srimati`) stays open until a phase writes it as a reading: `hi` turns on `smt`, `shrimati` and `shriyut`, `bn` `smt`, `shrimati` and `adhyapak` (`shriyut` with no bearer anywhere, `adhyapak` with family-name bearers only, every one where the title claim, acting at the head, does not reach), while `shri`, opening given names in every population 3e measured, stayed excluded until 2026-11-20 #1192 made it a `default = false` salutation in hi.toml, measured on India's Lok Sabha roll, the population a Hindi choice is made for, where it is the salutation (that entry weighs the reading by the callers who choose the pack, not by this pooled count, which the given boxes it adds to would still decide the other way), `sri` staying excluded, and `sushri`, an Odia given name, is a `default = false` salutation in hi.toml with the Odia name declared in or.toml, so the plain `hi` choice, made for data that holds those names, reads it as a title only inside a title phrase and a strict one as the title (decisions/indic-honorifics, 2026-11-03 #345/#870) — 2026-10-30 #753, phase 3e. +- Of the romanized titles a pack's phase lists, one whose native spelling is a default title turns on unless, counted in persons and pooled across every population measured, names open with it more often than it opens one as the title; a spelling outside the phase's list (`Shreemati`, `Srimati`) stays open until a phase writes it as a reading: `hi` turns on `smt`, `shrimati` and `shriyut`, `bn` `smt`, `shrimati` and `adhyapak` (`shriyut` with no bearer anywhere, `adhyapak` with family-name bearers only, every one where the title claim, acting at the head, does not reach), while `shri`, opening given names in every population 3e measured, stayed excluded until 2026-11-20 #1192 made it a `default = false` salutation in hi.toml, measured on India's Lok Sabha roll, the population a Hindi choice is made for, where it is the salutation (that entry weighs the reading by the callers who choose the pack; counted in persons and pooled, the roll's 2,217 members opening with the salutation outnumber the about 220 bearers 3e and hi.toml record, so this criterion turns it on too), `sri` staying excluded, and `sushri`, an Odia given name, is a `default = false` salutation in hi.toml with the Odia name declared in or.toml, so the plain `hi` choice, made for data that holds those names, reads it as a title only inside a title phrase and a strict one as the title (decisions/indic-honorifics, 2026-11-03 #345/#870) — 2026-10-30 #753, phase 3e. - A language pack is a choice of languages on `Locale.languages` selecting which readings compile, a tag choosing its own file and its ancestors', and a reading index, loaded on its first lookup, carries the languages to run time; strict is file-strict, the chosen files, `mul.toml` and native-script words' readings only, `und.toml` not among them, so it needs no 3i; third-party language files are deferred — 2026-10-27 #753 (Derek); 2026-10-29 #753, phase 3a (Derek); 2026-10-29 #753, phase 3b; 2026-10-30 #753, file-strict; 2026-11-02 #1005 (Derek); 2026-11-07 #1148. - A strict choice is `parser_for(..., strict=True)` over the whole choice, filtering the base's readings as a plain choice does, the caller's own edits applying after it, and a chained call keeping its base's strictness unless it passes `strict`, an explicit `False` on a strict base raising and an explicit `True` making a plain base's choice strict; a strict call whose packs choose no language raises; a strict choice accepts a tag whose file holds no reading, which a plain one refuses as changing nothing; a bare choice has no constructor, no `locales.choose`; and the words strict ungates are derived against the plain choice of the same tags and held to a reviewed set by a test — 2026-10-31 #753, phase 3j; 2026-11-02 #754, sub-phase 4i-c. - A choice is matched without regard to case, a tag whose file does not exist selects its ancestors' (`pt-AO` selects `pt`; a region's file holding a `[rules]` table and no reading selects its language's the same way, as `pt-PT.toml` did from decisions/O6's 2026-11-19 entry until #1189 gave it readings), `mul` and `und` are no language to choose, and a vocabulary reading turned on also prefers (a name reading never does, decision 15), so `de`'s generation `i` drops `ca`'s and `pl`'s conjunction under a `de` choice; the `Lexicon` records its choice, so that a choice chained through `base=` unions with the base's, and a caller's own edits apply after the choice, plain or strict, in the order written, a pack's fragment joining before the caller's lexicon — 2026-10-29 #753, phase 3b; 2026-11-02 #754, the `Lexicon` surface (Derek); 2026-11-02 #754, sub-phase 4i-c. @@ -631,8 +631,8 @@ Open: [#1145](https://github.com/derek73/python-nameparser/issues/1145), the dis - **Declined: a rule reading the genitive into the patronymic view** (#1253's decision allows one, #1237's option 2). In Cyrillic the view would repeat `family`, the pack's order reading the father first. In Latin, where the order is now the caller's, the rule could ORDER a romanized name the genitive marks (#1237 counted 515 Wikidata `en` labels with it on the first word against 1 on the second) and leave unmarked ones alone, the gain it would add here; but the Latin endings collide with given names written first, JRC's two-word spellings opening with `-yn` including `Mervyn King`, `Carolyn Porco`, `Kathryn Gustafson` and `Martyn Johnson`, and its Cyrillic ones with `-ийн` the Bulgarian spellings of Madeleine, Gene and Dean; and a rule kind is a new `PatronymicRule` member and a `Policy` change (nameparser/vocab/README.md's [rules]). Left for a decision. - **The given name last, at a cost to a Russian name in a Mongolian list.** `FAMILY_FIRST_GIVEN_LAST` reads a three-word Russian name written family first with the given name in the middle backwards (`Сидоров Иван Петрович` → given 'Петрович', middle 'Иван'), where `FAMILY_FIRST` reads given 'Иван'; under `parser_for(locales.MN, locales.RU)` the patronymic lands in `given`, where rules/R9's East Slavic rule, which reads a middle word, does not see it, so the view stays empty; under `FAMILY_FIRST` with RU it is the middle word and the view reads 'Петрович' (O1's rotation stands down under either declared order). Neither shape is measured: every Khural member is written in two words, and the clan name the order was chosen for appears in no source either. Left for a decision, with decisions/W4's open precedence for a patronymic shape over a pack's script order. - **Accepted:** every Cyrillic name reads by the pack's order, Russian, Kazakh and Kyrgyz ones included (`Иван Сидоров` → family 'Иван'), so the pack is for Mongolian data; the given name followed by the father's initial reads backwards in Cyrillic (`Сүхээ Б.` → family 'Сүхээ'), where the default reads it right; a lone Cyrillic word reads as the caller's lone-word setting names, given by default, and reports, the pack's order settling no field (rules/O5, decisions/W4); a word the script test does not read as Cyrillic leaves its name to the caller's order, so initials joined by a full stop (`Б.Б. Сүхээ` → given 'Б.', family 'Сүхээ', where `Б. Б. Сүхээ` reads family 'Б.') and a letter with a stress mark that has no precomposed form (`Ива́н Сидоров`) read as the default does; and the CLDR sample's `Ноён` (Mr.) is no listed title, so `Ноён Азжаргал Төмөр` reads family 'Ноён' under the pack (a vocabulary question, not the pack's); nor are `Доктор` (Dr.) and the honorific `гуай` written after a name, so `Доктор Батын Сүхээ` reads family 'Доктор', given 'Сүхээ', and `Батын Сүхээ гуай` family 'Батын', given 'гуай' under the pack, vocabulary candidates beside `Ноён`, found by the independent review of #1365 (2026-11-12) and not added here; a Latin letter that looks Cyrillic inside a Cyrillic word (`Cүхээ Батын`, its first letter U+0043) leaves the name to the caller's order, given 'Cүхээ'. And the pack's own cost in matching: the father's name written as an initial, the short form Mongolian names are usually written in (`Батын Сүхээ` / `Б. Сүхээ`), is the family under the pack, so the pair reads `family-initial`, an outcome no matcher accepts unless asked, and conflicts, where the default matcher calls it consistent only by reading the father's name as the given name; accepting `family-initial` restores it, and docs/languages.rst's Mongolian section shows the accept. -- 2026-11-20 #1192 — `shri` IS A SALUTATION UNDER A HINDI CHOICE, REVERSING PHASE 3E'S EXCLUSION. hi.toml's `excluded:salutation` becomes a `salutation` reading written `default = false` with `after_given = true`, the shape `shrimati`'s reading has, so `parser_for(locales.HI)` reads `Shri Ravi Kumar Verma` as title 'Shri', given 'Ravi' and `Verma, Ravi Shri` as title 'Shri' (rules/H8), where the default and `locales.BN` read given 'Shri' as before; the dotted `Shri.` was a title at the head already, by rules/H2's shape. Phase 3e weighed the word by the given boxes that open with it, where it broke 20 filed names and fixed none, because no population it read writes the salutation; the 3.2 cycle chooses a pack's reading by its accuracy for the callers who choose the pack, and the list a Hindi choice is made for, India's Lok Sabha roll, writes it before nearly every member's name. `sri` stays excluded: its bearers are Indonesian and Sri Lankan given names (`Sri Lestiani`), a different population, and turning `shri` on does not move it. - MEASURED 2026-11-20 on this branch (master `758c2f8e` with #1239, #966, #1215 and #1337), py3.11, with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)shri' 'expr:Parser(lexicon=parser_for(locales.HI).lexicon.remove("shri", kind="salutation"), policy=parser_for(locales.HI).policy)' plain:HI`, the pack against itself without the reading: 2,275 names moved, none in the committed corpora. opensanctions-parliaments 2,244, 2,243 of them among in_sansad's 10,650 distinct spellings (`--group in_sansad`), each gaining the salutation as the title (`Shri Ravi Kumar Verma`, `Verma, Shri R.K.`, `Ravi Kumar, Shri`, 211 members written with one name, `Shri Gopalan`), and 1 a Balinese name in Indonesia's regional heads that writes the word inside it, unclear. jrc-names 1, right. nepal-candidates 10, read by their Devanagari: 6 write a spaced `श्री`, which the default reads as the title, so the romanization now reads as its Devanagari does (one of them Shrimati written apart as two words, wrong both ways), and 4 the one word `श्रीनारायण`, a given name, now wrong. Broken by the filed boxes, each a given box holding the word: fec-individuals 10 (`FAMILY, SHRI` 7 times, and `FAMILY, SHRI L` and `FAMILY, SHRI K. DR.`, each opening the box, and `FAMILY, GIVEN SHRI`, a given name of two words ending in it, which `after_given` reads as the title, below), orcid-researchers 5 (1 `Shri` alone, 4 a given name of two words such as `Shri Lal`), patentsview-inventors 4 and psc-individuals 2 (`Mr Shri Anand`, the forename box `Shri`). So about 2,250 fixed against 25 broken, 21 of them in populations a Hindi choice is not made for (US donors and patent filers, UK company filings, ORCID's whole world). - ACCEPTED: a person whose given name is `Shri`, or opens with it, reads the salutation under the pack: `Verma, Shri` gives title 'Shri' and no given name, `Shri Mehra` title 'Shri', family 'Mehra', and `Shri Lal Mehra` given 'Lal'. Nothing written tells `Shri Lal`, a given name of two words, from `Shri Ravi`, the salutation before one. A narrower reading, the title only with two or more name words behind it, keeps `Shri Mehra` and loses the 211 Sansad mononyms (`Shri Kunjan`), so it was not taken. - AGAINST H8: the reading is written `after_given`, as `shrimati`'s is, though rules/H8's standing criterion leaves out a salutation borne as a given name, and decisions/H8 left the Devanagari `श्री` out on that doubt; so under the pack `Verma, Ravi Shri` reads title 'Shri' where `वर्मा, रवि श्री` keeps middle 'श्री'. Kept because the roll writes the salutation after the given name in a family-comma list, and the cost is small: without `after_given` (the same reading, the property dropped) 2 names move, a `FAMILY, GIVEN SHRI` filer, right, and a Sansad spelling with the salutation in brackets, read as the title with the property and as the nickname without it. H8's criterion stands for the default; a pack's `default = false` reading may carry `after_given` where the population the pack is chosen for writes it, and the next one is weighed the same way, not by this entry. +- 2026-11-20 #1192 — `shri` IS A SALUTATION UNDER A HINDI CHOICE, REVERSING PHASE 3E'S EXCLUSION. hi.toml's `excluded:salutation` becomes a `salutation` reading written `default = false`, as `shrimati`'s is but without `after_given` (below), so `parser_for(locales.HI)` reads `Shri Ravi Kumar Verma` as title 'Shri', given 'Ravi', where the default and `locales.BN` read given 'Shri' as before; the dotted `Shri.` was a title at the head already, by rules/H2's shape. Phase 3e weighed the word by the given boxes that open with it, where it broke 20 filed names and fixed none, because no population it read writes the salutation; the 3.2 cycle chooses a pack's reading by its accuracy for the callers who choose the pack, and the list a Hindi choice is made for, India's Lok Sabha roll, writes it before nearly every member's name. `sri` stays excluded: its bearers are Indonesian and Sri Lankan given names (`Sri Lestiani`), a different population, and turning `shri` on does not move it. + MEASURED 2026-11-20 on this branch (master `758c2f8e` with #1239, #966, #1215 and #1337), py3.11, with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)shri' 'expr:Parser(lexicon=parser_for(locales.HI).lexicon.remove("shri", kind="salutation"), policy=parser_for(locales.HI).policy)' plain:HI`, the pack against itself without the reading: 2,275 names moved, none in the committed corpora. opensanctions-parliaments 2,245, 2,244 of them among in_sansad's 10,650 distinct spellings (`--group in_sansad`), each gaining the salutation as the title (`Shri Ravi Kumar Verma`, `Verma, Shri R.K.`, `Ravi Kumar, Shri`, `(Shri) Ravi Kumar`, 211 spellings moving only the title and the given name, 206 of them a member written with one name beside the salutation, `Gopalan, Shri`), and 1 a Balinese name in Indonesia's regional heads that writes the word inside it, unclear. jrc-names 1, right. nepal-candidates 10, read by their Devanagari: 6 write a spaced `श्री`, which the default reads as the title, so the romanization now reads as its Devanagari does (one of them Shrimati written apart as two words, wrong both ways), and 4 the one word `श्रीनारायण`, a given name, now wrong. Broken by the filed boxes, each a given box holding the word: fec-individuals 9 (`FAMILY, SHRI` 7 times, `FAMILY, SHRI L` and `FAMILY, SHRI K. DR.`), orcid-researchers 5 (1 `Shri` alone, 4 a given name of two words such as `Shri Lal`), patentsview-inventors 4 and psc-individuals 2 (`Mr Shri Anand`, the forename box `Shri`). So about 2,250 fixed against 24 broken, 20 of them in populations a Hindi choice is not made for (US donors and patent filers, UK company filings, ORCID's whole world). + ACCEPTED: a person whose given name is `Shri`, or opens with it, reads the salutation under the pack: `Verma, Shri` gives title 'Shri' and no given name, `Shri Mehra` title 'Shri', family 'Mehra', and `Shri Lal Mehra` given 'Lal'. Nothing written tells `Shri Lal`, a given name of two words, from `Shri Ravi`, the salutation before one. A narrower reading, the title only with two or more name words behind it, keeps `Shri Mehra` and loses those 206 Sansad spellings (`Gopalan, Shri`), so it was not taken. + NOT `after_given` (rules/H8): rules/H8 leaves out a salutation borne as a given name, since a middle name may be one, and decisions/H8 left the Devanagari `श्री` out on that doubt; `shri` is borne as one, and the roll never asks for the property. in_sansad writes the salutation in two shapes, before the given name after a family comma (`Verma, Shri Ravi`, 653 of opensanctions-parliaments' distinct names) and after a full name and a comma (`Ravi Verma, Shri`), both read as the title without it, and holds no `Family, Given Shri`. Measured against the same reading carrying the property, the recipe below moves 2 names, both reading better without it: an FEC filer whose given name of two words ends in the word (`FAMILY, GIVEN SHRI`), whom the property read as given 'GIVEN' and title 'SHRI', and a Sansad spelling with the salutation in brackets (`(Shri) Ravi Kumar`), which the property left the nickname and which reads as the title without it. So `Verma, Ravi Shri` keeps middle 'Shri' under the pack, as `वर्मा, रवि श्री` keeps middle 'श्री', and the word records the refusal (`excluded = { after_given = ... }` on its entry); the dotted `Verma, Ravi Shri.` is the title by rules/H5's trailing vocabulary, as `Shri.` ending a name is. Recompute: the command above from a checkout of this change; the in_sansad figure with `--local opensanctions-parliaments --group in_sansad` and no `--match`; each moved name read from `--readings `, the two configurations' first field compared line by line. diff --git a/nameparser/config/_index.py b/nameparser/config/_index.py index e09ac4557..932f550e1 100644 --- a/nameparser/config/_index.py +++ b/nameparser/config/_index.py @@ -2672,7 +2672,7 @@ ('shekh', (('ar', 'style', (('addresses', 'given'), ('same_as', 'sheikh'))), ('ar', 'given', ()))), ('shelly', (('en', 'familiar', (('short_for', ('michelle',)),)),)), ('sheriff', (('en', 'office', ()),)), - ('shri', (('hi', 'salutation', (('after_given', True), ('default', False))),)), + ('shri', (('hi', 'salutation', (('default', False),)),)), ('shrimati', (('bn', 'salutation', (('after_given', True), ('default', False))), ('hi', 'salutation', (('after_given', True), ('default', False))))), ('shriyut', (('hi', 'salutation', (('after_given', True), ('default', False))),)), ('shrm-cp', (('en', 'credential', ()),)), diff --git a/nameparser/vocab/hi.toml b/nameparser/vocab/hi.toml index e0ade2edc..fd59039b0 100644 --- a/nameparser/vocab/hi.toml +++ b/nameparser/vocab/hi.toml @@ -10,7 +10,7 @@ excluded = { salutation = { reason = "Miss, the romanized कुमारी, wh [[word]] text = "shri" -salutation = { default = false, gender = "m", issue = [345, 753, 1192], expands = "Shri, Mr., the romanized श्री", after_given = true, note = "on only under a Hindi choice, reversing its 2026-10-30 exclusion (decisions/vocabulary-model, 2026-11-20 #1192): the salutation before 2,243 of in_sansad's 10,650 spellings (opensanctions-parliaments, 2026-11-20); borne as a given name, opening ORCID's given boxes 198 times, 52 of them alone (Shri Kant, Shri Lakshmi; its 2025 extract, 2026-10-30), nam_dict band 2 in India, Wikidata 7 given (2026-10-30), which read title Shri under the pack, an accepted cost (Verma, Shri gives no given name): 21 filed records broken (fec-individuals 10, orcid-researchers 5, patentsview-inventors 4, psc-individuals 2) and 4 nepal-candidates names whose Devanagari is the one word श्रीनारायण (2026-11-20)" } +salutation = { default = false, gender = "m", issue = [345, 753, 1192], expands = "Shri, Mr., the romanized श्री", note = "on only under a Hindi choice, reversing its 2026-10-30 exclusion (decisions/vocabulary-model, 2026-11-20 #1192): the salutation before 2,244 of in_sansad's 10,650 spellings (opensanctions-parliaments, 2026-11-20); borne as a given name, opening ORCID's given boxes 198 times, 52 of them alone (Shri Kant, Shri Lakshmi; its 2025 extract, 2026-10-30), nam_dict band 2 in India, Wikidata 7 given (2026-10-30), which read title Shri under the pack, an accepted cost (Verma, Shri gives no given name): 20 filed records broken (fec-individuals 9, orcid-researchers 5, patentsview-inventors 4, psc-individuals 2) and 4 nepal-candidates names whose Devanagari is the one word श्रीनारायण (2026-11-20)", excluded = { after_given = "borne as a given name, so where it ends the given part it may be one (rules/H8); the Lok Sabha roll writes no Family, Given Shri, and with the property 2 names read worse (decisions/vocabulary-model, 2026-11-20 #1192)" } } [[word]] text = "shrimati" diff --git a/tests/v2/cases.py b/tests/v2/cases.py index cb917550d..b3f8b143d 100644 --- a/tests/v2/cases.py +++ b/tests/v2/cases.py @@ -23215,12 +23215,18 @@ def _check_cjk_shape_purity(self) -> None: "Shri Gopalan Nair", {"title": "Shri", "given": "Gopalan", "family": "Nair"}, locale="hi", classification="fix(#1192)"), - Case("shri_ending_the_given_part_after_a_family_comma_under_hi", + Case("shri_bare_ending_the_given_part_stays_a_name_word_under_hi", "Verma, Ravi Shri", - {"title": "Shri", "given": "Ravi", "family": "Verma"}, + {"given": "Ravi", "middle": "Shri", "family": "Verma"}, + locale="hi", + notes="shri is not written after_given, being borne as a given " + "name, so H8 leaves it a middle name, as the default does"), + Case("shri_dotted_ending_the_given_part_under_hi", + "Verma, Ravi Shri.", + {"title": "Shri.", "given": "Ravi", "family": "Verma"}, locale="hi", classification="fix(#1192)", - notes="a salutation written after_given ends the given part as " - "the title, as smt does"), + notes="a listed title with a full stop ending the given part " + "is the title (rules/H5's trailing vocabulary)"), Case("shri_after_a_full_name_and_a_comma_under_hi", "Ravi Kumar, Shri", {"title": "Shri", "given": "Ravi", "family": "Kumar"}, diff --git a/tests/v2/test_locales.py b/tests/v2/test_locales.py index 7dd64b063..6a8f78d98 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -433,9 +433,12 @@ def test_shri_peels_before_a_declared_order_lays_out_the_rest() -> None: name = packed.parse("Shri Ravi Kumar Verma") assert (name.title, name.given, name.middle, name.family) == ( ("Shri",) + expect), (order, strict) - for text in ("Shri Verma", "Verma, Ravi Shri"): + for text in ("Shri Verma", "Verma, Shri Ravi"): assert packed.parse(text).title == "Shri", (text, order) - assert packed.parse("Verma, Ravi Shri").given == "Ravi" + assert packed.parse("Verma, Shri Ravi").given == "Ravi" + # not written after_given (rules/H8): bare, it ends the given + # part as a middle name + assert packed.parse("Verma, Ravi Shri").middle == "Shri" def test_sushri_is_the_title_only_under_a_strict_hindi_choice() -> None: @@ -2470,7 +2473,7 @@ def _default_corpus() -> list[str]: "SHRI RAVI KUMAR", # shri, in one case "Dr. Shri Ravi Kumar", # shri behind a listed title "Verma, Shri Ravi", # shri after a family comma - "Verma, Ravi Shri", # shri ending the given part (H8) + "Verma, Ravi Shri.", # shri, dotted, ending the given part "Shri Verma, Ravi", # shri before a family comma (H6) "Ravi Kumar Shri.", # shri, dotted, ending the name (H5) ", Ravi Shri.", # shri, dotted, after an empty head From a2bee22f1510a4189bb578e27d8b0b53cf0bb43d Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Fri, 20 Nov 2026 18:12:07 -0800 Subject: [PATCH 8/8] Correct the #1192 entry's person count, its one-name figure and its recipe Co-Authored-By: Claude Opus 5.5 --- docs/design/decisions/vocabulary-model.md | 8 ++++---- tests/v2/test_locales.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/design/decisions/vocabulary-model.md b/docs/design/decisions/vocabulary-model.md index 9026b2437..719e060fd 100644 --- a/docs/design/decisions/vocabulary-model.md +++ b/docs/design/decisions/vocabulary-model.md @@ -15,7 +15,7 @@ The vocabulary was a set of base sets plus marker subsets (`particles` and `part - `es` turns on `doña`, the courtesy title that leads a Spanish name with no complement and is a family name too, the other titles phase 3g turned on being read by default since 2026-11-06 #1115 (below); `don`, `dona` and `dom` are excluded, the packs included, names opening with each as a name more often than as the title; `maestro`, a family name whose form of address is written `Mtro.`, is excluded too, and so is `h`, the hijo an initial is written as; `sr` keeps a generation reading beside its salutation in both files, so a choice leaves it the dual position decides; no connective continues a title run, the shape unwritten in name data, and the office titles that take a complement stay out — 2026-10-30 #753, phase 3g. - `es` turns on `maestra` too, the form of address written out, `maestro` staying excluded; `profesor` and `profesora`, which phase 3g turned on, are read by default since 2026-11-03 (decisions/salutation-titles) — 2026-11-03 #980. - The titles phase 3f, phase 3g and #1108 wrote `default = false` for neutrality rather than for a collision are read by default, 27 words, 36 readings, the nine doctorates being written in cs.toml and sk.toml both: es `lic`, `licenciado`, `licenciada`, `lcdo`, `lcda`, `ingeniero`, `ingeniera`, `arq`, `mtro`, `mtra`, `doctora`; pt `doutor`, `doutora`, `professora`, `profa`; cs and sk `judr`, `mudr`, `phdr`, `rndr`, `mvdr`, `mddr`, `paeddr`, `pharmdr`, `thdr`; vi `ths`, `đbqh`, `dbqh`. A choice still turns on the titles a name or initials spell: es `maestra` and `doña`, cs `mga` and `bca`, `pan`, `mgr`'s degree, vi `gs`, `ts` and `pgs` — 2026-11-06 #1115. -- Of the romanized titles a pack's phase lists, one whose native spelling is a default title turns on unless, counted in persons and pooled across every population measured, names open with it more often than it opens one as the title; a spelling outside the phase's list (`Shreemati`, `Srimati`) stays open until a phase writes it as a reading: `hi` turns on `smt`, `shrimati` and `shriyut`, `bn` `smt`, `shrimati` and `adhyapak` (`shriyut` with no bearer anywhere, `adhyapak` with family-name bearers only, every one where the title claim, acting at the head, does not reach), while `shri`, opening given names in every population 3e measured, stayed excluded until 2026-11-20 #1192 made it a `default = false` salutation in hi.toml, measured on India's Lok Sabha roll, the population a Hindi choice is made for, where it is the salutation (that entry weighs the reading by the callers who choose the pack; counted in persons and pooled, the roll's 2,217 members opening with the salutation outnumber the about 220 bearers 3e and hi.toml record, so this criterion turns it on too), `sri` staying excluded, and `sushri`, an Odia given name, is a `default = false` salutation in hi.toml with the Odia name declared in or.toml, so the plain `hi` choice, made for data that holds those names, reads it as a title only inside a title phrase and a strict one as the title (decisions/indic-honorifics, 2026-11-03 #345/#870) — 2026-10-30 #753, phase 3e. +- Of the romanized titles a pack's phase lists, one whose native spelling is a default title turns on unless, counted in persons and pooled across every population measured, names open with it more often than it opens one as the title; a spelling outside the phase's list (`Shreemati`, `Srimati`) stays open until a phase writes it as a reading: `hi` turns on `smt`, `shrimati` and `shriyut`, `bn` `smt`, `shrimati` and `adhyapak` (`shriyut` with no bearer anywhere, `adhyapak` with family-name bearers only, every one where the title claim, acting at the head, does not reach), while `shri`, opening given names in every population 3e measured, stayed excluded until 2026-11-20 #1192 made it a `default = false` salutation in hi.toml, measured on India's Lok Sabha roll, the population a Hindi choice is made for, where it is the salutation (that entry weighs the reading by the callers who choose the pack; counted in persons and pooled, the roll's 1,522 members with a spelling that opens with the salutation outnumber the about 220 bearers 3e and hi.toml record, so this criterion turns it on too, as that entry counts), `sri` staying excluded, and `sushri`, an Odia given name, is a `default = false` salutation in hi.toml with the Odia name declared in or.toml, so the plain `hi` choice, made for data that holds those names, reads it as a title only inside a title phrase and a strict one as the title (decisions/indic-honorifics, 2026-11-03 #345/#870) — 2026-10-30 #753, phase 3e. - A language pack is a choice of languages on `Locale.languages` selecting which readings compile, a tag choosing its own file and its ancestors', and a reading index, loaded on its first lookup, carries the languages to run time; strict is file-strict, the chosen files, `mul.toml` and native-script words' readings only, `und.toml` not among them, so it needs no 3i; third-party language files are deferred — 2026-10-27 #753 (Derek); 2026-10-29 #753, phase 3a (Derek); 2026-10-29 #753, phase 3b; 2026-10-30 #753, file-strict; 2026-11-02 #1005 (Derek); 2026-11-07 #1148. - A strict choice is `parser_for(..., strict=True)` over the whole choice, filtering the base's readings as a plain choice does, the caller's own edits applying after it, and a chained call keeping its base's strictness unless it passes `strict`, an explicit `False` on a strict base raising and an explicit `True` making a plain base's choice strict; a strict call whose packs choose no language raises; a strict choice accepts a tag whose file holds no reading, which a plain one refuses as changing nothing; a bare choice has no constructor, no `locales.choose`; and the words strict ungates are derived against the plain choice of the same tags and held to a reviewed set by a test — 2026-10-31 #753, phase 3j; 2026-11-02 #754, sub-phase 4i-c. - A choice is matched without regard to case, a tag whose file does not exist selects its ancestors' (`pt-AO` selects `pt`; a region's file holding a `[rules]` table and no reading selects its language's the same way, as `pt-PT.toml` did from decisions/O6's 2026-11-19 entry until #1189 gave it readings), `mul` and `und` are no language to choose, and a vocabulary reading turned on also prefers (a name reading never does, decision 15), so `de`'s generation `i` drops `ca`'s and `pl`'s conjunction under a `de` choice; the `Lexicon` records its choice, so that a choice chained through `base=` unions with the base's, and a caller's own edits apply after the choice, plain or strict, in the order written, a pack's fragment joining before the caller's lexicon — 2026-10-29 #753, phase 3b; 2026-11-02 #754, the `Lexicon` surface (Derek); 2026-11-02 #754, sub-phase 4i-c. @@ -632,7 +632,7 @@ Open: [#1145](https://github.com/derek73/python-nameparser/issues/1145), the dis - **The given name last, at a cost to a Russian name in a Mongolian list.** `FAMILY_FIRST_GIVEN_LAST` reads a three-word Russian name written family first with the given name in the middle backwards (`Сидоров Иван Петрович` → given 'Петрович', middle 'Иван'), where `FAMILY_FIRST` reads given 'Иван'; under `parser_for(locales.MN, locales.RU)` the patronymic lands in `given`, where rules/R9's East Slavic rule, which reads a middle word, does not see it, so the view stays empty; under `FAMILY_FIRST` with RU it is the middle word and the view reads 'Петрович' (O1's rotation stands down under either declared order). Neither shape is measured: every Khural member is written in two words, and the clan name the order was chosen for appears in no source either. Left for a decision, with decisions/W4's open precedence for a patronymic shape over a pack's script order. - **Accepted:** every Cyrillic name reads by the pack's order, Russian, Kazakh and Kyrgyz ones included (`Иван Сидоров` → family 'Иван'), so the pack is for Mongolian data; the given name followed by the father's initial reads backwards in Cyrillic (`Сүхээ Б.` → family 'Сүхээ'), where the default reads it right; a lone Cyrillic word reads as the caller's lone-word setting names, given by default, and reports, the pack's order settling no field (rules/O5, decisions/W4); a word the script test does not read as Cyrillic leaves its name to the caller's order, so initials joined by a full stop (`Б.Б. Сүхээ` → given 'Б.', family 'Сүхээ', where `Б. Б. Сүхээ` reads family 'Б.') and a letter with a stress mark that has no precomposed form (`Ива́н Сидоров`) read as the default does; and the CLDR sample's `Ноён` (Mr.) is no listed title, so `Ноён Азжаргал Төмөр` reads family 'Ноён' under the pack (a vocabulary question, not the pack's); nor are `Доктор` (Dr.) and the honorific `гуай` written after a name, so `Доктор Батын Сүхээ` reads family 'Доктор', given 'Сүхээ', and `Батын Сүхээ гуай` family 'Батын', given 'гуай' under the pack, vocabulary candidates beside `Ноён`, found by the independent review of #1365 (2026-11-12) and not added here; a Latin letter that looks Cyrillic inside a Cyrillic word (`Cүхээ Батын`, its first letter U+0043) leaves the name to the caller's order, given 'Cүхээ'. And the pack's own cost in matching: the father's name written as an initial, the short form Mongolian names are usually written in (`Батын Сүхээ` / `Б. Сүхээ`), is the family under the pack, so the pair reads `family-initial`, an outcome no matcher accepts unless asked, and conflicts, where the default matcher calls it consistent only by reading the father's name as the given name; accepting `family-initial` restores it, and docs/languages.rst's Mongolian section shows the accept. - 2026-11-20 #1192 — `shri` IS A SALUTATION UNDER A HINDI CHOICE, REVERSING PHASE 3E'S EXCLUSION. hi.toml's `excluded:salutation` becomes a `salutation` reading written `default = false`, as `shrimati`'s is but without `after_given` (below), so `parser_for(locales.HI)` reads `Shri Ravi Kumar Verma` as title 'Shri', given 'Ravi', where the default and `locales.BN` read given 'Shri' as before; the dotted `Shri.` was a title at the head already, by rules/H2's shape. Phase 3e weighed the word by the given boxes that open with it, where it broke 20 filed names and fixed none, because no population it read writes the salutation; the 3.2 cycle chooses a pack's reading by its accuracy for the callers who choose the pack, and the list a Hindi choice is made for, India's Lok Sabha roll, writes it before nearly every member's name. `sri` stays excluded: its bearers are Indonesian and Sri Lankan given names (`Sri Lestiani`), a different population, and turning `shri` on does not move it. - MEASURED 2026-11-20 on this branch (master `758c2f8e` with #1239, #966, #1215 and #1337), py3.11, with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)shri' 'expr:Parser(lexicon=parser_for(locales.HI).lexicon.remove("shri", kind="salutation"), policy=parser_for(locales.HI).policy)' plain:HI`, the pack against itself without the reading: 2,275 names moved, none in the committed corpora. opensanctions-parliaments 2,245, 2,244 of them among in_sansad's 10,650 distinct spellings (`--group in_sansad`), each gaining the salutation as the title (`Shri Ravi Kumar Verma`, `Verma, Shri R.K.`, `Ravi Kumar, Shri`, `(Shri) Ravi Kumar`, 211 spellings moving only the title and the given name, 206 of them a member written with one name beside the salutation, `Gopalan, Shri`), and 1 a Balinese name in Indonesia's regional heads that writes the word inside it, unclear. jrc-names 1, right. nepal-candidates 10, read by their Devanagari: 6 write a spaced `श्री`, which the default reads as the title, so the romanization now reads as its Devanagari does (one of them Shrimati written apart as two words, wrong both ways), and 4 the one word `श्रीनारायण`, a given name, now wrong. Broken by the filed boxes, each a given box holding the word: fec-individuals 9 (`FAMILY, SHRI` 7 times, `FAMILY, SHRI L` and `FAMILY, SHRI K. DR.`), orcid-researchers 5 (1 `Shri` alone, 4 a given name of two words such as `Shri Lal`), patentsview-inventors 4 and psc-individuals 2 (`Mr Shri Anand`, the forename box `Shri`). So about 2,250 fixed against 24 broken, 20 of them in populations a Hindi choice is not made for (US donors and patent filers, UK company filings, ORCID's whole world). - ACCEPTED: a person whose given name is `Shri`, or opens with it, reads the salutation under the pack: `Verma, Shri` gives title 'Shri' and no given name, `Shri Mehra` title 'Shri', family 'Mehra', and `Shri Lal Mehra` given 'Lal'. Nothing written tells `Shri Lal`, a given name of two words, from `Shri Ravi`, the salutation before one. A narrower reading, the title only with two or more name words behind it, keeps `Shri Mehra` and loses those 206 Sansad spellings (`Gopalan, Shri`), so it was not taken. + MEASURED 2026-11-20 on this branch (master `758c2f8e` with #1239, #966, #1215 and #1337), py3.11, with `uv run python tools/differential/config_diff.py diff --local all --committed --match '(?i)shri' 'expr:Parser(lexicon=parser_for(locales.HI).lexicon.remove("shri", kind="salutation"), policy=parser_for(locales.HI).policy)' plain:HI`, the pack against itself without the reading: 2,275 names moved, none in the committed corpora. opensanctions-parliaments 2,245, 2,244 of them among in_sansad's 10,650 distinct spellings (`--group in_sansad`), each gaining the salutation as the title (`Shri Ravi Kumar Verma`, `Verma, Shri R.K.`, `Ravi Kumar, Shri`, `(Shri) Ravi Kumar`, 211 spellings moving only the title and the given name, 207 of them a member written with one name word beside the salutation, 202 as `Shri Gopalan` and 5 as `Gopalan, Shri`), and 1 a Balinese name in Indonesia's regional heads that writes the word inside it, unclear. jrc-names 1, right. nepal-candidates 10, read by their Devanagari: 6 write a spaced `श्री`, which the default reads as the title, so the romanization now reads as its Devanagari does (one of them Shrimati written apart as two words, wrong both ways), and 4 the one word `श्रीनारायण`, a given name, now wrong. Broken by the filed boxes, each a given box holding the word: fec-individuals 9 (`FAMILY, SHRI` 7 times, `FAMILY, SHRI L` and `FAMILY, SHRI K. DR.`), orcid-researchers 5 (1 `Shri` alone, 4 a given name of two words such as `Shri Lal`), patentsview-inventors 4 and psc-individuals 2 (`Mr Shri Anand`, the forename box `Shri`). So about 2,250 fixed against 24 broken, 20 of them in populations a Hindi choice is not made for (US donors and patent filers, UK company filings, ORCID's whole world). Counted in persons, as this file's Standing criterion counts: 1,522 in_sansad members have a spelling that opens with the word and 2,217 one that holds it (entities in opensanctions-parliaments' `raw.jsonl`), against the about 220 bearers phase 3e and hi.toml record (ORCID's 198 openers, Wikidata 7, FEC 9, PatentsView 4, PSC 2), so the pooled criterion turns the reading on too. + ACCEPTED: a person whose given name is `Shri`, or opens with it, reads the salutation under the pack: `Verma, Shri` gives title 'Shri' and no given name, `Shri Mehra` title 'Shri', family 'Mehra', and `Shri Lal Mehra` given 'Lal'. Nothing written tells `Shri Lal`, a given name of two words, from `Shri Ravi`, the salutation before one. A narrower reading, the title only with two or more name words behind it, keeps `Shri Mehra` and loses the 202 Sansad spellings written `Shri Gopalan`, so it was not taken. NOT `after_given` (rules/H8): rules/H8 leaves out a salutation borne as a given name, since a middle name may be one, and decisions/H8 left the Devanagari `श्री` out on that doubt; `shri` is borne as one, and the roll never asks for the property. in_sansad writes the salutation in two shapes, before the given name after a family comma (`Verma, Shri Ravi`, 653 of opensanctions-parliaments' distinct names) and after a full name and a comma (`Ravi Verma, Shri`), both read as the title without it, and holds no `Family, Given Shri`. Measured against the same reading carrying the property, the recipe below moves 2 names, both reading better without it: an FEC filer whose given name of two words ends in the word (`FAMILY, GIVEN SHRI`), whom the property read as given 'GIVEN' and title 'SHRI', and a Sansad spelling with the salutation in brackets (`(Shri) Ravi Kumar`), which the property left the nickname and which reads as the title without it. So `Verma, Ravi Shri` keeps middle 'Shri' under the pack, as `वर्मा, रवि श्री` keeps middle 'श्री', and the word records the refusal (`excluded = { after_given = ... }` on its entry); the dotted `Verma, Ravi Shri.` is the title by rules/H5's trailing vocabulary, as `Shri.` ending a name is. - Recompute: the command above from a checkout of this change; the in_sansad figure with `--local opensanctions-parliaments --group in_sansad` and no `--match`; each moved name read from `--readings `, the two configurations' first field compared line by line. + Recompute: the command above from a checkout of this change; the 2 moves the property makes with `'expr:Parser(lexicon=parser_for(locales.HI).lexicon.remove("shri", kind="salutation").add("shri", kind="salutation", after_given=True), policy=parser_for(locales.HI).policy)'` in place of the first configuration; the person counts from `raw.jsonl`'s in_sansad rows, their `entity` kept where `name` holds `shri` as a word, and where it opens with it (a bracket allowed); the in_sansad figure with `--local opensanctions-parliaments --group in_sansad` and no `--match`; each moved name read from `--readings `, the two configurations' first field compared line by line. diff --git a/tests/v2/test_locales.py b/tests/v2/test_locales.py index 6a8f78d98..c58235559 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -2449,9 +2449,9 @@ def _default_corpus() -> list[str]: ] # hi and bn: each romanized title at the head, in each case, behind a # listed title, after a family comma and before one (rules/H6); a dotted -# one where it ends the given part after a family comma (rules/H8) or -# ends the name (rules/H5), rules/H2's shape already reading it as a -# title at the head by default. +# one where it ends the given part after a family comma or ends the name +# (rules/H5's trailing vocabulary), rules/H2's shape already reading it +# as a title at the head by default. _ROTATORS["hi"] = [ "Shrimati Indira Gandhi", # shrimati at the head "SHRIMATI INDIRA GANDHI", # shrimati, in one case