From e473c54d16ca2e945f48ed484d78ed5b9f245917 Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Sat, 21 Nov 2026 12:10:45 -0800 Subject: [PATCH 1/6] Read French dit and dite as connectives under a French choice (#1159) fr.toml lists both as conjunctions written default = false: a choice of French joins a hereditary dit surname (Dupont dit Lebrun) and a West African alias (Mamadou dit Madou), and the default is unchanged, since Dit and Dite are names too and on by default about nine real names broke against the ones fixed (decisions/P3, 2026-11-21). Co-Authored-By: Claude Opus 5.5 --- docs/design/decisions/P3-connectives.md | 6 ++++ docs/languages.rst | 44 +++++++++++++++++++++++-- docs/release_log.rst | 1 + nameparser/config/_index.py | 2 ++ nameparser/vocab/fr.toml | 8 +++++ tests/v2/test_locales.py | 34 +++++++++++++++++++ 6 files changed, 93 insertions(+), 2 deletions(-) diff --git a/docs/design/decisions/P3-connectives.md b/docs/design/decisions/P3-connectives.md index 926668388..3839cca85 100644 --- a/docs/design/decisions/P3-connectives.md +++ b/docs/design/decisions/P3-connectives.md @@ -16,6 +16,7 @@ Examples read under the default order unless a line names another. - With the off switch a one-case `i` is the initial its capital is (rules/S10), so `rovira, i` and `john smith i jr` read alike with it on and off; and a connective letter ending its part is not reported — 2026-10-18, #721. - P3 keeps the join and its three-word count, and the single-letter connective read as an initial is rules/P8's, the entries deciding it having moved to decisions/P8 — 2026-10-19. - A frozen link joins nothing of its own but a neighbour's join can absorb it: `i y Carod Rovira Puig` → given 'i y Carod' (the first example, `Josep Carod Rovira Puig y i`, reads family 'Puig y', suffix 'i' since rules/P13, decisions/P13) — 2026-10-19 #760. +- French `dit` and `dite` are connectives under a French choice only (`fr.toml`, `default = false`): `Jean Dupont dit Lebrun` reads family 'Dupont dit Lebrun' and `Mamadou dit Madou Traore` given 'Mamadou dit Madou' under it, and the default is unchanged — 2026-11-21 #1159. Elsewhere: P3's joins are made before S2's trailing run is read, so the run counts a joined part as one name word (`Juan y Garcia X.Y.Z.` → family 'X.Y.Z.') and a salutation keeps its connective (`Mr. and Mrs.` → title 'Mr. and Mrs.') — decisions/S2's 2026-10-07 (Derek), #614 entry, indexed here by the 2026-10-07 #614 cross-reference. A declared separator in a trailing suffix part ends the search as a comma would, so a connective never joins across it — decisions/C10's 2026-10-03 (Derek), #549 entry, indexed here by the 2026-10-03 #549 cross-reference; C3's count of the words before a comma counts a connective surname's words (`Ortega y Gasset, Dr.` → given 'Ortega', middle 'y', family 'Gasset') — decisions/C1's 2026-10-06 (Derek), #613 entry. @@ -63,3 +64,8 @@ Open: none in this file. - 2026-10-18, #721 — THE OFF SWITCH NO LONGER RESTORES THE ONE-CASE ROLE MOVERS. With `i` removed from the conjunctions, a one-case `i` is a one-letter roman numeral, which since #721 is the initial its capital is (rules/S10), so `rovira, i`, `john smith i jr` and `maier, amy i, jr.` read with the switch off exactly as with it on, and as their all-caps twins read either way — where 2.3.0 read them as suffixes, the disagreement with the capitals that decisions/P3's 2026-09-20 bullet "ACCEPTED, AND THE HONEST STATEMENT OF THE ONE-CASE HALF" measured. The off-switch grid's property is unchanged, and these rows no longer lean on its exemption (2): the two readings now agree on them (on: `initial`; off: `initial`, where 2.3.0's off reading was not), so they pass on equal fields. The exemption still guards the rows it was written for (#721's design-docs review measured the rows only it saves falling from thousands on master to a few hundred, all of them a connective `i` before a strict-comma numeral such as `I ROVIRA, V` — a dated snapshot). And a connective letter ending its part is not reported (rules/P8, "unless nothing of its part stands to its right"): the fork had no other way to go. - 2026-10-19 — RULE SPLIT: the single-letter connective read as an initial left rules/P3 for rules/P8, one rule per piece of evidence (docs/design/AGENTS.md), P3 keeping the join and its three-word count and P8 taking the case contrast. The entries deciding that half moved to decisions/P8 with it: #267 (2026-07-30), the #383 + #479 entry with its #528, #289/#516 and #492/#478 amendments, the two 2026-09-13 #383/#479 entries after it, and the 2026-09-24 #478 cross-reference. The #397 entries stay here, since `i` joining is P3's question, and so does #721's off-switch entry; where they say the one-case half or the marked subset, that half is rules/P8's now. - 2026-10-19 #760 — SUPERSEDED IN PART 2026-11-05 (#1098): its example reads family 'Puig y', suffix 'i' since rules/P13 joins a connective with nothing to link to the word before it (decisions/P13), and `i y Carod Rovira Puig` shows the absorption instead. MOVED FROM group's code comment on the both-sides test, the one fact the #397 entries above did not hold. "No join of its own" is the whole claim a frozen link carries: a NEIGHBOUR's join can still absorb it, since both loops of `join_connectives` skip a frozen piece as the join's SUBJECT and nothing keeps it out of the span another connective's join takes. `Josep Carod Rovira Puig y i` freezes the trailing 'i' (nothing stands on its right) and the 'y' beside it joins across it all the same, for family 'Puig y i', which is what the tree before #397's both-sides scope read there too; pinned by `test_a_frozen_link_is_still_absorbed_by_a_neighbours_join` in tests/v2/pipeline/test_group.py. + +- 2026-11-21 #1159 — FRENCH `dit` AND `dite` ARE CONNECTIVES UNDER A FRENCH CHOICE, NOT BY DEFAULT. `dit` and `dite` ("called") join two words of a name in two uses: a hereditary French two-part surname, one legal surname in France, Quebec and Switzerland (`Dupont dit Lebrun`), and a West African alias beside the given name (`Mamadou dit Madou`). Read as written, the first half was a middle name (`Jean Dupont dit Lebrun` → middle 'Dupont dit', family 'Lebrun'). Neither word had a reading. As a particle the word strands the first surname in the middle and reads `Dit` opening a name as a particle; as an alias marker (rules/N4) it cuts a legal surname in half; a connective joins both sides, which both uses want, so `fr.toml` lists both as `conjunction`, P3 unchanged. + MEASURED against master 488ea605, the reading on by default first. Every local corpus holds 67 distinct names with `dit` or `dite` as a word between two others or at an end (`config_diff.py diff default --local all --match '(?i)(^|[\s,])dite?($|[\s,.])'`), and 50 move: hereditary surnames read whole, West African aliases joined to the given name with the family as before, and names written family first, data errors and an alias read into the family, wrong before and after. By population, scored against the filed boxes where a corpus has them: `orcid-researchers` 11 records fixed, 0 broken, 3 changed between two wrong readings; `patentsview-inventors` 2 fixed, 3 broken; `psc-individuals` 0 fixed, 3 broken (two of them boxes filing the alias or the first surname as a middle name), 1 changed; and by `snapshot.py --local --base`, `ctgov-officials` 6 moves (2 surnames read whole, 2 a surname `Dite` lower-cased by case repair and its initial dropped, 2 case only), `ctgov-contacts` 4 (3 surnames read whole, 1 family-first, wrong before and after) and `fec-individuals` 2 (a given name `Dit` lower-cased by case repair). The breaks are where `Dit` or `Dite` is a person's own name, Khmer, Vietnamese, Latvian or Arabic: a three-word name loses its family name to P3's three-word reading (given `X Dit Y`, as `Juan and Garcia` reads), a word ending a name takes the word before it into the family, case repair writes it in lower case and `initials()` drops it, and an Arabic `Abou` or `Al` after it is cut off the family (`X Dit Abou Akl` → family 'Akl'). By default, then, the scored populations fix 13 records and break 6, and the unscored ones read 5 names right and break 4 by case, more breaks than a handful, so the reading is written `default = false`, read under a French choice: with it the default moves 0 of the 67, and the French choice moves the same 50 names to the same readings, its costs included. A gate keeping the reading only where no name reads (a lower-case `dit` alone, say) would need a property the build does not have, and was not built. + The grid, under all three orders and the four comma shapes: a title and a suffix around the name keep their fields, capitals and lower case read alike, two in one name join all three parts, `Dupont dit Lebrun, Jean` and `Traore, Mamadou dit Madou` read as their comma-free twins, a family-first order lays the joined part out by position (`Dupont dit Lebrun Jean` → family 'Dupont dit Lebrun'), `dit` opening the name or alone after one word is a name word, and a hyphenated `Dupont-dit-Lebrun` is one word in every configuration. The name match under the French choice reads either half of the surname as part of the other (`Jean Dupont dit Lebrun` / `Jean Dupont` and `/ Jean Lebrun`, `part-of-other`) and the hyphenated spelling as `joined`, where the default reads `Jean Dupont` as a conflict; `match_diff.py` parses under `Parser()` and `locales.ES` only, so it moves nothing here by construction. + RECOMPUTE: the diff above with `expr:Parser(lexicon=Lexicon.default().add("dit", "dite", kind="conjunction"))` on master, or `plain:fr` on the branch, `--readings` in each tree; `local_agreement.py orcid-researchers|patentsview-inventors|psc-individuals --base <488ea605>` and `snapshot.py --local ctgov-officials|ctgov-contacts|fec-individuals --base <488ea605>`, run on a tree holding the reading on by default. diff --git a/docs/languages.rst b/docs/languages.rst index 7e3828095..550dadb53 100644 --- a/docs/languages.rst +++ b/docs/languages.rst @@ -19,7 +19,7 @@ subset with its own parser, or pass several packs to ``parser_for``: The sections below cover Czech, Slovak, Slovenian and Croatian names, Spanish and Portuguese titles and family names, romanized Indic titles, Vietnamese, Mongolian and Thai names, Arabic-script names, Maghrebi, -Amazigh, Hebrew and Dutch particles, and Burmese and Malay names. Other languages are described where their mechanism is: +Amazigh, Hebrew and Dutch particles, French ``dit`` names, and Burmese and Malay names. Other languages are described where their mechanism is: - **East Slavic patronymics** (``ru``): :ref:`east-slavic-patronymics`. - **Turkic patronymic markers** (``tr_az``): @@ -237,7 +237,8 @@ on: Clair Smith`` reads given ``St``. A caller whose names also hold the English Saint chooses French too, a -choice that changes no other word: +choice that changes no other word but ``dit`` and ``dite`` +(:ref:`french-dit-names`): .. doctest:: @@ -1369,6 +1370,45 @@ What the pack costs >>> parser_for(locales.NL, english).parse("John Smith VD").suffix 'VD' +.. _french-dit-names: + +French ``dit`` names +-------------------- + +``dit`` and its feminine ``dite`` ("called") join two words of a name +in two uses: a hereditary French family name of two parts, one legal +surname in France, Quebec and Switzerland (``Dupont dit Lebrun``), and +a West African alias written beside the given name (``Mamadou dit +Madou``). Choosing French reads either as one part of the name; the +default does not, and reads the first half as a middle name: + +.. doctest:: + + >>> french_names = parser_for(Locale(code="fr", lexicon=Lexicon.empty(), + ... languages=frozenset({"fr"}))) + >>> parse("Jean Dupont dit Lebrun").family + 'Lebrun' + >>> french_names.parse("Jean Dupont dit Lebrun").family + 'Dupont dit Lebrun' + >>> french_names.parse("Mamadou dit Madou Traore").given + 'Mamadou dit Madou' + +It is a choice rather than the default because ``Dit`` and ``Dite`` are +also names (Khmer, Vietnamese and Latvian ones among them), and the +choice reads the word as a connective wherever it stands: + +- **A name of three words** with the name in the middle is read as one + given name, as ``Juan and Garcia`` is (``Sok Dit Chan`` gives given + ``Sok Dit Chan`` and no family name). +- **Ending a name**, it joins the word before it to the family name + (``Tran Thi Dit`` gives family ``Thi Dit``). +- **Case repair** of a name written in one case writes it in lower + case (``SOK DIT CHAN`` gives ``Sok dit Chan``), and ``initials()`` + gives it no initial there. + +Written with hyphens (``Dupont-dit-Lebrun``) the name is one word and +reads the same either way. + .. _burmese-names: Burmese names diff --git a/docs/release_log.rst b/docs/release_log.rst index 421f58c8c..88268007f 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -4,6 +4,7 @@ Release Log nameparser 3.2 is under development. + - **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`` and ``Mamadou dit Madou Traore`` given ``Mamadou dit Madou``, where the default, as 1.4.0 through 3.1.0, gives middle ``Dupont dit``, family ``Lebrun``; 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` - **Add the Czech and Slovak post-nominals DiS., DrSc. and ArtD. as credentials.** ``parse("Jan Novák, DiS.")`` gives suffix ``DiS.``, where 1.4.0 through 3.1.0 gave title ``DiS.``; DiS., which is also a surname, reads as the credential after a full name and a comma, and written as ``DiS.`` or ``Dis`` it stays a name word at the end of a name of mixed case without one (``Jan Novák DiS.``), while a surname written ``DIS`` there reads as the credential (``Jan DIS``). :issue:`969` - **Add credentials: BCh, BChir and BMBCh, the Nigerian marks mni, fwc, fsi, fnse, psc and ndc, and the Hong Kong and Singapore honours GBM, GBS, SBS, BBS and BBM.** ``parse("Jane Doe, BCh")`` gives suffix ``BCh``, where 1.4.0 through 3.1.0 gave given ``BCh``, family ``Jane Doe``. A word spelling one of them after a one-word family name and a comma, or ending a name, reads as the credential (``Bello, MNI``). :issue:`1361`, :issue:`1228`, :issue:`1182` diff --git a/nameparser/config/_index.py b/nameparser/config/_index.py index 37c1754dd..b002f4d70 100644 --- a/nameparser/config/_index.py +++ b/nameparser/config/_index.py @@ -1062,7 +1062,9 @@ ('discovery', (('en', 'modifier', ()),)), ('dissident', (('en', 'occupation', ()),)), ('district', (('en', 'modifier', ()),)), + ('dit', (('fr', 'conjunction', (('default', False),)),)), ('dita', (('en', 'familiar', (('short_for', ('anindita',)),)), ('pt-BR', 'familiar', (('short_for', ('benedita',)),)))), + ('dite', (('fr', 'conjunction', (('default', False),)),)), ('ditinha', (('pt-BR', 'familiar', (('short_for', ('benedita',)),)),)), ('ditinho', (('pt-BR', 'familiar', (('short_for', ('benedito',)),)),)), ('dito', (('pt-BR', 'familiar', (('short_for', ('benedito',)),)),)), diff --git a/nameparser/vocab/fr.toml b/nameparser/vocab/fr.toml index acf893f31..80c61280e 100644 --- a/nameparser/vocab/fr.toml +++ b/nameparser/vocab/fr.toml @@ -182,6 +182,14 @@ issue = 360 expands = "Sainte, contracted" note = "Has a vowel, which is why the criterion is \"abbreviation of a word that is never itself a name\" rather than the vowel shape #360 first proposed. Measured misparse: \"Ste Marie\" gave given='Ste'." +[[word]] +text = "dit" +conjunction = { default = false, issue = 1159 } + +[[word]] +text = "dite" +conjunction = { default = false, issue = 1159 } + [[word]] text = "et" conjunction = {} diff --git a/tests/v2/test_locales.py b/tests/v2/test_locales.py index 378c22cc9..8b078cd27 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -188,6 +188,40 @@ def test_nl_reads_a_leading_ten_by_its_given_reading_unless_strict( for a in name.ambiguities) is reported +_FRENCH = Locale(code="fr", lexicon=Lexicon.empty(), + languages=frozenset({"fr"})) + + +@pytest.mark.parametrize(("text", "default", "french"), [ + # #1159: dit and dite are connectives under a French choice only + # (fr.toml, default = false; decisions/P3) + ("Jean Dupont dit Lebrun", ("Jean", "Dupont dit", "Lebrun"), + ("Jean", "", "Dupont dit Lebrun")), + ("Marie Martin dite Mimi", ("Marie", "Martin dite", "Mimi"), + ("Marie", "", "Martin dite Mimi")), + ("Mamadou dit Madou Traore", ("Mamadou", "dit Madou", "Traore"), + ("Mamadou dit Madou", "", "Traore")), + ("JEAN DUPONT DIT LEBRUN", ("JEAN", "DUPONT DIT", "LEBRUN"), + ("JEAN", "", "DUPONT DIT LEBRUN")), + ("Dupont dit Lebrun, Jean", ("Jean", "", "Dupont dit Lebrun"), + ("Jean", "", "Dupont dit Lebrun")), + ("Traore, Mamadou dit Madou", ("Mamadou", "dit Madou", "Traore"), + ("Mamadou dit Madou", "", "Traore")), + # a hyphenated dit name is one word, and dit opening a name a name + ("Jean Dupont-dit-Lebrun", ("Jean", "", "Dupont-dit-Lebrun"), + ("Jean", "", "Dupont-dit-Lebrun")), + ("Dit Clapper", ("Dit", "", "Clapper"), ("Dit", "", "Clapper")), + # the choice's cost, decisions/P3: a name Dit in a three-word name + ("Sok Dit Chan", ("Sok", "Dit", "Chan"), ("Sok Dit Chan", "", "")), +]) +def test_dit_is_a_connective_under_a_french_choice_only( + text: str, default: tuple[str, str, str], + french: tuple[str, str, str]) -> None: + for parser, want in ((Parser(), default), (parser_for(_FRENCH), french)): + name = parser.parse(text) + assert (name.given, name.middle, name.family) == want, (text, parser) + + def test_a_strict_dutch_choice_keeps_a_leading_oude_given() -> None: # #1455: oude's given reading is in nl.toml itself, so a strict Dutch # choice keeps it, where ten's (in zh.toml) leaves From 63e20029695fd278f926b9f085f3659210e2a80f Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Sat, 21 Nov 2026 12:19:42 -0800 Subject: [PATCH 2/6] Record dit's vetting on the word and pin the costs review found (#1159) fr.toml's dit and dite carry expands and a note saying why they are off by default. Tests pin the family-first orders, the empty head, a stacked and a strict French choice, case repair and initials, the name match, and the costs where Dit is a name (opening a longer name, ending one, a suffix comma); languages.rst, decisions/P3 and the release bullet state them. Co-Authored-By: Claude Opus 5.5 --- docs/design/decisions/P3-connectives.md | 2 +- docs/languages.rst | 10 ++++- docs/release_log.rst | 2 +- nameparser/vocab/fr.toml | 4 +- tests/v2/test_locales.py | 56 ++++++++++++++++++++++++- 5 files changed, 66 insertions(+), 8 deletions(-) diff --git a/docs/design/decisions/P3-connectives.md b/docs/design/decisions/P3-connectives.md index 3839cca85..1ef2bfafb 100644 --- a/docs/design/decisions/P3-connectives.md +++ b/docs/design/decisions/P3-connectives.md @@ -67,5 +67,5 @@ Open: none in this file. - 2026-11-21 #1159 — FRENCH `dit` AND `dite` ARE CONNECTIVES UNDER A FRENCH CHOICE, NOT BY DEFAULT. `dit` and `dite` ("called") join two words of a name in two uses: a hereditary French two-part surname, one legal surname in France, Quebec and Switzerland (`Dupont dit Lebrun`), and a West African alias beside the given name (`Mamadou dit Madou`). Read as written, the first half was a middle name (`Jean Dupont dit Lebrun` → middle 'Dupont dit', family 'Lebrun'). Neither word had a reading. As a particle the word strands the first surname in the middle and reads `Dit` opening a name as a particle; as an alias marker (rules/N4) it cuts a legal surname in half; a connective joins both sides, which both uses want, so `fr.toml` lists both as `conjunction`, P3 unchanged. MEASURED against master 488ea605, the reading on by default first. Every local corpus holds 67 distinct names with `dit` or `dite` as a word between two others or at an end (`config_diff.py diff default --local all --match '(?i)(^|[\s,])dite?($|[\s,.])'`), and 50 move: hereditary surnames read whole, West African aliases joined to the given name with the family as before, and names written family first, data errors and an alias read into the family, wrong before and after. By population, scored against the filed boxes where a corpus has them: `orcid-researchers` 11 records fixed, 0 broken, 3 changed between two wrong readings; `patentsview-inventors` 2 fixed, 3 broken; `psc-individuals` 0 fixed, 3 broken (two of them boxes filing the alias or the first surname as a middle name), 1 changed; and by `snapshot.py --local --base`, `ctgov-officials` 6 moves (2 surnames read whole, 2 a surname `Dite` lower-cased by case repair and its initial dropped, 2 case only), `ctgov-contacts` 4 (3 surnames read whole, 1 family-first, wrong before and after) and `fec-individuals` 2 (a given name `Dit` lower-cased by case repair). The breaks are where `Dit` or `Dite` is a person's own name, Khmer, Vietnamese, Latvian or Arabic: a three-word name loses its family name to P3's three-word reading (given `X Dit Y`, as `Juan and Garcia` reads), a word ending a name takes the word before it into the family, case repair writes it in lower case and `initials()` drops it, and an Arabic `Abou` or `Al` after it is cut off the family (`X Dit Abou Akl` → family 'Akl'). By default, then, the scored populations fix 13 records and break 6, and the unscored ones read 5 names right and break 4 by case, more breaks than a handful, so the reading is written `default = false`, read under a French choice: with it the default moves 0 of the 67, and the French choice moves the same 50 names to the same readings, its costs included. A gate keeping the reading only where no name reads (a lower-case `dit` alone, say) would need a property the build does not have, and was not built. - The grid, under all three orders and the four comma shapes: a title and a suffix around the name keep their fields, capitals and lower case read alike, two in one name join all three parts, `Dupont dit Lebrun, Jean` and `Traore, Mamadou dit Madou` read as their comma-free twins, a family-first order lays the joined part out by position (`Dupont dit Lebrun Jean` → family 'Dupont dit Lebrun'), `dit` opening the name or alone after one word is a name word, and a hyphenated `Dupont-dit-Lebrun` is one word in every configuration. The name match under the French choice reads either half of the surname as part of the other (`Jean Dupont dit Lebrun` / `Jean Dupont` and `/ Jean Lebrun`, `part-of-other`) and the hyphenated spelling as `joined`, where the default reads `Jean Dupont` as a conflict; `match_diff.py` parses under `Parser()` and `locales.ES` only, so it moves nothing here by construction. + The grid, under all three orders and the four comma shapes: a title and a suffix around the name keep their fields, capitals and lower case read alike, two in one name join all three parts, `Dupont dit Lebrun, Jean` and `Traore, Mamadou dit Madou` read as their comma-free twins, a family-first order lays the joined part out by position (`Dupont dit Lebrun Jean` → family 'Dupont dit Lebrun'), `dit` opening a two-word name or alone after one word is a name word, and a hyphenated `Dupont-dit-Lebrun` is one word in every configuration. Under the choice, two more costs of the same kind: `Dit` opening a name of three words or more joins the next word into the given name (`Dit Jean Dupont` → given 'Dit Jean'), and a suffix comma after a joined name leaves no family (`Dupont dit Lebrun, Jr.` → given 'Dupont dit Lebrun', a `given-or-family` report; the default reads family 'Lebrun'), as P3 reads any connective there; and case repair writes a hyphenated `-dit-` in lower case (`JEAN DUPONT-DIT-LEBRUN` → 'Jean Dupont-dit-Lebrun'), which the 67-name population, read by a pattern that finds `dit` only between spaces or commas, does not count, the `ctgov-officials` case moves above being of that spelling. The name match under the French choice reads either half of the surname as part of the other (`Jean Dupont dit Lebrun` / `Jean Dupont` and `/ Jean Lebrun`, `part-of-other`) and the hyphenated spelling as `joined`, where the default reads `Jean Dupont` as a conflict; `match_diff.py` parses under `Parser()` and `locales.ES` only, so it moves nothing here by construction. RECOMPUTE: the diff above with `expr:Parser(lexicon=Lexicon.default().add("dit", "dite", kind="conjunction"))` on master, or `plain:fr` on the branch, `--readings` in each tree; `local_agreement.py orcid-researchers|patentsview-inventors|psc-individuals --base <488ea605>` and `snapshot.py --local ctgov-officials|ctgov-contacts|fec-individuals --base <488ea605>`, run on a tree holding the reading on by default. diff --git a/docs/languages.rst b/docs/languages.rst index 550dadb53..7ccd06bbe 100644 --- a/docs/languages.rst +++ b/docs/languages.rst @@ -1400,14 +1400,20 @@ choice reads the word as a connective wherever it stands: - **A name of three words** with the name in the middle is read as one given name, as ``Juan and Garcia`` is (``Sok Dit Chan`` gives given ``Sok Dit Chan`` and no family name). +- **Opening a name of three words or more**, it joins the next word to + the given name (``Dit Jean Dupont`` gives given ``Dit Jean``). - **Ending a name**, it joins the word before it to the family name (``Tran Thi Dit`` gives family ``Thi Dit``). +- **Before a comma and a suffix**, the joined name is read as the given + name and the family is left empty (``Dupont dit Lebrun, Jr.``). - **Case repair** of a name written in one case writes it in lower case (``SOK DIT CHAN`` gives ``Sok dit Chan``), and ``initials()`` - gives it no initial there. + never gives it an initial (``Sok Dit Chan`` gives ``S. C.``). Written with hyphens (``Dupont-dit-Lebrun``) the name is one word and -reads the same either way. +its fields read the same either way; case repair writes its ``dit`` in +lower case under the choice (``JEAN DUPONT-DIT-LEBRUN`` gives ``Jean +Dupont-dit-Lebrun``). .. _burmese-names: diff --git a/docs/release_log.rst b/docs/release_log.rst index 88268007f..91e887c0c 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -4,7 +4,7 @@ Release Log nameparser 3.2 is under development. - - **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`` and ``Mamadou dit Madou Traore`` given ``Mamadou dit Madou``, where the default, as 1.4.0 through 3.1.0, gives middle ``Dupont dit``, family ``Lebrun``; the default is unchanged, ``Dit`` and ``Dite`` being names too. :issue:`1159` + - **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` - **Add the Czech and Slovak post-nominals DiS., DrSc. and ArtD. as credentials.** ``parse("Jan Novák, DiS.")`` gives suffix ``DiS.``, where 1.4.0 through 3.1.0 gave title ``DiS.``; DiS., which is also a surname, reads as the credential after a full name and a comma, and written as ``DiS.`` or ``Dis`` it stays a name word at the end of a name of mixed case without one (``Jan Novák DiS.``), while a surname written ``DIS`` there reads as the credential (``Jan DIS``). :issue:`969` - **Add credentials: BCh, BChir and BMBCh, the Nigerian marks mni, fwc, fsi, fnse, psc and ndc, and the Hong Kong and Singapore honours GBM, GBS, SBS, BBS and BBM.** ``parse("Jane Doe, BCh")`` gives suffix ``BCh``, where 1.4.0 through 3.1.0 gave given ``BCh``, family ``Jane Doe``. A word spelling one of them after a one-word family name and a comma, or ending a name, reads as the credential (``Bello, MNI``). :issue:`1361`, :issue:`1228`, :issue:`1182` diff --git a/nameparser/vocab/fr.toml b/nameparser/vocab/fr.toml index 80c61280e..b38c33e46 100644 --- a/nameparser/vocab/fr.toml +++ b/nameparser/vocab/fr.toml @@ -184,11 +184,11 @@ note = "Has a vowel, which is why the criterion is \"abbreviation of a word that [[word]] text = "dit" -conjunction = { default = false, issue = 1159 } +conjunction = { default = false, issue = 1159, expands = "called (masculine), joining a hereditary two-part surname (Dupont dit Lebrun) or an alias to the given name (Mamadou dit Madou)", note = "Off by default: Dit and Dite are also Khmer, Vietnamese, Latvian and Arabic names, and on by default the local corpora fixed 13 scored records against 6 broken, plus 4 names lower-cased by case repair (decisions/P3, 2026-11-21)." } [[word]] text = "dite" -conjunction = { default = false, issue = 1159 } +conjunction = { default = false, issue = 1159, expands = "called (feminine), joining a hereditary two-part surname (Dupont dit Lebrun) or an alias to the given name (Mamadou dit Madou)", note = "Off by default: Dit and Dite are also Khmer, Vietnamese, Latvian and Arabic names, and on by default the local corpora fixed 13 scored records against 6 broken, plus 4 names lower-cased by case repair (decisions/P3, 2026-11-21)." } [[word]] text = "et" diff --git a/tests/v2/test_locales.py b/tests/v2/test_locales.py index 8b078cd27..ee52e8bf9 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -207,12 +207,21 @@ def test_nl_reads_a_leading_ten_by_its_given_reading_unless_strict( ("Jean", "", "Dupont dit Lebrun")), ("Traore, Mamadou dit Madou", ("Mamadou", "dit Madou", "Traore"), ("Mamadou dit Madou", "", "Traore")), - # a hyphenated dit name is one word, and dit opening a name a name + ("Dupont dit Lebrun, Jr.", ("Dupont", "dit", "Lebrun"), + ("Dupont dit Lebrun", "", "")), + (", Jean dit Lebrun", ("Jean", "dit Lebrun", ""), + ("Jean dit Lebrun", "", "")), + # a hyphenated dit name is one word, and dit opening a two-word name + # a name word ("Jean Dupont-dit-Lebrun", ("Jean", "", "Dupont-dit-Lebrun"), ("Jean", "", "Dupont-dit-Lebrun")), ("Dit Clapper", ("Dit", "", "Clapper"), ("Dit", "", "Clapper")), - # the choice's cost, decisions/P3: a name Dit in a three-word name + # the choice's costs, decisions/P3: a name Dit inside a three-word + # name, opening a longer one, or ending one; a suffix comma after a + # joined family leaves no family word ("Sok Dit Chan", ("Sok", "Dit", "Chan"), ("Sok Dit Chan", "", "")), + ("Dit Jean Dupont", ("Dit", "Jean", "Dupont"), ("Dit Jean", "", "Dupont")), + ("Tran Thi Dit", ("Tran", "Thi", "Dit"), ("Tran", "", "Thi Dit")), ]) def test_dit_is_a_connective_under_a_french_choice_only( text: str, default: tuple[str, str, str], @@ -222,6 +231,49 @@ def test_dit_is_a_connective_under_a_french_choice_only( assert (name.given, name.middle, name.family) == want, (text, parser) +@pytest.mark.parametrize("order", [FAMILY_FIRST, FAMILY_FIRST_GIVEN_LAST]) +@pytest.mark.parametrize(("text", "given", "family"), [ + ("Dupont dit Lebrun Jean", "Jean", "Dupont dit Lebrun"), + ("Traore Mamadou dit Madou", "Mamadou dit Madou", "Traore"), +]) +def test_a_french_choice_lays_a_dit_name_out_by_a_family_first_order( + order: tuple[Role, Role, Role], text: str, given: str, family: str) -> None: + parser = parser_for(_FRENCH) + parser = dataclasses.replace( + parser, policy=dataclasses.replace(parser.policy, name_order=order)) + name = parser.parse(text) + assert (name.given, name.middle, name.family) == (given, "", family) + + +def test_dit_stays_a_connective_when_french_is_stacked_or_strict() -> None: + for parser in (parser_for(_FRENCH, locales.ES), parser_for(locales.ES, _FRENCH), + parser_for(_FRENCH, locales.CS), parser_for(_FRENCH, strict=True)): + assert parser.parse("Jean Dupont dit Lebrun").family == "Dupont dit Lebrun" + + +def test_a_french_choice_repairs_dit_in_lower_case_and_gives_it_no_initial() -> None: + # decisions/P3's case and initial costs, where Dit is a name + french, default = parser_for(_FRENCH), Parser() + for text, repaired, initials, as_default in ( + ("JEAN DUPONT DIT LEBRUN", "Jean Dupont dit Lebrun", "J. D. L.", + "Jean Dupont Dit Lebrun"), + ("JEAN DUPONT-DIT-LEBRUN", "Jean Dupont-dit-Lebrun", "J. D.", + "Jean Dupont-Dit-Lebrun")): + name = french.parse(text) + assert str(french.capitalized(name)) == repaired + assert name.initials() == initials + assert str(default.capitalized(default.parse(text))) == as_default + assert french.parse("Sok Dit Chan").initials() == "S. C." + + +def test_a_french_choice_matches_a_dit_surname_with_its_halves() -> None: + match = parser_for(_FRENCH).matching() + for other in ("Jean Dupont", "Jean Lebrun", "Jean Dupont-dit-Lebrun"): + assert match.check("Jean Dupont dit Lebrun", other).consistent, other + assert not Parser().matching().check( + "Jean Dupont dit Lebrun", "Jean Dupont").consistent + + def test_a_strict_dutch_choice_keeps_a_leading_oude_given() -> None: # #1455: oude's given reading is in nl.toml itself, so a strict Dutch # choice keeps it, where ten's (in zh.toml) leaves From 2be5dd0b350ee672cc714116d0668c7b37f0958f Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Sat, 21 Nov 2026 12:24:22 -0800 Subject: [PATCH 3/6] Narrow dit's initials claim and its name attributions to what was measured (#1159) A lone dit keeps its initial under the French choice (Jean Dit gives J. D.); the corpora's name uses are a Cantonese given name and Latvian and Slavic surnames, and the Arabic records are the connective read with too short a reach, stated as its own cost. Co-Authored-By: Claude Opus 5.5 --- docs/design/decisions/P3-connectives.md | 2 +- docs/languages.rst | 12 +++++++++--- nameparser/vocab/fr.toml | 4 ++-- tests/v2/test_locales.py | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/docs/design/decisions/P3-connectives.md b/docs/design/decisions/P3-connectives.md index 1ef2bfafb..d0962e713 100644 --- a/docs/design/decisions/P3-connectives.md +++ b/docs/design/decisions/P3-connectives.md @@ -66,6 +66,6 @@ Open: none in this file. - 2026-10-19 #760 — SUPERSEDED IN PART 2026-11-05 (#1098): its example reads family 'Puig y', suffix 'i' since rules/P13 joins a connective with nothing to link to the word before it (decisions/P13), and `i y Carod Rovira Puig` shows the absorption instead. MOVED FROM group's code comment on the both-sides test, the one fact the #397 entries above did not hold. "No join of its own" is the whole claim a frozen link carries: a NEIGHBOUR's join can still absorb it, since both loops of `join_connectives` skip a frozen piece as the join's SUBJECT and nothing keeps it out of the span another connective's join takes. `Josep Carod Rovira Puig y i` freezes the trailing 'i' (nothing stands on its right) and the 'y' beside it joins across it all the same, for family 'Puig y i', which is what the tree before #397's both-sides scope read there too; pinned by `test_a_frozen_link_is_still_absorbed_by_a_neighbours_join` in tests/v2/pipeline/test_group.py. - 2026-11-21 #1159 — FRENCH `dit` AND `dite` ARE CONNECTIVES UNDER A FRENCH CHOICE, NOT BY DEFAULT. `dit` and `dite` ("called") join two words of a name in two uses: a hereditary French two-part surname, one legal surname in France, Quebec and Switzerland (`Dupont dit Lebrun`), and a West African alias beside the given name (`Mamadou dit Madou`). Read as written, the first half was a middle name (`Jean Dupont dit Lebrun` → middle 'Dupont dit', family 'Lebrun'). Neither word had a reading. As a particle the word strands the first surname in the middle and reads `Dit` opening a name as a particle; as an alias marker (rules/N4) it cuts a legal surname in half; a connective joins both sides, which both uses want, so `fr.toml` lists both as `conjunction`, P3 unchanged. - MEASURED against master 488ea605, the reading on by default first. Every local corpus holds 67 distinct names with `dit` or `dite` as a word between two others or at an end (`config_diff.py diff default --local all --match '(?i)(^|[\s,])dite?($|[\s,.])'`), and 50 move: hereditary surnames read whole, West African aliases joined to the given name with the family as before, and names written family first, data errors and an alias read into the family, wrong before and after. By population, scored against the filed boxes where a corpus has them: `orcid-researchers` 11 records fixed, 0 broken, 3 changed between two wrong readings; `patentsview-inventors` 2 fixed, 3 broken; `psc-individuals` 0 fixed, 3 broken (two of them boxes filing the alias or the first surname as a middle name), 1 changed; and by `snapshot.py --local --base`, `ctgov-officials` 6 moves (2 surnames read whole, 2 a surname `Dite` lower-cased by case repair and its initial dropped, 2 case only), `ctgov-contacts` 4 (3 surnames read whole, 1 family-first, wrong before and after) and `fec-individuals` 2 (a given name `Dit` lower-cased by case repair). The breaks are where `Dit` or `Dite` is a person's own name, Khmer, Vietnamese, Latvian or Arabic: a three-word name loses its family name to P3's three-word reading (given `X Dit Y`, as `Juan and Garcia` reads), a word ending a name takes the word before it into the family, case repair writes it in lower case and `initials()` drops it, and an Arabic `Abou` or `Al` after it is cut off the family (`X Dit Abou Akl` → family 'Akl'). By default, then, the scored populations fix 13 records and break 6, and the unscored ones read 5 names right and break 4 by case, more breaks than a handful, so the reading is written `default = false`, read under a French choice: with it the default moves 0 of the 67, and the French choice moves the same 50 names to the same readings, its costs included. A gate keeping the reading only where no name reads (a lower-case `dit` alone, say) would need a property the build does not have, and was not built. + MEASURED against master 488ea605, the reading on by default first. Every local corpus holds 67 distinct names with `dit` or `dite` as a word between two others or at an end (`config_diff.py diff default --local all --match '(?i)(^|[\s,])dite?($|[\s,.])'`), and 50 move: hereditary surnames read whole, West African aliases joined to the given name with the family as before, and names written family first, data errors and an alias read into the family, wrong before and after. By population, scored against the filed boxes where a corpus has them: `orcid-researchers` 11 records fixed, 0 broken, 3 changed between two wrong readings; `patentsview-inventors` 2 fixed, 3 broken; `psc-individuals` 0 fixed, 3 broken (two of them boxes filing the alias or the first surname as a middle name), 1 changed; and by `snapshot.py --local --base`, `ctgov-officials` 6 moves (2 surnames read whole, 2 a surname `Dite` lower-cased by case repair and its initial dropped, 2 case only), `ctgov-contacts` 4 (3 surnames read whole, 1 family-first, wrong before and after) and `fec-individuals` 2 (a given name `Dit` lower-cased by case repair). The breaks are of two kinds. Where `Dit` or `Dite` is a person's own name (a Cantonese given name written `Dit`, Latvian and Slavic surnames `Dite`, in the corpora read): a three-word name loses its family name to P3's three-word reading (given `X Dit Y`, as `Juan and Garcia` reads), a word ending a name takes the word before it into the family, and case repair writes it in lower case and `initials()` drops it inside a joined part (alone in its field it keeps its initial, `Jean Dit` giving 'J. D.'). And where it is the connective but P3's join, one word on each side, falls short: a Levantine two-part surname whose second half opens with `Abou` or `Al` loses that word from the family (`X Dit Abou Akl` → family 'Akl'). By default, then, the scored populations fix 13 records and break 6, and the unscored ones read 5 names right and break 4 by case, more breaks than a handful, so the reading is written `default = false`, read under a French choice: with it the default moves 0 of the 67, and the French choice moves the same 50 names to the same readings, its costs included. A gate keeping the reading only where no name reads (a lower-case `dit` alone, say) would need a property the build does not have, and was not built. The grid, under all three orders and the four comma shapes: a title and a suffix around the name keep their fields, capitals and lower case read alike, two in one name join all three parts, `Dupont dit Lebrun, Jean` and `Traore, Mamadou dit Madou` read as their comma-free twins, a family-first order lays the joined part out by position (`Dupont dit Lebrun Jean` → family 'Dupont dit Lebrun'), `dit` opening a two-word name or alone after one word is a name word, and a hyphenated `Dupont-dit-Lebrun` is one word in every configuration. Under the choice, two more costs of the same kind: `Dit` opening a name of three words or more joins the next word into the given name (`Dit Jean Dupont` → given 'Dit Jean'), and a suffix comma after a joined name leaves no family (`Dupont dit Lebrun, Jr.` → given 'Dupont dit Lebrun', a `given-or-family` report; the default reads family 'Lebrun'), as P3 reads any connective there; and case repair writes a hyphenated `-dit-` in lower case (`JEAN DUPONT-DIT-LEBRUN` → 'Jean Dupont-dit-Lebrun'), which the 67-name population, read by a pattern that finds `dit` only between spaces or commas, does not count, the `ctgov-officials` case moves above being of that spelling. The name match under the French choice reads either half of the surname as part of the other (`Jean Dupont dit Lebrun` / `Jean Dupont` and `/ Jean Lebrun`, `part-of-other`) and the hyphenated spelling as `joined`, where the default reads `Jean Dupont` as a conflict; `match_diff.py` parses under `Parser()` and `locales.ES` only, so it moves nothing here by construction. RECOMPUTE: the diff above with `expr:Parser(lexicon=Lexicon.default().add("dit", "dite", kind="conjunction"))` on master, or `plain:fr` on the branch, `--readings` in each tree; `local_agreement.py orcid-researchers|patentsview-inventors|psc-individuals --base <488ea605>` and `snapshot.py --local ctgov-officials|ctgov-contacts|fec-individuals --base <488ea605>`, run on a tree holding the reading on by default. diff --git a/docs/languages.rst b/docs/languages.rst index 7ccd06bbe..93558f9e6 100644 --- a/docs/languages.rst +++ b/docs/languages.rst @@ -1394,8 +1394,8 @@ default does not, and reads the first half as a middle name: 'Mamadou dit Madou' It is a choice rather than the default because ``Dit`` and ``Dite`` are -also names (Khmer, Vietnamese and Latvian ones among them), and the -choice reads the word as a connective wherever it stands: +also names (a Cantonese given name, Latvian and Slavic surnames), and +the choice reads the word as a connective wherever it stands: - **A name of three words** with the name in the middle is read as one given name, as ``Juan and Garcia`` is (``Sok Dit Chan`` gives given @@ -1404,11 +1404,17 @@ choice reads the word as a connective wherever it stands: the given name (``Dit Jean Dupont`` gives given ``Dit Jean``). - **Ending a name**, it joins the word before it to the family name (``Tran Thi Dit`` gives family ``Thi Dit``). +- **An Arabic surname joined by it** whose second half opens with + ``Abou`` or ``Al`` is cut after that word (``Karim Haddad dit Abou + Nasr`` gives family ``Nasr``), the connective joining one word on + each side. - **Before a comma and a suffix**, the joined name is read as the given name and the family is left empty (``Dupont dit Lebrun, Jr.``). - **Case repair** of a name written in one case writes it in lower case (``SOK DIT CHAN`` gives ``Sok dit Chan``), and ``initials()`` - never gives it an initial (``Sok Dit Chan`` gives ``S. C.``). + gives it no initial inside a joined part (``Sok Dit Chan`` gives + ``S. C.``), alone in its field it keeps one (``Jean Dit`` gives + ``J. D.``). Written with hyphens (``Dupont-dit-Lebrun``) the name is one word and its fields read the same either way; case repair writes its ``dit`` in diff --git a/nameparser/vocab/fr.toml b/nameparser/vocab/fr.toml index b38c33e46..05a07a9df 100644 --- a/nameparser/vocab/fr.toml +++ b/nameparser/vocab/fr.toml @@ -184,11 +184,11 @@ note = "Has a vowel, which is why the criterion is \"abbreviation of a word that [[word]] text = "dit" -conjunction = { default = false, issue = 1159, expands = "called (masculine), joining a hereditary two-part surname (Dupont dit Lebrun) or an alias to the given name (Mamadou dit Madou)", note = "Off by default: Dit and Dite are also Khmer, Vietnamese, Latvian and Arabic names, and on by default the local corpora fixed 13 scored records against 6 broken, plus 4 names lower-cased by case repair (decisions/P3, 2026-11-21)." } +conjunction = { default = false, issue = 1159, expands = "called (masculine), joining a hereditary two-part surname (Dupont dit Lebrun) or an alias to the given name (Mamadou dit Madou)", note = "Off by default: Dit and Dite are also names (a Cantonese given name, Latvian and Slavic surnames, in the corpora measured), and on by default the local corpora fixed 13 scored records against 6 broken, plus 4 names lower-cased by case repair (decisions/P3, 2026-11-21)." } [[word]] text = "dite" -conjunction = { default = false, issue = 1159, expands = "called (feminine), joining a hereditary two-part surname (Dupont dit Lebrun) or an alias to the given name (Mamadou dit Madou)", note = "Off by default: Dit and Dite are also Khmer, Vietnamese, Latvian and Arabic names, and on by default the local corpora fixed 13 scored records against 6 broken, plus 4 names lower-cased by case repair (decisions/P3, 2026-11-21)." } +conjunction = { default = false, issue = 1159, expands = "called (feminine), joining a hereditary two-part surname (Dupont dit Lebrun) or an alias to the given name (Mamadou dit Madou)", note = "Off by default: Dit and Dite are also names (a Cantonese given name, Latvian and Slavic surnames, in the corpora measured), and on by default the local corpora fixed 13 scored records against 6 broken, plus 4 names lower-cased by case repair (decisions/P3, 2026-11-21)." } [[word]] text = "et" diff --git a/tests/v2/test_locales.py b/tests/v2/test_locales.py index ee52e8bf9..3c0d5a820 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -207,8 +207,6 @@ def test_nl_reads_a_leading_ten_by_its_given_reading_unless_strict( ("Jean", "", "Dupont dit Lebrun")), ("Traore, Mamadou dit Madou", ("Mamadou", "dit Madou", "Traore"), ("Mamadou dit Madou", "", "Traore")), - ("Dupont dit Lebrun, Jr.", ("Dupont", "dit", "Lebrun"), - ("Dupont dit Lebrun", "", "")), (", Jean dit Lebrun", ("Jean", "dit Lebrun", ""), ("Jean dit Lebrun", "", "")), # a hyphenated dit name is one word, and dit opening a two-word name @@ -222,6 +220,8 @@ def test_nl_reads_a_leading_ten_by_its_given_reading_unless_strict( ("Sok Dit Chan", ("Sok", "Dit", "Chan"), ("Sok Dit Chan", "", "")), ("Dit Jean Dupont", ("Dit", "Jean", "Dupont"), ("Dit Jean", "", "Dupont")), ("Tran Thi Dit", ("Tran", "Thi", "Dit"), ("Tran", "", "Thi Dit")), + ("Dupont dit Lebrun, Jr.", ("Dupont", "dit", "Lebrun"), + ("Dupont dit Lebrun", "", "")), ]) def test_dit_is_a_connective_under_a_french_choice_only( text: str, default: tuple[str, str, str], @@ -263,7 +263,9 @@ def test_a_french_choice_repairs_dit_in_lower_case_and_gives_it_no_initial() -> assert str(french.capitalized(name)) == repaired assert name.initials() == initials assert str(default.capitalized(default.parse(text))) == as_default + # dropped inside a joined part only: alone in its field it keeps one assert french.parse("Sok Dit Chan").initials() == "S. C." + assert french.parse("Jean Dit").initials() == "J. D." def test_a_french_choice_matches_a_dit_surname_with_its_halves() -> None: From 1fa425533ae0655e6d8a580f6f9ca0df8b51172e Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Sat, 21 Nov 2026 12:28:07 -0800 Subject: [PATCH 4/6] State dit's particle cost by class, its name uses as measured, and record the check (#1159) The join cuts any particle opening the second half, French de and Le as well as Abou and Al; the attribution is a Cantonese and a Latvian given name and a surname Dite, by the names' shape; the test's name says what it checks; nameparser/vocab/AGENTS.md records the check the review found missing, a joining word's costs run by class. Co-Authored-By: Claude Opus 5.5 --- docs/design/decisions/P3-connectives.md | 2 +- docs/languages.rst | 13 +++++++------ nameparser/vocab/AGENTS.md | 4 ++++ nameparser/vocab/fr.toml | 4 ++-- tests/v2/test_locales.py | 5 ++++- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/docs/design/decisions/P3-connectives.md b/docs/design/decisions/P3-connectives.md index d0962e713..0a21fbe3a 100644 --- a/docs/design/decisions/P3-connectives.md +++ b/docs/design/decisions/P3-connectives.md @@ -66,6 +66,6 @@ Open: none in this file. - 2026-10-19 #760 — SUPERSEDED IN PART 2026-11-05 (#1098): its example reads family 'Puig y', suffix 'i' since rules/P13 joins a connective with nothing to link to the word before it (decisions/P13), and `i y Carod Rovira Puig` shows the absorption instead. MOVED FROM group's code comment on the both-sides test, the one fact the #397 entries above did not hold. "No join of its own" is the whole claim a frozen link carries: a NEIGHBOUR's join can still absorb it, since both loops of `join_connectives` skip a frozen piece as the join's SUBJECT and nothing keeps it out of the span another connective's join takes. `Josep Carod Rovira Puig y i` freezes the trailing 'i' (nothing stands on its right) and the 'y' beside it joins across it all the same, for family 'Puig y i', which is what the tree before #397's both-sides scope read there too; pinned by `test_a_frozen_link_is_still_absorbed_by_a_neighbours_join` in tests/v2/pipeline/test_group.py. - 2026-11-21 #1159 — FRENCH `dit` AND `dite` ARE CONNECTIVES UNDER A FRENCH CHOICE, NOT BY DEFAULT. `dit` and `dite` ("called") join two words of a name in two uses: a hereditary French two-part surname, one legal surname in France, Quebec and Switzerland (`Dupont dit Lebrun`), and a West African alias beside the given name (`Mamadou dit Madou`). Read as written, the first half was a middle name (`Jean Dupont dit Lebrun` → middle 'Dupont dit', family 'Lebrun'). Neither word had a reading. As a particle the word strands the first surname in the middle and reads `Dit` opening a name as a particle; as an alias marker (rules/N4) it cuts a legal surname in half; a connective joins both sides, which both uses want, so `fr.toml` lists both as `conjunction`, P3 unchanged. - MEASURED against master 488ea605, the reading on by default first. Every local corpus holds 67 distinct names with `dit` or `dite` as a word between two others or at an end (`config_diff.py diff default --local all --match '(?i)(^|[\s,])dite?($|[\s,.])'`), and 50 move: hereditary surnames read whole, West African aliases joined to the given name with the family as before, and names written family first, data errors and an alias read into the family, wrong before and after. By population, scored against the filed boxes where a corpus has them: `orcid-researchers` 11 records fixed, 0 broken, 3 changed between two wrong readings; `patentsview-inventors` 2 fixed, 3 broken; `psc-individuals` 0 fixed, 3 broken (two of them boxes filing the alias or the first surname as a middle name), 1 changed; and by `snapshot.py --local --base`, `ctgov-officials` 6 moves (2 surnames read whole, 2 a surname `Dite` lower-cased by case repair and its initial dropped, 2 case only), `ctgov-contacts` 4 (3 surnames read whole, 1 family-first, wrong before and after) and `fec-individuals` 2 (a given name `Dit` lower-cased by case repair). The breaks are of two kinds. Where `Dit` or `Dite` is a person's own name (a Cantonese given name written `Dit`, Latvian and Slavic surnames `Dite`, in the corpora read): a three-word name loses its family name to P3's three-word reading (given `X Dit Y`, as `Juan and Garcia` reads), a word ending a name takes the word before it into the family, and case repair writes it in lower case and `initials()` drops it inside a joined part (alone in its field it keeps its initial, `Jean Dit` giving 'J. D.'). And where it is the connective but P3's join, one word on each side, falls short: a Levantine two-part surname whose second half opens with `Abou` or `Al` loses that word from the family (`X Dit Abou Akl` → family 'Akl'). By default, then, the scored populations fix 13 records and break 6, and the unscored ones read 5 names right and break 4 by case, more breaks than a handful, so the reading is written `default = false`, read under a French choice: with it the default moves 0 of the 67, and the French choice moves the same 50 names to the same readings, its costs included. A gate keeping the reading only where no name reads (a lower-case `dit` alone, say) would need a property the build does not have, and was not built. + MEASURED against master 488ea605, the reading on by default first. Every local corpus holds 67 distinct names with `dit` or `dite` as a word between two others or at an end (`config_diff.py diff default --local all --match '(?i)(^|[\s,])dite?($|[\s,.])'`), and 50 move: hereditary surnames read whole, West African aliases joined to the given name with the family as before, and names written family first, data errors and an alias read into the family, wrong before and after. By population, scored against the filed boxes where a corpus has them: `orcid-researchers` 11 records fixed, 0 broken, 3 changed between two wrong readings; `patentsview-inventors` 2 fixed, 3 broken; `psc-individuals` 0 fixed, 3 broken (two of them boxes filing the alias or the first surname as a middle name), 1 changed; and by `snapshot.py --local --base`, `ctgov-officials` 6 moves (2 surnames read whole, 2 a surname `Dite` lower-cased by case repair and its initial dropped, 2 case only), `ctgov-contacts` 4 (3 surnames read whole, 1 family-first, wrong before and after) and `fec-individuals` 2 (a given name `Dit` lower-cased by case repair). The breaks are of two kinds. Where `Dit` or `Dite` is a person's own name, a given name or a surname (a Cantonese and a Latvian given name and a surname `Dite` among the corpora's, judged by the names' shape, the readings holding no country): a three-word name loses its family name to P3's three-word reading (given `X Dit Y`, as `Juan and Garcia` reads), a word ending a name takes the word before it into the family, and case repair writes it in lower case and `initials()` drops it inside a joined part (alone in its field it keeps its initial, `Jean Dit` giving 'J. D.'). And where it is the connective but P3's join, one word on each side, falls short: a second half opening with a particle loses the particle to the middle name, whatever its language (`X Dit Abou Akl` → family 'Akl' among the corpora's Levantine surnames; `Jean Dupont dit de Lebrun` → family 'Lebrun'). One three-word name with an Arabic word on each side reads as one given name, and whether its `Dit` is a name or the connective the record does not say. By default, then, the scored populations fix 13 records and break 6, and the unscored ones read 5 names right and break 4 by case, more breaks than a handful, so the reading is written `default = false`, read under a French choice: with it the default moves 0 of the 67, and the French choice moves the same 50 names to the same readings, its costs included. A gate keeping the reading only where no name reads (a lower-case `dit` alone, say) would need a property the build does not have, and was not built. The grid, under all three orders and the four comma shapes: a title and a suffix around the name keep their fields, capitals and lower case read alike, two in one name join all three parts, `Dupont dit Lebrun, Jean` and `Traore, Mamadou dit Madou` read as their comma-free twins, a family-first order lays the joined part out by position (`Dupont dit Lebrun Jean` → family 'Dupont dit Lebrun'), `dit` opening a two-word name or alone after one word is a name word, and a hyphenated `Dupont-dit-Lebrun` is one word in every configuration. Under the choice, two more costs of the same kind: `Dit` opening a name of three words or more joins the next word into the given name (`Dit Jean Dupont` → given 'Dit Jean'), and a suffix comma after a joined name leaves no family (`Dupont dit Lebrun, Jr.` → given 'Dupont dit Lebrun', a `given-or-family` report; the default reads family 'Lebrun'), as P3 reads any connective there; and case repair writes a hyphenated `-dit-` in lower case (`JEAN DUPONT-DIT-LEBRUN` → 'Jean Dupont-dit-Lebrun'), which the 67-name population, read by a pattern that finds `dit` only between spaces or commas, does not count, the `ctgov-officials` case moves above being of that spelling. The name match under the French choice reads either half of the surname as part of the other (`Jean Dupont dit Lebrun` / `Jean Dupont` and `/ Jean Lebrun`, `part-of-other`) and the hyphenated spelling as `joined`, where the default reads `Jean Dupont` as a conflict; `match_diff.py` parses under `Parser()` and `locales.ES` only, so it moves nothing here by construction. RECOMPUTE: the diff above with `expr:Parser(lexicon=Lexicon.default().add("dit", "dite", kind="conjunction"))` on master, or `plain:fr` on the branch, `--readings` in each tree; `local_agreement.py orcid-researchers|patentsview-inventors|psc-individuals --base <488ea605>` and `snapshot.py --local ctgov-officials|ctgov-contacts|fec-individuals --base <488ea605>`, run on a tree holding the reading on by default. diff --git a/docs/languages.rst b/docs/languages.rst index 93558f9e6..c6c95f421 100644 --- a/docs/languages.rst +++ b/docs/languages.rst @@ -1394,8 +1394,8 @@ default does not, and reads the first half as a middle name: 'Mamadou dit Madou' It is a choice rather than the default because ``Dit`` and ``Dite`` are -also names (a Cantonese given name, Latvian and Slavic surnames), and -the choice reads the word as a connective wherever it stands: +also given names and surnames (a Cantonese and a Latvian given name, and +a surname ``Dite``, among them), and the choice reads the word as a connective wherever it stands: - **A name of three words** with the name in the middle is read as one given name, as ``Juan and Garcia`` is (``Sok Dit Chan`` gives given @@ -1404,10 +1404,6 @@ the choice reads the word as a connective wherever it stands: the given name (``Dit Jean Dupont`` gives given ``Dit Jean``). - **Ending a name**, it joins the word before it to the family name (``Tran Thi Dit`` gives family ``Thi Dit``). -- **An Arabic surname joined by it** whose second half opens with - ``Abou`` or ``Al`` is cut after that word (``Karim Haddad dit Abou - Nasr`` gives family ``Nasr``), the connective joining one word on - each side. - **Before a comma and a suffix**, the joined name is read as the given name and the family is left empty (``Dupont dit Lebrun, Jr.``). - **Case repair** of a name written in one case writes it in lower @@ -1421,6 +1417,11 @@ its fields read the same either way; case repair writes its ``dit`` in lower case under the choice (``JEAN DUPONT-DIT-LEBRUN`` gives ``Jean Dupont-dit-Lebrun``). +The connective joins one word on each side, so a surname whose second +half opens with a particle loses the particle to the middle name, in +any language (``Jean Dupont dit de Lebrun`` gives family ``Lebrun``, +``Karim Haddad dit Abou Nasr`` family ``Nasr``). + .. _burmese-names: Burmese names diff --git a/nameparser/vocab/AGENTS.md b/nameparser/vocab/AGENTS.md index b255d0e39..251887f50 100644 --- a/nameparser/vocab/AGENTS.md +++ b/nameparser/vocab/AGENTS.md @@ -18,6 +18,10 @@ An acronym credential is matched with every full stop removed, so listing `P.Eng 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`. +## Step 2, for a joining word: state its costs by class, from a grid + +A word that joins its neighbours (a connective, a particle) reaches every word beside it, so a cost read off the corpus names the instances the corpus held, not the class: #1159's French `dit` was first written as cutting an Arabic `Abou` or `Al` off the family, which is P3's one-word join meeting any particle (`Jean Dupont dit de Lebrun` → family 'Lebrun'), and as giving no initial, where only a joined `dit` loses one (`Jean Dit` keeps 'J. D.'), each found by the review of the commit that wrote it. Before writing a cost, run it with a neighbour of each class the join can meet (a particle of two languages, a title, a lone word in its field, a name word on either side, a word ending the name), and state the class with the corpus's instance as its measured example; and attribute a word's name uses only to what the records show (a name's shape, where no country is held), never to the examples you invented. + ## Step 2, for a glued word: does any name, or any longer word, end in it? A word that would peel GLUED (`GLUED_HONORIFICS`) asks a different question, whether any name ENDS in it, and for a CJK word the tool answers that too: an ends-with row from a cached index of Wikidata's CJK name labels (built on first use; 33 minutes on 2026-10-17), plus the names the word ends across the family/given join (阿部 + 長 for 部長). Read the tool's hits by item before counting them, because labels include transcriptions and mislabels: #707's one hit for 二世 was 厄德二世, the given name Odo with a regnal numeral in its Chinese label, borne by 109 Western people named Odo. Then ask a third question the tool cannot: does a common longer word end in it? The peel matches the end of a token, spaced or glued, so a listed tail splits every unlisted compound that ends in it — #707 vetted 議員, 社長 and 医学博士 against names and its review found 衆議院議員, 副社長 and 獣医学博士 cut at the tail (`田中 副社長` → given 副); no corpus held a compound office word until #707's rules examples added two, so the snapshot was silent about the class. List the common compounds whole or record the split as a cost. diff --git a/nameparser/vocab/fr.toml b/nameparser/vocab/fr.toml index 05a07a9df..65459e4c4 100644 --- a/nameparser/vocab/fr.toml +++ b/nameparser/vocab/fr.toml @@ -184,11 +184,11 @@ note = "Has a vowel, which is why the criterion is \"abbreviation of a word that [[word]] text = "dit" -conjunction = { default = false, issue = 1159, expands = "called (masculine), joining a hereditary two-part surname (Dupont dit Lebrun) or an alias to the given name (Mamadou dit Madou)", note = "Off by default: Dit and Dite are also names (a Cantonese given name, Latvian and Slavic surnames, in the corpora measured), and on by default the local corpora fixed 13 scored records against 6 broken, plus 4 names lower-cased by case repair (decisions/P3, 2026-11-21)." } +conjunction = { default = false, issue = 1159, expands = "called (masculine), joining a hereditary two-part surname (Dupont dit Lebrun) or an alias to the given name (Mamadou dit Madou)", note = "Off by default: Dit and Dite are also given names and surnames (a Cantonese and a Latvian given name, a surname Dite, in the corpora measured), and on by default the local corpora fixed 13 scored records against 6 broken, plus 4 names lower-cased by case repair (decisions/P3, 2026-11-21)." } [[word]] text = "dite" -conjunction = { default = false, issue = 1159, expands = "called (feminine), joining a hereditary two-part surname (Dupont dit Lebrun) or an alias to the given name (Mamadou dit Madou)", note = "Off by default: Dit and Dite are also names (a Cantonese given name, Latvian and Slavic surnames, in the corpora measured), and on by default the local corpora fixed 13 scored records against 6 broken, plus 4 names lower-cased by case repair (decisions/P3, 2026-11-21)." } +conjunction = { default = false, issue = 1159, expands = "called (feminine), joining a hereditary two-part surname (Dupont dit Lebrun) or an alias to the given name (Mamadou dit Madou)", note = "Off by default: Dit and Dite are also given names and surnames (a Cantonese and a Latvian given name, a surname Dite, in the corpora measured), and on by default the local corpora fixed 13 scored records against 6 broken, plus 4 names lower-cased by case repair (decisions/P3, 2026-11-21)." } [[word]] text = "et" diff --git a/tests/v2/test_locales.py b/tests/v2/test_locales.py index 3c0d5a820..8a3491ba3 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -222,6 +222,9 @@ def test_nl_reads_a_leading_ten_by_its_given_reading_unless_strict( ("Tran Thi Dit", ("Tran", "Thi", "Dit"), ("Tran", "", "Thi Dit")), ("Dupont dit Lebrun, Jr.", ("Dupont", "dit", "Lebrun"), ("Dupont dit Lebrun", "", "")), + # and a second half opening with a particle loses it to the middle + ("Jean Dupont dit de Lebrun", ("Jean", "Dupont dit", "de Lebrun"), + ("Jean", "Dupont dit de", "Lebrun")), ]) def test_dit_is_a_connective_under_a_french_choice_only( text: str, default: tuple[str, str, str], @@ -251,7 +254,7 @@ def test_dit_stays_a_connective_when_french_is_stacked_or_strict() -> None: assert parser.parse("Jean Dupont dit Lebrun").family == "Dupont dit Lebrun" -def test_a_french_choice_repairs_dit_in_lower_case_and_gives_it_no_initial() -> None: +def test_a_french_choice_repairs_dit_in_lower_case_and_drops_its_initial_in_a_joined_part() -> None: # decisions/P3's case and initial costs, where Dit is a name french, default = parser_for(_FRENCH), Parser() for text, repaired, initials, as_default in ( From 1d5f5d59949f1ec28e0493cda0053c3f3d200a2f Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Sat, 21 Nov 2026 12:31:17 -0800 Subject: [PATCH 5/6] Scope dit's particle cost to the path it reads on, and pin its other forms (#1159) Without a comma the particle goes to the middle name given-first and the second half leaves the family under a family-first order; a family comma keeps the surname whole. Rows pin the comma and family-first forms, and nameparser/vocab/AGENTS.md's check names the comma shapes and orders. Co-Authored-By: Claude Opus 5.5 --- docs/design/decisions/P3-connectives.md | 4 ++-- docs/languages.rst | 14 ++++++++++---- nameparser/vocab/AGENTS.md | 2 +- tests/v2/test_locales.py | 6 ++++++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/design/decisions/P3-connectives.md b/docs/design/decisions/P3-connectives.md index 0a21fbe3a..8efe3ffec 100644 --- a/docs/design/decisions/P3-connectives.md +++ b/docs/design/decisions/P3-connectives.md @@ -66,6 +66,6 @@ Open: none in this file. - 2026-10-19 #760 — SUPERSEDED IN PART 2026-11-05 (#1098): its example reads family 'Puig y', suffix 'i' since rules/P13 joins a connective with nothing to link to the word before it (decisions/P13), and `i y Carod Rovira Puig` shows the absorption instead. MOVED FROM group's code comment on the both-sides test, the one fact the #397 entries above did not hold. "No join of its own" is the whole claim a frozen link carries: a NEIGHBOUR's join can still absorb it, since both loops of `join_connectives` skip a frozen piece as the join's SUBJECT and nothing keeps it out of the span another connective's join takes. `Josep Carod Rovira Puig y i` freezes the trailing 'i' (nothing stands on its right) and the 'y' beside it joins across it all the same, for family 'Puig y i', which is what the tree before #397's both-sides scope read there too; pinned by `test_a_frozen_link_is_still_absorbed_by_a_neighbours_join` in tests/v2/pipeline/test_group.py. - 2026-11-21 #1159 — FRENCH `dit` AND `dite` ARE CONNECTIVES UNDER A FRENCH CHOICE, NOT BY DEFAULT. `dit` and `dite` ("called") join two words of a name in two uses: a hereditary French two-part surname, one legal surname in France, Quebec and Switzerland (`Dupont dit Lebrun`), and a West African alias beside the given name (`Mamadou dit Madou`). Read as written, the first half was a middle name (`Jean Dupont dit Lebrun` → middle 'Dupont dit', family 'Lebrun'). Neither word had a reading. As a particle the word strands the first surname in the middle and reads `Dit` opening a name as a particle; as an alias marker (rules/N4) it cuts a legal surname in half; a connective joins both sides, which both uses want, so `fr.toml` lists both as `conjunction`, P3 unchanged. - MEASURED against master 488ea605, the reading on by default first. Every local corpus holds 67 distinct names with `dit` or `dite` as a word between two others or at an end (`config_diff.py diff default --local all --match '(?i)(^|[\s,])dite?($|[\s,.])'`), and 50 move: hereditary surnames read whole, West African aliases joined to the given name with the family as before, and names written family first, data errors and an alias read into the family, wrong before and after. By population, scored against the filed boxes where a corpus has them: `orcid-researchers` 11 records fixed, 0 broken, 3 changed between two wrong readings; `patentsview-inventors` 2 fixed, 3 broken; `psc-individuals` 0 fixed, 3 broken (two of them boxes filing the alias or the first surname as a middle name), 1 changed; and by `snapshot.py --local --base`, `ctgov-officials` 6 moves (2 surnames read whole, 2 a surname `Dite` lower-cased by case repair and its initial dropped, 2 case only), `ctgov-contacts` 4 (3 surnames read whole, 1 family-first, wrong before and after) and `fec-individuals` 2 (a given name `Dit` lower-cased by case repair). The breaks are of two kinds. Where `Dit` or `Dite` is a person's own name, a given name or a surname (a Cantonese and a Latvian given name and a surname `Dite` among the corpora's, judged by the names' shape, the readings holding no country): a three-word name loses its family name to P3's three-word reading (given `X Dit Y`, as `Juan and Garcia` reads), a word ending a name takes the word before it into the family, and case repair writes it in lower case and `initials()` drops it inside a joined part (alone in its field it keeps its initial, `Jean Dit` giving 'J. D.'). And where it is the connective but P3's join, one word on each side, falls short: a second half opening with a particle loses the particle to the middle name, whatever its language (`X Dit Abou Akl` → family 'Akl' among the corpora's Levantine surnames; `Jean Dupont dit de Lebrun` → family 'Lebrun'). One three-word name with an Arabic word on each side reads as one given name, and whether its `Dit` is a name or the connective the record does not say. By default, then, the scored populations fix 13 records and break 6, and the unscored ones read 5 names right and break 4 by case, more breaks than a handful, so the reading is written `default = false`, read under a French choice: with it the default moves 0 of the 67, and the French choice moves the same 50 names to the same readings, its costs included. A gate keeping the reading only where no name reads (a lower-case `dit` alone, say) would need a property the build does not have, and was not built. - The grid, under all three orders and the four comma shapes: a title and a suffix around the name keep their fields, capitals and lower case read alike, two in one name join all three parts, `Dupont dit Lebrun, Jean` and `Traore, Mamadou dit Madou` read as their comma-free twins, a family-first order lays the joined part out by position (`Dupont dit Lebrun Jean` → family 'Dupont dit Lebrun'), `dit` opening a two-word name or alone after one word is a name word, and a hyphenated `Dupont-dit-Lebrun` is one word in every configuration. Under the choice, two more costs of the same kind: `Dit` opening a name of three words or more joins the next word into the given name (`Dit Jean Dupont` → given 'Dit Jean'), and a suffix comma after a joined name leaves no family (`Dupont dit Lebrun, Jr.` → given 'Dupont dit Lebrun', a `given-or-family` report; the default reads family 'Lebrun'), as P3 reads any connective there; and case repair writes a hyphenated `-dit-` in lower case (`JEAN DUPONT-DIT-LEBRUN` → 'Jean Dupont-dit-Lebrun'), which the 67-name population, read by a pattern that finds `dit` only between spaces or commas, does not count, the `ctgov-officials` case moves above being of that spelling. The name match under the French choice reads either half of the surname as part of the other (`Jean Dupont dit Lebrun` / `Jean Dupont` and `/ Jean Lebrun`, `part-of-other`) and the hyphenated spelling as `joined`, where the default reads `Jean Dupont` as a conflict; `match_diff.py` parses under `Parser()` and `locales.ES` only, so it moves nothing here by construction. + MEASURED against master 488ea605, the reading on by default first. Every local corpus holds 67 distinct names with `dit` or `dite` as a word between two others or at an end (`config_diff.py diff default --local all --match '(?i)(^|[\s,])dite?($|[\s,.])'`), and 50 move: hereditary surnames read whole, West African aliases joined to the given name with the family as before, and names written family first, data errors and an alias read into the family, wrong before and after. By population, scored against the filed boxes where a corpus has them: `orcid-researchers` 11 records fixed, 0 broken, 3 changed between two wrong readings; `patentsview-inventors` 2 fixed, 3 broken; `psc-individuals` 0 fixed, 3 broken (two of them boxes filing the alias or the first surname as a middle name), 1 changed; and by `snapshot.py --local --base`, `ctgov-officials` 6 moves (2 surnames read whole, 2 a surname `Dite` lower-cased by case repair and its initial dropped, 2 case only), `ctgov-contacts` 4 (3 surnames read whole, 1 family-first, wrong before and after) and `fec-individuals` 2 (a given name `Dit` lower-cased by case repair). The breaks are of two kinds. Where `Dit` or `Dite` is a person's own name, a given name or a surname (a Cantonese and a Latvian given name and a surname `Dite` among the corpora's, judged by the names' shape, the readings holding no country): a three-word name loses its family name to P3's three-word reading (given `X Dit Y`, as `Juan and Garcia` reads), a word ending a name takes the word before it into the family, and case repair writes it in lower case and `initials()` drops it inside a joined part (alone in its field it keeps its initial, `Jean Dit` giving 'J. D.'). And where it is the connective but P3's join, one word on each side, falls short: a second half opening with a particle, whatever its language, is split where the name has no comma: given name first, the particle goes to the middle with the first half (`X Dit Abou Akl` → family 'Akl' among the corpora's Levantine surnames; `Jean Dupont dit de Lebrun` → family 'Lebrun'; of a run `de la` the first word only), and under a family-first order the second half leaves the family (`Dupont dit de Lebrun Jean` → family 'Dupont dit de'), while after a family comma the surname reads whole (`Dupont dit de Lebrun, Jean`). One three-word name with an Arabic word on each side reads as one given name, and whether its `Dit` is a name or the connective the record does not say. By default, then, the scored populations fix 13 records and break 6, and the unscored ones read 5 names right and break 4 by case, more breaks than a handful, so the reading is written `default = false`, read under a French choice: with it the default moves 0 of the 67, and the French choice moves the same 50 names to the same readings, its costs included. A gate keeping the reading only where no name reads (a lower-case `dit` alone, say) would need a property the build does not have, and was not built. + The grid, under all three orders and the four comma shapes: a title and a suffix around the name keep their fields, capitals and lower case read alike, two in one name join all three parts, `Dupont dit Lebrun, Jean` and `Traore, Mamadou dit Madou` read as their comma-free twins, a family-first order lays the joined part out by position (`Dupont dit Lebrun Jean` → family 'Dupont dit Lebrun', a particle opening the second half aside, below), `dit` opening a two-word name or alone after one word is a name word, and a hyphenated `Dupont-dit-Lebrun` is one word in every configuration. Under the choice, two more costs of the same kind: `Dit` opening a name of three words or more joins the next word into the given name (`Dit Jean Dupont` → given 'Dit Jean'), and a suffix comma after a joined name leaves no family (`Dupont dit Lebrun, Jr.` → given 'Dupont dit Lebrun', a `given-or-family` report; the default reads family 'Lebrun'), as P3 reads any connective there; and case repair writes a hyphenated `-dit-` in lower case (`JEAN DUPONT-DIT-LEBRUN` → 'Jean Dupont-dit-Lebrun'), which the 67-name population, read by a pattern that finds `dit` only between spaces or commas, does not count, the `ctgov-officials` case moves above being of that spelling. The name match under the French choice reads either half of the surname as part of the other (`Jean Dupont dit Lebrun` / `Jean Dupont` and `/ Jean Lebrun`, `part-of-other`) and the hyphenated spelling as `joined`, where the default reads `Jean Dupont` as a conflict; `match_diff.py` parses under `Parser()` and `locales.ES` only, so it moves nothing here by construction. RECOMPUTE: the diff above with `expr:Parser(lexicon=Lexicon.default().add("dit", "dite", kind="conjunction"))` on master, or `plain:fr` on the branch, `--readings` in each tree; `local_agreement.py orcid-researchers|patentsview-inventors|psc-individuals --base <488ea605>` and `snapshot.py --local ctgov-officials|ctgov-contacts|fec-individuals --base <488ea605>`, run on a tree holding the reading on by default. diff --git a/docs/languages.rst b/docs/languages.rst index c6c95f421..987f95bf4 100644 --- a/docs/languages.rst +++ b/docs/languages.rst @@ -1395,7 +1395,8 @@ default does not, and reads the first half as a middle name: It is a choice rather than the default because ``Dit`` and ``Dite`` are also given names and surnames (a Cantonese and a Latvian given name, and -a surname ``Dite``, among them), and the choice reads the word as a connective wherever it stands: +a surname ``Dite``, among them), and the choice reads the word as a +connective wherever it stands: - **A name of three words** with the name in the middle is read as one given name, as ``Juan and Garcia`` is (``Sok Dit Chan`` gives given @@ -1418,9 +1419,14 @@ lower case under the choice (``JEAN DUPONT-DIT-LEBRUN`` gives ``Jean Dupont-dit-Lebrun``). The connective joins one word on each side, so a surname whose second -half opens with a particle loses the particle to the middle name, in -any language (``Jean Dupont dit de Lebrun`` gives family ``Lebrun``, -``Karim Haddad dit Abou Nasr`` family ``Nasr``). +half opens with a particle, in any language, is split where the name +has no comma: written given name first, the particle goes to the middle +name with the first half (``Jean Dupont dit de Lebrun`` gives family +``Lebrun``, ``Karim Haddad dit Abou Nasr`` family ``Nasr``; of a run +such as ``de la`` only the first word), and under a family-first order +the second half leaves the family instead (``Dupont dit de Lebrun +Jean`` gives family ``Dupont dit de``). After a family comma the +surname is read whole (``Dupont dit de Lebrun, Jean``). .. _burmese-names: diff --git a/nameparser/vocab/AGENTS.md b/nameparser/vocab/AGENTS.md index 251887f50..8edc64789 100644 --- a/nameparser/vocab/AGENTS.md +++ b/nameparser/vocab/AGENTS.md @@ -20,7 +20,7 @@ A reading written for one choice is measured under that choice's own parser, not ## Step 2, for a joining word: state its costs by class, from a grid -A word that joins its neighbours (a connective, a particle) reaches every word beside it, so a cost read off the corpus names the instances the corpus held, not the class: #1159's French `dit` was first written as cutting an Arabic `Abou` or `Al` off the family, which is P3's one-word join meeting any particle (`Jean Dupont dit de Lebrun` → family 'Lebrun'), and as giving no initial, where only a joined `dit` loses one (`Jean Dit` keeps 'J. D.'), each found by the review of the commit that wrote it. Before writing a cost, run it with a neighbour of each class the join can meet (a particle of two languages, a title, a lone word in its field, a name word on either side, a word ending the name), and state the class with the corpus's instance as its measured example; and attribute a word's name uses only to what the records show (a name's shape, where no country is held), never to the examples you invented. +A word that joins its neighbours (a connective, a particle) reaches every word beside it, so a cost read off the corpus names the instances the corpus held, not the class: #1159's French `dit` was first written as cutting an Arabic `Abou` or `Al` off the family, which is P3's one-word join meeting any particle (`Jean Dupont dit de Lebrun` → family 'Lebrun'), and as giving no initial, where only a joined `dit` loses one (`Jean Dit` keeps 'J. D.'), each found by the review of the commit that wrote it. Before writing a cost, run it with a neighbour of each class the join can meet (a particle of two languages, a title, a lone word in its field, a name word on either side, a word ending the name) in each comma shape and each `name_order` (root AGENTS.md's sweep): the particle cost's first class statement held given-first without a comma and was wrong on both other paths, a family comma keeping the surname whole and a family-first order cutting its second half instead, and state the class with the corpus's instance as its measured example; and attribute a word's name uses only to what the records show (a name's shape, where no country is held), never to the examples you invented. ## Step 2, for a glued word: does any name, or any longer word, end in it? diff --git a/tests/v2/test_locales.py b/tests/v2/test_locales.py index 8a3491ba3..b860b30b7 100644 --- a/tests/v2/test_locales.py +++ b/tests/v2/test_locales.py @@ -225,6 +225,9 @@ def test_nl_reads_a_leading_ten_by_its_given_reading_unless_strict( # and a second half opening with a particle loses it to the middle ("Jean Dupont dit de Lebrun", ("Jean", "Dupont dit", "de Lebrun"), ("Jean", "Dupont dit de", "Lebrun")), + # after a family comma the surname reads whole + ("Dupont dit de Lebrun, Jean", ("Jean", "", "Dupont dit de Lebrun"), + ("Jean", "", "Dupont dit de Lebrun")), ]) def test_dit_is_a_connective_under_a_french_choice_only( text: str, default: tuple[str, str, str], @@ -246,6 +249,9 @@ def test_a_french_choice_lays_a_dit_name_out_by_a_family_first_order( parser, policy=dataclasses.replace(parser.policy, name_order=order)) name = parser.parse(text) assert (name.given, name.middle, name.family) == (given, "", family) + # the particle cost's family-first form: the second half leaves the + # family (decisions/P3) + assert parser.parse("Dupont dit de Lebrun Jean").family == "Dupont dit de" def test_dit_stays_a_connective_when_french_is_stacked_or_strict() -> None: From b6367cc1e935b6d5a7beb2482f134375f531c05a Mon Sep 17 00:00:00 2001 From: Derek Gulbranson Date: Sat, 21 Nov 2026 12:32:57 -0800 Subject: [PATCH 6/6] Say a suffix comma splits a particle-led dit surname too (#1159) Co-Authored-By: Claude Opus 5.5 --- docs/design/decisions/P3-connectives.md | 2 +- docs/languages.rst | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/design/decisions/P3-connectives.md b/docs/design/decisions/P3-connectives.md index 8efe3ffec..c94438e57 100644 --- a/docs/design/decisions/P3-connectives.md +++ b/docs/design/decisions/P3-connectives.md @@ -66,6 +66,6 @@ Open: none in this file. - 2026-10-19 #760 — SUPERSEDED IN PART 2026-11-05 (#1098): its example reads family 'Puig y', suffix 'i' since rules/P13 joins a connective with nothing to link to the word before it (decisions/P13), and `i y Carod Rovira Puig` shows the absorption instead. MOVED FROM group's code comment on the both-sides test, the one fact the #397 entries above did not hold. "No join of its own" is the whole claim a frozen link carries: a NEIGHBOUR's join can still absorb it, since both loops of `join_connectives` skip a frozen piece as the join's SUBJECT and nothing keeps it out of the span another connective's join takes. `Josep Carod Rovira Puig y i` freezes the trailing 'i' (nothing stands on its right) and the 'y' beside it joins across it all the same, for family 'Puig y i', which is what the tree before #397's both-sides scope read there too; pinned by `test_a_frozen_link_is_still_absorbed_by_a_neighbours_join` in tests/v2/pipeline/test_group.py. - 2026-11-21 #1159 — FRENCH `dit` AND `dite` ARE CONNECTIVES UNDER A FRENCH CHOICE, NOT BY DEFAULT. `dit` and `dite` ("called") join two words of a name in two uses: a hereditary French two-part surname, one legal surname in France, Quebec and Switzerland (`Dupont dit Lebrun`), and a West African alias beside the given name (`Mamadou dit Madou`). Read as written, the first half was a middle name (`Jean Dupont dit Lebrun` → middle 'Dupont dit', family 'Lebrun'). Neither word had a reading. As a particle the word strands the first surname in the middle and reads `Dit` opening a name as a particle; as an alias marker (rules/N4) it cuts a legal surname in half; a connective joins both sides, which both uses want, so `fr.toml` lists both as `conjunction`, P3 unchanged. - MEASURED against master 488ea605, the reading on by default first. Every local corpus holds 67 distinct names with `dit` or `dite` as a word between two others or at an end (`config_diff.py diff default --local all --match '(?i)(^|[\s,])dite?($|[\s,.])'`), and 50 move: hereditary surnames read whole, West African aliases joined to the given name with the family as before, and names written family first, data errors and an alias read into the family, wrong before and after. By population, scored against the filed boxes where a corpus has them: `orcid-researchers` 11 records fixed, 0 broken, 3 changed between two wrong readings; `patentsview-inventors` 2 fixed, 3 broken; `psc-individuals` 0 fixed, 3 broken (two of them boxes filing the alias or the first surname as a middle name), 1 changed; and by `snapshot.py --local --base`, `ctgov-officials` 6 moves (2 surnames read whole, 2 a surname `Dite` lower-cased by case repair and its initial dropped, 2 case only), `ctgov-contacts` 4 (3 surnames read whole, 1 family-first, wrong before and after) and `fec-individuals` 2 (a given name `Dit` lower-cased by case repair). The breaks are of two kinds. Where `Dit` or `Dite` is a person's own name, a given name or a surname (a Cantonese and a Latvian given name and a surname `Dite` among the corpora's, judged by the names' shape, the readings holding no country): a three-word name loses its family name to P3's three-word reading (given `X Dit Y`, as `Juan and Garcia` reads), a word ending a name takes the word before it into the family, and case repair writes it in lower case and `initials()` drops it inside a joined part (alone in its field it keeps its initial, `Jean Dit` giving 'J. D.'). And where it is the connective but P3's join, one word on each side, falls short: a second half opening with a particle, whatever its language, is split where the name has no comma: given name first, the particle goes to the middle with the first half (`X Dit Abou Akl` → family 'Akl' among the corpora's Levantine surnames; `Jean Dupont dit de Lebrun` → family 'Lebrun'; of a run `de la` the first word only), and under a family-first order the second half leaves the family (`Dupont dit de Lebrun Jean` → family 'Dupont dit de'), while after a family comma the surname reads whole (`Dupont dit de Lebrun, Jean`). One three-word name with an Arabic word on each side reads as one given name, and whether its `Dit` is a name or the connective the record does not say. By default, then, the scored populations fix 13 records and break 6, and the unscored ones read 5 names right and break 4 by case, more breaks than a handful, so the reading is written `default = false`, read under a French choice: with it the default moves 0 of the 67, and the French choice moves the same 50 names to the same readings, its costs included. A gate keeping the reading only where no name reads (a lower-case `dit` alone, say) would need a property the build does not have, and was not built. + MEASURED against master 488ea605, the reading on by default first. Every local corpus holds 67 distinct names with `dit` or `dite` as a word between two others or at an end (`config_diff.py diff default --local all --match '(?i)(^|[\s,])dite?($|[\s,.])'`), and 50 move: hereditary surnames read whole, West African aliases joined to the given name with the family as before, and names written family first, data errors and an alias read into the family, wrong before and after. By population, scored against the filed boxes where a corpus has them: `orcid-researchers` 11 records fixed, 0 broken, 3 changed between two wrong readings; `patentsview-inventors` 2 fixed, 3 broken; `psc-individuals` 0 fixed, 3 broken (two of them boxes filing the alias or the first surname as a middle name), 1 changed; and by `snapshot.py --local --base`, `ctgov-officials` 6 moves (2 surnames read whole, 2 a surname `Dite` lower-cased by case repair and its initial dropped, 2 case only), `ctgov-contacts` 4 (3 surnames read whole, 1 family-first, wrong before and after) and `fec-individuals` 2 (a given name `Dit` lower-cased by case repair). The breaks are of two kinds. Where `Dit` or `Dite` is a person's own name, a given name or a surname (a Cantonese and a Latvian given name and a surname `Dite` among the corpora's, judged by the names' shape, the readings holding no country): a three-word name loses its family name to P3's three-word reading (given `X Dit Y`, as `Juan and Garcia` reads), a word ending a name takes the word before it into the family, and case repair writes it in lower case and `initials()` drops it inside a joined part (alone in its field it keeps its initial, `Jean Dit` giving 'J. D.'). And where it is the connective but P3's join, one word on each side, falls short: a second half opening with a particle, whatever its language, is split unless a family comma follows the surname, a suffix comma included (`Jean Dupont dit de Lebrun, Jr.` → family 'Lebrun'): given name first, the particle goes to the middle with the first half (`X Dit Abou Akl` → family 'Akl' among the corpora's Levantine surnames; `Jean Dupont dit de Lebrun` → family 'Lebrun'; of a run `de la` the first word only), and under a family-first order the second half leaves the family (`Dupont dit de Lebrun Jean` → family 'Dupont dit de'), while after a family comma the surname reads whole (`Dupont dit de Lebrun, Jean`). One three-word name with an Arabic word on each side reads as one given name, and whether its `Dit` is a name or the connective the record does not say. By default, then, the scored populations fix 13 records and break 6, and the unscored ones read 5 names right and break 4 by case, more breaks than a handful, so the reading is written `default = false`, read under a French choice: with it the default moves 0 of the 67, and the French choice moves the same 50 names to the same readings, its costs included. A gate keeping the reading only where no name reads (a lower-case `dit` alone, say) would need a property the build does not have, and was not built. The grid, under all three orders and the four comma shapes: a title and a suffix around the name keep their fields, capitals and lower case read alike, two in one name join all three parts, `Dupont dit Lebrun, Jean` and `Traore, Mamadou dit Madou` read as their comma-free twins, a family-first order lays the joined part out by position (`Dupont dit Lebrun Jean` → family 'Dupont dit Lebrun', a particle opening the second half aside, below), `dit` opening a two-word name or alone after one word is a name word, and a hyphenated `Dupont-dit-Lebrun` is one word in every configuration. Under the choice, two more costs of the same kind: `Dit` opening a name of three words or more joins the next word into the given name (`Dit Jean Dupont` → given 'Dit Jean'), and a suffix comma after a joined name leaves no family (`Dupont dit Lebrun, Jr.` → given 'Dupont dit Lebrun', a `given-or-family` report; the default reads family 'Lebrun'), as P3 reads any connective there; and case repair writes a hyphenated `-dit-` in lower case (`JEAN DUPONT-DIT-LEBRUN` → 'Jean Dupont-dit-Lebrun'), which the 67-name population, read by a pattern that finds `dit` only between spaces or commas, does not count, the `ctgov-officials` case moves above being of that spelling. The name match under the French choice reads either half of the surname as part of the other (`Jean Dupont dit Lebrun` / `Jean Dupont` and `/ Jean Lebrun`, `part-of-other`) and the hyphenated spelling as `joined`, where the default reads `Jean Dupont` as a conflict; `match_diff.py` parses under `Parser()` and `locales.ES` only, so it moves nothing here by construction. RECOMPUTE: the diff above with `expr:Parser(lexicon=Lexicon.default().add("dit", "dite", kind="conjunction"))` on master, or `plain:fr` on the branch, `--readings` in each tree; `local_agreement.py orcid-researchers|patentsview-inventors|psc-individuals --base <488ea605>` and `snapshot.py --local ctgov-officials|ctgov-contacts|fec-individuals --base <488ea605>`, run on a tree holding the reading on by default. diff --git a/docs/languages.rst b/docs/languages.rst index 987f95bf4..bd02124da 100644 --- a/docs/languages.rst +++ b/docs/languages.rst @@ -1419,8 +1419,9 @@ lower case under the choice (``JEAN DUPONT-DIT-LEBRUN`` gives ``Jean Dupont-dit-Lebrun``). The connective joins one word on each side, so a surname whose second -half opens with a particle, in any language, is split where the name -has no comma: written given name first, the particle goes to the middle +half opens with a particle, in any language, is split unless a family +comma follows it (a suffix comma does not keep it): written given name +first, the particle goes to the middle name with the first half (``Jean Dupont dit de Lebrun`` gives family ``Lebrun``, ``Karim Haddad dit Abou Nasr`` family ``Nasr``; of a run such as ``de la`` only the first word), and under a family-first order