From 85f222d50b493ec834dbf4f22a794830fe5b68dc Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Sat, 21 Nov 2026 16:17:31 -0800 Subject: [PATCH 1/3] Read Bc and Ing as titles under locales.CS, and give cs and sk their own et (#970) bc's exclusion in cs.toml becomes an academic reading written default = false, with no case mask. ing gains one beside it, and locales.CS a lexicon fragment removing ing's given reading, mul.toml's, which would otherwise make the title one only inside a phrase (rules/H9): a choice never drops a name reading, and a strict one keeps mul.toml's. The family reading stays, so mul.toml's credential stays gated and Ing the surname keeps its place. ing joins MUL_SHARED, the title and the credential being read in different places. cs.toml and sk.toml list et as a connective, which only a strict choice, dropping fr.toml's, notices. The default does not move. Under the pack cz-candidates gains 165 records and loses 4, and the X et X records left outside the title fall from 174 to 16 (decisions/vocabulary-model, the 2026-11-21 #970 entry). Co-Authored-By: Claude Opus 5.5 --- docs/design/decisions/vocabulary-model.md | 16 +++- docs/design/rules/H9-title-phrase.md | 6 +- docs/languages.rst | 22 ++++- docs/locales.rst | 6 +- docs/release_log.rst | 1 + nameparser/config/_index.py | 5 +- nameparser/locales/AGENTS.md | 1 + nameparser/locales/cs.py | 39 ++++++-- nameparser/vocab/AGENTS.md | 2 +- nameparser/vocab/cs.toml | 10 +- nameparser/vocab/mul.toml | 2 +- nameparser/vocab/sk.toml | 4 + tests/v2/test_locales.py | 106 +++++++++++++++++++--- tools/differential/corpus_rules.jsonl | 2 + tools/differential/snapshot.jsonl | 2 + tools/vocab/build.py | 6 ++ 16 files changed, 194 insertions(+), 36 deletions(-) diff --git a/docs/design/decisions/vocabulary-model.md b/docs/design/decisions/vocabulary-model.md index 186f25900..496ad962c 100644 --- a/docs/design/decisions/vocabulary-model.md +++ b/docs/design/decisions/vocabulary-model.md @@ -7,7 +7,7 @@ The vocabulary was a set of base sets plus marker subsets (`particles` and `part - The vocabulary redesign comes before adding many packs: it is designed for 3.0, and what is safe is pulled forward in four phases, (1) the data format and a compiler, snapshot-neutral, (2) derived ambiguity with the gate on every reading kind, (3) pack semantics, (4) the rules menu, order and shapes, and the output model — 2026-10-15/16. - Each word is described by its readings (word → reading → properties), each kind belonging to one category that decides the compiled field it feeds; detailed kinds are recorded even where the kinds of a category behave alike, generation and credential being separate kinds of the suffix category (its kinds are the entries `CATEGORY` in `nameparser/_reading_index.py` maps to `suffix`) — 2026-10-15/16; 2026-10-18 #737. - A language file holds the words the parser might meet in names written in that language, immigrant particles included, not the words of its etymology, and a word sits in the file of every language whose names it occurs in, a Latin transliteration in its source language's file; `mul.toml` holds the words shared on purpose instead (the generations `i` to `v`, `2` and `jr` with `junior` and `jnr`, `&`, the European titles below, and the degrees and salutations every country's data writes alike), a word joining it where it harms no language and would otherwise be duplicated into every language's file — 2026-10-15/16; 2026-10-18 #737; 2026-10-19 #749; 2026-10-19 #750, title kinds; 2026-11-02 #1005 (Derek); 2026-11-03 #1005, the strict-gap batches (Derek). -- The default loads every language and keeps working for names of any language. Choosing a language narrows it since 3.0's phase 3 (#753): a pack settles only the clashes where its language has a vocabulary reading (`locales.VI` excepted: its fragment removes readings of Vietnamese syllables no reading in its file can settle, 2026-11-05 #1108; `locales.MY`'s fragment, 2026-11-19 #1231, was dropped the same day for a strict choice, decisions/vocabulary-collisions' #1483 entry), a strict choice reads only the chosen languages' files, `mul.toml` and native-script words' readings as a plain choice of the same languages keeps them (name readings included), and a pack's preferred reading can outrank one a shape rule derives — 2026-10-15/16; 2026-10-30 #753, file-strict; 2026-11-02 #1005 (Derek); 2026-11-07 #1148. +- The default loads every language and keeps working for names of any language. Choosing a language narrows it since 3.0's phase 3 (#753): a pack settles only the clashes where its language has a vocabulary reading (`locales.VI` excepted: its fragment removes readings of Vietnamese syllables no reading in its file can settle, 2026-11-05 #1108; and `locales.CS`, whose fragment removes `ing`'s given reading, mul.toml's, so its Ing is a title, 2026-11-21 #970; `locales.MY`'s fragment, 2026-11-19 #1231, was dropped the same day for a strict choice, decisions/vocabulary-collisions' #1483 entry), a strict choice reads only the chosen languages' files, `mul.toml` and native-script words' readings as a plain choice of the same languages keeps them (name readings included), and a pack's preferred reading can outrank one a shape rule derives — 2026-10-15/16; 2026-10-30 #753, file-strict; 2026-11-02 #1005 (Derek); 2026-11-07 #1148. - `e`, `y` and `i` stay in the default; choosing a language settles their one-case fork for that language's own reading, `may_be_initial` not holding on a chosen file's conjunction, as `locales.PT`, `locales.PT_BR` and `locales.PT_PT` do for `e` — 2026-10-15/16; 2026-10-29 #753, phase 3b; 2026-10-30 #753, phase 3g. - A patronymic field came in 3.0, as a view that names its words without emptying `family`, and the particle kinds already draw the `clan`/`patronymic` line for it: a patronymic is followed by a parent's name, a clan prefix by a family name the lineage shares — 2026-10-15/16; 2026-10-19 #749; 2026-10-28 #754 (Derek); landed as rules/R9, 2026-10-29 #754, sub-phase 4c. - A shipped pack that is only a choice of languages declares no `DEVIATES`, its surface the words its choice changes; `ga` turns on `nic`, `mhic`, `mic` and `uí` as clan particles, `gd` `nic`, and `pt-BR` `sb` as Sobrinho's spelling, while the single letters `f` and `n` are excluded, the pack included, the letter abbreviating a surname more often than the agnomen in the filings that write it — 2026-10-30 #753, phase 3h. @@ -98,7 +98,7 @@ Open: [#1145](https://github.com/derek73/python-nameparser/issues/1145), the dis 3. Detailed kinds are recorded during the migration even where every kind of a category behaves alike at first; generation and credential are separate kinds (#326). 4. A language file means "the words the parser might encounter in names in that language" — what occurs in names and records written in it, including particles common there through immigration — not words of that language's etymology. 5. The default loads every language and keeps working for names of any language, as today; choosing a language narrows it. - 6. Packs prefer and strict packs restrict: a pack settles only the clashes where its language has a VOCABULARY reading, and a strict variant also drops other languages' name-level readings. (Excepted for one pack, 2026-11-05 #1108, below: `locales.VI`'s fragment removes readings of Vietnamese syllables where vi.toml holds none. `locales.MY`'s removed Burmese syllables' readings from 2026-11-19 #1231 until #1483 the same day, which read a wholly Burmese list strictly instead, decisions/vocabulary-collisions.) + 6. Packs prefer and strict packs restrict: a pack settles only the clashes where its language has a VOCABULARY reading, and a strict variant also drops other languages' name-level readings. (Excepted for two packs: 2026-11-05 #1108, below, `locales.VI`'s fragment removes readings of Vietnamese syllables where vi.toml holds none; 2026-11-21 #970, below, `locales.CS`'s removes `ing`'s given reading, a name reading no choice drops. `locales.MY`'s removed Burmese syllables' readings from 2026-11-19 #1231 until #1483 the same day, which read a wholly Burmese list strictly instead, decisions/vocabulary-collisions.) 7. `e`/`y`/`i` stay in the default, at least to start; choosing a language settles the one-case fork. 8. A patronymic field belongs in 3.0. 9. Gender is recorded only where a word gives a definitive clue. @@ -107,7 +107,7 @@ Open: [#1145](https://github.com/derek73/python-nameparser/issues/1145), the dis 12. Bearer counts are structured provenance (source + count), never used to compute a reading: two data sets deciding one reading would make the decision unclear. A new census flags changed names for review. 13. `Dean Smith` reads given `Dean`, as today. 14. Order and shape are separate: a language supplies only a default order; the shapes (where titles, suffixes, particles and commas sit) belong to each order and live in the core. - 15. Vocabulary readings settle a clash; name readings only keep the gate on. (Bent for one pack, 2026-11-05 #1108, below: `locales.VI`'s fragment removes the particle, connective and credential readings of Vietnamese syllables, the settling no reading in vi.toml can do. `locales.MY`'s removed the particle readings of Burmese syllables and `do`'s credential from 2026-11-19 #1231 until #1483 the same day, decisions/vocabulary-collisions.) + 15. Vocabulary readings settle a clash; name readings only keep the gate on. (Bent for two packs: 2026-11-05 #1108, below, `locales.VI`'s fragment removes the particle, connective and credential readings of Vietnamese syllables, the settling no reading in vi.toml can do; 2026-11-21 #970, below, `locales.CS`'s removes `ing`'s given reading, so the name reading no longer gates cs.toml's title. `locales.MY`'s removed the particle readings of Burmese syllables and `do`'s credential from 2026-11-19 #1231 until #1483 the same day, decisions/vocabulary-collisions.) 16. The contested-head rule covers only words outside `titles` today (`dean`, `justice`, `major`); a title that is also a given name today is decided one word at a time, like the graf class (decisions/salutation-titles). 17. `cased` and `same_as` replace a "canonical" spelling, and `cased` replaces `capitalization_exceptions`; both default to the word, and a reading's `native` spelling is for surfacing. 18. `acronym` is a reading property, replacing the `suffix_acronyms`/`suffix_words` split; `expands` records the meaning an entry was added for, not every meaning. @@ -380,7 +380,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 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. +- **2026-10-30 #753, phase 3f (its `bc` and `ing` left out superseded by the 2026-11-21 #970 entry, which reads both as titles under `locales.CS`; 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. @@ -638,3 +638,11 @@ Open: [#1145](https://github.com/derek73/python-nameparser/issues/1145), the dis NOT `after_given` (rules/H8): rules/H8 leaves out a salutation borne as a given name, since a middle name may be one, and decisions/H8 left the Devanagari `श्री` out on that doubt; `shri` is borne as one, and the roll never asks for the property. in_sansad writes the salutation in two shapes, before the given name after a family comma (`Verma, Shri Ravi`, 653 of opensanctions-parliaments' distinct names) and after a full name and a comma (`Ravi Verma, Shri`), both read as the title without it, and holds no `Family, Given Shri`. Measured against the same reading carrying the property, the recipe below moves 2 names, both reading better without it: an FEC filer whose given name of two words ends in the word (`FAMILY, GIVEN SHRI`), whom the property read as given 'GIVEN' and title 'SHRI', and a Sansad spelling with the salutation in brackets (`(Shri) Ravi Kumar`), which the property left the nickname and which reads as the title without it. So `Verma, Ravi Shri` keeps middle 'Shri' under the pack, as `वर्मा, रवि श्री` keeps middle 'श्री', and the word records the refusal (`excluded = { after_given = ... }` on its entry); the dotted `Verma, Ravi Shri.` is the title by rules/H5's trailing vocabulary, as `Shri.` ending a name is. Recompute: the command above from a checkout of this change; the 2 moves the property makes with `'expr:Parser(lexicon=parser_for(locales.HI).lexicon.remove("shri", kind="salutation").add("shri", kind="salutation", after_given=True), policy=parser_for(locales.HI).policy)'` in place of the first configuration; the person counts from `raw.jsonl`'s in_sansad rows, their `entity` kept where `name` holds `shri` as a word, and where it opens with it (a bracket allowed); the in_sansad figure with `--local opensanctions-parliaments --group in_sansad` and no `--match`; each moved name read from `--readings `, the two configurations' first field compared line by line. - 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`). The default does not move: `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 (`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, against master `1e920d6f`: cz-candidates under `--locale cs` gains 51 records and loses none, and of every local corpus's names holding the word, 80 read otherwise, 58 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 nursing credential moved from suffix to title (`X, APRN, 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, so neither competes. + - **`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). + - **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. The `X et X` records whose pair the pack read outside the title fell from 174 to 16 (`Ing et Ing` 107 to 1, `Bc et Bc` 48 to 0; `D et Ph` 7, `DiS et DiS` 6 and three single shapes left; recompute: `config_diff.py diff --local cz-candidates --match '(?i)\b(et|&)\s?[a-z]' --readings FILE default plain:CS`, counting the names a degree pair joined by `et` or `&` matches whose `plain:CS` title holds no `et` or `&`). 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 Novotný`, `Jiří Dvořá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'); 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`.** 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..32ddfc27a 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. + ``` + "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..d6e73a94e 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,17 @@ 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, so a +name that opens with the given name Ing reads it as the title under +the pack (``Ing Wei Lim`` gives title ``Ing``); Ing the surname keeps +its place (``Tom Ing`` gives family ``Ing``). ``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..3d6a809ec 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`` + - none; it takes ``Ing``'s given-name reading out + * - ``sk`` - yes - ``two_family_names`` - none diff --git a/docs/release_log.rst b/docs/release_log.rst index c2d03624e..3a2a90e19 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -4,6 +4,7 @@ Release Log nameparser 3.2 is under development. + - **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. :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 d87b1ff5e..936262bc8 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..89c402eaa 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,19 @@ (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``: 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, Chinese, +Malaysian or Swedish (``Ing Wei Lim`` gives title ``Ing``), 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 +46,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 +55,20 @@ 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 letters + ``ing`` in any case, the word the fragment changes, which + over-declares (``King``), the safe direction.""" + return deviates_by_two_family_names(name) or "ing" in name.casefold() diff --git a/nameparser/vocab/AGENTS.md b/nameparser/vocab/AGENTS.md index 8edc64789..474e45ca1 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 never compete, being read in different places (`ing`, cs.toml's title before the name beside mul.toml's credential after it, #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..cddc06a1c 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, against master 1e920d6f): 58 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 nursing credential moved from suffix to title. 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 it moves 165 of cz-candidates' 170,181 records to agreement and 4 away (with bc, master efdf0e16): Ing. et Ing. 107 of the pairs, 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 19 open with Ing the given name and read title 'Ing' under the pack (Ing Wei Lim), against some 160 degrees now read (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 nothing but a strict choice of cs, which drops fr.toml and read Ing. et Ing. Jan Novák as title 'Ing.', given 'et' (#970)" } + [[word]] text = "roz" [word.birth_marker] diff --git a/nameparser/vocab/mul.toml b/nameparser/vocab/mul.toml index 93c937134..2b72258e6 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. A Czech choice reads it as the title (cs.toml's ing, whose given reading locales.CS removes, #970)", issue = 840 } } [[word]] text = "mba" diff --git a/nameparser/vocab/sk.toml b/nameparser/vocab/sk.toml index 4d8fd5c14..53564c3a6 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 nothing but a strict choice of sk, which drops fr.toml (#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..4d4aec8f2 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -1386,11 +1386,14 @@ 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 name readings that gate its Ing 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"): @@ -2507,6 +2510,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 +2520,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 +3473,97 @@ 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 name readings + # 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á", "", "", ())), + # the costs, each a name the pack is not for: Ing the given name + # opening a name, read as the title; a title chunk making a + # period-joined post-nominal a title (rules/H2's joined tokens), + # 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, "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, before a comma and as the credential after a full name, and + # a family comma keeps it too; 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, 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 59c2abdb1..89f8fb183 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..c49463a36 100644 --- a/tools/vocab/build.py +++ b/tools/vocab/build.py @@ -377,6 +377,12 @@ 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 and which never competes with " + "the credential, the two reading in different places; " + "locales.CS's fragment removes the name readings that gate " + "the title (#970)", } From 532cbf9d05f3310495645132694f582bae618d4f Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Sat, 21 Nov 2026 16:32:23 -0800 Subject: [PATCH 2/3] Fix the review findings: DEVIATES by word, the missing rows, and the records (#970) cs's DEVIATES declares the word Ing rather than any name holding its letters, which had exempted John King and Wing Lau from the gate, and a test holds it. The table gains the moved shapes it lacked (a family comma's head, the trailing dotted title, past a second comma, lower case) and the costs (Lim, Ing; Ing Ho, Mei; a lone Ing or Bc; Ing first under a family-first order), and a test reads strict cs and sk for et and Ing, and the case masks bc does without. The records: the bc breakdown sums to its 80 (59 Czech degrees), with a recipe; the X et X count is retaken with a filter that sees a spaced & and a stated detector, 176 to 16 of 443; the costs a family comma pays are listed; the claim that the title and the credential never compete is narrowed to past a second comma; et's Reading.languages moves, which the notes and the entry now say; decisions/H9 records the pack's removal; two stand-in names that matched real candidates are replaced. Co-Authored-By: Claude Opus 5.5 --- docs/design/decisions/H9-title-phrase.md | 3 + docs/design/decisions/vocabulary-model.md | 10 +-- docs/languages.rst | 11 ++- docs/locales.rst | 2 +- docs/release_log.rst | 2 +- nameparser/locales/cs.py | 20 +++-- nameparser/vocab/AGENTS.md | 2 +- nameparser/vocab/cs.toml | 6 +- nameparser/vocab/mul.toml | 2 +- nameparser/vocab/sk.toml | 2 +- tests/v2/test_locales.py | 89 +++++++++++++++++++++-- tools/vocab/build.py | 10 ++- 12 files changed, 125 insertions(+), 34 deletions(-) diff --git a/docs/design/decisions/H9-title-phrase.md b/docs/design/decisions/H9-title-phrase.md index 9dde9b6c5..e359903fb 100644 --- a/docs/design/decisions/H9-title-phrase.md +++ b/docs/design/decisions/H9-title-phrase.md @@ -15,6 +15,8 @@ - `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. ## Log @@ -161,3 +163,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`). The default does not move: `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 (`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, against master `1e920d6f`: cz-candidates under `--locale cs` gains 51 records and loses none, and of every local corpus's names holding the word, 80 read otherwise, 58 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 nursing credential moved from suffix to title (`X, APRN, 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, so neither competes. +- 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). - - **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. The `X et X` records whose pair the pack read outside the title fell from 174 to 16 (`Ing et Ing` 107 to 1, `Bc et Bc` 48 to 0; `D et Ph` 7, `DiS et DiS` 6 and three single shapes left; recompute: `config_diff.py diff --local cz-candidates --match '(?i)\b(et|&)\s?[a-z]' --readings FILE default plain:CS`, counting the names a degree pair joined by `et` or `&` matches whose `plain:CS` title holds no `et` or `&`). 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 Novotný`, `Jiří Dvořá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'); 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. + - **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 `&`). 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`.** 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/languages.rst b/docs/languages.rst index d6e73a94e..6ffcd757b 100644 --- a/docs/languages.rst +++ b/docs/languages.rst @@ -104,10 +104,13 @@ So they wait for a pack: >>> 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, so a -name that opens with the given name Ing reads it as the title under -the pack (``Ing Wei Lim`` gives title ``Ing``); Ing the surname keeps -its place (``Tom Ing`` gives family ``Ing``). ``BC`` after a comma is +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``). diff --git a/docs/locales.rst b/docs/locales.rst index 3d6a809ec..ae4de84e1 100644 --- a/docs/locales.rst +++ b/docs/locales.rst @@ -410,7 +410,7 @@ says what it can change: * - ``cs`` - yes - ``two_family_names`` - - none; it takes ``Ing``'s given-name reading out + - a removal: ``Ing``'s given-name reading * - ``sk`` - yes - ``two_family_names`` diff --git a/docs/release_log.rst b/docs/release_log.rst index 3a2a90e19..fed75e148 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -4,7 +4,7 @@ Release Log nameparser 3.2 is under development. - - **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. :issue:`970` + - **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/locales/cs.py b/nameparser/locales/cs.py index 89c402eaa..cc65fcd8d 100644 --- a/nameparser/locales/cs.py +++ b/nameparser/locales/cs.py @@ -27,14 +27,17 @@ 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``: a choice never +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, Chinese, -Malaysian or Swedish (``Ing Wei Lim`` gives title ``Ing``), and a +``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). @@ -68,7 +71,10 @@ 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 letters - ``ing`` in any case, the word the fragment changes, which - over-declares (``King``), the safe direction.""" - return deviates_by_two_family_names(name) or "ing" in name.casefold() + 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 474e45ca1..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`), or that the two readings never compete, being read in different places (`ing`, cs.toml's title before the name beside mul.toml's credential after it, #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). +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 cddc06a1c..8d2df69b3 100644 --- a/nameparser/vocab/cs.toml +++ b/nameparser/vocab/cs.toml @@ -25,7 +25,7 @@ salutation = { issue = 606, gender = "f", after_given = true } [[word]] text = "bc" -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, against master 1e920d6f): 58 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 nursing credential moved from suffix to title. 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)" } +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" @@ -33,7 +33,7 @@ academic = { default = false, cased = "BcA", issue = [753, 848], expands = "baka [[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 it moves 165 of cz-candidates' 170,181 records to agreement and 4 away (with bc, master efdf0e16): Ing. et Ing. 107 of the pairs, 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 19 open with Ing the given name and read title 'Ing' under the pack (Ing Wei Lim), against some 160 degrees now read (decisions/vocabulary-model, the 2026-11-21 #970 entry)" } +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" @@ -141,7 +141,7 @@ excluded = { credential = { reason = "IEn., written after the name by 3 Czech el [[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 nothing but a strict choice of cs, which drops fr.toml and read Ing. et Ing. Jan Novák as title 'Ing.', given 'et' (#970)" } +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" diff --git a/nameparser/vocab/mul.toml b/nameparser/vocab/mul.toml index 2b72258e6..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. A Czech choice reads it as the title (cs.toml's ing, whose given reading locales.CS removes, #970)", 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 53564c3a6..2e371fd11 100644 --- a/nameparser/vocab/sk.toml +++ b/nameparser/vocab/sk.toml @@ -84,7 +84,7 @@ credential = { cased = "DrSc", issue = [753, 848, 969], expands = "doktor vied, [[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 nothing but a strict choice of sk, which drops fr.toml (#970)" } +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 (#970)" } # -- BEGIN generated by tools/vocab/familiar.py; edit the tool, not this block -- diff --git a/tests/v2/test_locales.py b/tests/v2/test_locales.py index 4d4aec8f2..bfcc214a7 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -1387,7 +1387,8 @@ 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; sl and hr stay nothing but their choice. cs's fragment, - # since #970, removes the name readings that gate its Ing + # 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"), @@ -1409,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 @@ -3474,7 +3481,7 @@ def test_no_exclusion_is_pack_shaped_any_more() -> None: ("", "Petr", "Pavel", "Novák", "", "", ()), ("", "Petr", "Pavel", "Novák", "", "", ())), # Bc and Ing, the pack's titles since #970: Bc a reading off by - # default, Ing the same with the fragment removing the name readings + # 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) @@ -3520,14 +3527,58 @@ def test_no_exclusion_is_pack_shaped_any_more() -> None: ("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, read as the title; a title chunk making a - # period-joined post-nominal a title (rules/H2's joined tokens), + # 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",))), @@ -3542,8 +3593,8 @@ def test_no_exclusion_is_pack_shaped_any_more() -> None: ("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, before a comma and as the credential after a full name, and - # a family comma keeps it too; and a bare + # 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", @@ -3584,6 +3635,27 @@ 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 + (locales.SK, "Ing Ján Kováč", ("", "Ing", "", "Ján Kováč")), +]) +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 @@ -3596,6 +3668,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/vocab/build.py b/tools/vocab/build.py index c49463a36..1a7bd97d0 100644 --- a/tools/vocab/build.py +++ b/tools/vocab/build.py @@ -379,10 +379,12 @@ def _alnum(text: str) -> str: "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 and which never competes with " - "the credential, the two reading in different places; " - "locales.CS's fragment removes the name readings that gate " - "the title (#970)", + "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", } From feb28d3b4effbad4aa5b3967059ba0e353311d4e Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Sat, 21 Nov 2026 16:39:11 -0800 Subject: [PATCH 3/3] Record strict sk's et cost and narrow rules/H9's sentence to before the name (#970) The second review of the fix: under strict sk, which lists no Ing or Bc title, sk.toml's et joins their pair into the given name, a field move the records did not name. It is now in the decisions entry, sk.toml's note and a test row. rules/H9's Czech sentence says before the name, as the rest of the change does, the X et X recipe says its test is a substring, and decisions/H9's new line joins its list. Co-Authored-By: Claude Opus 5.5 --- docs/design/decisions/H9-title-phrase.md | 1 - docs/design/decisions/vocabulary-model.md | 6 +++--- docs/design/rules/H9-title-phrase.md | 2 +- nameparser/vocab/sk.toml | 2 +- tests/v2/test_locales.py | 5 ++++- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/design/decisions/H9-title-phrase.md b/docs/design/decisions/H9-title-phrase.md index e359903fb..d1ca61554 100644 --- a/docs/design/decisions/H9-title-phrase.md +++ b/docs/design/decisions/H9-title-phrase.md @@ -14,7 +14,6 @@ - `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. diff --git a/docs/design/decisions/vocabulary-model.md b/docs/design/decisions/vocabulary-model.md index f5f6cac9c..c80f7f64e 100644 --- a/docs/design/decisions/vocabulary-model.md +++ b/docs/design/decisions/vocabulary-model.md @@ -642,7 +642,7 @@ Open: [#1145](https://github.com/derek73/python-nameparser/issues/1145), the dis - 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). - - **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 `&`). 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. + - **`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`.** 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. + - **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 32ddfc27a..953d45971 100644 --- a/docs/design/rules/H9-title-phrase.md +++ b/docs/design/rules/H9-title-phrase.md @@ -118,7 +118,7 @@ "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 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. +- **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." diff --git a/nameparser/vocab/sk.toml b/nameparser/vocab/sk.toml index 2e371fd11..a48e10909 100644 --- a/nameparser/vocab/sk.toml +++ b/nameparser/vocab/sk.toml @@ -84,7 +84,7 @@ credential = { cased = "DrSc", issue = [753, 848, 969], expands = "doktor vied, [[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 (#970)" } +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 -- diff --git a/tests/v2/test_locales.py b/tests/v2/test_locales.py index bfcc214a7..57a020674 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -3647,8 +3647,11 @@ def fields(n: ParsedName) -> tuple[object, ...]: (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 + # 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: