diff --git a/docs/design/decisions/H2-leading-abbreviation-title.md b/docs/design/decisions/H2-leading-abbreviation-title.md index 9c04dfddf..852f4ce7e 100644 --- a/docs/design/decisions/H2-leading-abbreviation-title.md +++ b/docs/design/decisions/H2-leading-abbreviation-title.md @@ -12,6 +12,8 @@ Elsewhere: #316's question 2, a symmetric leading rule reading `Esq. Smith` as a suffix, is declined and the trailing slot reads vocabulary, decisions/H5's 2026-09-08 #316 entry (the undated `Decided 2026-09-08` paragraph below records the hook it closed here); the shape does not fire before a family comma, decisions/H6's 2026-10-17 #701 and 2026-10-18 #710 entries; a letter typed decomposed is the same letter to the shape, decisions/nfd-shapes' 2026-10-12 #652 entry, and the script veto reads the composed spelling, its 2026-10-13 #665 entry; halfwidth katakana is classified since #594 (decisions/W4); a given name written short opening the given part after a family comma (`Rahman, Md` → given 'Md'), decisions/C13's 2026-11-14 #1393 entry; one glued to the next word at its full stop, divided there (`Md.Karim Uddin` → given 'Md.'), decisions/T8. +- Declined: reading an unlisted abbreviation that alone fills the part after a full name and a comma as a post-nominal; the shape keeps it the title there (`John Smith, Insp.` → title 'Insp.', as in 1.4.0) — 2026-11-20 #969. + Open: none in this file. ## Log @@ -38,3 +40,4 @@ Decided 2026-09-08 (was Open: [#316](https://github.com/derek73/python-nameparse - **The glued word**, decisions/period-joined-words' entry of this date: the set is also what that file counts as a chunk read on its own. - **Its signal.** The clause reads neither the shape nor the script but a closed list of spellings, held in code (`_vocab._DIGRAPH_INITIALS`) rather than in the vocabulary, so a caller cannot remove a member from the set, but restores the title reading by listing the word as a title, which outranks the shape (`Lexicon.default().add("yu", kind="title")` reads `Yu. A. Chibrikova` title 'Yu.'), and a caller's `given` reading with `same_as` still reaches any word. It is a third reading beside the shape and the two script vetoes the #1191 entry names, which adds to the question a split of H2 would settle; a reading property in the TOML marking an initial was not weighed against it, only `same_as`. - 2026-11-16 #1393 — THE READING ACTS BEYOND THE HEAD OF A NAME. The 2026-10-26 #789 line said a given name written short acts nowhere but where H2's shape would fire; decisions/C13's 2026-11-14 #1393 entry reads one opening the given part after a family comma (`Rahman, Md` → given 'Md', reported), and rules/T8 divides one glued to the next word at its full stop (`Md.Karim Uddin` → given 'Md.', decisions/T8). The Standing line drops the clause and names `sk` (#1129) and `md` (#1383) in the shipped set. Found by the 3.1 release sweep. +- 2026-11-20 #969 — DECLINED: AN UNLISTED ABBREVIATION FILLING THE PART AFTER A FULL NAME AND A COMMA IS NOT READ AS A POST-NOMINAL BY SHAPE (the issue's option (b)). Decided 2026-11-20. One word is nearly the whole population: of the roughly 3,300 Czech candidates' records whose box after the name read as a title, `DiS.` is 3,232 (cz-candidates, 170,181 records, 2026-10-30), and it is listed instead (decisions/suffix-acronym-collisions' entry of this date). The rest are a few words a vocabulary answers or leaves (`dipl. um.` 27, `Dr.` 10, `DrSc.` 12, `ArtD.` 3, `IEn.` 3). A rule of shape would reverse a reading held since 1.4.0, an unlisted abbreviation heading the part after a family comma being this rule's title (`John Smith, Insp.` → title 'Insp.'), for every unlisted word in every corpus, which the vocabulary does not need to. Recompute, on a checkout of `3ca31c2f`, before DiS was listed: over `local_corpora.py`'s cz-candidates records with the `titulza` box (after the name) filled, parse each `name` with `Parser()` and count the records whose parsed title holds a word of the box; the total near 3,300 (3,330) is every such record. `dis` is the issue's test, `re.search(r"\bdis\b", box.replace(".", "").casefold())`, 3,248 records holding it and 3,232 read as a title; `DrSc.` 12, `ArtD.` 3 and `IEn.` 3 fold alike, while `dipl. um.` 27 and `Dr.` 10 count the boxes written exactly so (folded, `dipl` 40 and `dr` 20). diff --git a/docs/design/decisions/suffix-acronym-collisions.md b/docs/design/decisions/suffix-acronym-collisions.md index e40f552fb..350f5e64f 100644 --- a/docs/design/decisions/suffix-acronym-collisions.md +++ b/docs/design/decisions/suffix-acronym-collisions.md @@ -38,6 +38,8 @@ Elsewhere: since phase 2a the ambiguous marking above is derived from a word's n - The Nigerian marks `mni`, `fwc`, `fsi`, `fnse`, `psc` and `ndc`, all but `psc` repaired in lower case (`psc` being a surname, so unmasked), and the honours `gbm`, `gbs`, `sbs`, `bbs` and `bbm` are credentials; a word spelling one after a one-word family and a comma reads as it, in capitals or Title case (`Bello, MNI`, `Gurung, Mni`), and so does one opening the given part there or ending a name — 2026-11-20 #1361. - `bchir` is marked ambiguous by its family reading, the surname Bchir, with no case mask; `mh` and `sc` are out, their clash being with initials; `san` waits for a Nigerian English choice of language — 2026-11-20 #1361. +- The Czech and Slovak `DiS` is a credential, marked ambiguous by mul.toml's surname Dis and carrying no case mask; `DrSc` and `ArtD`, the post-nominals phase 3f wrote `default = false` for neutrality, are read by default — 2026-11-20 #969. + Open: #1053, carried over from #965 (telling the credential `FREng`, written in mixed case, from the surname `Freng`; a case reading of S6's, held in decisions/S6). ## Log @@ -103,3 +105,9 @@ Open: #1053, carried over from #965 (telling the credential `FREng`, written in - **Declined: `mh` and `sc`.** Listed, the two moved 324 local-corpus names, most of them wrong: the `Sc` of a split `M. Sc.` (94), capitals initials after a comma (FEC's `DOYLE, SC` shape) losing the given name, and paired initials inside a name (`M.H.`) losing the family. After a comma with `JP` behind them they read as the credential run already (rules/C5, #1392). Accepted with the decline: a lone trailing `, MH` or `, SC` stays the given name, and with no comma each reads as the family (`Hon WONG Kwok-kin MH JP` → family 'MH', suffix 'JP'), as 18 MH and 4 SC names of the LegCo lists are written. Neither has a name reading to mark it ambiguous by, its clash being with initials. Each carries an `excluded` entry in en.toml. - **Deferred: `san`** (Senior Advocate of Nigeria), the given name San and es, it and fil's saint particle. As a default credential it cost 17 family names written in capitals (TSE's `ALCEU A SAN` shape) and added 143 reports; it waits for a Nigerian English choice of language, where it would be a `default = false` reading. en.toml records the exclusion; #1228 stays open for it. - **Measured** 2026-11-20 against a checkout of master `0d8c6fa8`: `snapshot.py --local SOURCE --base` on ctgov-officials (322 entries move, decisions/S12's entry, none emptying a field), govuk-people (1, a report) and fec-individuals (2); `local_agreement.py --base` on orcid-researchers (2 records fixed, 0 broken: an `, mni` and an `aus der`) and psc-individuals (1 fixed, a surname box ending `Gbm`, and 1 company name changed); the committed snapshot, the Hong Kong lines and `Jane Doe, BM, BCh, PhD`. The `mh`/`sc` and `san` figures are the triage's of the same day. Recompute: those commands with `--base `; for the declined and deferred words, `config_diff.py diff default` against an `expr:` lexicon adding them as credentials, `--local all --match` over the words; the bearer counts are on the words (`tools/vocab/query.py --word bchir`, `tools/name_usage.py mni --boxes`). +- **2026-11-20 (#969) — `DIS` IS A CREDENTIAL, MARKED AMBIGUOUS AND UNMASKED; `DRSC` AND `ARTD` ARE READ BY DEFAULT.** Decided 2026-11-20. `Jan Novák, DiS.` read title 'DiS.' (rules/H2, the unlisted abbreviation heading the given part after a family comma), `Bc. Jan Novák, DiS.` title 'Bc. DiS.', and `Jan Novák, DiS` reversed the name; the Czech candidates' registers write the diploma after the name in 3,248 of 170,181 records (2026-10-30). + - SUPERSEDES, in part: decisions/vocabulary-model's 2026-10-30 #753, phase 3f entry's `default = false` on `drsc` and `artd`. + - **The readings.** `dis` is a credential in cs.toml and sk.toml, the diploma of both countries. Its surname reading, the Dis of ORCID's family boxes (14, five of them with a country, BR, CZ, FI, NL and US) and PatentsView's (6), stands in mul.toml, its bearers being of no one language, so a strict choice of either language still gates it: `Jan Dis` keeps the family, reported. It carries no case mask: a mask applies in every role and repaired the surname (`JAN DIS` → `Jan DiS`), the `psc` lesson of the 2026-11-20 (#1361) entry above, so a mixed-case spelling is left as written, and case repair of a name written in one case writes `DIS.` (`jan novák, dis.` → `Jan Novák, DIS.`), as `capitalized(force=True)` writes `DIS`. `drsc` (cs.toml, sk.toml) and `artd` (sk.toml), which phase 3f wrote `default = false` for neutrality, as it wrote the doctorates the 2026-11-06 #1115 entry of decisions/vocabulary-model turned on, are read by default: neither has a name reading (ORCID's boxes hold `DrSc` 5 times, the credential typed in; no Census, SSA or PatentsView bearer of either). + - **Accepted:** a `DiS` written in mixed case in the first part after a full name and a comma reports `suffix-or-name`, the gated class's report there (rules/C4), where one in capitals in a name of mixed case reads with none (rules/S6) and one past a second comma reports `comma-structure` only; with no comma the word in its own mixed case stays a name word by its writing (`Jan Novák DiS.` → family 'DiS.', reported, rules/S6), as master read it, the mixed case's reading being #1053's open question, and so it does ending the given part after a family comma (`Novák, Jan DiS.` → middle 'DiS.'); after a one-word family or nothing (`Novák, DiS.`, `, DiS.`) it is still rules/H2's title; and a surname Dis written otherwise than Dis reads as the credential: in capitals in a name of mixed case even with no word to spare, unreported where a family remains (`Jan Novák DIS` → suffix 'DIS'; `Jan DIS` → suffix 'DIS', no family, reported `given-or-family`), rules/S6's capitals reading, as `Amani BCHIR` reads in the 2026-11-20 (#1361) entry above; and in a name written in one case, or in lower case in a name of mixed case, where the count takes it with a word to spare (`PETR JAN DIS` → family 'JAN', suffix 'DIS', reported; `jan novák dis` → suffix 'dis'), its writing saying nothing (rules/S4, S6). + - **Left out:** `IEn.` (3 Czech records), a given name (US SSA 16 births since 1880, a lower bound, years under 5 unrecorded), with an `excluded` entry in cs.toml; `dipl. um.` (27), two words, the first already mul.toml's academic `dipl`; `Dr.` written after the name (10), a title. + - **Measured** 2026-11-20 against a checkout of master `3ca31c2f`: `local_agreement.py cz-candidates --base`, 3,169 records fixed, 0 broken, 79 changed (the credential now right where another field still disagrees, mostly a double surname, and `Bc. et Bc.`, which master misreads too); with `--locale cs`, 3,216 fixed, 0 broken, 17 changed; `snapshot.py --local ctgov-officials --base`, 19 entries move, every one a `DrSc` or `Dr.Sc.` read as the credential where it was a given name, a title or a `comma-structure` report; `local_agreement.py orcid-researchers --base`, 1 record fixed (a Croatian `dr.sc.` in the given box), 1 changed (an Austrian family box holding `Dr.Sc.`); psc-individuals, none; the committed snapshot, none. Recompute: those commands with `--base `; the bearer counts with `tools/name_usage.py dis drsc artd ien --boxes`; the Czech candidates' per-word counts by decisions/H2's 2026-11-20 #969 recipe. diff --git a/docs/design/decisions/vocabulary-model.md b/docs/design/decisions/vocabulary-model.md index 719e060fd..862306459 100644 --- a/docs/design/decisions/vocabulary-model.md +++ b/docs/design/decisions/vocabulary-model.md @@ -379,7 +379,7 @@ Open: [#1145](https://github.com/derek73/python-nameparser/issues/1145), the dis - **Open: a period-joined token whose only title chunk the choice makes possibly given reads as a name word, in both directions.** `_vocab.period_joined_vocab` makes a token a title where ANY chunk is in `titles`, and under `ne` `श्री` has moved to `titles_ambiguous`. That costs `सु.श्री.` (सुश्री, Ms., written with its periods), title under the default and given under `ne`, 2 nepal-candidates names; and it fixes a given name glued behind the word, `श्री.राम थापा`, title `श्री.राम` under the default and given `श्री.राम` under `ne`. Whether a possibly-given chunk counts there is open; a fix would move the default for every word of `TITLES_AMBIGUOUS`, and its grid holds both `सु.श्री.` and `श्री.X`. - **Recompute:** the three commands above from a checkout of this change; the CLDR record with `cldr_agreement.py`; the word counts with `tools/name_usage.py guru गुरु श्री`. - **2026-10-30 #754, sub-phase 4g — THE COMPOUND GIVEN NAME IS A RULE KIND: `Policy.two_given_names`, rules/O7, OFF BY DEFAULT AND A `[rules]` KEY; NO DEFAULT PARSE MOVES.** Carries out item 7 of the 2026-10-28 #754 output-model entry and the 4g row of its item 9. The rule kind is built as the 4f entry's item 1 says a new one is: a `Policy` field with `ADDED_IN` (`3.0.0`, so a 2.8 `Policy` pickle loads with it off, tests/v2/data/policy_v28.pickle), a `flag` row in `tools/vocab/build.py`'s `RULE_KEYS` with its default `false` refused, a row in `_locale._RULE_VALUES`, and a mechanisms.md entry, DECLARED-SPAN, which it shares with rules/O6's switch, whose mirror it is. No file turns it on: whether `es` and `pt` do is 3g's. What the rule reads, its precedence against O6 and O3, and the measurements are decisions/O7's 2026-10-30 entry; the `Maria do Carmo Silva` shape the RFC's table names stays unread, the particle chain running to the end of the name, and is Open there. Item 6 of the 4f entry, deriving `DEVIATES` from the rules, stays open: this rule has no surface in the name for a pack to declare. -- **2026-10-30 #753, phase 3f (its doctorates' `default = false` superseded by the 2026-11-06 #1115, the pack titles entry, which reads them by default, so the default reads `Jan Novák, MUDr` as the pack does) — THE CZECH, SLOVAK, SLOVENIAN AND CROATIAN PACKS: `locales.CS`, `SK`, `SL` AND `HR`, ONE `Locale` PER LANGUAGE, EACH, LIKE `locales.NE`, A CHOICE OF ITS ONE TAG; `pan` AND `roz` BECOME READINGS OFF BY DEFAULT; THE DEFAULT DOES NOT MOVE.** Carries out 3f of item 11 of the 2026-10-27 #753 entry. +- **2026-10-30 #753, phase 3f (its doctorates' `default = false` superseded by the 2026-11-06 #1115, the pack titles entry, which reads them by default, so the default reads `Jan Novák, MUDr` as the pack does; the post-nominals `DrSc` and `ArtD` read by default since decisions/suffix-acronym-collisions' 2026-11-20 #969 entry) — THE CZECH, SLOVAK, SLOVENIAN AND CROATIAN PACKS: `locales.CS`, `SK`, `SL` AND `HR`, ONE `Locale` PER LANGUAGE, EACH, LIKE `locales.NE`, A CHOICE OF ITS ONE TAG; `pan` AND `roz` BECOME READINGS OFF BY DEFAULT; THE DEFAULT DOES NOT MOVE.** Carries out 3f of item 11 of the 2026-10-27 #753 entry. - **One pack per language,** as the RFC's API section already had it ("each language is a pack of its own"), and for three reasons measured here: the files hold different words (sl and hr only the generations, sk `ArtD.`, cs `pan` and `roz`), so a shared pack would turn on Czech `pan` and `roz` for a Slovenian caller; the choice is a set, so a caller with data in two of them passes both (`parser_for(locales.CS, locales.SK)`); and a pack is then nothing but its tag, `Locale(code="cs", lexicon=Lexicon.empty(), languages=frozenset({"cs"}))`, auditable as its file. Each module ships no `DEVIATES`, as phase 3d's contract has it for a pack that is nothing but a choice: its deviations are `changed_words` of its choice, and the contract test now also refuses a choice pack whose choice changes no word (decisions/deviates-registry's 2026-10-30 phase 3f entry). - **The readings, all written `default = false`, so `_compiled.py` is unchanged.** 3c's generations `ml` and `st` in all four. In cs and sk, the academic titles written before the name as `academic` readings with their case masks (`mudr`, `mddr`, `mvdr`, `judr`, `phdr`, `rndr`, `paeddr`, `pharmdr`, `thdr`, `mgr`; cs also `mga` and `bca`) and the degrees written after it as `credential` readings (`drsc`; sk also `artd`): #848's open question 1, whether `Mgr.`, `MUDr.` and `PhDr.` follow `Ing.` to the suffix after a comma, is answered for the pack by Czech usage, title, since they stand before the name. `mgr` changes no compiled set, en and fr reading it as Monsignor already; under the choice its kind is `academic`. cs's and pl's `pan` exclusions become `salutation` readings, and cs's `roz` exclusion a `birth_marker` reading, each keeping its collision in its note. So `Jan Novák, MUDr` reads title `MUDr`, given `Jan` under `locales.CS` where the default reverses it (given `MUDr`, family `Jan Novák`), `Jan Novák MUDr.` reads the title at the end (rules/H5), `Jan Novák, DrSc` suffix `DrSc`, `Jana Nováková roz. Svobodová` maiden `Svobodová`, `Janez Novak st.` under `locales.SL` suffix `st.`, reported suffix-or-name, and `capitalized()` writes `MUDr.` for `mudr.`. Every reading was swept over the four comma shapes, the three orders, dotted, bare and one-case spellings and a family comma behind a `Freiherr` head; tests/v2/test_locales.py's `test_the_west_and_south_slavic_packs_read_what_the_default_refuses` pins a row of each, default and pack side by side. - **Left out, with the reason:** `bc` (bakalář) is an exclusion, measured: under a Czech choice it moved 23 of ctgov-officials' 536,981 officials, one a Czech `Bc` and the rest the US nursing credential Board Certified or initials (`Lora L. Beebe, PhD, PMHNP, BC` read title `BC`; `ACNP-BC` recased `ACNP-Bc`), and `Bc.` with its period is a title at the head by its shape anyway. `ing` stays mul.toml's ambiguous credential: an `academic` reading beside its `given` reading would be a title only inside a title phrase (rules/H9), moving nothing but `Ing` in a phrase, and its dotted spelling is a title by shape. `doc` (docent) is an English nickname (US SSA 1,391 given-name births, nam_dict band 4), recorded as no reading of any file; an `academic` reading would need that `given` reading beside it, which makes it a title only inside a title phrase (rules/H9), so it would move nothing a pack wants, and the dotted `doc.` is a title by shape already. Slovak `rod.` and `rodená`, the masculine `rozený`, the Slovene and Croatian academic abbreviations (`dr. sc.`, `mag.`, `univ. dipl. inž.`) and Slovak `pán` and `pani` are unvetted, not refused. diff --git a/docs/languages.rst b/docs/languages.rst index f05db8ede..7e3828095 100644 --- a/docs/languages.rst +++ b/docs/languages.rst @@ -55,8 +55,9 @@ What the default reads and what waits for a pack ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The default reads the doctorates before the name (``MUDr.``, -``JUDr.``, ``PhDr.``, ``RNDr.`` and the rest), and ``Mgr.``, which it -lists as Monsignor. It cannot read the other words, each of which +``JUDr.``, ``PhDr.``, ``RNDr.`` and the rest), ``Mgr.``, which it +lists as Monsignor, and the degrees after it, ``DiS.``, ``DrSc.`` and +``ArtD.``. It cannot read the other words, each of which another reading claims: - ``ml.`` is also a pair of initials. @@ -74,13 +75,11 @@ So they wait for a pack: - Turns on * - ``locales.CS`` - ``ml.``, ``st.``; the titles ``MgA.``, ``BcA.`` and ``mjr.``, and - ``Mgr.`` read as the degree; ``DrSc.`` - after the name; ``Pan`` (Mr.); ``roz.``, which routes a maiden + ``Mgr.`` read as the degree; ``Pan`` (Mr.); ``roz.``, which routes a maiden name as ``rozená`` does; two family names (``two_family_names``) * - ``locales.SK`` - - ``ml.``, ``st.``; ``Mgr.`` read as the degree; - ``ArtD.`` and ``DrSc.`` after the name; two family names + - ``ml.``, ``st.``; ``Mgr.`` read as the degree; two family names (``two_family_names``) * - ``locales.SL``, ``locales.HR`` - ``ml.``, ``st.`` diff --git a/docs/release_log.rst b/docs/release_log.rst index 650eb8779..39e230a8e 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -4,6 +4,7 @@ Release Log nameparser 3.2 is under development. + - **Add the Czech and Slovak post-nominals DiS., DrSc. and ArtD. as credentials.** ``parse("Jan Novák, DiS.")`` gives suffix ``DiS.``, where 1.4.0 through 3.1.0 gave title ``DiS.``; DiS., which is also a surname, reads as the credential after a full name and a comma, and written as ``DiS.`` or ``Dis`` it stays a name word at the end of a name of mixed case without one (``Jan Novák DiS.``), while a surname written ``DIS`` there reads as the credential (``Jan DIS``). :issue:`969` - **Add credentials: BCh, BChir and BMBCh, the Nigerian marks mni, fwc, fsi, fnse, psc and ndc, and the Hong Kong and Singapore honours GBM, GBS, SBS, BBS and BBM.** ``parse("Jane Doe, BCh")`` gives suffix ``BCh``, where 1.4.0 through 3.1.0 gave given ``BCh``, family ``Jane Doe``. A word spelling one of them after a one-word family name and a comma, or ending a name, reads as the credential (``Bello, MNI``). :issue:`1361`, :issue:`1228`, :issue:`1182` - **Read aus as a German family-name particle.** ``parse("Karen aus der Fünten")`` gives family ``aus der Fünten``, where 1.4.0 through 3.1.0 gave middle ``aus``, family ``der Fünten``; an Aus written as a middle name before a surname is read into the family too (``Kevin Aus Smith``). :issue:`1284` - **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` diff --git a/nameparser/config/_compiled.py b/nameparser/config/_compiled.py index 4b190a40e..7ccbf9fee 100644 --- a/nameparser/config/_compiled.py +++ b/nameparser/config/_compiled.py @@ -2956,6 +2956,7 @@ 'ciro', 'csi', 'cua', + 'dis', 'do', 'ea', 'ed', @@ -3032,6 +3033,7 @@ 'arm', 'arnp', 'arrc', + 'artd', 'asa', 'asc', 'asid', @@ -3318,6 +3320,7 @@ 'dfm', 'diplac', 'diplom', + 'dis', 'djur', 'dlitt', 'dm', @@ -3336,6 +3339,7 @@ 'drb', 'drmp', 'drph', + 'drsc', 'dsc', 'dsci', 'dsm', @@ -3825,6 +3829,7 @@ CAPITALIZATION_EXCEPTIONS: dict[str, str] = { 'ait': 'Ait', + 'artd': 'ArtD', 'aït': 'Aït', 'bch': 'BCh', 'bmbch': 'BMBCh', @@ -3858,6 +3863,7 @@ 'dphysio': 'DPhysio', 'dpsych': 'DPsych', 'drph': 'DrPH', + 'drsc': 'DrSc', 'dsc': 'DSc', 'dsci': 'DSci', 'dtech': 'DTech', diff --git a/nameparser/config/_index.py b/nameparser/config/_index.py index 173bfc002..d9bb5d677 100644 --- a/nameparser/config/_index.py +++ b/nameparser/config/_index.py @@ -231,7 +231,7 @@ ('arrc', (('en', 'credential', ()),)), ('arseniy', (('mul', 'spelling', (('spelling_of', ('arsenii',)),)),)), ('art', (('en', 'familiar', (('short_for', ('arthur',)),)),)), - ('artd', (('sk', 'credential', (('cased', 'ArtD'), ('default', False))),)), + ('artd', (('sk', 'credential', (('cased', 'ArtD'),)),)), ('artyom', (('ru', 'spelling', (('spelling_of', ('artem',)),)),)), ('as-', (('ar', 'article', (('same_as', 'al-'),)),)), ('asa', (('en', 'credential', ()), ('en', 'given', ()), ('en', 'family', ()))), @@ -896,6 +896,7 @@ ('diplomat', (('en', 'occupation', ()),)), ('dir', (('en', 'office', (('attaches', ('gen',)), ('same_as', 'director'))),)), ('director', (('en', 'office', (('attaches', ('gen',)),)),)), + ('dis', (('cs', 'credential', ()), ('mul', 'family', ()), ('sk', 'credential', ()))), ('discovery', (('en', 'modifier', ()),)), ('dissident', (('en', 'occupation', ()),)), ('district', (('en', 'modifier', ()),)), @@ -955,7 +956,7 @@ ('drmp', (('en', 'credential', ()),)), ('drph', (('en', 'credential', (('cased', 'DrPH'),)),)), ('drs', (('mul', 'academic', ()),)), - ('drsc', (('cs', 'credential', (('cased', 'DrSc'), ('default', False))), ('sk', 'credential', (('cased', 'DrSc'), ('default', False))))), + ('drsc', (('cs', 'credential', (('cased', 'DrSc'),)), ('sk', 'credential', (('cased', 'DrSc'),)))), ('druid', (('en', 'religious', ()),)), ('drummer', (('en', 'occupation', ()),)), ('dsc', (('en', 'credential', (('cased', 'DSc'),)),)), diff --git a/nameparser/locales/cs.py b/nameparser/locales/cs.py index 7af3ddf7d..05d81e973 100644 --- a/nameparser/locales/cs.py +++ b/nameparser/locales/cs.py @@ -6,8 +6,8 @@ ``pan``, the birth marker ``roz.``, the academic titles written before the name that the default leaves off (``MgA.``, ``BcA.``, the rank ``mjr.``; ``Mgr.`` read -as the degree, the doctorates being read by default since #1115) and -the post-nominal ``DrSc.``; on a word cs.toml holds a +as the degree, the doctorates being read by default since #1115, and +the post-nominal ``DrSc.`` since #969); on a word cs.toml holds a vocabulary reading of, other languages' vocabulary readings leave (`st`'s Saint title and particle, so ``St Clair`` is a given name under this pack; a caller whose names also hold the English Saint chooses diff --git a/nameparser/locales/sk.py b/nameparser/locales/sk.py index 5a8b429f1..cb03a3c0b 100644 --- a/nameparser/locales/sk.py +++ b/nameparser/locales/sk.py @@ -3,8 +3,8 @@ mechanisms.md#LOCALE-PACKS-PURE-DATA). Choosing it turns on nameparser/vocab/sk.toml's readings written ``default = false``: the generations ``ml.`` and ``st.``, ``Mgr.`` read as the degree (the -doctorates are read by default since #1115) and the post-nominals -``ArtD.`` and ``DrSc.``; on a word sk.toml holds a +doctorates are read by default since #1115, and the post-nominals +``ArtD.`` and ``DrSc.`` since #969); on a word sk.toml holds a vocabulary reading of, other languages' vocabulary readings leave (`st`'s Saint title and particle, so ``St Clair`` is a given name under this pack; a caller whose names also hold the English Saint chooses diff --git a/nameparser/vocab/cs.toml b/nameparser/vocab/cs.toml index de82bf486..d77d8b851 100644 --- a/nameparser/vocab/cs.toml +++ b/nameparser/vocab/cs.toml @@ -123,9 +123,17 @@ generation = { default = false, title_case_is_name = true, expands = "starší, text = "starší" generation = { issue = 661 } +[[word]] +text = "dis" +credential = { issue = 969, expands = "diplomovaný specialista, the Czech tertiary professional diploma, written after the name", note = "cz-candidates: 3,248 of 170,181 Czech election candidates' records hold it in the box after the name (2026-10-30), 3,232 of them read as a title behind the comma; NPPES 2 (written DIS); ClinicalTrials.gov 1 official, after a comma (data 2026-11-18). The surname Dis is mul.toml's family reading, which gates the credential (rules/S4). No case mask (decided 2026-11-20): a mask applies in every role and would repair the surname to DiS (JAN DIS → Jan DiS), so a mixed-case spelling is left as written, and case repair of a name written in one case, like capitalized(force=True), writes DIS" } + [[word]] text = "drsc" -credential = { default = false, cased = "DrSc", issue = [753, 848], expands = "doktor věd, Doctor scientiarum, written after the name", note = "16 of ClinicalTrials.gov's 536,981 officials write it, all after a comma (data 2026-10-21)" } +credential = { cased = "DrSc", issue = [753, 848, 969], expands = "doktor věd, Doctor scientiarum, written after the name", note = "on by default since 2026-11-20 (#969): no name reading (ORCID boxes hold it 5 times, the credential typed into a name box; no Census, SSA or PatentsView bearer), and Czech candidates write it after a comma, where unlisted it read as a title (12 records under the default, 2026-10-30); 16 of ClinicalTrials.gov's 536,981 officials write it, all after a comma (data 2026-10-21)" } + +[[word]] +text = "ien" +excluded = { credential = { reason = "IEn., written after the name by 3 Czech election candidates (cz-candidates, 2026-10-30), is the given name Ien: US SSA 16 births since 1880, a lower bound, years under 5 unrecorded (2026-11-20), so a credential reading would take a given name ending a name", issue = 969, decided = 2026-11-20 } } [[word]] text = "roz" diff --git a/nameparser/vocab/mul.toml b/nameparser/vocab/mul.toml index 092b436ca..b50071406 100644 --- a/nameparser/vocab/mul.toml +++ b/nameparser/vocab/mul.toml @@ -155,6 +155,10 @@ given = { same_as = "muhammad", note = "Muhammad written short, in Indonesia, Sy text = "mohd" given = { us_ssa = 87, wikidata = 363, as_of = 2026-11-06, same_as = ["muhammad", "mohamad", "mohammad", "mohammed", "mohamed"], note = "Muhammad written short, in Malaysia, Brunei, Singapore and India: ORCID given boxes 8,594 (Malaysia 2,739, India 1,468), PatentsView 304; US SSA male births; Wikidata is a lower bound (Malaysia 276); written with its period at the head of a name (Mohd. Shameem), it read as a title by the leading-abbreviation shape (#1115). The long spellings it stands for are those written where it is: the first words of Malaysia's ORCID given boxes are muhammad 1,971, mohamad 627, mohammad 433, mohamed 183 and mohammed 164, and muhammed 12, a Turkish spelling (Turkey 2,544) left out (the first word of each ORCID given box by the record's country, 2026-11-14 (decisions/vocabulary-model, 2026-11-14 #1383))" } +[[word]] +text = "dis" +family = { note = "the surname Dis: ORCID family boxes 14 (5 with a country, BR, CZ, FI, NL and US 1 each; 9 with none), given boxes 6; PatentsView family boxes 6 (US 4, NL 2); US Census 2010 under 100 and SSA under 5 a year (2026-11-20). It gates cs.toml's and sk.toml's credential DiS, so a name of mixed case ending in the surname written Dis keeps it (rules/S4, S6); written DIS in a name of mixed case it reads as the credential even with no word to spare (Jan DIS), and in a name written in one case with a word to spare (PETR JAN DIS), #969" } + [[word]] text = "kaur" family = { shared = true, us_census_2010 = 48753, wikidata = 204, as_of = 2026-11-03, native = "ਕੌਰ", gender = "f", note = "the name every Sikh woman is given, written after her personal name and before a family name where she has one (Harpreet Kaur Dhillon): in mul.toml so every choice of languages keeps it; UK PSC filers put it in the middle-name box 2,354 times (2,264 as its only word), the whole surname box 674 and the forename box 25; ORCID holders whose family box holds another surname put it in the given box 69 times and open the family box with it 3 (2026-11-03, #704). Wikidata is a lower bound" } diff --git a/nameparser/vocab/sk.toml b/nameparser/vocab/sk.toml index 3c3beba05..27b2dd8ef 100644 --- a/nameparser/vocab/sk.toml +++ b/nameparser/vocab/sk.toml @@ -72,11 +72,15 @@ generation = { issue = 661 } [[word]] text = "artd" -credential = { default = false, cased = "ArtD", issue = [753, 848], expands = "doktor umenia, artis doctor, written after the name" } +credential = { cased = "ArtD", issue = [753, 848, 969], expands = "doktor umenia, artis doctor, written after the name", note = "on by default since 2026-11-20 (#969): no name reading (no ORCID, PatentsView, Census or SSA bearer), written after the name (Czech candidates 3 after a comma, read as a title while it was off, 2026-10-30)" } + +[[word]] +text = "dis" +credential = { issue = 969, expands = "diplomovaný špecialista, the Slovak tertiary professional diploma, written after the name; cs.toml's entry holds the counts and why it carries no case mask" } [[word]] text = "drsc" -credential = { default = false, cased = "DrSc", issue = [753, 848], expands = "doktor vied, Doctor scientiarum, written after the name" } +credential = { cased = "DrSc", issue = [753, 848, 969], expands = "doktor vied, Doctor scientiarum, written after the name", note = "on by default since 2026-11-20 (#969), as cs.toml's entry is" } # -- BEGIN generated by tools/vocab/familiar.py; edit the tool, not this block -- diff --git a/tests/v2/cases.py b/tests/v2/cases.py index 637b34ada..4963e250b 100644 --- a/tests/v2/cases.py +++ b/tests/v2/cases.py @@ -1646,6 +1646,54 @@ def _check_cjk_shape_purity(self) -> None: classification="fix(#1284)", notes="the accepted cost of listing aus: no corpus name has the " "shape; read middle 'Aus' 1.4.0 through 3.1"), + Case("dis_after_a_comma_reads_the_credential", "Jan Novák, DiS.", + {"given": "Jan", "family": "Novák", "suffix": "DiS."}, + classification="fix(#969)", ambiguities=("suffix-or-name",), + notes="cs.toml's DiS, gated by mul.toml's surname Dis (rules/C4 " + "after the comma); read title 'DiS.' 1.4.0 through 3.1"), + Case("dis_behind_a_title_keeps_the_title_apart", "Bc. Jan Novák, DiS.", + {"title": "Bc.", "given": "Jan", "family": "Novák", "suffix": "DiS."}, + classification="fix(#969)", ambiguities=("suffix-or-name",), + notes="read title 'Bc. DiS.' 3.1, title 'DiS.', first " + "'Bc. Jan Novák' 1.4.0"), + Case("dis_without_its_period_no_longer_reverses_the_name", + "Jan Novák, DiS", + {"given": "Jan", "family": "Novák", "suffix": "DiS"}, + classification="fix(#969)", ambiguities=("suffix-or-name",), + notes="read given 'DiS', family 'Jan Novák' 1.4.0 through 3.1"), + Case("dis_with_no_comma_stays_a_name_word", "Jan Novák DiS.", + {"given": "Jan", "middle": "Novák", "family": "DiS."}, + ambiguities=("suffix-or-name",), + notes="boundary: the gated credential written in its own mixed " + "case with no comma reads as a name by its writing " + "(rules/S6), the count alone taking it (rules/S4); whether " + "that mixed case should read as the credential is #1053's"), + Case("surname_dis_in_capitals_in_a_mixed_case_name_reads_the_credential", + "Jan DIS", + {"given": "Jan", "suffix": "DIS"}, + classification="fix(#969)", ambiguities=("given-or-family",), + notes="the accepted cost: a gated acronym in capitals in a name " + "of mixed case reads as the credential even with no word to " + "spare (rules/S6), as Amani BCHIR does; read family 'DIS' " + "through 3.1"), + Case("surname_dis_in_capitals_with_a_word_to_spare_reads_the_credential", + "PETR JAN DIS", + {"given": "PETR", "family": "JAN", "suffix": "DIS"}, + classification="fix(#969)", ambiguities=("suffix-or-name",), + notes="the accepted cost: in a name written in one case the gated " + "word's writing says nothing (rules/S6) and the count takes " + "it (rules/S4); read middle 'JAN', family 'DIS' through 3.1"), + Case("surname_dis_ending_a_name_keeps_the_family", "Jan Dis", + {"given": "Jan", "family": "Dis"}, + ambiguities=("suffix-or-name",), + notes="boundary: mul.toml's family reading gates the credential " + "(#969); the report is new with it"), + Case("drsc_after_a_comma_reads_the_credential", "Jan Novák, DrSc.", + {"given": "Jan", "family": "Novák", "suffix": "DrSc."}, + classification="fix(#969)", + notes="DrSc on by default since #969, off until then (read only " + "under locales.CS and SK); read title 'DrSc.' 1.4.0 through " + "3.1"), Case("ba_is_a_suffix_when_a_family_name_remains", "John Smith BA", {"given": "John", "family": "Smith", "suffix": "BA"}, notes="the words-to-spare half: a full name in front leaves the " diff --git a/tests/v2/test_cases.py b/tests/v2/test_cases.py index d45d1d555..f9ee1f6c4 100644 --- a/tests/v2/test_cases.py +++ b/tests/v2/test_cases.py @@ -522,9 +522,12 @@ def test_the_field_sweep_sees_the_claims_it_checks() -> None: # particle-or-given; 2242 -> 2257 the same day, #1361's, #1284's # and #1392's rows under three orders (the bchir rows' suffix-or-name # and given-or-family, 'Aus Rahman's particle-or-given, and the two - # 'Jane Doe, BM, ...' rows). - assert claims == 2257, ( - f"the field sweep checks {claims} claims, recorded as 2257 on " + # 'Jane Doe, BM, ...' rows); 2257 -> 2272 the same day, #969's DiS + # rows' suffix-or-name under three orders; 2272 -> 2275 the same day, + # its review's 'PETR JAN DIS' under three orders; 2275 -> 2278 the + # same day, its second review's 'Jan DIS' under three orders. + assert claims == 2278, ( + f"the field sweep checks {claims} claims, recorded as 2278 on " f"2026-11-20") @@ -1016,8 +1019,10 @@ def test_the_alternative_sweep_sees_the_fields_it_checks() -> None: # the same day, its second fix review's two rows, their reports all # skipped; 614 -> 617 the same day, #1239's 'Broeck, Pieter Vanden' # under three orders; 617 -> 620 and 509 -> 512 the same day, #1361's - # and #1284's rows under three orders - assert (checked, skipped) == (620, 512), (checked, skipped) + # and #1284's rows under three orders; 620 -> 629 the same day, #969's + # three DiS rows after a comma under three orders; 629 -> 632 the same + # day, its review's 'PETR JAN DIS' under three orders + assert (checked, skipped) == (632, 512), (checked, skipped) def test_every_case_name_is_unique() -> None: diff --git a/tests/v2/test_local_agreement.py b/tests/v2/test_local_agreement.py index 4e8018cd9..43a53ec68 100644 --- a/tests/v2/test_local_agreement.py +++ b/tests/v2/test_local_agreement.py @@ -900,9 +900,10 @@ def test_a_suffix_is_compared_with_the_box_after_the_name_not_the_surname() -> N def test_a_title_box_the_parse_misses_is_scored_where_the_source_sets_nothing_aside() -> None: # Bc. is a title by its shape (rules/H2) and listed in no vocabulary, # so the title box holds an unlisted word; the parse reads the - # diploma after the name as a second title. - missed = _candidate("Bc.", "Jan", "Novák", "DiS.") - assert _volby_read(missed)[:2] == ({"title": "Bc. DiS.", "suffix": ""}, False) + # unlisted post-nominal after the name as a second title (IEn., + # where DiS. served until #969 listed it). + missed = _candidate("Bc.", "Jan", "Novák", "IEn.") + assert _volby_read(missed)[:2] == ({"title": "Bc. IEn.", "suffix": ""}, False) # The control: a source that sets aside would excuse the parser's miss. setting = agreement.Fielded(dict(_VOLBY_FIELDS.fields), group="election") assert _volby_read(missed, setting)[1] @@ -911,7 +912,7 @@ def test_a_title_box_the_parse_misses_is_scored_where_the_source_sets_nothing_as def test_the_report_of_a_source_with_a_suffix_box_counts_by_election( monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setattr(agreement, "GROUP_FLOOR", 1) - rows = [_candidate("Ing.", "Jan", "Novák"), _candidate("", "Eva", "Malá", "DiS."), + rows = [_candidate("Ing.", "Jan", "Novák"), _candidate("", "Eva", "Malá", "IEn."), _candidate("Mgr.", "Bo", "Dvořák", election="ps2025")] result = agreement.score(rows, _VOLBY_FIELDS, Parser()) assert result.scored == {"kv2022": 2, "ps2025": 1} diff --git a/tests/v2/test_locales.py b/tests/v2/test_locales.py index c58235559..378c22cc9 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -2363,7 +2363,6 @@ def _default_corpus() -> list[str]: "MgA Malá", # mga "Mjr Novák", # mjr, three initials elsewhere (#1129) "Chief Mjr Novák", # chief mjr, the phrase chief makes - "Jan Novák, DrSc", # drsc, a credential after a comma "Pan Novák", # pan "Jana Nováková (roz. Svobodová)", # roz, the birth marker, bracketed "Dienstbier ml.", # ml @@ -2374,8 +2373,6 @@ def _default_corpus() -> list[str]: "Jan\u200bPavel -", # rules/O6 over a zero-width split and a lone mark ] _ROTATORS["sk"] = [ - "Jozef Mrkva, ArtD.", # artd, a credential after a comma - "Jozef Mrkva, DrSc", # drsc "Mrkva ml.", # ml "Ján Mrkva st.", # st "Mária Nováková Kováčová", # rules/O6, the patch @@ -2866,6 +2863,34 @@ def test_rotator_deviates_and_declares(code: str, name: str) -> None: assert _deviates(code)(name) +# #969 turned the post-nominals on by default, so no choice moves them: +# the rows that witnessed each as a choice word now witness that the +# default reads it as the pack does, a credential after a comma, where +# the default reversed the bare one and took the dotted one for a title +# until then (decisions/suffix-acronym-collisions, the 2026-11-20 #969 +# entry). +_READ_BY_DEFAULT_SINCE_969: dict[str, list[str]] = { + "cs": [ + "Jan Novák, DrSc", # drsc, bare after a comma + "prof. MUDr. Jan Novák, DrSc.", # drsc, dotted behind titles + ], + "sk": [ + "Jozef Mrkva, ArtD.", # artd + "Jozef Mrkva, DrSc", # drsc + ], +} + + +@pytest.mark.parametrize("code, name", [ + (code, name) for code in sorted(_READ_BY_DEFAULT_SINCE_969) + for name in _READ_BY_DEFAULT_SINCE_969[code]]) +def test_a_post_nominal_read_by_default_since_969_reads_as_its_pack_reads_it( + code: str, name: str) -> None: + default = _default_parse(name) + assert _require_packed(code).parse(name).as_dict() == default + assert default["suffix"], name + + @pytest.mark.parametrize("code, name", [ (code, name) for code in sorted(_READ_BY_DEFAULT_SINCE_1115) for name in _READ_BY_DEFAULT_SINCE_1115[code]]) @@ -3201,17 +3226,6 @@ def test_no_exclusion_is_pack_shaped_any_more() -> None: ("cs", None, "JANA MALÁ MGA.", ("", "JANA", "MALÁ", "MGA.", "", "", ()), ("MGA.", "JANA", "", "MALÁ", "", "", ())), - # the post-nominals: a credential after a comma, where the default - # reverses the bare one and takes the dotted one for a title - ("cs", None, "Jan Novák, DrSc", - ("", "DrSc", "", "Jan Novák", "", "", ()), - ("", "Jan", "", "Novák", "DrSc", "", ())), - ("cs", None, "prof. MUDr. Jan Novák, DrSc.", - ("prof. MUDr. DrSc.", "Jan", "", "Novák", "", "", ()), - ("prof. MUDr.", "Jan", "", "Novák", "DrSc.", "", ())), - ("sk", None, "Jozef Mrkva, ArtD.", - ("ArtD.", "Jozef", "", "Mrkva", "", "", ()), - ("", "Jozef", "", "Mrkva", "ArtD.", "", ())), # the salutation and the birth marker, each converted from an # exclusion; pl's pan with cs's ("cs", None, "Pan Jan Novák",