Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/design/decisions/vocabulary-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -646,3 +646,10 @@ Open: [#1145](https://github.com/derek73/python-nameparser/issues/1145), the dis
- **Measured** 2026-11-21 against a checkout of master `efdf0e16`, Python 3.11, the three together: `local_agreement.py cz-candidates --base <master> --locale cs`, 169,254 of 170,181 records agreeing in every field (99.5%), 165 now agreeing, 4 now disagreeing and 11 changed. Of the 443 cz-candidates records holding a pair of degrees joined by `et` or `&`, those whose pair the pack read outside the title fell from 176 to 16 (`Ing et Ing` 107 to 1, `Bc et Bc` 48 to 0, `Ing & Ing` and `Bc & Bc` 1 each to 0; left, `D et Ph` 7, `DiS et DiS` 6, `arch et Ing` 1, `MSSc et MSSc` 1 and the one `Ing et Ing`; recompute: `config_diff.py diff --local cz-candidates --match '(?i)[a-z]\.?\s?(et|&)\s?[a-z]' --readings FILE default plain:CS` in each tree, the pair being a match of `([A-Za-z]+)\.\s?(et|&)\s?([A-Za-z]+)\.` in the name and outside the title where the `plain:CS` title holds no `et` or `&` as a substring, since `Bc.et Bc.` writes no space before it). Of every local corpus's names holding `bc`, `ing` or `et`, 260 read otherwise under plain `locales.CS`, none by a report alone: 193 a degree written with its period or in a pair, 24 the `bc` names above, and 43 holding `Ing` otherwise, of which about 22 are the degree read right now (`Ing Václav Novák`, `Jiří Novák, Prof Ing`) and about 19 Ing the given name opening a name read as the title (`Ing Wei Lim`, `ING MEI TAN`, `Mrs Ing Marie Berg`), the cost the pack takes, its callers' names being Czech.
- **What breaks, under the pack only:** a name opening with the given name Ing (`Ing Wei Lim` reads title 'Ing'), and Ing alone after a family comma (`Lim, Ing` reads title 'Ing' and no given name), and a lone `Ing` or `Bc` (a title and no name); Ing the surname at the head of a family comma (`Ing Ho, Mei` reads title 'Ing', family 'Ho') or first under a family-first order (`Ing Wei` under `FAMILY_FIRST` reads title 'Ing', family 'Wei'); a post-nominal glued to Ing.'s stop (`Ph.D., Ing.Paed.IGIP` reads title 'Ing.Paed.IGIP', a period-joined token being a title where a chunk is one, rules/S3), 3 cz-candidates records; and `EUR ING` past a second comma, read as the title there (rules/C2), 1 record. The initials B.C. and the nursing credential BC, above. A degree in a credential list past the second comma (`Dana Novotná, prof.,Ing.,PhD`) moves from suffix to title, its name fields unchanged.
- **Slovak is left as it was, save `et` and its strict cost above.** The one fielded population of Slovak names the corpora hold, the Slovak chamber in opensanctions-parliaments, writes no degree, so no measurement reaches `locales.SK`; cz-candidates' evidence is Czech, and a fragment for `ing` under `SK` waits for Slovak names to weigh it on.
- 2026-11-21 #1463 — ar.toml GIVES `cheikh` `given` AND `family` READINGS AND ms.toml GIVES `sultan` THE SAME, SO STRICT `ar` AND STRICT `ms` KEEP THEIR GATES; NO ROLE MOVES UNDER THE DEFAULT OR A PLAIN CHOICE. Decided 2026-11-21. Each word's only name reading stood in a file the strict choice drops (`cheikh`'s in fr.toml, `sultan`'s in ar.toml and tr.toml), so strict kept the chosen file's title reading and dropped the gate (rules/H9; the 2026-10-30 #753 derived-marker clause), reading the given name as a title: under strict `ar`, `Cheikh Kaddari` gave title 'Cheikh', given 'Kaddari'; under strict `ms`, `Sultan Zulkarnain` gave title 'Sultan', family 'Zulkarnain'. Both words leave tests/v2/test_reading_index.py's `STRICT_UNGATED`, as `sultan` left it under `ar` (the 2026-11-03 strict-gap batch F entry, whose "the next case of this gap" this is). Each takes a `family` reading too, as batch F gave `sultan` one in ar.toml: the gate reads a `given` reading alone (rules/H9), so the `family` one moves no role, but it names the file in `Reading.languages` where the strict choice read a family `Cheikh` or `Sultan` with none, and the counts below show both borne as family names in those countries.
- **Counted first**, the issue's third question, 2026-11-21 with `tools/name_usage.py cheikh sultan --boxes` and `--country` for the Maghreb, Egypt, Mauritania, Senegal, Saudi Arabia and Malaysia. `cheikh`: ORCID given boxes Mauritania 13 (3.79% of 343), Algeria 9, Morocco 4, Tunisia 1, Egypt 0, family boxes Tunisia 17, Algeria 14, Morocco 11, Mauritania 7; Senegal's 81 given boxes are fr.toml's, Wolof names written in French. `sultan`: ORCID given boxes Malaysia 7 of 62,996, family boxes 19, PatentsView 1 each; the Malaysian candidates write it once. Both are borne as given and as family names in the chosen language's countries, `sultan` rarely as a given one, and each reading records its counts.
- **Measured** 2026-11-21 on master `81a24221`, Python 3.11, strict against strict with the reading added, scored against ORCID's and PatentsView's boxes: `config_diff.py score strict:ar 'expr:(lambda p: Parser(lexicon=p.lexicon.add("cheikh", kind="given"), policy=p.policy))(parser_for(bare("ar"), strict=True))' --group TN --group MA --group DZ --group EG --group MR --cap 1000000`, 12 records fixed and 0 broken (Algeria 7 of 19,661, Morocco 1 of 19,635, Mauritania 4 of 336; Tunisia and Egypt 0), the issue's 8 in its four countries reproduced; the same with `strict:ms`, `"sultan"`, `bare("ms")` and `--group MY`, 1 fixed of 18,811 and 0 broken. The score's titled filter (`local_agreement.titled`, a record either column reads with a listed title typed into the given-names box) cannot drop one of these records: it reads a title as listed only where every word is in the default's `titles`, and both words are in `titles_ambiguous` there (rules/H9), so the 12 and the 1 count every record the score reads, 63 ORCID records holding `cheikh` with both boxes filed and 8 ORCID and 2 PatentsView records holding `sultan`. A word in the default's `titles` would need a direct count. Across trees, `config_diff.py diff default plain:ar plain:ms plain:MS plain:fr strict:ar strict:ms strict:ar+en strict:ms+en --local all --committed --match '(?i)cheikh|sultan' --readings FILE` in a checkout of master and of this change, the files compared line by line: of 3,567 names, the default and the four plain choices move 0; strict `ar` moves 196 and strict `ar` + `en` 196, strict `ms` 742 and strict `ms` + `en` 737, every move under strict `ar` taking the title `Cheikh` off, and under strict `ms` 733 taking the title `Sultan` off, 8 reading a credential strict `ms` does not list (en.toml's `DPT`, `DDS`) after a comma as the suffix, where the part before it, holding the title `Sultan`, had not counted as a full name (`Aisha Sultan, DPT`: given 'DPT', family 'Aisha Sultan' before), and 1 moving only its report (`Sultan II`, title-or-name to given-or-family), each landing on the plain choice's fields save where strict drops another word (ar.toml's `al` and `abu` under strict `ms`, a credential `BA`), and the 8 comma rows reporting the credential strict does not list (suffix-or-name), where the plain choice, listing it, reports nothing. `tests/v2/test_snapshot.py` passes unchanged and `build.py` reports `_compiled.py` current.
- **`Reading.languages`** of a given or family `Cheikh` gains `ar` beside `fr`, and of a given or family `Sultan` gains `ms` beside `ar` and `tr`, by default and under every choice that keeps the file; under strict `ar` a family `Cheikh`, and under strict `ms` a family `Sultan`, named no file before.
- **Accepted:** under strict `ms`, a ruler's style opening a name reads the given name, as it does by default and under `locales.MS` (`Sultan Rahmat ibni Sultan Kamil` → given 'Sultan'); behind a style it stays the title where the style is read (`His Majesty Sultan Rahmat` under strict `ms` + `en`; strict `ms` alone drops en.toml's `his` and `majesty`, before this change and after).
- **The pairs re-taken here stay ungated, as wanted:** under a strict choice the word is the particle that language writes. Re-taken 2026-11-21 on `81a24221` by the same score with each tag's ungated words given back their `given` reading: `ben` under strict `ar` fixes 62 records (Tunisia 45, Algeria 9, Morocco 8), `bin` under strict `ms` 6 (ORCID 2, PatentsView 4), `del`, `la`, `san` and `santa` under strict `it` 7, `del`, `la` and `san` under strict `fil` 2, `da`, `do` and `santa` under strict `pt-BR` 1, each breaking none. Read record by record, nearly all are a family name written first with the boxes filed that way round (`Ben Amri Salma`, given box `Ben Amri`): strict reads the whole name as the family (rules/P1's fold, `Ben Amri Salma` → family 'Ben Amri Salma'), wrong too, and the gate agrees with the boxes only because it reads the first word as a given name, so neither reading is the name and the gate's is no better. The rest are a given name the particle is spelled like: of another origin (`Bin Qiaoyu`, the Chinese given name, in Malaysia; `La Thuy`), a cost accepted under strict's premise that its data is of one origin (docs/locales.rst, "Reading one language only": strict is "for data you know to be of one origin"), which answers the issue's second question for `Bin`; and one of the language's own (`La Reina Dimaculangan`, a Philippine given name), a cost of reading `la` as the particle that the premise does not answer, left with the pair.
- **Not weighed here:** the rest of `STRICT_UNGATED`, which stays as it was: `gd`, `hr`, `sk`, `sl` and `hi`, and `marquis`, `marquise`, `tho`, `st` and `sushri`, which the issue's samples held too rarely to say anything (its first open question); the pairs of `nl`, `fr`, `ca` and `ga`, which moved none of the 822 records the issue's table read for them, so no reading of a record weighs them; `pt` and `pt-PT` (the issue's table read `pt` with `pt-BR` and holds no `pt-PT`; only `pt-BR` is re-taken here); and `my`'s ranks, which joined after the issue (#1483) and are titles, not particles, their given names written only in en.toml. None is decided as wanted by this entry (#1463).
1 change: 1 addition & 0 deletions docs/release_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Release Log

nameparser 3.2 is under development.

- **Keep Cheikh and Sultan as given names under a strict Arabic or Malay choice.** With ``languages=frozenset({"ar"})`` chosen and ``strict=True``, ``Cheikh Kaddari`` gives given ``Cheikh``, family ``Kaddari``, where 3.0.0 through 3.1.0 gave title ``Cheikh``, given ``Kaddari``; ``Sultan Zulkarnain`` under a strict ``ms`` choice reads given ``Sultan`` the same way. The default and every plain choice read both as before. :issue:`1463`
- **Read the Cyrillic doctorate д-р ending a name as a credential, and the Bulgarian д.м. under a Bulgarian choice.** ``parse("Іван Петренко д-р")`` gives family ``Петренко``, suffix ``д-р``, where 1.4.0 through 3.1.0 gave middle ``Петренко``, family ``д-р``; in front of the name ``д-р`` stays the title, and after a comma it is the suffix too (``Іван Петренко, д-р``). With Bulgarian chosen (``languages=frozenset({"bg"})``), ``доц. д-р Мария Петрова, д.м.`` gives title ``доц. д-р``, family ``Петрова``, suffix ``д.м.``; by default it gives given ``д.м.``, family ``доц. Мария Петрова``, suffix ``д-р``, where 1.4.0 through 3.1.0 kept ``д-р`` in the family. :issue:`1128`
- **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`
Expand Down
4 changes: 2 additions & 2 deletions nameparser/config/_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@
('chdm', (('en', 'credential', ()),)),
('che', (('en', 'credential', ()), ('en', 'given', ()), ('en', 'family', ()))),
('chef', (('en', 'occupation', ()),)),
('cheikh', (('ar', 'style', (('addresses', 'given'), ('same_as', 'sheikh'))), ('fr', 'style', (('addresses', 'given'), ('same_as', 'sheikh'))), ('fr', 'given', ()), ('fr', 'family', ()))),
('cheikh', (('ar', 'style', (('addresses', 'given'), ('same_as', 'sheikh'))), ('ar', 'given', ()), ('ar', 'family', ()), ('fr', 'style', (('addresses', 'given'), ('same_as', 'sheikh'))), ('fr', 'given', ()), ('fr', 'family', ()))),
('chemist', (('en', 'occupation', ()),)),
('ches', (('en', 'credential', ()),)),
('chet', (('en', 'familiar', (('short_for', ('chester',)),)),)),
Expand Down Expand Up @@ -3332,7 +3332,7 @@
('sue', (('en', 'familiar', (('short_for', ('susan', 'susanne', 'suzanne')),)),)),
('suffragist', (('en', 'occupation', ()),)),
('sula', (('pt-BR', 'familiar', (('short_for', ('sulamita',)),)),)),
('sultan', (('ar', 'nobility', ()), ('ar', 'given', ()), ('ar', 'family', ()), ('ms', 'nobility', ()), ('tr', 'nobility', ()), ('tr', 'given', ()), ('tr', 'family', ()))),
('sultan', (('ar', 'nobility', ()), ('ar', 'given', ()), ('ar', 'family', ()), ('ms', 'nobility', ()), ('ms', 'given', ()), ('ms', 'family', ()), ('tr', 'nobility', ()), ('tr', 'given', ()), ('tr', 'family', ()))),
('sultana', (('ar', 'nobility', ()), ('ar', 'given', ()), ('ar', 'family', ()))),
('superior', (('en', 'modifier', ()),)),
('supreme', (('en', 'modifier', ()),)),
Expand Down
2 changes: 1 addition & 1 deletion nameparser/vocab/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ An acronym credential is matched with every full stop removed, so listing `P.Eng

## Step 2, for a reading a language file adds: score it under the choice that reads it

A reading written for one choice is measured under that choice's own parser, not the default's: the words around it are the choice's too. #1122 scored the readings `pt.toml` gained for a strict Portuguese choice with the default's particles and marked `carmen` (35 fixed to 0 broken) and `pilar` (20 to 3), whose Portuguese-country names were Spanish `del Carmen` and `del Pilar`; under `parser_for(locales.PT, strict=True)`, which holds no `del`, they scored 1 to 0 and 0 to 2, found by the design-docs review. Score with the choice's parser (its lexicon with and without the reading, beside its policy), and write test rows in phrases the language itself writes: the first draft's `Maria do Carmen` passed while Portuguese writes `do Carmo`.
A reading written for one choice is measured under that choice's own parser, not the default's: the words around it are the choice's too. #1122 scored the readings `pt.toml` gained for a strict Portuguese choice with the default's particles and marked `carmen` (35 fixed to 0 broken) and `pilar` (20 to 3), whose Portuguese-country names were Spanish `del Carmen` and `del Pilar`; under `parser_for(locales.PT, strict=True)`, which holds no `del`, they scored 1 to 0 and 0 to 2, found by the design-docs review. Score with the choice's parser (its lexicon with and without the reading, beside its policy), and write test rows in phrases the language itself writes: the first draft's `Maria do Carmen` passed while Portuguese writes `do Carmo`. A negative control for such a reading reverts the TOML and rebuilds, never copies `config/_index.py` from the base: the index holds every file's readings, so the base's copy reverts every reading the change adds at once, and #1463's control for `sultan` alone then failed `cheikh`'s rows too, a control that names nothing. Revert one file in a scratch copy of the tree (`git worktree add --detach`), never in a worktree anything else reads, run `build.py`, take the reading, and restore that file before the next; or take it without a revert, with the reading removed from the choice's own lexicon (`lexicon.remove(word, kind="given")`), but only where no other kept file (`mul.toml`, `und.toml`, another chosen tag) holds a reading of that kind on the word, since a `remove` drops the kind from every file: under strict `ms`, `remove("md", kind="given")` also drops `mul.toml`'s Muhammad written short.

## Step 2, for a joining word: state its costs by class, from a grid

Expand Down
2 changes: 2 additions & 0 deletions nameparser/vocab/ar.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ family = { us_census_2010 = 6462, wikidata = 60, as_of = 2026-10-27, note = "US
[[word]]
text = "cheikh"
style = { addresses = "given", gender = "m", same_as = "sheikh", expands = "the French transliteration, 'Cheikh Anta Diop'" }
given = { note = "a given name in the Maghreb and Mauritania, counted 2026-11-21 (tools/name_usage.py --boxes): ORCID given boxes Mauritania 13 (3.79%), Algeria 9, Morocco 4, Tunisia 1; fr.toml's readings carry the Senegalese and Wikidata totals. Without it strict ar, which drops fr.toml's given reading, read it as a title opening a name (rules/H9): against strict ar, the reading fixes 12 ORCID records of Algeria, Morocco and Mauritania and breaks none (config_diff.py score on 81a24221) (#1463)" }
family = { note = "a family name in the Maghreb and Mauritania, counted 2026-11-21 (tools/name_usage.py --boxes): ORCID family boxes Tunisia 17, Algeria 14, Morocco 11, Mauritania 7; it moves no role, and names ar in Reading.languages where strict ar read a family Cheikh with no file (#1463)" }

[[word]]
text = "shaik"
Expand Down
2 changes: 2 additions & 0 deletions nameparser/vocab/ms.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ nobility = { default = false, addresses = "given", issue = 1180, decided = 2026-
[[word]]
text = "sultan"
nobility = {}
given = { note = "a given name in Malaysia, rarely, counted 2026-11-21 (tools/name_usage.py --boxes): ORCID given boxes Malaysia 7, PatentsView 1. Without it strict ms, which drops ar.toml's and tr.toml's given readings, read it as a title opening a name (rules/H9): against strict ms, the reading fixes 1 ORCID record of Malaysia and breaks none (config_diff.py score on 81a24221). A ruler's style opening a name (Sultan Rahmat ibni Sultan Kamil) then reads the given name under strict ms, as it does by default and under locales.MS (#1463)" }
family = { note = "a family name in Malaysia, counted 2026-11-21 (tools/name_usage.py --boxes): ORCID family boxes 19, PatentsView 1; it moves no role, and names ms in Reading.languages where strict ms read a family Sultan with no file (#1463)" }

[[word]]
text = "tan"
Expand Down
Loading