diff --git a/docs/design/decisions/H9-title-phrase.md b/docs/design/decisions/H9-title-phrase.md index 9dde9b6c5..d1ca61554 100644 --- a/docs/design/decisions/H9-title-phrase.md +++ b/docs/design/decisions/H9-title-phrase.md @@ -14,6 +14,7 @@ - `hon` is a title that may be a given name only under a Chinese choice, zh.toml's `given` reading being off by default; there a style written short has its phrase partner in the article before it (`The Hon John Smith`), a rule that reaches no other word, so `The Sheikh` and `The Grace` stay epithets — 2026-11-03 #999, `hon`. - `lady` is a title that may be a given name only under a Spanish choice, es.toml's `given` reading being off by default, and `locales.ES` makes that choice; eight more titles borne as given names, `sir`, `general`, `bishop`, `colonel`, `canon`, `author`, `empress` and `lawyer`, stay titles everywhere, their counts on their title readings — 2026-11-03 #913, the last nine. - The article before any other title that may be a given name is no partner, save before a modifier, whose object of `the` decision 10 reads (`The Wing Smith` → title 'The Wing'), at the head, after a comma and under every order: `The Marquis de Sade` reads given 'The Marquis', `The Marquis of Tavistock` the title — 2026-11-03 #913, the article (Derek). +- A pack's fragment may take a title's `given` reading out too, the caller's case above made by the pack: `locales.CS` removes `ing`'s, so its `Ing` is a title wherever a title is read before the name (`Ing Jan Novák` reads title 'Ing' under the pack, given 'Ing' by default) — 2026-11-21 #970, decisions/vocabulary-model. Not standing: what a v1 caller's `titles` list did to a title that may be a given name — emptying it, replacing it, removing a word 2.6.0 listed — overtaken by 3.0's removal of the v1 layer, #357 in decisions/3-0-reevaluations — 2026-10-25 #752, phase 2i; 2026-10-26 #752, the v1 title list. @@ -161,3 +162,4 @@ Not standing: what a v1 caller's `titles` list did to a title that may be a give - THE CHOICE'S COSTS, accepted by Derek in choosing it: a peeress written with the bare title reads the given name, and under `locales.ES` rules/O6's two family names then take her own given name into the family (`Lady Annabel Goldsmith` → given 'Lady', family 'Annabel Goldsmith'; the plain choice reads middle 'Annabel'); alone after a full name and a comma the word reverses the name (`John Smith, Lady` → given 'Lady', family 'John Smith'), as `hon` does; a leading `The` joins it into the given name (`The Lady Smith` → given 'The Lady'), the shape the article entry above keeps on purpose; and a conjoined pair opening with it does too (`Lady and Sir John Smith` → given 'Lady and Sir'). Every title after it but the five it attaches to loses the phrase (`Lady Judge Smith`, `Lady Professor Smith` → given 'Lady'): the five are the offices found written after it, one slot left under `hon`'s six. - MEASURED under the choice (2026-11-03, py3.11): the 595 local-corpus texts holding `lady` as a word, distinct within each corpus (`(?i)(?`, the two configurations' first field compared line by line. - 2026-11-21 #1180 — A PHRASE MAY BE WRITTEN WHOLLY OFF BY DEFAULT IN ONE FILE. `Tan Sri` and `Puan Sri`, Malaysian honours, are phrases rules/H9 reads, `tan` and `puan` attaching to `sri`, each a title off by default in ms.toml for `locales.MS` (decisions/salutation-titles, the same day's entry). The build refused them: `attaches` had to name a word with a title reading ON by default, and `sri` holds none, hi.toml excluding it as a salutation and the exclusion refusing every title kind of a reading on by default. Decided 2026-11-21, B over A. A: turn `sri`'s title on by default, gated by mul.toml's `given` reading, and narrow hi.toml's exclusion. It moved no corpus name (0 of the 597 local-corpus names holding `sri`, `config_diff.py diff --local all --match '(?i)(^|[\s,.])sri([\s,.]|$)' default 'expr:Parser(lexicon=Lexicon.default().add("sri", kind="given").add("sri", kind="nobility", addresses="given"))'`, master `488ea605`), but it moved the default to satisfy a tool rule, and a style before the word makes a phrase there (`Hon. Sri Mulyani` title 'Hon. Sri', rules/H9). B: the build check admits a partner whose title reading is off by default in the reading's own file, where the reading is off by default too, so the default compiles no phrase and holds no `sri` title (`nameparser/config/_compiled.py` holds no `tan`, `sri` or `puan`), and the one choice of the file turns both on. The check still refuses a partner with no title reading, one with only a name reading in the file, one another file turns on, and a partner off by default beside a reading on by default, each a mutation in tests/v2/test_vocab.py; the other-file refusal holds even where a choice of the reading's file selects that file too (`pt.toml` under `pt-BR`), narrower than the reason needs, so a phrase's two halves stand in one file. Option B pays A's style cost under the pack alone (`Hon. Sri Mulyani`), beside the pack's own for `tan` (`Hon. Tan Ah Kow` title 'Hon. Tan'), both recorded in decisions/salutation-titles' entry. A caller's `Lexicon.add` had no such check and gets none: a phrase naming no title word compiles to nothing, an inert entry (AGENTS.md, invariants guard harm, not no-ops), and under a choice the compile builds a phrase only from the title words the chosen pool holds. + +- 2026-11-21 #970 — `locales.CS` READS `Bc` AND `Ing` AS TITLES, AND cs.toml AND sk.toml WRITE THEIR OWN `et`. Decided 2026-11-21, reversing the phase 3f entry's two exclusions by the rule the 3.2 cycle chooses a pack's readings by, its accuracy for the callers who choose it (as the 2026-11-20 #1192 entry did for `shri`). No field moves by default: `nameparser/config/_compiled.py` is unchanged, tests/v2/test_snapshot.py passes with no re-record, and the names holding `bc`, `ing` or `et` in every local corpus, 37,100, read as master reads them; what moves is `et`'s `Reading.languages`, which gains `cs` and `sk` beside `fr` by default (`cs` alone under the pack), a view the snapshot does not record (`config_diff.py diff --local all --match '(?i)(^|[^a-zà-ž])(ing|bc|et)([^a-zà-ž]|$)' --readings FILE default plain:CS` in each tree, compared line by line; master `efdf0e16`). + - **`bc`** becomes an `academic` reading written `default = false`, with no case mask. Phase 3f measured its 23 ClinicalTrials.gov moves under a Czech choice and excluded it; those officials are a US register read under a choice made for Czech names. With `bc` alone, measured 2026-11-21 against master `1e920d6f` (a checkout of it with this reading in place of the exclusion; recompute: `local_agreement.py cz-candidates --base --locale cs` in that checkout, and `config_diff.py diff --local all --match '(?i)(^|[^a-z])bc([^a-z]|$)' --readings FILE default plain:CS` in both, compared line by line; the 80 also reproduces on `efdf0e16` as `plain:CS` against `'expr:parser_for(locales.CS).lexicon.add("bc", kind="academic")'`): cz-candidates under `--locale cs` gains 51 records and loses none, and of every local corpus's names holding the word, 80 read otherwise, 59 Czech degrees now right, 5 names a trailing `BC` had reversed now right (`Jane Moss, BC` read given 'BC', family 'Jane Moss'), and 16 costs, 9 the initials B.C. (`MOSS, BC` reads title 'BC' and no given name) and 7 the credential BC moved from suffix to title, 6 the nursing credential (`X, APRN, BC`) and 1 the BC of `MB BC`. The mask `cased = "Bc"` is left off: it recased `ACNP-BC` as `ACNP-Bc` under `capitalized(force=True)`, which is the case-repair cost phase 3f recorded, and title case writes `Bc.` without it. + - **`ing`** gains an `academic` reading in cs.toml, written `default = false`, and `locales.CS` a lexicon fragment removing its `given` reading. Moving the name readings out of mul.toml would not have done it, measured on a build of that option: a choice never drops a name reading (decision 15), whichever file holds it, so the default and plain `locales.CS` read every name of the grid as master did, and only `strict=True` read the title. The build refused the option twice on the way, for a cs.toml reading of a word mul.toml holds (check 13, until the word joins `MUL_SHARED`) and then for mul.toml's credential beside a name reading in another file, which a strict choice would ungate. Nor would a strict choice of `cs` alone do: the name readings are mul.toml's, which strict keeps. So the fragment, decision 15's bend as `locales.VI` has it, and it removes the `given` reading only: rules/H9 gates a title by a `given` reading alone, while the credential's gate (`SUFFIX_ACRONYMS_AMBIGUOUS`) reads `given` or `family`, so the family reading kept leaves mul.toml's credential gated, and `Mr Tom Ing` keeps family `Ing` where removing both read suffix `Ing` (about 50 surnames in the corpora moved that way in the first build, `Tom Ing, MD PhD` reading family 'Tom'). `ing` joins `MUL_SHARED`: the cs title is read before the name and mul.toml's credential after it, and the two meet only past a second comma, where rules/C2 reads a title, so a degree in a credential list there moves from suffix to title (below). + - **`et`** joins cs.toml and sk.toml as a `conjunction`, on by default. fr.toml's reads it already, so it compiles to the same sets by default and under a plain choice; a strict choice drops fr.toml, and strict `cs` read `Ing. et Ing. Jan Novák` as title 'Ing.', given 'et', middle 'Ing.', where now it reads title 'Ing. et Ing.' (strict `sk`, `Mgr. et Mgr. Ján Kováč`, the same). The cost is under strict `sk`, which lists no `ing` or `bc` title: the joined pair is one piece the leading-abbreviation shape (rules/H2) no longer takes, so `Ing. et Ing. Jan Novák` reads given 'Ing. et Ing.', family 'Jan Novák', where it read title 'Ing.', given 'et', middle 'Ing.', both readings wrong; plain `sk` read the pair so already, through fr.toml's `et`. + - **Measured** 2026-11-21 against a checkout of master `efdf0e16`, Python 3.11, the three together: `local_agreement.py cz-candidates --base --locale cs`, 169,254 of 170,181 records agreeing in every field (99.5%), 165 now agreeing, 4 now disagreeing and 11 changed. Of the 443 cz-candidates records holding a pair of degrees joined by `et` or `&`, those whose pair the pack read outside the title fell from 176 to 16 (`Ing et Ing` 107 to 1, `Bc et Bc` 48 to 0, `Ing & Ing` and `Bc & Bc` 1 each to 0; left, `D et Ph` 7, `DiS et DiS` 6, `arch et Ing` 1, `MSSc et MSSc` 1 and the one `Ing et Ing`; recompute: `config_diff.py diff --local cz-candidates --match '(?i)[a-z]\.?\s?(et|&)\s?[a-z]' --readings FILE default plain:CS` in each tree, the pair being a match of `([A-Za-z]+)\.\s?(et|&)\s?([A-Za-z]+)\.` in the name and outside the title where the `plain:CS` title holds no `et` or `&` as a substring, since `Bc.et Bc.` writes no space before it). Of every local corpus's names holding `bc`, `ing` or `et`, 260 read otherwise under plain `locales.CS`, none by a report alone: 193 a degree written with its period or in a pair, 24 the `bc` names above, and 43 holding `Ing` otherwise, of which about 22 are the degree read right now (`Ing Václav Novák`, `Jiří Novák, Prof Ing`) and about 19 Ing the given name opening a name read as the title (`Ing Wei Lim`, `ING MEI TAN`, `Mrs Ing Marie Berg`), the cost the pack takes, its callers' names being Czech. + - **What breaks, under the pack only:** a name opening with the given name Ing (`Ing Wei Lim` reads title 'Ing'), and Ing alone after a family comma (`Lim, Ing` reads title 'Ing' and no given name), and a lone `Ing` or `Bc` (a title and no name); Ing the surname at the head of a family comma (`Ing Ho, Mei` reads title 'Ing', family 'Ho') or first under a family-first order (`Ing Wei` under `FAMILY_FIRST` reads title 'Ing', family 'Wei'); a post-nominal glued to Ing.'s stop (`Ph.D., Ing.Paed.IGIP` reads title 'Ing.Paed.IGIP', a period-joined token being a title where a chunk is one, rules/S3), 3 cz-candidates records; and `EUR ING` past a second comma, read as the title there (rules/C2), 1 record. The initials B.C. and the nursing credential BC, above. A degree in a credential list past the second comma (`Dana Novotná, prof.,Ing.,PhD`) moves from suffix to title, its name fields unchanged. + - **Slovak is left as it was, save `et` and its strict cost above.** The one fielded population of Slovak names the corpora hold, the Slovak chamber in opensanctions-parliaments, writes no degree, so no measurement reaches `locales.SK`; cz-candidates' evidence is Czech, and a fragment for `ing` under `SK` waits for Slovak names to weigh it on. diff --git a/docs/design/rules/H9-title-phrase.md b/docs/design/rules/H9-title-phrase.md index 7c43525a7..953d45971 100644 --- a/docs/design/rules/H9-title-phrase.md +++ b/docs/design/rules/H9-title-phrase.md @@ -118,7 +118,11 @@ "Dean and Mary Smith" → given="Dean and Mary" "Dean. and Mary Smith" → given="Dean. and Mary" ``` -- **A title that may be a given name whose given reading a caller removes** is a title wherever it stands, since that is what removing it asks; a modifier is read by this rule unless a caller reads its word as another title kind, and leaving its word out of the modifiers turns the rule off for it. +- **A title that may be a given name whose given reading a caller or a pack removes** is a title wherever it stands, since that is what removing it asks; a modifier is read by this rule unless a caller reads its word as another title kind, and leaving its word out of the modifiers turns the rule off for it. The Czech pack removes Ing's given reading, so its Ing is a title wherever a title is read before the name. + ``` + "Ing Jan Novák" [cs] → title="Ing" + "Ing. et Ing. Jan Novák" [cs] → title="Ing. et Ing." + ``` - **A title phrase written in capitals under capitals-as-family handling** ("Marie BARON GRAND"): the caller has said the capitals write the family name, so the words are the family name, not a title (O9). ``` "Marie BARON GRAND" capitals_as_family → family="BARON GRAND" diff --git a/docs/languages.rst b/docs/languages.rst index b91fba98b..6ffcd757b 100644 --- a/docs/languages.rst +++ b/docs/languages.rst @@ -64,7 +64,11 @@ another reading claims: - ``st.`` is Saint in English and French. - ``Pan`` and ``Roz`` are names in other languages. - ``MgA.`` and the rank ``mjr.`` (major) are written as initials too. -- ``BcA.`` is an English credential. +- ``BcA.`` is an English credential, and ``Bc`` the US nursing + credential BC and a pair of initials. +- ``Ing`` is a given name too (Chinese, Malaysian and Swedish). Written + with its period ``Ing.`` is a title before the name by its shape, as + ``Bc.`` is, but not two of them joined by ``et`` (``Ing. et Ing.``). So they wait for a pack: @@ -74,8 +78,9 @@ So they wait for a pack: * - Pack - Turns on * - ``locales.CS`` - - ``ml.``, ``st.``; the titles ``MgA.``, ``BcA.`` and ``mjr.``, and - ``Mgr.`` read as the degree; ``Pan`` (Mr.); ``roz.``, which routes a maiden + - ``ml.``, ``st.``; the titles ``MgA.``, ``BcA.``, ``Bc.``, ``Ing.`` + and ``mjr.``, and ``Mgr.`` read as the degree, written bare or + joined by ``et``; ``Pan`` (Mr.); ``roz.``, which routes a maiden name as ``rozená`` does; two family names (``two_family_names``) * - ``locales.SK`` @@ -94,6 +99,20 @@ So they wait for a pack: 'ml.' >>> czech.parse("Jana Nováková roz. Svobodová").maiden 'Svobodová' + >>> parse("Ing. et Ing. Jan Novák").given + 'Ing. et Ing.' + >>> czech.parse("Ing. et Ing. Jan Novák").title + 'Ing. et Ing.' + +The Czech pack reads ``Ing`` as a title wherever a title is read +before the name, so a name that opens with the given name Ing reads it +as the title under the pack (``Ing Wei Lim`` gives title ``Ing``), as +does Ing alone after a family comma (``Lim, Ing``) and Ing the surname +at the head of one (``Ing Ho, Mei`` gives family ``Ho``); Ing the +surname at the end keeps its place (``Tom Ing`` gives family ``Ing``), +and after a full name and a comma Ing is still the credential. ``BC`` after a comma is +the title too, so initials written there lose their given name +(``MOSS, BC`` gives title ``BC``). Where a title is read, by spelling and position ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/locales.rst b/docs/locales.rst index 6a0bb965b..ae4de84e1 100644 --- a/docs/locales.rst +++ b/docs/locales.rst @@ -407,7 +407,11 @@ says what it can change: - yes - none - none - * - ``cs``, ``sk`` + * - ``cs`` + - yes + - ``two_family_names`` + - a removal: ``Ing``'s given-name reading + * - ``sk`` - yes - ``two_family_names`` - none diff --git a/docs/release_log.rst b/docs/release_log.rst index 1f3f3c4de..d19c8d93e 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -5,6 +5,7 @@ Release Log nameparser 3.2 is under development. - **Read the Cyrillic doctorate д-р ending a name as a credential, and the Bulgarian д.м. under a Bulgarian choice.** ``parse("Іван Петренко д-р")`` gives family ``Петренко``, suffix ``д-р``, where 1.4.0 through 3.1.0 gave middle ``Петренко``, family ``д-р``; in front of the name ``д-р`` stays the title, and after a comma it is the suffix too (``Іван Петренко, д-р``). With Bulgarian chosen (``languages=frozenset({"bg"})``), ``доц. д-р Мария Петрова, д.м.`` gives title ``доц. д-р``, family ``Петрова``, suffix ``д.м.``; by default it gives given ``д.м.``, family ``доц. Мария Петрова``, suffix ``д-р``, where 1.4.0 through 3.1.0 kept ``д-р`` in the family. :issue:`1128` + - **Read Bc and Ing as titles under locales.CS, written bare or two joined by et.** ``parser_for(locales.CS).parse("Ing. et Ing. Jan Novák")`` gives title ``Ing. et Ing.``, given ``Jan``, family ``Novák``, where 3.0.0 through 3.1.0 gave given ``Ing. et Ing.``, family ``Jan Novák``; the default is unchanged. Under the pack a name that opens with the given name Ing reads it as the title (``Ing Wei Lim``), and initials ``BC`` after a comma read as the title too (``MOSS, BC``); a strict choice of ``cs`` or ``sk`` now keeps ``et`` between two degrees the pack reads (``Mgr. et Mgr.``). :issue:`970` - **Read an unlisted credential written in mixed case after a full name and a comma, such as MRes or AuD.** ``parse("Jane Smith, MRes")`` gives suffix ``MRes``, where 1.4.0 through 3.1.0 gave given ``MRes``, family ``Jane Smith``; the word must open with two capitals or end in one, so ``LeBron`` and ``PhDc`` stay given names, while a given name written so after a two-word surname reads as the credential (``García López, DAndre``). Behind one word it stays the given name (``Smith, MRes``), save behind initials spelling a credential, which read as the credential with it (``Smith, M.B. ChB``, and ``Jansen, J.P. IJsbrand``, which loses its given name). The positions only ``CapsSuffixes.EVERYWHERE`` reads still take words in capitals alone (``Alex Lee ONeill`` keeps family ``ONeill``). :issue:`1517` - **Add French dit and dite as connectives under a French choice.** With ``languages=frozenset({"fr"})`` chosen, ``Jean Dupont dit Lebrun`` gives family ``Dupont dit Lebrun``, where the default, as 1.4.0 through 3.1.0, gives middle ``Dupont dit``, family ``Lebrun``; a West African alias joins the given name the same way (``Mamadou dit Madou``), and the default is unchanged, ``Dit`` and ``Dite`` being names too. :issue:`1159` - **Add Brazilian Portuguese familiar forms, found in the names Brazil's election candidates put on the ballot.** With ``familiar-form`` accepted, ``Tião Alves`` / ``Sebastião Alves`` and ``Cida Silva`` / ``Aparecida Silva`` are consistent, where 3.1.0 read a conflict. They are filed under ``pt-BR``, so a strict choice of another language leaves them out, and one name spelled two ways (``Elizangela`` / ``Elisangela``) is not among them. :issue:`1495` diff --git a/nameparser/config/_index.py b/nameparser/config/_index.py index 8e643f131..959954e07 100644 --- a/nameparser/config/_index.py +++ b/nameparser/config/_index.py @@ -344,6 +344,7 @@ ('bay', (('tr', 'family', ()),)), ('bbm', (('en', 'credential', ()),)), ('bbs', (('en', 'credential', ()),)), + ('bc', (('cs', 'academic', (('default', False),)),)), ('bca', (('cs', 'academic', (('cased', 'BcA'), ('default', False))), ('en', 'credential', ()))), ('bcba', (('en', 'credential', ()),)), ('bch', (('en', 'credential', (('cased', 'BCh'),)),)), @@ -1258,7 +1259,7 @@ ('esq', (('en', 'courtesy', ()),)), ('esquire', (('en', 'courtesy', (('same_as', 'esq'),)),)), ('essayist', (('en', 'occupation', ()),)), - ('et', (('fr', 'conjunction', ()),)), + ('et', (('cs', 'conjunction', ()), ('fr', 'conjunction', ()), ('sk', 'conjunction', ()))), ('et-', (('ar', 'article', (('same_as', 'el-'),)),)), ('eta', (('hu', 'familiar', (('short_for', ('etelka',)),)),)), ('eth-', (('ar', 'article', (('same_as', 'el-'),)),)), @@ -1692,7 +1693,7 @@ ('inacio', (('pt-BR', 'familiar', (('short_for', ('inacinho',)),)),)), ('industrialist', (('en', 'occupation', ()),)), ('information', (('en', 'modifier', ()),)), - ('ing', (('mul', 'credential', (('cased', 'Ing'),)), ('mul', 'given', ()), ('mul', 'family', ()))), + ('ing', (('cs', 'academic', (('default', False),)), ('mul', 'credential', (('cased', 'Ing'),)), ('mul', 'given', ()), ('mul', 'family', ()))), ('ingeniera', (('es', 'academic', (('same_as', 'ingeniero'),)),)), ('ingeniero', (('es', 'academic', ()),)), ('inma', (('ca', 'familiar', (('short_for', ('inmaculada',)),)), ('es', 'familiar', (('short_for', ('inmaculada',)),)))), diff --git a/nameparser/locales/AGENTS.md b/nameparser/locales/AGENTS.md index b5c024af4..5de3bf0b8 100644 --- a/nameparser/locales/AGENTS.md +++ b/nameparser/locales/AGENTS.md @@ -12,6 +12,7 @@ Decide which layer the vocabulary belongs in, if the pack carries any. - **Vocabulary that declares a language its script does not belongs in the pack**, where asking for it is the declaration. A Chinese surname list silently mangles the Japanese names written in the same characters. - **A word reading that is right in its language and wrong as a default** is written in that language's vocabulary file with `default = false` (`nameparser/vocab/README.md`, Properties), and the pack's `languages` turns it on; the pack module lists nothing (`nameparser/locales/hi.py`). - **Before a pack removes another language's readings, measure a strict choice of its language.** A removal list names other languages' words, so it fails silently in two ways, checked on master `d12af9d6`: removing a reading that is no longer there raises nothing, in a lexicon or a pack, and a reading another language gains later is not on the list, which misreads names and which no test can name. A strict choice (`parser_for(PACK, strict=True)`) reads no other language's file, so neither can happen to it. Prefer it, with what the language's lists write that strict drops added to the language's own vocabulary file, `default = false` (copies of another file's reading must copy every vocabulary reading of the word, since a choice that holds one drops the other files', as `my.toml`'s `lt` copies `en.toml`'s credential with its rank). A pack that removes readings records in its docstring why strict would not do; `locales.VI`'s list predates this rule, and strict `vi` was measured beside it in #1483 and left for a later decision (decisions/vocabulary-collisions, the 2026-11-19 #1483 entry). #1231 shipped `locales.MY` with nine particles and a credential removed; #1483 found five credential syllables the list missed (`PE`, `LAT`, `EI`, `SI`, `PA`), and `RA`, ungated,, all read right by strict `my`, and the fragment was dropped for strict plus my.toml's English ranks. +- **Strict cannot reach a mul.toml reading, and a removal takes the one reading that does the gating.** A strict choice keeps mul.toml, so where the reading in the way is mul.toml's, a fragment is the only route; moving the reading into another file does not help a plain choice either, since a choice never drops a name reading (decision 15), and the build refuses the move twice (check 13: a reading in another file of a word mul.toml holds, and mul.toml's credential beside a name reading elsewhere that strict would ungate). Then remove only what gates the reading you want: rules/H9 gates a title by a `given` reading alone, while the credential gate (`SUFFIX_ACRONYMS_AMBIGUOUS`) reads `given` or `family`. #970's first build of `locales.CS` removed both of `ing`'s name readings and ungated mul.toml's credential with the title, so about 50 corpus surnames read as the suffix (`Mr Tom Ing`, `Tom Ing, MD PhD` family 'Tom'); removing `given` alone ungated the title and kept those surnames. List every reading the word holds (`tools/vocab/query.py --word`) and ask which set each one compiles into before writing the removal. - **A pack with no list of its own ships an empty `Lexicon`** (`Lexicon.empty()`, as `nameparser/locales/ru.py` does); `nameparser/locales/zh.py` is the template for one that carries a list. Curate vocabulary conservatively, the same rule as the user guide's "Words that are also ordinary names" (docs/customize.rst, label `ambiguous-words`): when you're unsure whether a word or a marker belongs, leave it out. diff --git a/nameparser/locales/cs.py b/nameparser/locales/cs.py index 05d81e973..cc65fcd8d 100644 --- a/nameparser/locales/cs.py +++ b/nameparser/locales/cs.py @@ -1,11 +1,11 @@ -"""The Czech locale pack: a choice of languages, ``cs``, and a policy -patch, no lexicon fragment (3.0, phase 3f, #753; -mechanisms.md#LOCALE-PACKS-PURE-DATA). Choosing it turns on +"""The Czech locale pack: a choice of languages, ``cs``, a policy +patch and a lexicon fragment (3.0, phase 3f, #753; the fragment since +#970; mechanisms.md#LOCALE-PACKS-PURE-DATA). Choosing it turns on nameparser/vocab/cs.toml's readings written ``default = false``: the generations ``ml.`` (mladší) and ``st.`` (starší), the salutation ``pan``, the birth marker ``roz.``, the academic titles written before -the name that the default leaves off (``MgA.``, ``BcA.``, the rank -``mjr.``; ``Mgr.`` read +the name that the default leaves off (``MgA.``, ``BcA.``, ``Bc.``, +``Ing.``, the rank ``mjr.``; ``Mgr.`` read 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 @@ -25,6 +25,22 @@ (decisions/vocabulary-model's 2026-10-30 phase 3f amended entry, which records the cost and the list that could lift it). +Its fragment removes ``ing``'s given-name reading, so ``Ing Jan Novák`` +gives title ``Ing``, and ``Ing. et Ing. Jan Novák`` the title ``Ing. et +Ing.``, where the default gives the given name ``Ing`` and ``Ing. et +Ing.``: a choice never +drops a name reading (decision 15 of decisions/vocabulary-model), and +this one is mul.toml's, which a strict choice keeps too, so neither a +reading cs.toml could write nor ``strict=True`` makes Ing a title +outside a title phrase (rules/H9). The family reading stays, keeping +the credential mul.toml lists gated, so ``Mr Tom Ing`` keeps family +``Ing``. The cost is Ing the given name opening a name or alone after +a family comma, Chinese, Malaysian or Swedish (``Ing Wei Lim`` and +``Lim, Ing`` give title ``Ing``), Ing the surname at the head of a +family comma (``Ing Ho, Mei`` gives family ``Ho``), and a +post-nominal glued to Ing.'s stop (``Ing.Paed.IGIP``) read as a title +(decisions/vocabulary-model, the 2026-11-21 #970 entry). + Data sources: the readings' own entries in nameparser/vocab/cs.toml, each with its issue and the vetting on its note; nothing is listed here. @@ -33,7 +49,7 @@ are derived, not declared -- the words whose compiled readings it changes (``_reading_index.changed_words``), which the non-interference gate in tests/v2/test_locales.py ors in -- so DEVIATES below declares -only what the patch changes. +only what the patch and the fragment change. """ from __future__ import annotations @@ -42,12 +58,23 @@ CS = Locale( code="cs", - lexicon=Lexicon.empty(), + # the given reading that gates cs.toml's Ing (#970): a choice never + # drops a name reading, and this is mul.toml's, which strict keeps + lexicon=Lexicon.empty().remove("ing", kind="given"), # nameparser/vocab/cs.toml's [rules], compiled by tools/vocab/build.py policy=rules_patch("cs"), languages=frozenset({"cs"}), ) -# rules/O6's declaration, which every pack turning O6 on shares -DEVIATES = deviates_by_two_family_names +def DEVIATES(name: str) -> bool: + """True when this pack may parse `name` differently from the + default parser (the declared-deviation predicate the + non-interference gate consumes): rules/O6's declaration, which + every pack turning O6 on shares, or a name holding the word the + fragment changes, ``Ing``, in any case and glued to a stop + (``Ing.Paed.IGIP``), but not a word that merely holds its letters + (``King``). The derived surface holds ``ing`` too while cs.toml + lists it; this keeps the fragment declared if that reading goes.""" + letters = "".join(c if c.isalpha() else " " for c in name.casefold()) + return deviates_by_two_family_names(name) or "ing" in letters.split() diff --git a/nameparser/vocab/AGENTS.md b/nameparser/vocab/AGENTS.md index 8edc64789..86acff746 100644 --- a/nameparser/vocab/AGENTS.md +++ b/nameparser/vocab/AGENTS.md @@ -58,7 +58,7 @@ A title that gains a `given` reading is a title only in a phrase from then on, s ## A word that moves into mul.toml -Every strict choice reads `mul.toml` (#1005), so a word there is read in names of every language, and the bar is that it harms none. Check four things before moving one. Its name readings, in every file: a moved vocabulary reading keeps working under strict while a name reading left in en.toml leaves, ungating it, which #1005's simulation measured for the 48 credentials that are also names (`do`: 207 more Vietnamese ORCID records broken; 159 Chinese PSC filers, `ma` in 103 and `meng` in 28; `kc`: 16 Nepalese). Whether it is written as a name's abbreviation, which check 13 cannot see: `md`'s credential stayed in en.toml as Muhammad's (#853), whose move, found by review, read `Rahman, Md` suffix 'Md' under strict `bn`; #1383 has since recorded the abbreviation, a `given` reading with `same_as` in mul.toml, but a name written short marks no clash with a credential, so that reading would not have caught the move either (the credential joined it in mul.toml in #1383's review, once #1393 read `Rahman, Md` as the given name under every choice); put a family-comma name in the grid (`Family, Word Given`), the shape where a strict choice is the only reader of the word as a name. And whether the word has a second reading in the file it leaves: move both or neither, then parse the second reading's shape under a strict choice without `en`. Check 13 of `tools/vocab/build.py` already refuses the split (a `mul.toml` reading beside another file's) until the word joins `MUL_SHARED`; adding it there to get past the refusal is this split, so a word joins `MUL_SHARED` only with the measurement that the second reading's language prefers it (`i`). The 2026-11-03 audit's first draft moved `ms`'s salutation and left its credential, and strict `ko` read `A Israni, MD, MS` title 'MS', 46,838 names of four corpora moving; `ms` moved whole, which costs the South Indian initials #1005 had kept it for (`Radha MS` reads suffix 'MS' under strict without `en`, as the default does; about 150 ORCID and PatentsView records) against some 38,000 recovered. And whether another language's file holds a vocabulary reading of it: `choose`'s prefer step never drops mul.toml's readings, so the move would change that language's plain choice (`abd`, ar.toml's bound given name, stayed). +Every strict choice reads `mul.toml` (#1005), so a word there is read in names of every language, and the bar is that it harms none. Check four things before moving one. Its name readings, in every file: a moved vocabulary reading keeps working under strict while a name reading left in en.toml leaves, ungating it, which #1005's simulation measured for the 48 credentials that are also names (`do`: 207 more Vietnamese ORCID records broken; 159 Chinese PSC filers, `ma` in 103 and `meng` in 28; `kc`: 16 Nepalese). Whether it is written as a name's abbreviation, which check 13 cannot see: `md`'s credential stayed in en.toml as Muhammad's (#853), whose move, found by review, read `Rahman, Md` suffix 'Md' under strict `bn`; #1383 has since recorded the abbreviation, a `given` reading with `same_as` in mul.toml, but a name written short marks no clash with a credential, so that reading would not have caught the move either (the credential joined it in mul.toml in #1383's review, once #1393 read `Rahman, Md` as the given name under every choice); put a family-comma name in the grid (`Family, Word Given`), the shape where a strict choice is the only reader of the word as a name. And whether the word has a second reading in the file it leaves: move both or neither, then parse the second reading's shape under a strict choice without `en`. Check 13 of `tools/vocab/build.py` already refuses the split (a `mul.toml` reading beside another file's) until the word joins `MUL_SHARED`; adding it there to get past the refusal is this split, so a word joins `MUL_SHARED` only with the measurement that the second reading's language prefers it (`i`), or that the two readings are read in different places, saying where they still meet (`ing`, cs.toml's title before the name beside mul.toml's credential after it, which meet past a second comma, where rules/C2 reads the title, #970). The 2026-11-03 audit's first draft moved `ms`'s salutation and left its credential, and strict `ko` read `A Israni, MD, MS` title 'MS', 46,838 names of four corpora moving; `ms` moved whole, which costs the South Indian initials #1005 had kept it for (`Radha MS` reads suffix 'MS' under strict without `en`, as the default does; about 150 ORCID and PatentsView records) against some 38,000 recovered. And whether another language's file holds a vocabulary reading of it: `choose`'s prefer step never drops mul.toml's readings, so the move would change that language's plain choice (`abd`, ar.toml's bound given name, stayed). ## A reading taken out: what it used to override diff --git a/nameparser/vocab/cs.toml b/nameparser/vocab/cs.toml index e06a18302..8d2df69b3 100644 --- a/nameparser/vocab/cs.toml +++ b/nameparser/vocab/cs.toml @@ -25,12 +25,16 @@ salutation = { issue = 606, gender = "f", after_given = true } [[word]] text = "bc" -excluded = { academic = { reason = "bakalář, the Czech and Slovak Bachelor, but BC is the US nursing credential Board Certified, written after the name (APRN, BC; ACNP-BC): read as a title under a Czech choice it moved 23 of ClinicalTrials.gov's 536,981 officials, one a Czech Bc (Dagmar Koveslygetyova, Bc) and the rest that credential or initials (Lora L. Beebe, PhD, PMHNP, BC read title 'BC'; ACNP-BC recased 'ACNP-Bc'), measured 2026-10-30; written Bc. at the head of a name it reads as a title by its shape without a reading (rules/H2)", issue = 753, decided = 2026-10-30 } } +academic = { default = false, issue = [753, 970], expands = "bakalář, Bachelor", note = "bakalář, the Czech and Slovak Bachelor. Excluded on 2026-10-30 because as a title under a Czech choice it moved 23 of ClinicalTrials.gov's 536,981 officials, one a Czech Bc and the rest the US nursing credential Board Certified (APRN, BC) or initials; re-weighed on 2026-11-21 by the rule that a choice is optimised for its language's names, those 23 being a US register read under a Czech choice. Under locales.CS it moves 51 of cz-candidates' 170,181 records to agreement and none away, the Bc. et Bc. pair most, and of every local corpus's names holding the word, 80 read differently (bc alone, measured 2026-11-21 against master 1e920d6f; recipe in the decisions entry): 59 Czech degrees now right, 5 names a trailing BC had reversed now right, and 16 costs, 9 initials B.C. (MOSS, BC reads title 'BC', no given name) and 7 the credential BC moved from suffix to title, 6 of them the nursing credential and 1 the BC of MB BC. No case mask: cased = 'Bc' recased ACNP-BC as ACNP-Bc under capitalized(force=True), and title case writes Bc. without one (decisions/vocabulary-model, the 2026-11-21 #970 entry)" } [[word]] text = "bca" academic = { default = false, cased = "BcA", issue = [753, 848], expands = "bakalář umění, Bachelor of Arts" } +[[word]] +text = "ing" +academic = { default = false, issue = 970, expands = "inženýr, the engineering degree", note = "inženýr, the engineering degree, written before the name. Its given reading in mul.toml (Ing, a Chinese, Malaysian and Swedish given name) would make it a title only inside a title phrase (rules/H9), and a choice never drops a name reading, so locales.CS's fragment removes that reading; the family reading stays, keeping mul.toml's credential gated (Mr Tom Ing keeps family Ing). Under locales.CS, with bc, it moves 165 of cz-candidates' 170,181 records to agreement and 4 away (measured 2026-11-21 against master efdf0e16), the records whose Ing et Ing pair stood outside the title falling from 107 to 1, and the cost an Ing.Paed.IGIP or EUR ING written after the name read as a title. Among every local corpus's names holding the word, about 162 are the degree now read (140 written with its period or in a pair, about 22 bare) and about 19 open with Ing the given name, which reads title 'Ing' (Ing Wei Lim); Ing alone after a family comma (Lim, Ing) and Ing the surname at the head of a family comma (Ing Ho, Mei) read the title too (decisions/vocabulary-model, the 2026-11-21 #970 entry)" } + [[word]] text = "judr" academic = { cased = "JUDr", issue = [753, 848], expands = "doktor práv, Juris utriusque doctor" } @@ -135,6 +139,10 @@ credential = { cased = "DrSc", issue = [753, 848, 969], expands = "doktor věd, 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 = "et" +conjunction = { issue = 970, note = "Latin 'and', which Czech writes between two degrees of the same rank (Ing. et Ing., Mgr. et Mgr.); fr.toml's conjunction already reads it by default, so this copy moves no field but under a strict choice of cs, which drops fr.toml and read Ing. et Ing. Jan Novák as title 'Ing.', given 'et'; there et now joins any two words, as by default (Pierre et Marie Curie gives given 'Pierre et Marie'), and the word's Reading.languages gains cs (#970)" } + [[word]] text = "roz" [word.birth_marker] diff --git a/nameparser/vocab/mul.toml b/nameparser/vocab/mul.toml index 93c937134..e8a3e816c 100644 --- a/nameparser/vocab/mul.toml +++ b/nameparser/vocab/mul.toml @@ -111,7 +111,7 @@ text = "ing" family = { us_census_2010 = 1814, wikidata = 13, as_of = 2026-10-23 } given = { wikidata = 10, as_of = 2026-10-23, note = "nam_dict band 5 in Sweden; Wikidata is a lower bound" } credential = { cased = "Ing", expands = "Ingenieur, inženýr: the engineering degree of Czech, Slovak, Austrian and Romanian names", note = "52 of 536,981 ClinicalTrials.gov study officials write it, 43 after a comma (data 2026-10-21); NPPES 0, a credential outside US healthcare. Marked on C-i: the surname reading is substantial (Census 2010 bearers 1,814, over the 200 threshold)", issue = 848 } -excluded = { academic = { reason = "Ing is borne as a given name (nam_dict band 5 in Sweden, Wikidata 10+ given) and as a surname (US Census 1,814), measured 2026-10-22 with tools/name_usage.py, and a title claims the word in front of a name ('Ing Smith'); with its period, 'Ing.' (Ingegnere, Ingenieur) already reads as a title by its shape (rules/H2). After a full name and a comma it reads as the ambiguous credential instead, #848", issue = 840 } } +excluded = { academic = { reason = "Ing is borne as a given name (nam_dict band 5 in Sweden, Wikidata 10+ given) and as a surname (US Census 1,814), measured 2026-10-22 with tools/name_usage.py, and a title claims the word in front of a name ('Ing Smith'); with its period, 'Ing.' (Ingegnere, Ingenieur) already reads as a title by its shape (rules/H2). After a full name and a comma it reads as the ambiguous credential instead, #848. locales.CS reads it as the title (cs.toml's ing, whose given reading the pack's fragment removes, #970)", issue = 840 } } [[word]] text = "mba" diff --git a/nameparser/vocab/sk.toml b/nameparser/vocab/sk.toml index 4d8fd5c14..a48e10909 100644 --- a/nameparser/vocab/sk.toml +++ b/nameparser/vocab/sk.toml @@ -82,6 +82,10 @@ credential = { issue = 969, expands = "diplomovaný špecialista, the Slovak ter text = "drsc" 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" } +[[word]] +text = "et" +conjunction = { issue = 970, note = "Latin 'and', which Slovak writes between two degrees of the same rank (Mgr. et Mgr.); fr.toml's conjunction already reads it by default, so this copy moves no field but under a strict choice of sk, which drops fr.toml; there et now joins any two words, as by default, and the word's Reading.languages gains sk. The cost under strict sk: a pair of degrees sk.toml lists no title for is joined into the given name, Ing. et Ing. Jan Novák reading given 'Ing. et Ing.', family 'Jan Novák', where strict sk read title 'Ing.', given 'et', both wrong (#970)" } + # -- BEGIN generated by tools/vocab/familiar.py; edit the tool, not this block -- [[word]] diff --git a/tests/v2/test_locales.py b/tests/v2/test_locales.py index 59e8c1062..57a020674 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -1386,11 +1386,15 @@ def test_mn_fills_no_patronymic() -> None: def test_cs_and_sk_pack_contents() -> None: # 3f, amended 2026-10-30: cs and sk are their choice plus rules/O6's - # patch, no fragment; sl and hr stay nothing but their choice + # patch; sl and hr stay nothing but their choice. cs's fragment, + # since #970, removes the given reading that gates its Ing, and + # keeps the family reading that gates mul.toml's credential from nameparser._locale import deviates_by_two_family_names from nameparser.locales import cs as _cs, es as _es, sk as _sk + fragments = {"cs": Lexicon.empty().remove("ing", kind="given"), + "sk": Lexicon.empty()} for code, pack in (("cs", locales.CS), ("sk", locales.SK)): - assert pack == Locale(code=code, lexicon=Lexicon.empty(), + assert pack == Locale(code=code, lexicon=fragments[code], policy=PolicyPatch(two_family_names=True), languages=frozenset({code})), code for code in ("sl", "hr"): @@ -1406,6 +1410,12 @@ def test_cs_and_sk_pack_contents() -> None: # name words (the #973 review: these moved undeclared under all three) for name in ("김민준 1", "Jan\u200bPavel -"): assert deviates_by_two_family_names(name), name + # cs's fragment declares the word it changes, Ing, in any case and + # glued to a stop, and not a name that merely holds its letters + for name in ("Ing Novák", "ING NOVÁK", "Novák Ing.", "Ing.Novák"): + assert _cs.DEVIATES(name) and not deviates_by_two_family_names(name), name + for name in ("John King", "Wing Lau", "Ingrid Berg"): + assert not _cs.DEVIATES(name), name # rules/O6's declaration counts a run opening with a classified character twice @@ -2507,6 +2517,8 @@ def _default_corpus() -> list[str]: # and the patch has rotators of its own. _ROTATORS["cs"] = [ "BcA Krejčí", # bca + "Bc Krejčí", # bc (#970) + "Hon. Ing Krejčí", # ing, a title the choice reads behind a style (rules/H9) "MgA Malá", # mga "Mjr Novák", # mjr, three initials elsewhere (#1129) "Chief Mjr Novák", # chief mjr, the phrase chief makes @@ -2515,7 +2527,7 @@ def _default_corpus() -> list[str]: "Dienstbier ml.", # ml "Jiří Dienstbier st.", # st "Alena Pešová Řehořová", # rules/O6, the patch - "Ing. Alena Pešová Řehořová", # rules/O6 behind a title + "MUDr. Alena Pešová Řehořová", # rules/O6 behind a title the choice leaves (Ing is its word since #970) "김민준 1", # rules/O6 over a segmented name and a word of no letter "Jan\u200bPavel -", # rules/O6 over a zero-width split and a lone mark ] @@ -3468,22 +3480,141 @@ def test_no_exclusion_is_pack_shaped_any_more() -> None: ("cs", None, "Novák, Petr Pavel", ("", "Petr", "Pavel", "Novák", "", "", ()), ("", "Petr", "Pavel", "Novák", "", "", ())), - # left alone: a bare title ending the given part is a name word - # (rules/H5), the title Mgr was one already, and BC, excluded for - # the US credential it spells, stays one (cs.toml's bc) + # Bc and Ing, the pack's titles since #970: Bc a reading off by + # default, Ing the same with the fragment removing the given reading + # that would make it a title only in a phrase (rules/H9), so both + # read bare, in each comma shape and order, and a pair joined by et + # is one title run (rules/P3) + ("cs", None, "Ing Jan Novák", + ("", "Ing", "Jan", "Novák", "", "", ()), + ("Ing", "Jan", "", "Novák", "", "", ())), + ("cs", None, "ING JAN NOVÁK", + ("", "ING", "JAN", "NOVÁK", "", "", ()), + ("ING", "JAN", "", "NOVÁK", "", "", ())), + ("cs", None, "Ing Novák", + ("", "Ing", "", "Novák", "", "", ()), + ("Ing", "", "", "Novák", "", "", ())), + ("cs", None, "Novák, Ing Jan", + ("", "Ing", "Jan", "Novák", "", "", ("SUFFIX_OR_NAME",)), + ("Ing", "Jan", "", "Novák", "", "", ("SUFFIX_OR_NAME",))), + ("cs", None, ", Ing Jan", + ("", "Ing", "Jan", "", "", "", ("SUFFIX_OR_NAME",)), + ("Ing", "", "", "Jan", "", "", ("SUFFIX_OR_NAME",))), + ("cs", "FAMILY_FIRST", "Ing Novák Jan", + ("", "Novák", "Jan", "Ing", "", "", ()), + ("Ing", "Jan", "", "Novák", "", "", ())), + ("cs", "FAMILY_FIRST_GIVEN_LAST", "Ing Novák Jan", + ("", "Jan", "Novák", "Ing", "", "", ()), + ("Ing", "Jan", "", "Novák", "", "", ())), + ("cs", None, "Ing. et Ing. Jan Novák", + ("", "Ing. et Ing.", "Jan", "Novák", "", "", ()), + ("Ing. et Ing.", "Jan", "", "Novák", "", "", ())), + ("cs", None, "doc. Ing. et Ing. Jan Novák", + ("doc.", "Ing. et Ing.", "Jan", "Novák", "", "", ()), + ("doc. Ing. et Ing.", "Jan", "", "Novák", "", "", ())), + ("cs", None, "Bc. et Bc. Jana Malá", + ("", "Bc. et Bc.", "Jana", "Malá", "", "", ()), + ("Bc. et Bc.", "Jana", "", "Malá", "", "", ())), + ("cs", None, "Mgr. Bc. et Bc. Jana Malá", + ("Mgr.", "Bc. et Bc.", "Jana", "Malá", "", "", ()), + ("Mgr. Bc. et Bc.", "Jana", "", "Malá", "", "", ())), + ("cs", "FAMILY_FIRST", "Bc. et Bc. Malá Jana", + ("", "Malá", "Jana", "Bc. et Bc.", "", "", ()), + ("Bc. et Bc.", "Jana", "", "Malá", "", "", ())), + ("cs", None, "Bc Jana Malá", + ("", "Bc", "Jana", "Malá", "", "", ()), + ("Bc", "Jana", "", "Malá", "", "", ())), + ("cs", None, "Jana Malá, Bc", + ("", "Bc", "", "Jana Malá", "", "", ()), + ("Bc", "Jana", "", "Malá", "", "", ())), + ("cs", None, "Malá, Bc Jana", + ("", "Bc", "Jana", "Malá", "", "", ()), + ("Bc", "Jana", "", "Malá", "", "", ())), + ("cs", None, "ing jan novák", + ("", "ing", "jan", "novák", "", "", ()), + ("ing", "jan", "", "novák", "", "", ())), + # at the head of a family comma, by vocabulary (rules/H6) + ("cs", None, "Ing Novák, Jan", + ("", "Jan", "", "Ing Novák", "", "", ()), + ("Ing", "Jan", "", "Novák", "", "", ())), + ("cs", None, "Bc Novák, Jan", + ("", "Jan", "", "Bc Novák", "", "", ()), + ("Bc", "Jan", "", "Novák", "", "", ())), + # dotted at the end, a listed title there (rules/H5), and past a + # second comma (rules/C2) + ("cs", None, "Jana Malá Bc.", + ("", "Jana", "Malá", "Bc.", "", "", ()), + ("Bc.", "Jana", "", "Malá", "", "", ())), + ("cs", None, "Jan Novák Ing.", + ("", "Jan", "Novák", "Ing.", "", "", ("SUFFIX_OR_NAME",)), + ("Ing.", "Jan", "", "Novák", "", "", ())), + ("cs", None, "Novák, Jan, Ing.", + ("", "Jan", "", "Novák", "Ing.", "", ("COMMA_STRUCTURE",)), + ("Ing.", "Jan", "", "Novák", "", "", ())), + # the costs, each a name the pack is not for: Ing the given name + # opening a name, or alone after a family comma, read as the title, + # and a lone Ing or Bc a title with no name; Ing the surname at the + # head of a family comma or first under a family-first order; a + # title chunk making a period-joined post-nominal a title (rules/S3), + # and ING past a second comma (rules/C2); BC the initials and the + # US nursing credential + ("cs", None, "Ing Wei Lim", + ("", "Ing", "Wei", "Lim", "", "", ()), + ("Ing", "Wei", "", "Lim", "", "", ())), + ("cs", None, "Lim, Ing", + ("", "Ing", "", "Lim", "", "", ("SUFFIX_OR_NAME",)), + ("Ing", "", "", "Lim", "", "", ("SUFFIX_OR_NAME",))), + ("cs", None, "Ing", + ("", "Ing", "", "", "", "", ("GIVEN_OR_FAMILY",)), + ("Ing", "", "", "", "", "", ())), + ("cs", None, "Bc", + ("", "Bc", "", "", "", "", ("GIVEN_OR_FAMILY",)), + ("Bc", "", "", "", "", "", ())), + ("cs", None, "Malá, Bc", + ("", "Bc", "", "Malá", "", "", ()), + ("Bc", "", "", "Malá", "", "", ())), + ("cs", None, "Ing Ho, Mei", + ("", "Mei", "", "Ing Ho", "", "", ()), + ("Ing", "Mei", "", "Ho", "", "", ())), + ("cs", "FAMILY_FIRST", "Ing Wei", + ("", "Wei", "", "Ing", "", "", ()), + ("Ing", "", "", "Wei", "", "", ())), + ("cs", None, "Jan Novák, MBA, EUR ING", + ("", "Jan", "", "Novák", "MBA, EUR ING", "", ("COMMA_STRUCTURE",)), + ("ING", "Jan", "", "Novák", "MBA, EUR", "", ("COMMA_STRUCTURE",))), + ("cs", None, "Jan Novák, Ph.D., Ing.Paed.IGIP", + ("", "Jan", "", "Novák", "Ph.D., Ing.Paed.IGIP", "", ()), + ("Ing.Paed.IGIP", "Jan", "", "Novák", "Ph.D.", "", ())), + ("cs", None, "MOSS, BC", + ("", "BC", "", "MOSS", "", "", ()), + ("BC", "", "", "MOSS", "", "", ())), + ("cs", None, "Jane Doe, APRN, BC", + ("", "Jane", "", "Doe", "APRN, BC", "", ("COMMA_STRUCTURE",)), + ("BC", "Jane", "", "Doe", "APRN", "", ())), + # left alone: the family reading the fragment keeps leaves the + # credential gated, so Ing the surname stays the family name at the + # end and before a comma, Ing after a full name and a comma stays + # the credential, and a family comma keeps the surname; and a bare + # title ending the given part is a name word (rules/H5), the title + # Mgr was one already + ("cs", None, "Mr Tom Ing", + ("Mr", "Tom", "", "Ing", "", "", ("SUFFIX_OR_NAME",)), + ("Mr", "Tom", "", "Ing", "", "", ("SUFFIX_OR_NAME",))), + ("cs", None, "Wei Ing, PhD", + ("", "Wei", "", "Ing", "PhD", "", ("SUFFIX_OR_NAME",)), + ("", "Wei", "", "Ing", "PhD", "", ("SUFFIX_OR_NAME",))), + ("cs", None, "Jan Novák, Ing", + ("", "Jan", "", "Novák", "Ing", "", ("SUFFIX_OR_NAME",)), + ("", "Jan", "", "Novák", "Ing", "", ("SUFFIX_OR_NAME",))), + ("cs", None, "Ing, Wei", + ("", "Wei", "", "Ing", "", "", ()), + ("", "Wei", "", "Ing", "", "", ())), ("cs", "FAMILY_FIRST_GIVEN_LAST", "Novák, Jan MUDr", ("", "Jan", "MUDr", "Novák", "", "", ()), ("", "Jan", "MUDr", "Novák", "", "", ())), ("cs", None, "Mgr Jana Nováková", ("Mgr", "Jana", "", "Nováková", "", "", ()), ("Mgr", "Jana", "", "Nováková", "", "", ())), - # PMHNP, listed since #993, no longer reports a comma structure of - # its own; BC's remains - ("cs", None, "Lora L. Beebe, PhD, PMHNP, BC", - ("", "Lora", "L.", "Beebe", "PhD, PMHNP, BC", "", - ("COMMA_STRUCTURE",)), - ("", "Lora", "L.", "Beebe", "PhD, PMHNP, BC", "", - ("COMMA_STRUCTURE",))), ]) def test_the_west_and_south_slavic_packs_read_what_the_default_refuses( tags: str, order: str | None, name: str, @@ -3504,6 +3635,30 @@ def fields(n: ParsedName) -> tuple[object, ...]: default, packed) +@pytest.mark.parametrize("pack, name, fields", [ + # a strict choice drops fr.toml, whose et was the only one until cs + # and sk wrote their own (#970), so the pair stays one title run + (locales.CS, "Ing. et Ing. Jan Novák", ("Ing. et Ing.", "Jan", "", "Novák")), + (locales.CS, "Mgr. et Mgr. Jana Malá", ("Mgr. et Mgr.", "Jana", "", "Malá")), + (locales.SK, "Mgr. et Mgr. Jana Malá", ("Mgr. et Mgr.", "Jana", "", "Malá")), + # and Ing reads under strict as under the plain pack: the fragment's + # removal is what makes it a title, strict keeping mul.toml's given + # reading, and the family reading it keeps leaves the surname placed + (locales.CS, "Ing Jan Novák", ("Ing", "Jan", "", "Novák")), + (locales.CS, "Mr Tom Ing", ("Mr", "Tom", "", "Ing")), + (locales.CS, "Tom Ing, MD PhD", ("", "Tom", "", "Ing")), + # Slovak is left as it was: sk.toml lists neither Bc nor Ing, so its + # et joins their pair into the given name, as plain sk reads it + # through fr.toml's (strict sk read title 'Ing.', given 'et') + (locales.SK, "Ing Ján Kováč", ("", "Ing", "", "Ján Kováč")), + (locales.SK, "Ing. et Ing. Jan Novák", ("", "Ing. et Ing.", "", "Jan Novák")), +]) +def test_a_strict_cs_or_sk_choice_keeps_et_and_reads_ing_as_the_pack( + pack: Locale, name: str, fields: tuple[str, ...]) -> None: + n = parser_for(pack, strict=True).parse(name) + assert (n.title, n.given, n.middle, n.family) == fields + + def test_the_west_and_south_slavic_packs_repair_their_titles_case() -> None: # the readings' cased masks join with them, so capitalized() writes # the title as Czech does under the pack, and since #1115 by default @@ -3516,6 +3671,11 @@ def test_the_west_and_south_slavic_packs_repair_their_titles_case() -> None: assert str(cs.capitalized(cs.parse("mga. jan novák"))) == ( "MgA. Jan Novák") assert str(parse("mga. jan novák").capitalized()) == "Mga. Jan Novák" + # bc carries no mask (#970): title case writes Bc. as Czech does, + # and a mask would recase the nursing credential ACNP-BC + assert str(cs.capitalized(cs.parse("bc. jana malá"))) == "Bc. Jana Malá" + assert str(cs.capitalized(cs.parse("Jane Doe, ACNP-BC"), force=True)) == ( + "Jane Doe, ACNP-BC") # -- 3h: the Irish, Scottish Gaelic and Brazilian Portuguese packs -- diff --git a/tools/differential/corpus_rules.jsonl b/tools/differential/corpus_rules.jsonl index b8e4bd7fc..858ba0886 100644 --- a/tools/differential/corpus_rules.jsonl +++ b/tools/differential/corpus_rules.jsonl @@ -524,6 +524,8 @@ "II Van Johnson" "IVANOV Roman MBA" "IVOI, PAUL D'" +"Ing Jan Novák" +"Ing. et Ing. Jan Novák" "Ivan FAN R IVANOV MD de" "Ivan Ivanovich Ivanov" "Ivan PETROVICH IVANOVICH" diff --git a/tools/differential/snapshot.jsonl b/tools/differential/snapshot.jsonl index 7773a63b5..12e3ee670 100644 --- a/tools/differential/snapshot.jsonl +++ b/tools/differential/snapshot.jsonl @@ -1609,6 +1609,8 @@ {"name": "Imam Khomeini", "title": "Imam", "family": "Khomeini", "initials": "K."} {"name": "Imanishi, Kinji", "given": "Kinji", "family": "Imanishi", "initials": "K. I."} {"name": "Indalecio Soriano Fuertes", "given": "Indalecio", "middle": "Soriano", "family": "Fuertes", "initials": "I. S. F."} +{"name": "Ing Jan Novák", "given": "Ing", "middle": "Jan", "family": "Novák", "initials": "I. J. N."} +{"name": "Ing. et Ing. Jan Novák", "given": "Ing. et Ing.", "middle": "Jan", "family": "Novák", "initials": "I. I. J. N."} {"name": "Ingrid Andersson", "given": "Ingrid", "family": "Andersson", "initials": "I. A."} {"name": "Ingrid Betancourt Pulecio", "given": "Ingrid", "middle": "Betancourt", "family": "Pulecio", "initials": "I. B. P."} {"name": "Insp. John Smith", "title": "Insp.", "given": "John", "family": "Smith", "initials": "J. S."} diff --git a/tools/vocab/build.py b/tools/vocab/build.py index 23ca6293c..1a7bd97d0 100644 --- a/tools/vocab/build.py +++ b/tools/vocab/build.py @@ -377,6 +377,14 @@ def _alnum(text: str) -> str: MUL_SHARED: dict[str, str] = { "i": "the numeral every language writes, beside the ca and pl " "conjunction and de's period-written numeral", + "ing": "mul.toml's credential written after the name and its name " + "readings, beside cs.toml's academic title written before it, " + "which a Czech choice turns on; the two are read in different " + "places, save past a second comma, where the title takes the " + "word (rules/C2), a cost the 2026-11-21 #970 decisions entry " + "records; locales.CS's fragment removes the given reading " + "that gates the title, the family reading keeping the " + "credential gated", }