diff --git a/AGENTS.md b/AGENTS.md index 42f46d1d3..f43d8b86c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -273,7 +273,7 @@ The compiled sets, read by `Lexicon` (mostly as the `_sets` field of the same na - suffixes — `SUFFIX_ACRONYMS` (suffix readings with `acronym = true`, matched with every period removed, e.g. "M.D.") and `SUFFIX_WORDS` (the rest, e.g. "Jr."), disjoint because a word has one suffix kind; `SUFFIX_ACRONYMS_AMBIGUOUS` (an acronym reading on a word with a `given` or `family` reading, derived since 2026-10-25: the build refuses the phase 1 flag `may_be_name`; a `given` reading carrying `same_as`, a name written short, marks no clash with a suffix reading since #1383 (`ReadingProperties.marks_a_clash`), so `md`, Muhammad written short, stays an unambiguous credential); `SUFFIX_WORDS_AMBIGUOUS` (its word twin, a generation or agnomen reading, or a credential written as a word, on a word with a name reading, `fils`, `junior`, `júnior`, the agnomens and `kc`, `pc` and `dl`, gated by the count, rules/S11, since 2026-10-25, the credentials since 2026-10-30, #965, Junior since #1039) with `AGNOMENS` inside it (the `agnomen` kind) and `TITLE_CASE_NAME_WORDS` beside it (the readings written `title_case_is_name`, `fils`, `père`, `kc`, `pc`, `dl`, whose writing leans, Title case to the name; any other gated word's writing never leans, #1039); and `GLUED_HONORIFICS` (#308, `attached`), the subset of `SUFFIX_WORDS` the peel may split off the END of a name token — a separate, harsher bar, since the glued position has no writer-drawn boundary to lean on, and each word refused it carries `excluded = { attached = … }` - particles — `PARTICLES` (family-name particles, e.g. "de", "van") and `NON_GIVEN_NAME_PARTICLES`, the curated subset that is *never* a standalone given name (the particles whose word has no `given` reading, each stating `may_be_given = false`; a `given` reading on the word is what makes a particle possibly given, the phase 1 flag `may_be_given = true` refused since 2026-10-25). What the subset licenses is rules/P1's fold in `post_rules` (the "rule 1b" of older issue comments — decisions/legacy-rule-numbers maps the old numbers), and the fold has ONE site: the piece that OPENS the name. A lone never-given particle there, with at least one more name word behind it, starts the family. Titles do not move the opening position (rules/P4), so `Sir de Mesnil` reads family `de Mesnil` under every `name_order`, as `de Mesnil` does. How far the fold reaches depends on the order the name was read under: by default it takes the rest of the name (`de Mesnil Jean` → family `de Mesnil Jean`); under either family-first order it takes the particle run plus ONE name unit and lays the rest out by the order (`de Mesnil Jean` → family `de Mesnil`, given `Jean`); after a family comma it takes the rest of that part whatever the order (`Smith, de Mesnil Jean` → family `Smith de Mesnil Jean`). The leading particle stays a lone piece for the fold to find — `group` does not chain it forward, and the fold walks the particles after it itself — so `de la Vega` reads family `de la Vega` under all three orders. Behind a title-particle (`St`, `Freiherr`, P4's Except) it does chain, and under a family-first order the fold cuts that chain as it cuts a run (`St de Mesnil Jean` → family `de Mesnil`, given `Jean`, #828). The GIVEN position is not a site. It was a second one until #467, which removed it because under a family-first order that slot holds what the caller DECLARED to be the given name: `Mesnil de` under `FAMILY_FIRST` or `FAMILY_FIRST_GIVEN_LAST` reads given `de`, family `Mesnil`. Nor is a particle inside the name: `Juan de la Vega` under a family-first order reads family `Juan`, given `de la Vega`, with no ambiguity recorded — what the vocabulary forbids is the bare particle as a given name, not a name part that begins with one. A bare `de` has nothing to fold into and is placed like any one-word name, by `Policy.lone_name_word` (rules/O5, #1111): given `de` by default under every order, family `de` where the caller sets the switch to family. A leading particle OUTSIDE the set is left to position — `Van Gogh` is given `Van`, family `Gogh` by default and family `Van`, given `Gogh` under both family-first orders — and records a `PARTICLE_OR_GIVEN` ambiguity under all three, save one written in lower case in a mixed-case name under a family-first order, which the fold takes and which records none (`van Gogh` → family `van Gogh`, rules/P11, #670); a never-given particle opening the name records none (`de Mesnil`), and neither does an ambiguous one inside it (`Vincent van Gogh`). The internal `Lexicon._sets.particles_ambiguous`, the particles holding a `given` reading, is its complement within `PARTICLES`, so the two mark OPPOSITE sets — see the flip warning in `docs/migrate.rst` before translating either - bound given names — `BOUND_GIVEN_NAMES` (`bound_given` readings, e.g. "abdul", "abu"; one that is also a particle needs a `given` reading, a build check); a group-stage rule joins the first non-title piece to its following piece before roles are assigned, reserving a family word unless a family comma has already fixed it or a given-name title stands ahead (#369, rules/P5) (ported from v1's `_join_bound_first_name`), and `BOUND_PHRASES` (#694, rules/P12, the two-word given names a bound word's `completed_by` lists, Arabic `عبد` before the names of God), each pair joined past the first name word, where P5's join does not reach -- given names written short — `GIVEN_NAME_ABBREVIATIONS` (#789, a `given` reading carrying `same_as`, the full name: "chas", "wm", Filipino "ma", `md`), the given names written short that rules/H2's shape yields to, and that rules/C13's given-name Except reads where one is also a credential opening the part after a family comma (#1393, classify's `vocab:given-abbreviation` tag); nothing else reads it +- given names written short — `GIVEN_NAME_ABBREVIATIONS` (#789, a `given` reading carrying `same_as`, the full name: "chas", "wm", Filipino "ma", `md`), the given names written short that rules/H2's shape yields to, and that rules/C13's given-name Except reads where one is also a credential opening the part after a family comma (#1393, classify's `vocab:given-abbreviation` tag), and that rules/S8's run declines for in a name written wholly in one case with a name word behind it (#1394, `SITI NORA MD YUSRI`); nothing else reads it - names a given name's second half reads — `PARTICLE_GIVEN_NAMES` (#704, a `given` reading written `after_particle`: "carmen", "ángeles", "lurdes", "graças", the Spanish and Portuguese words a compound given name writes behind a particle, which rules/P10 reads as a middle name in `María del Carmen García`, by default, and "piedade" only under a Portuguese choice, #1118, #1122), `SAINT_PARTICLES` (the `saint` kind, `san`, `santa`, `st`, `ste`, `sta`, `sto`, whose run P10 refuses, `Santa María` being a surname) and `SHARED_NAMES` (#704, a name reading written `shared`: Sikh "kaur", "singh", which rules/O6 and O7 neither take nor complete and P10 does not complete, `Kaur del Carmen García`), private; each is read through classify's tags or the lexicon in `_post_rules` - conjunctions — `CONJUNCTIONS` (e.g. "and", "of") used to chain multi-word titles and to join name parts (rules/P3), plus `CONJUNCTIONS_AMBIGUOUS` (#383/#479, rules/P8, `may_be_initial`, refused by the build on anything but a cased single letter), the subset of single cased letters that read as an INITIAL in a name written wholly in one case — a marker set - maiden markers — `MAIDEN_MARKERS` (`birth_marker` readings, e.g. "née", "geb.") routing the following name to `maiden`; with an `addresses = "given"` title, the one kind a phrase may be (`z domu`) diff --git a/docs/customize.rst b/docs/customize.rst index 9cb311745..444278721 100644 --- a/docs/customize.rst +++ b/docs/customize.rst @@ -381,9 +381,10 @@ Keeping Md. a title ^^^^^^^^^^^^^^^^^^^ Through 3.0.1 a leading ``Md.`` read as a title, and ``Md`` after a -family comma as the credential. To keep those readings, remove the -given reading; the name match then no longer links ``Md`` to the -long spellings of Muhammad: +family comma as the credential; through 3.1, ``MD`` inside a name +written in capitals read as the credential, taking the words behind +it. To keep those readings, remove the given reading; the name match +then no longer links ``Md`` to the long spellings of Muhammad: .. doctest:: @@ -392,6 +393,8 @@ long spellings of Muhammad: 'Md.' >>> md_title.parse("Rahman, Md").suffix 'Md' + >>> md_title.parse("SITI NORA MD YUSRI").suffix + 'MD YUSRI' Name readings ^^^^^^^^^^^^^ diff --git a/docs/design/decisions/S8-credentials-trailing-run.md b/docs/design/decisions/S8-credentials-trailing-run.md index 577c9cdf6..3f69c08c4 100644 --- a/docs/design/decisions/S8-credentials-trailing-run.md +++ b/docs/design/decisions/S8-credentials-trailing-run.md @@ -13,6 +13,7 @@ Examples name each field as the default order reads it; under the family-first o - Lifting the credential out of the name, the family-comma path's older reading (`John Smith PhD Jones` as family 'Jones', suffix 'PhD'), was declined — 2026-10-04 #602. - An ambiguous acronym written with its periods starts the run (`John Smith M.A. Jones` → suffix 'M.A. Jones'); and so, since 2026-10-25 #785, does a listed member written in capitals in a name of mixed case, its writing settling it, after the given word after a family comma (`Smith, John MA Jones` → suffix 'MA Jones') and elsewhere only where no name word stands behind it (`John Smith MA JD Jones` → suffix 'MA JD Jones', while `John Smith MA Jones` keeps family 'Jones', 2026-10-26 (Derek)); `John Smith Ma Jones` keeps family 'Jones' and `JOHN SMITH MA JONES` family 'JONES', and `John Smith DO Jones` family 'DO Jones', its particle reading refusing the start — 2026-10-20 #761; 2026-10-25 #785; 2026-10-26 (Derek), #785. - With no family comma, a credential acronym written in Title case with a name word behind it does not start the run, as a settled member does not (`Badrul Akmal Hisham Md Yusoff` → family 'Yusoff', the reading of 1.4.0 through 2.3.0; `John Smith MD Jones` and `John Smith M.D. Jones` → suffix 'MD Jones', 'M.D. Jones'); a suffix word written in Title case still starts it on its case alone (`John Smith Esq Jones` → suffix 'Esq Jones'; a generation word before a name word does not, by the word behind it, below), and so does the acronym after the given word after a family comma (`Smith, John Md Jones` → suffix 'Md Jones') — 2026-11-02 #1019 (Derek). +- With no family comma, in a name written wholly in one case (its own words, or for a word in a maiden clause or between brackets the whole name, S6), a credential that is also a given name written short (`md`, the one such word shipped) with a name word behind it does not start the run, as its Title case does not, and the decline reports `suffix-or-name`, the credential the reading not taken, nothing in the writing settling it (`SITI NORA MD YUSRI` → middle 'NORA MD', family 'YUSRI', reported, the reading of 1.4.0 through 2.3.0; `siti nora md yusri` alike; `AHMAD BIN MD RAHMAN` → family 'BIN MD RAHMAN'). A name word there is `_name_word_behind`'s, a word in lower case included, that holds a letter of a script with case and is no maiden marker, so the run still starts before a credential or suffix word (`JOHN SMITH MD PHD`, `JOHN SMITH MD JR`), a numeral S10 reads as the generation (`JOHN SMITH MD VI JONES`, and since this entry `John Smith Md VI Jones` too), a maiden marker (`JOHN SMITH MD NÉE JONES`) and a word of a script with no case (`محمد علي MD حسن` → suffix 'MD حسن'); written with its periods (`JOHN SMITH M.D. JONES`), in a name of mixed case (`John Smith MD Jones`, `JOHN SMITH née Ann Lee MD Jones`) and after the given word after a family comma (`SMITH, JOHN MD JONES`) it starts it as before. Accepted: the degree in capitals before a family name reads as a name word, reported (`JOHN SMITH MD JONES` → family 'JONES') — 2026-11-18 #1394. Not standing: the split of 2026-10-17 #682, carried out. @@ -37,7 +38,7 @@ Open: #1053, carried over from #965 (an unlisted word in capitals joins a listed - 2026-10-25 #784 — A NUMERAL THAT READS AS THE GENERATION STARTS THE RUN, WHATEVER ITS SPELLING. The run start asked the suffix vocabulary, so a listed numeral started it and a numeral S10 reads by its shape did not: `John Smith III Jones` → suffix 'III Jones', `John Smith VI Jones` → family 'Jones'. It now asks the numeral's predicate (decisions/vocabulary-model's 2026-10-25 2f entry) for a numeral of two or more letters, with the word in front and the name's case, so a Title-case `Vi` in a mixed-case name, which leans to the name, and a numeral behind an initial start nothing. A single letter still never starts the run. The numeral starting the run reports `suffix-or-name` where its shape alone reads it, as S10's numeral does anywhere it is weighed. The given part after a family comma starts its run the same way (`Smith, John VI Jones`). Separately, #819's reading of a lone letter ahead of a further comma stops the run short of that letter (decisions/C9's 2026-10-25 #819 entry). - 2026-10-25 #785 (Derek, 2026-10-23) — A LISTED MEMBER ITS CAPITALS SETTLE STARTS THE RUN, as its dotted spelling has since 2026-10-20 #761, answering #785's second question. Asked of the run start's one predicate (`_pieces.starts_a_credential_run`), whose particle test still refuses `DO`, so a member's other readings answer as before; the inline pre-tests ahead of it (the trailing run's start and the given part's) admit a member, as they admit a numeral. Accepted: a writer's initials in capitals between the given names and the family name that spell a listed member start the run too (rules/S8's Accepted clause). The record, with what was measured, is decisions/S6's entry of this date. - 2026-10-26 (Derek), #785 — WITH NO FAMILY COMMA A NAME WORD BEHIND A SETTLED MEMBER KEEPS IT FROM STARTING THE RUN. SUPERSEDES the rule's Accepted clause of 2026-10-25 (capitals initials and capitals family names reading as suffixes): `Maria Ana MA Silva` keeps family 'Silva', and the Accepted cost is now `John Smith MA Jones` keeping family 'Jones'. The record is decisions/S6's entry of this date. -- 2026-11-02 #1019 (Derek) (its generation word written mid-name, left to the run, superseded by the 2026-11-02 #1023 entry, below) — WITH NO FAMILY COMMA, A CREDENTIAL ACRONYM WRITTEN IN TITLE CASE WITH A NAME WORD BEHIND IT DOES NOT START THE RUN. Since #602 (2.4.0) a credential after two name words takes the rest of its part, a title/suffix dual included, so `Badrul Akmal Hisham Md Yusoff` read family 'Hisham', suffix 'Md Yusoff' from 2.4.0 (while `md` was still a dual; #853 made it credential-only in 2.6.0 and changed nothing here), where 1.4.0 through 2.3.0 read middle 'Akmal Hisham Md', family 'Yusoff' (the wheels, run 2026-11-02). Found by #1017's measurement of the comma count. The run now asks of an acronym (`vocab:suffix` without `vocab:suffix-word`) what it asks of a settled member since 2026-10-26 #785: with a name word behind it (`_pieces._name_word_behind`), written as one run of letters, a trailing period allowed, its first letter a capital and every later one lower case (`Md`, `Phd`, `Md.`; `_pieces.acronym_in_title_case`), it is the writing of a name word, where the credential is written with capitals after the first letter or with periods or joiners inside it (`MD`, `PhD`, `M.D.`, `M.d.`, `Pa-c`), so it starts nothing. The interior-period test is the review's: the first build dropped punctuation before the case test, and read `John Smith M.a. Jones`, `John Smith Ph.d. Jones` and `John Smith Pa-c Jones` as name words, overriding the periods that settle an ambiguous member (S3). The title/suffix duals move with the rest (`John Smith Lt Jones` → middle 'Smith Lt'). The mask is not asked: the three acronyms whose own mask is Title case, `bt` (Baronet), `kt` and `knt`, read as names before a name word too (`John Smith Bt Jones` → middle 'Smith Bt'), an accepted cost, since `Bt` mid-name is mostly the Malay binti (`Siti Hajar Bt Khalit`) and a baronet's `Bt` is written last or before a further post-nominal (`Sir John Smith Bt KBE` → suffix 'Bt KBE'); exempting a word written in its mask would undo the binti reading. Where the settled member's cue does not reach, neither does this: the given part after a family comma (`Smith, John Md Jones` → suffix 'Md Jones'), and a credential behind it (`John Smith Md Phd` → suffix 'Md Phd'). A suffix word, a generation, honorific or other word written out (`Jr`, `Esq`, `III`), has no capitals of its own for Title case to drop, so its case says nothing and it is not asked (`Гай Плиний Старший Иванов` → suffix 'Старший Иванов'). +- 2026-11-02 #1019 (Derek) (its generation word written mid-name, left to the run, superseded by the 2026-11-02 #1023 entry, below; its name of one case, where the run started before a name word, superseded for a given name written short by the 2026-11-18 #1394 entry, below) — WITH NO FAMILY COMMA, A CREDENTIAL ACRONYM WRITTEN IN TITLE CASE WITH A NAME WORD BEHIND IT DOES NOT START THE RUN. Since #602 (2.4.0) a credential after two name words takes the rest of its part, a title/suffix dual included, so `Badrul Akmal Hisham Md Yusoff` read family 'Hisham', suffix 'Md Yusoff' from 2.4.0 (while `md` was still a dual; #853 made it credential-only in 2.6.0 and changed nothing here), where 1.4.0 through 2.3.0 read middle 'Akmal Hisham Md', family 'Yusoff' (the wheels, run 2026-11-02). Found by #1017's measurement of the comma count. The run now asks of an acronym (`vocab:suffix` without `vocab:suffix-word`) what it asks of a settled member since 2026-10-26 #785: with a name word behind it (`_pieces._name_word_behind`), written as one run of letters, a trailing period allowed, its first letter a capital and every later one lower case (`Md`, `Phd`, `Md.`; `_pieces.acronym_in_title_case`), it is the writing of a name word, where the credential is written with capitals after the first letter or with periods or joiners inside it (`MD`, `PhD`, `M.D.`, `M.d.`, `Pa-c`), so it starts nothing. The interior-period test is the review's: the first build dropped punctuation before the case test, and read `John Smith M.a. Jones`, `John Smith Ph.d. Jones` and `John Smith Pa-c Jones` as name words, overriding the periods that settle an ambiguous member (S3). The title/suffix duals move with the rest (`John Smith Lt Jones` → middle 'Smith Lt'). The mask is not asked: the three acronyms whose own mask is Title case, `bt` (Baronet), `kt` and `knt`, read as names before a name word too (`John Smith Bt Jones` → middle 'Smith Bt'), an accepted cost, since `Bt` mid-name is mostly the Malay binti (`Siti Hajar Bt Khalit`) and a baronet's `Bt` is written last or before a further post-nominal (`Sir John Smith Bt KBE` → suffix 'Bt KBE'); exempting a word written in its mask would undo the binti reading. Where the settled member's cue does not reach, neither does this: the given part after a family comma (`Smith, John Md Jones` → suffix 'Md Jones'), and a credential behind it (`John Smith Md Phd` → suffix 'Md Phd'). A suffix word, a generation, honorific or other word written out (`Jr`, `Esq`, `III`), has no capitals of its own for Title case to drop, so its case says nothing and it is not asked (`Гай Плиний Старший Иванов` → suffix 'Старший Иванов'). MEASURED 2026-11-02 against 593d8996 (master, after the review's interior-period fix; the first measurement, against c1ceb3b3 before it, differed only in one more PatentsView record changed), every local corpus read with `--base `: `tools/differential/local_agreement.py --base` for the four scored corpora, `tools/differential/snapshot.py --local --base` for the rest. Scored against the filers' boxes: orcid-researchers 19 records into agreement, 10 out of it, 152 moved between disagreements; psc-individuals 18 in, 14 out, 12 between; patentsview-inventors 19 in, 4 out, 19 between; cz-candidates none. Every record out of agreement had agreed only because the scorer counts the parser's suffix as part of the surname box: `Muhammad Alif Naim Bin Md Khir` read family 'Bin', suffix 'Md Khir' against the filed surname 'Bin Md Khir', and `Maryam Salah Ud Din` family 'Salah', suffix 'Ud Din'; the tree reads family 'Khir' and 'Din', as 1.4.0 does, the patronymic or compound surname being one the positional reading cannot see. The words that move are `Md`, `Ud`, `Bt`, `Pg`, `Mt`, `Cem`, `Ch`, `Obe`, `Mba`, `Ms`, `Am`, `Ra`, `Gm`, `Cro`, `Afm` and `Phd` (and, unscored, `Cap`, `Ches` and `Asla`), the duals `Ms` and `Ra` among them, `Ra` two of the records out of agreement (`Iñigo Eletxiger Ra Aja`), a name word in every moved record but the PSC records that typed credentials in the title box (`Medical Doctor Phd Siri Heydorn`), which the scorer sets aside either way. Unscored: ctgov-officials 9 names move (`Ahmad Zia Ud Din`; `Yu Ngai Ms Leung, MPH` → family 'Leung'), jrc-names 9 (`Muhammad Asyraf Md Kamal`, `Kennedy de Cap Canaveral`), nepal-candidates 1 (`Shubhawati Kumari Ra. Kurmi` → family 'Kurmi'); govuk-people, ukec-individuals, tse-donors, dof-signatures, tw-donors and fec-individuals none, and no committed corpus name. ACCEPTED, found in review: the run declines before any word that reads as a name word, so a Title-case credential before an unlisted one gives the family that word (`Jane Doe Rn Bsn` → family 'Bsn', `bsn` being unlisted; master read suffix 'Rn Bsn'; `bsn` listed since 2026-11-03 #993, the rule's example uses the unlisted `Ccrn`, which reads as `Bsn` did), and one before a title gives the family the title (`John Smith Md Dr` → family 'Dr', `Jane Smith Phd Mrs` → family 'Mrs'). Measured 2026-11-02 over every name holding no comma in the 13 cached local corpora (`~/.cache/nameparser-tools/local/*/corpus.jsonl`), matching `\b(Rn|Np|Pa|Md|Phd|Do|Dds|Lcsw|Mba|Ms|Mph)\.? (Bsn|Msn|Ccrn|Cnp|Fnp|Aprn|Bc|Dnp|Pa-c|Mph|Dr|Prof|Mrs|Mr)\b`: 0 names. The pattern names the common Title-case credentials and what follows them, so the count bounds these shapes, not every one the rule reaches. Merged on that measurement (decided in chat). DECLINED: a name reading for `md`, which #1017 measured and declined (it reverses `Amie Cullimore, MD BSc BEd` and capitals such as `ADAM SINGER, MD`); and a rule for `md` alone, since `Ud`, `Bt`, `Pg` and `Mt` stand in the same place in the same names. A scan of every `~/.cache/nameparser-tools/local/*/corpus.jsonl` (2026-11-02; each entry a string with no comma, not wholly upper or lower case, split on spaces; counted once per entry at its first word at index 2 or later that is alphabetic, Title case and, lower-cased, in `L.suffix_acronyms | L.suffix_words` less both `_ambiguous` sets, `L = Parser().lexicon._sets`, followed by an alphabetic Title-case word outside that set) found 223 `md`, 70 `ud`, 23 `cem`, 16 `pg`, and generation words written mid-name (`junior` 281, `jr` 66, `iii` 9), the last a suffix WORD and left to the run: `Guy Andre Junior Francois` still reads suffix 'Junior Francois', a separate question. @@ -46,3 +47,12 @@ Open: #1053, carried over from #965 (an unlisted word in capitals joins a listed RETRACTED: the four S8 examples #661 and #679 added for generational words before a name word (`Antonio Pavlović mlađi Jones`, `Pieter Bruegel stariji Jones`, `Ана Хорват старији Џонс`, `Гай Плиний Старший Иванов`), now examples of the clause, each family the last word; no corpus holds that shape in those scripts, and the reading is the Latin one's. The honorific keeps the run (`राम शर्मा साहब मोहन`, `John Smith Esq Jones`): no box count speaks to it. The tests that used a mid-name `Jr` only to start a run now use `Esq` (the maiden clause's `Jane Doe Esq. Smith nee Jones PhD`, the particle report's `Jane Doe nee van der Berg Esq mc van` and `John Smith Esq. von und zu Mc`, assemble's reading row, and three case rows); the case row `bound_given_join_takes_a_chain_carrying_a_declined_marker` returns to the reading it pinned before #602, #417's (given 'Abd van der Berg née', middle 'Jr', family 'Jones'), `bound_given_join_reserves_nothing_behind_a_credential_run` holding the run's path with `Esq`. ACCEPTED: a generation word typed before the family name is a word of the middle name, not a suffix (`Mr Robert Alexander (Jnr) Halliday` → middle 'Alexander Jnr'), lifting a post-nominal out of the middle of a name being declined (#602, above). MEASURED 2026-11-03 against 7ce9cbf4 (master, after #1019 and #1021), every local corpus read with `--base `, the same figures the first build gave against 593d8996 before the review's fixes and #1019: `tools/differential/local_agreement.py --base` for the four scored corpora, `tools/differential/snapshot.py --local --base` for the rest. Scored against the filers' boxes: psc-individuals 91 records into agreement, none out of it, 7 moved between disagreements; orcid-researchers 56 in, one out, 26 between; patentsview-inventors 5 in, one out; cz-candidates none. The two out of agreement are Spanish surnames holding the word, filed in the surname box (`Arecrisna Junior Cuadra Cabrera`, `Mireles Jr. Garcia`), which the run had read whole as suffix-and-surname and the tree reads as middle words before the last surname; the 26 ORCID records between disagreements are Junior in the given box before two surnames, now in the given part as filed, the second surname the positional reading cannot see. Unscored: tse-donors 43 names move, each in a name of one case, 41 a JUNIOR or JÚNIOR, one a JR and one an SR before the surname (`JOAO BATISTA JUNIOR GOMES` → family 'GOMES'), four of them losing a reading the run had made tidier, a filing's stray word or the ordinal Segundo behind the generation word now the family (`SILVIO GREGIO JUNIOR ZZ` → family 'ZZ', where the run read suffix 'JUNIOR ZZ'); jrc-names 5, each a Junior (`Jean Marie Junior Salomon`); ctgov-officials one, initials in capitals before the surname (`Tatiana Izabele SR Jaworski de Sa Riechi, PHd`); fec-individuals, ukec-individuals, govuk-people, tw-donors, nepal-candidates and dof-signatures none. The committed snapshot moves five of the names already in it, the ones the clause retracts or reaches, all rules examples or #602's measured `Jane van der Berg née Jr Jones` (middle 'van der Berg née Jr', family 'Jones', as 1.4.0 read it). +- 2026-11-18 #1394 — WITH NO FAMILY COMMA, IN A NAME WRITTEN WHOLLY IN ONE CASE, A CREDENTIAL THAT IS ALSO A GIVEN NAME WRITTEN SHORT WITH A NAME WORD BEHIND IT DOES NOT START THE RUN, AND THE DECLINE IS REPORTED. #1019 withheld the run from `Md` by its Title case, a name word's writing, and left a name of one case to the run, the name having no Title case to read (its case row `BADRUL AKMAL HISHAM MD YUSOFF` → suffix 'MD YUSOFF'). #1383 (3.1) then gave `md` a `given` reading carrying `same_as`, Muhammad written short, which classify tags `vocab:given-abbreviation`. In a name of one case `MD` is written as every other word of the name is, so its capitals say nothing (S6: "A name written wholly in one case says nothing about any word in it"), and the given name it may be reads as its Title case does: `_pieces.short_given_name_in_one_case`, a fourth writing beside the three in `declined_by_the_name_behind`, so `run_start`, P2's chain stop (`AHMAD BIN MD RAHMAN` → family 'BIN MD RAHMAN', where 3175314d read family 'BIN', suffix 'MD RAHMAN') and assign's family-part pass before a family comma (`BIN MD RAHMAN, AHMAD` → family 'BIN MD RAHMAN', where 3175314d read suffix 'MD') ask one predicate. Behind it, for this writing alone, a word in lower case is a name word (`siti nora md yusri`), lower case being the name's own writing there, as #1023 found for the generation word. Its narrowings, each with a row that fails without it: a word with no letter of a script with case behind it keeps the run (`محمد علي MD حسن`), the capitals of a Latin `MD` there being the credential's spelling rather than a case the name shares (the twin control `_UNGUARDED_EFFECT` read `ჯეკ ბერიძე MD ნინო` and its Arabic twin both moving in the first build); a maiden marker behind it keeps the run, since in capitals `NÉE` would count as a name word and the clause it opens be lost (`JOHN SMITH MD NÉE JONES` → middle 'SMITH MD NÉE' in the first build); the case asked of a word in a maiden clause or between brackets is the WHOLE name's (S6), since `ParseState.one_case` covers the own words alone and the review found `JOHN SMITH née Ann Lee MD Jones` reading the clause's mixed-case `MD` as one of a name in one case, while a word of the own words asks `one_case`, so appending a clause changes nothing about it (a first fix asking the whole name for every word failed `test_a_maiden_clause_changes_nothing_else` on four rows: `JOHN SMITH MD JONES` read the run once a mixed-case clause followed); and a numeral S10 reads as the generation is no name word, which the review found reading `JOHN SMITH MD VI JONES` family 'MD' and which reached the Title-case acronym too, so `John Smith Md VI Jones` reads suffix 'Md VI Jones' now where 3175314d read family 'Md', and so does a settled member's (`John Smith MA VI Jones` → suffix 'MA VI Jones', where 3175314d read family 'MA'); the numeral is weighed behind the credential itself, not the word written before it, which the second review found was a one-letter nickname in `JOHN SMITH MD (B) VI JONES` (family 'MD' in that round). The review also found the first build's lower-case widening reaching the Title-case acronym inside a mixed-case clause (`JOHN SMITH née Ann Lee Md jones`), so it is passed to `_name_word_behind` for this writing alone. Only `md` is reached on the shipped vocabulary: `ma`, the other given name written short that is a credential, is an ambiguous member, which starts no run in a name of one case already. `Bt`, `Ud` and `Pg`, which #1019 read by their Title case, carry no given reading and are not reached (`SITI HAJAR BT KHALIT` still reads suffix 'BT KHALIT'), left to their own issue. + REPORTED: the decline reports `suffix-or-name`, the credential's reading (`suffix_reading`) the alternative, where `run_start` declines the run for this writing; `run_start` records the word in `Peel.declined`, which `tail_reading` returns and group's tail read carries to assign (`_placed`), and assign emits it once the word holds a name role; group's rebuilt read, where the particle chain takes a member the read had picked, carries it too, which the second review found dropped (`JOHN VAN MD MA DE`). The first build reported nothing, as #1019's Title-case decline does not; review found it dropping the report 3175314d gave on the same names (`SITI NORA MD YUSRI`, `JOHN SMITH MD JONES`), where by this entry's own reasoning nothing in the writing settles the fork, unlike Title case. A decline inside P2's chain stop or assign's family-part pass reports only where `run_start` declined too (`AHMAD BIN MD RAHMAN` does; `BIN MD RAHMAN, AHMAD`, whose MD the family-part pass reads, does not). + ACCEPTED: the degree written before a family name in a name of one case reads as a name word, reported (`JOHN SMITH MD JONES` → middle 'SMITH MD', family 'JONES'); a title written in capitals behind it becomes the family name (`JOHN SMITH MD MR` → family 'MR'; `JOHN SMITH MD PROF.` keeps title 'PROF.', H5 taking it first). + MEASURED 2026-11-18 against 3175314d with `tools/differential/measure.py --base ` over every fetched local corpus, each step's moves read by name, after the review round: + - orcid-researchers' snapshot moves 68 names, each a name of Malay or Bengali form with `MD` or `MD.` for Muhammad before a name word, now a name word (reported, as 3175314d reported the run). + - Scored against the filers' boxes (`local_agreement.py orcid-researchers --base`, `--list 100`): 2 records come into agreement (both filed from Bangladesh) and none leave it. 53 move between disagreements: 50 filed from Malaysia, one from Bangladesh, one from the UAE, one with no country. Each now holds the filed given box whole and the filed family box's last word, where 3175314d read the second given word as the family; the filers put the father's name with its `MD` in the family box, which no positional reading gives. No United States record moves. + - ctgov-contacts moves 2, each a name in capitals with `MD` before one or two surnames: the family is now the last surname where 3175314d read the given name's second word, and the `MD` (the degree in both, by the names) is now a middle word, reported. + - Every other corpus moves nothing: ctgov-officials, nepal-candidates, fec-individuals, psc-individuals, patentsview-inventors, cz-candidates, tse-donors, jrc-names and opensanctions-parliaments among them. + - The committed snapshot moves only this entry's new rules examples; CLDR and GND agreement do not move. diff --git a/docs/design/decisions/indic-honorifics.md b/docs/design/decisions/indic-honorifics.md index 0e5392903..f0a513a68 100644 --- a/docs/design/decisions/indic-honorifics.md +++ b/docs/design/decisions/indic-honorifics.md @@ -60,7 +60,7 @@ Open: #514 (whether the Tibetan prefix titles Tulku, Khenpo, Geshe, Kyabje and J THE CREDENTIAL is in mul.toml rather than en.toml, so a strict choice without `en` keeps it, as for `msc`; and the salutation refusal stays in bn.toml with its reason rewritten to the box counts. What it moves, measured 2026-11-06 on cc775c20 against `Lexicon.default().remove("mst", kind="credential")` over the committed corpora and every fetched local corpus, the names matching `(?i)(^|[^a-z])m\.?\s?s\.?\s?t\b` (267, before this change's case rows joined the committed corpora through corpus_shapes.jsonl: they add four names, each of which moves, the fifth, `Mrs Mst Nasima Akther`, being a PSC record already and moving under neither reading): 3 names, the ClinicalTrials.gov investigator `rauena Lopes, Mst` (given 'Mst', family 'rauena Lopes' before; given 'rauena', family 'Lopes', suffix 'Mst' after), the FEC name `SUAN CPA MST CGMA, WILMAR` (family 'SUAN MST', suffix 'CPA, CGMA' before; family 'SUAN', suffix 'CPA MST CGMA' after) and one `suffix-or-name` report that `M.D. MST` no longer makes; the PSC and ORCID names not at all. Recompute with `uv run python tools/differential/config_diff.py diff 'expr:Parser(lexicon=Lexicon.default().remove("mst", kind="credential"))' default --local all --committed --match` and that pattern; the PSC counts from `~/.cache/nameparser-tools/local/psc-individuals/raw.jsonl`, the records whose `forename` opens with a word that is `mst` once lowercased and stripped of edge periods, and those whose `title` holds one; the score with `uv run python tools/differential/config_diff.py score 'expr:Parser(lexicon=Lexicon.default().add("mst", kind="salutation"))' default --group Bangladeshi --group BD`, the dual first so the fixed/broken column counts the shipped reading against it. ACCEPTED COST (Derek), `md`'s (2) of the 2026-10-23 entry: the given part of a family comma that `Mst` opens reads as a credential run (`Begum, Mst Amina` → family 'Begum', suffix 'Mst Amina', where 1.4.0 through the parent read given 'Mst', middle 'Amina'). The period-marked form there, found by the design-docs review after the decision and accepted the same day ("Yes, accept it"), reads as `Md.` already did there (`Akther, Mst. Nasima` → family 'Akther', suffix 'Mst. Nasima', where 1.4.0 through the parent read title 'Mst.', given 'Nasima'; `Akther, Mrs Mst. Nasima` → title 'Mrs', suffix 'Mst. Nasima'); no fetched corpus held either shape. NOT CHANGED: `Mst.` with its period opening a name is still a title by rules/H2's leading-abbreviation shape, as `Md.` is (2026-10-27), and the Bengali মোসাঃ/মোছাঃ stay titles. -- 2026-11-14 #1383 — A LEADING `Md.` IS THE GIVEN NAME, AND SO IS `Md` OPENING THE GIVEN PART AFTER A FAMILY COMMA, WRITTEN AS A GIVEN NAME (#1393). SUPERSEDES: the 2026-10-27 #853 entry (the period-marked `Md.` a title by rules/H2's shape), and the 2026-10-23 #853 entry's accepted cost (2) (the given part of a family comma that `Md` opens reading as credentials). Decided (maintainer), reversing the 2026-10-27 ruling: `md` gains a `given` reading carrying `same_as` (Muhammad written short, decisions/vocabulary-model's 2026-11-13 #1383 entry), which rules/H2's shape yields to, so `Md. Karim Uddin` reads given 'Md.', middle 'Karim'. The 2026-10-27 entry kept the title as an accepted cost; the reason a name reading was refused was decisions/C3's 2026-11-02 #1017 DECLINED bullet, that it would make the commonest credential ambiguous. A given name written short now makes no acronym ambiguous (#1383's amendment), so the yield costs the degree nothing (`John Smith, MD` keeps suffix 'MD'). +- 2026-11-14 #1383 (its glued `SITI AMINAH MD.NOOR`, left to #1394, superseded by decisions/S8's 2026-11-18 #1394 entry: middle 'AMINAH MD.', family 'NOOR') — A LEADING `Md.` IS THE GIVEN NAME, AND SO IS `Md` OPENING THE GIVEN PART AFTER A FAMILY COMMA, WRITTEN AS A GIVEN NAME (#1393). SUPERSEDES: the 2026-10-27 #853 entry (the period-marked `Md.` a title by rules/H2's shape), and the 2026-10-23 #853 entry's accepted cost (2) (the given part of a family comma that `Md` opens reading as credentials). Decided (maintainer), reversing the 2026-10-27 ruling: `md` gains a `given` reading carrying `same_as` (Muhammad written short, decisions/vocabulary-model's 2026-11-13 #1383 entry), which rules/H2's shape yields to, so `Md. Karim Uddin` reads given 'Md.', middle 'Karim'. The 2026-10-27 entry kept the title as an accepted cost; the reason a name reading was refused was decisions/C3's 2026-11-02 #1017 DECLINED bullet, that it would make the commonest credential ambiguous. A given name written short now makes no acronym ambiguous (#1383's amendment), so the yield costs the degree nothing (`John Smith, MD` keeps suffix 'MD'). - Implementation choice, recorded with this PR, the comma (#1393, fixed in the same change): rules/C13 gains an Except, `Md` opening the given part after a family comma being the given name where its writing says so (`Uddin, Md Karim`, `Rahman, Md.`, `RAHMAN, MD ABDUL` → given 'Md'), and the postnominal part elsewhere (`Smith, MD PhD`, `Smith, Md PhD`, `Smith, Md XYZ`, `Uddin, Mr Md`, `Dr. Rahman, Md`); its conditions, as narrowed by the change's second review, are rules/C13's and decisions/C13's to state, not restated here. - Measured, 2026-11-14, on this branch against master 3dadc263, whose parse #1390 did not change, over every local corpus's `corpus.jsonl` (the entries holding the word `md` after a comma, `,[^,]*\bmd\b`, case-insensitive, each corpus's distinct texts): 149,226 names, 19 move (re-taken after the second review's changes, 2026-11-14: the same 149,226 and 19; with the committed corpora, which this change's rule examples and case rows join, 149,359 and 27 after the third review), 5 of them #1383's leading `Md.` (ctgov) and 14 the comma's: fec-individuals 9 (`UDDIN, MD KARIM` shapes, given 'MD'), psc-individuals 3 (the forename box holding `Md` behind a title typed in the surname box), orcid-researchers 2 (`Uddin, Md. Karim`, `Hossain, Md`), and 13 of the 14 read right. The writing behind the design: after one word and a comma, `X, MD` in capitals alone is the degree in ClinicalTrials.gov (107, `Novak, MD`, `BERGER, MD`), while FEC's 10 (a Bangladeshi surname alone, then `MD`) are likely Muhammad, which no writing tells apart; `X, Md` written with a lower-case letter was the given name in all 3 found (ORCID 1, PSC 2). Recompute: each entry of a `corpus.jsonl` under `~/.cache/nameparser-tools/local/` matching `^\s*([^\s,]+),\s*(md\.?)(?:\s+(\S.*))?\s*$`, case-insensitive, grouped by the word's case, a word after it or none, and the head in capitals or not; the moves by parsing every entry matching the first pattern in both checkouts and comparing the seven name fields. - Accepted: `MD` in capitals alone after a family comma stays the degree (`RAHMAN, MD` → suffix 'MD'), so `Md. Rahman` / `RAHMAN, MD` does not match; the degree written before a given name reads as Muhammad written short, the writing being the same (`SMITH, MD JANE` → given 'MD', 1 of FEC's 9 movers); a name in one case writes no case that tells (`rahman, md` → suffix 'md'); and `mst`, which holds no given reading, keeps the cost the 2026-11-06 #1130 entry recorded (`Begum, Mst Amina` → suffix 'Mst Amina'). A full spelling of Muhammad written with a full stop is still a title by rules/H2's shape (`Mohammed. Rahman` → title 'Mohammed.'): 10 of the 22,986 ORCID names opening with one of the five long spellings write it so, and no other local corpus does (2026-11-14: in orcid-researchers' `corpus.jsonl`, `grep -ciE '^"(muhammad|mohammad|mohammed|mohamed|mohamad)\. '` gives 10 and the same pattern with a space for the stop, `'^"(…) '`, 22,986; the second review's own count, by another recipe, gave 23,028). diff --git a/docs/design/decisions/vocabulary-model.md b/docs/design/decisions/vocabulary-model.md index 26f19a2d7..6f1b47c82 100644 --- a/docs/design/decisions/vocabulary-model.md +++ b/docs/design/decisions/vocabulary-model.md @@ -68,7 +68,7 @@ Open: [#1145](https://github.com/derek73/python-nameparser/issues/1145), the dis ## Log - **2026-11-15 #1404 — A `remove` OF A `familiar` OR `spelling` READING MAY HOLD ONE PROPERTY, THE PAIRS TO DROP, AND IS APPLIED TO BOTH NAMES OF A PAIR.** Amends item 3 of the 2026-11-02 #754 entry's edit log for these two kinds alone; the decision is decisions/name-matching's of this date. An edit is still `(op, words, kind, props)`: a `remove` held no properties, and now a `familiar` remove may hold `(("short_for", names),)` and a `spelling` one `(("spelling_of", names),)`, the names normalized, deduplicated and sorted as an `add`'s are, so `Lexicon.__setstate__`'s canonical-form check (the constructor rebuilding each edit through `_make_edit`) accepts exactly what `remove` writes and refuses any other property, an empty list, an unsorted or unnormalized one, and the property on another kind or with no words. A remove of the whole word keeps the form it had, `("remove", (word,), kind, ())`, and what changes is how it is applied (`_lexicon._drop_pairs`): to the word's readings and to the other words' lists naming it. Matching having shipped in no release, no pickle a release wrote holds either edit, so no layout marker is needed; a 3.1-cycle pickle holding a whole-word remove loads and now cuts the pairs other words hold. A clash message renders the edit as the call that wrote it, its list bounded as an `add`'s (`_shown_value`); the repr counts the readings changed, as for any edit. -- **2026-11-13 #1383 A GIVEN NAME WRITTEN SHORT MARKS NO CLASH, AND A `same_as` MAY NAME SEVERAL WORDS.** (its Accepted `Rahman, Md.`, `Rahman, Md` and `RAHMAN, MD ABDUL` superseded by 2026-11-14 #1383, below: given 'Md') `md` is the medical degree (`en.toml`) and Muhammad written short (Bangladesh, Nepal, India); `mohd` and `moh` were given names written short already, pointing at `muhammad` alone (#1115). AMENDS the 2026-10-25 #752 entry's derivation (a clash with a name is a name reading) by one exception. +- **2026-11-13 #1383 A GIVEN NAME WRITTEN SHORT MARKS NO CLASH, AND A `same_as` MAY NAME SEVERAL WORDS.** (its Accepted `Rahman, Md.`, `Rahman, Md` and `RAHMAN, MD ABDUL` superseded by 2026-11-14 #1383, below: given 'Md'; its Accepted `SITI AMINAH MD.NOOR` superseded by decisions/S8's 2026-11-18 #1394 entry: middle 'AMINAH MD.', family 'NOOR') `md` is the medical degree (`en.toml`) and Muhammad written short (Bangladesh, Nepal, India); `mohd` and `moh` were given names written short already, pointing at `muhammad` alone (#1115). AMENDS the 2026-10-25 #752 entry's derivation (a clash with a name is a name reading) by one exception. - Decided (maintainer, #1383's shape (a)): `md` gains a `given` reading with `same_as`, as `wm` and `chas` have, so a leading `Md.` is the given name. - Measured, 2026-11-13, the plain reading first: `tools/differential/config_diff.py diff default "expr:Parser(lexicon=Lexicon.default().add('md', kind='given', same_as='muhammad'))"` moved 36 of the committed corpora's 7,557 names, about 34 of them the credential (`John Smith, MD – PhD` read given 'MD', family 'John Smith'; `Smith, MD - PhD - FACS`, `Washington Jr. MD, Franklin`, `Dr. Pope MD`), and with `--local ctgov-officials --match '(?i)(^|[^a-z])md([^a-z]|$)'` 2,448 of 144,709 (1,950 gaining a report, about 450 losing the credential: `BERGER, MD` given 'MD', `Bin Wang, MD & PhD`): a name reading on the word makes the acronym ambiguous (check 11), gated by the words-to-spare count. - Decided (#1383's amendment): a `given` reading carrying `same_as` makes no acronym ambiguous. Implementation choice, recorded with this PR: it marks no clash with a suffix word either (`SUFFIX_WORDS_AMBIGUOUS`), by the same reason, in `_reading_index.compile_readings` (its `named`), the build's check 11 text and nameparser/vocab/README.md. Its reason: a name written short is read by rules/H2's yielding at the head of a name and by the name match, never by the words-to-spare count a clash gates, so it has nothing to say there. Its reach on the shipped vocabulary is `md` alone: the only other word that is a given name written short and an ambiguous suffix or title is `ma`, whose plain given and family readings (`en.toml`) still mark it, `test_the_shipped_short_forms_of_muhammad` pinning both. Not reached: `TITLES_AMBIGUOUS` reads every `given` reading, unchanged (no shipped title is written short so). diff --git a/docs/design/rules/S8-credentials-trailing-run.md b/docs/design/rules/S8-credentials-trailing-run.md index 7368fbb16..5657cdce7 100644 --- a/docs/design/rules/S8-credentials-trailing-run.md +++ b/docs/design/rules/S8-credentials-trailing-run.md @@ -25,7 +25,7 @@ "John von PhD Jones" → family="von" "John von PhD Jones" → suffix="PhD Jones" ``` -- **What is a credential here.** A title word never starts the run, and neither does a member of the ambiguous class its writing leaves unsettled, a single letter, a connective, a word that is also particle or bound given-name vocabulary, the capitals of `DO` included: a credential is the writer's mark that the post-nominals have begun, and those carry no such mark. Where no family comma divides the name, nor does a credential acronym written in Title case with a name word behind it, as a settled member does not: Title case is how a name word is written, and `Md` is how Muhammad is written short; the acronyms whose own writing is Title case (`Bt`, `Kt`, `Knt`) read so too. Where no family comma divides the name, nor does a generation word written out, a numeral aside, with a name word behind it: a word that is no suffix word, numeral read as the generation (S10), initial, connective, title word or maiden marker, and is a particle or is written in Title case, in a script with no case, or in a name of one case. A generation word there was typed into the middle of a name written given name first, where a filer's form puts it, or is the given name Junior, and the family name stands behind it. Capitals behind it in a name of mixed case are no name word here, where behind a member its capitals settle they are one: behind that member capitals are as likely a family name or the writer's own initials as a credential, the member itself being capitals that may be initials, while a generation word is written out, so capitals behind it read as the credential that follows it as likely as a name. An honorific or a generational word otherwise carries it as a credential does, whatever its script. +- **What is a credential here.** A title word never starts the run, and neither does a member of the ambiguous class its writing leaves unsettled, a single letter, a connective, a word that is also particle or bound given-name vocabulary, the capitals of `DO` included: a credential is the writer's mark that the post-nominals have begun, and those carry no such mark. Where no family comma divides the name, nor does a credential acronym written in Title case with a name word behind it, as a settled member does not: Title case is how a name word is written, and `Md` is how Muhammad is written short; the acronyms whose own writing is Title case (`Bt`, `Kt`, `Knt`) read so too. Where no family comma divides the name, nor, in a name written wholly in one case, does a credential that is also a given name written short (`md`) with a name word behind it, in lower case as in capitals, that holds a letter of a script with case and is no maiden marker or numeral read as the generation (S10): its case is the name's and says nothing, so it reads as its Title case does, the case asked of a word in a maiden clause or between brackets being the whole name's (S6), and written with its periods (`M.D.`) it is the degree's writing and no given name. Where no family comma divides the name, nor does a generation word written out, a numeral aside, with a name word behind it: a word that is no suffix word, numeral read as the generation (S10), initial, connective, title word or maiden marker, and is a particle or is written in Title case, in a script with no case, or in a name of one case. A generation word there was typed into the middle of a name written given name first, where a filer's form puts it, or is the given name Junior, and the family name stands behind it. Capitals behind it in a name of mixed case are no name word here, where behind a member its capitals settle they are one: behind that member capitals are as likely a family name or the writer's own initials as a credential, the member itself being capitals that may be initials, while a generation word is written out, so capitals behind it read as the credential that follows it as likely as a name. An honorific or a generational word otherwise carries it as a credential does, whatever its script. ``` "Mary Jane Pope Smith" → family="Smith" "Josep Carod i Rovira" → family="Carod i Rovira" @@ -36,6 +36,12 @@ "Badrul Akmal Hisham Md Yusoff" → family="Yusoff" "John Smith Md Phd" → suffix="Md Phd" "John Smith MD Jones" → suffix="MD Jones" + "SITI NORA MD YUSRI" → family="YUSRI" + "AHMAD BIN MD RAHMAN" → family="BIN MD RAHMAN" + "JOHN SMITH MD PHD" → suffix="MD PHD" + "JOHN SMITH M.D. JONES" → suffix="M.D. JONES" + "SMITH, JOHN MD JONES" → suffix="MD JONES" + "محمد علي MD حسن" → suffix="MD حسن" "Smith, John Md Jones" → suffix="Md Jones" "Guy Andre Junior Francois" → family="Francois" "John Smith Jr. Jones" → middle="Smith Jr." @@ -50,9 +56,10 @@ "John Smith Esq Jones" → suffix="Esq Jones" "राम शर्मा साहब मोहन" → suffix="साहब मोहन" ``` -- **What reports.** A name word the run absorbs is reported `suffix-or-name`. +- **What reports.** A name word the run absorbs is reported `suffix-or-name`, and so is a given name written short whose run a name of one case declines, the credential being the reading not taken: nothing in the writing settles it. ``` "John Smith PhD Jones" → ambiguities=("suffix-or-name",) + "SITI NORA MD YUSRI" → ambiguities=("suffix-or-name",) "राम शर्मा साहब मोहन" → ambiguities=("suffix-or-name",) ``` @@ -111,7 +118,13 @@ "Jane Doe Rn Ccrn" → family="Ccrn" "John Smith Md Dr" → family="Dr" ``` +- With no family comma, in a name written wholly in one case, the degree written before a family name reads as Muhammad written short, reported, the name having no case to tell the two apart: `MD` with a name word behind it is a word of the middle name, where written in a name of mixed case, or with its periods, it starts the run. A title written in capitals after it becomes the family name. + ``` + "JOHN SMITH MD JONES" → family="JONES" + "JOHN SMITH MD JONES" → middle="SMITH MD" + "JOHN SMITH MD MR" → family="MR" + ``` --- -**Signal:** neighbor: an unambiguous credential after the name core, and the rest of its part + case contrast: a credential acronym in Title case before a name word +**Signal:** neighbor: an unambiguous credential after the name core, and the rest of its part + case contrast: a credential acronym in Title case before a name word, or none around a given name written short **history:** decisions/S8 · **implemented:** nameparser/_pipeline/_assign.py, nameparser/_pipeline/_pieces.py diff --git a/docs/release_log.rst b/docs/release_log.rst index 900a55df9..19390cd63 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -6,6 +6,7 @@ Release Log - **Fix Dutch Oude, which read as a middle name.** ``parse("Piet Oude Luttikhuis")`` gives family ``Oude Luttikhuis``, where 1.4.0 through 3.1.0 gave middle ``Oude``, family ``Luttikhuis``; ``Oude`` opening a name stays the given name, reported, being a rare Dutch given name too. :issue:`1455` - **Add locales.NL, which reads ten as a family-name particle.** ``parser_for(locales.NL).parse("Jan ten Brink")`` gives family ``ten Brink``, where the default, as 1.4.0 through 3.1.0, gives middle ``ten``; a ``Ten`` opening a name stays the given name, reported, save under ``strict=True``. It also takes a Chinese given-name syllable inside a name into the family (``Kheng Ten Choo`` gives family ``Ten Choo``), and choosing Dutch reads ``VD`` as ``van der`` rather than the credential (``John Smith, VD`` gives family ``John Smith VD``). See :ref:`dutch-particles`. :issue:`1455` + - **Fix MD inside a name written in capitals, which read as the degree and took the name behind it.** ``parse("SITI NORA MD YUSRI")`` gives middle ``NORA MD``, family ``YUSRI``, as 1.4.0 through 2.3.0 did, where 2.4.0 through 3.1.0 gave family ``NORA``, suffix ``MD YUSRI``; a name in lower case reads the same way, and both report ``suffix-or-name``, the degree being the other reading. The degree written before a family name in capitals reads so too (``JOHN SMITH MD JONES`` gives family ``JONES``, reported), where ``John Smith MD Jones`` and ``JOHN SMITH M.D. JONES`` keep it. :issue:`1394` * 3.1.0 - November 16, 2026 diff --git a/nameparser/AGENTS.md b/nameparser/AGENTS.md index a6da52d2c..daa38f078 100644 --- a/nameparser/AGENTS.md +++ b/nameparser/AGENTS.md @@ -46,7 +46,7 @@ So a change that handles `V` and `III` can still miss `VI` — #610 found exactl ### Credentials and titles -The same split runs through the credentials (`MA` listed, `X.Y.Z.` by the dotted shape, `XYZ` by the caps shape, `MD/PhD` by its listed chunks and `PU-PH` by the caps shape's joined spelling, #752, each with its joiner glued, spaced and glued to one side, which are three token streams -- and a new chunk reading inherits the old one's exceptions, which #752's first draft did not (`Jack I-V` lost its family to the listed numerals, and the fix's length test counted a chunk's period, so `Jack I.-V.` did too, found by the second review; and the converse, a credential listed whole WITH its joiner (`NP-C`, `SHRM-CP`), is one word a chunk reading must not cut: #1088's fix asking each chunk of a joined word in S1's initials Except read the chunk `C` and turned `John (NP-C) Smith` from suffix to nickname, found by the second review, so put a listed hyphenated credential in the grid of any change that reads chunks; S3's own cut did the same inside a joined word until #1103 (`Jane Smith PhD/NP-C` read family 'PhD/NP-C'), and #1103's first build, cutting at the slashes first and taking the longest listed run from the left, still refused `CCC/SLP/L` (`CCC`, `SLP/L` both listed), `MS-OTR/L` and `APRN-FNP-C`, found by the design-docs review; so put a listed credential of each joiner in that grid, alone, inside a longer word behind each joiner, and where a listed run overlaps another, and a joiner chain hundreds of chunks long, which the first build's search took cubic time over; and a member of the ambiguous class beside a credential, bare and dotted (`MA/PhD`, `M.A/PhD`), which #1103 left refused while S13 read `(M.A, PhD)`, and which #1138 reads as a chunk, the joined word then a member S13 settles by position, inside the name too; #1138's three review rounds each found the word that settles a member defined differently for a joined word and its written-apart spelling, a title too (`Ma/Ms`), a generation (`Ed Jr`), a joined generation (`(Ed, Jr/Sr)`), so put a dual, a generation and a joined word among the settlers of any twin grid, as `test_a_joined_member_reads_as_its_spelling_written_apart` now does), and `Ph. D.` merged by group into one flagged piece the peel's walk never holds -- #603 found #602's run-start predicate refusing it too, so `Smith, John Ph. D. Jones` kept middle 'Jones' where `Smith, John PhD Jones` read suffix 'PhD Jones') and the titles (`Prof.` period-marked and read at the end of a name, `Prof` bare and a name word there, and `Mr. and Mrs.` a run P3 joins, carrying a piece tag a one-word vocabulary test never sees -- PR #735's review found C12's hand copy of C13's title test (C8's until its 2026-10-19 split) reading `John Smith Jr., Mr. and Mrs. AD` as all suffix; ask C13's predicates in C13's order, `not is_suffix_piece` then `is_title_piece`, not the token tags, since `is_title_piece` alone reads the duals `Ms` and `Sr.` as titles). A listed acronym's CASE is a spelling too: #602's run start asked only whether the word was listed, so `Md` (Muhammad written short), `Ud`, `Bt` and `Pg` in Title case before a name word took it into the suffix (`Badrul Akmal Hisham Md Yusoff` → suffix 'Md Yusoff'), the Title case being a name word's writing, which `MD`, `md` and `M.D.` still start the run in, found by #1017's measurement and fixed by #1019; put `MD`, `Md`, `md` and `M.D.` in a credential rule's grid, each with a name word behind it, and the dotted and joined Title-case spellings (`M.d.`, `M.a.`, `Pa-c`): #1019's first build read a word's letters with its punctuation dropped, so those read as name words too, found by review. +The same split runs through the credentials (`MA` listed, `X.Y.Z.` by the dotted shape, `XYZ` by the caps shape, `MD/PhD` by its listed chunks and `PU-PH` by the caps shape's joined spelling, #752, each with its joiner glued, spaced and glued to one side, which are three token streams -- and a new chunk reading inherits the old one's exceptions, which #752's first draft did not (`Jack I-V` lost its family to the listed numerals, and the fix's length test counted a chunk's period, so `Jack I.-V.` did too, found by the second review; and the converse, a credential listed whole WITH its joiner (`NP-C`, `SHRM-CP`), is one word a chunk reading must not cut: #1088's fix asking each chunk of a joined word in S1's initials Except read the chunk `C` and turned `John (NP-C) Smith` from suffix to nickname, found by the second review, so put a listed hyphenated credential in the grid of any change that reads chunks; S3's own cut did the same inside a joined word until #1103 (`Jane Smith PhD/NP-C` read family 'PhD/NP-C'), and #1103's first build, cutting at the slashes first and taking the longest listed run from the left, still refused `CCC/SLP/L` (`CCC`, `SLP/L` both listed), `MS-OTR/L` and `APRN-FNP-C`, found by the design-docs review; so put a listed credential of each joiner in that grid, alone, inside a longer word behind each joiner, and where a listed run overlaps another, and a joiner chain hundreds of chunks long, which the first build's search took cubic time over; and a member of the ambiguous class beside a credential, bare and dotted (`MA/PhD`, `M.A/PhD`), which #1103 left refused while S13 read `(M.A, PhD)`, and which #1138 reads as a chunk, the joined word then a member S13 settles by position, inside the name too; #1138's three review rounds each found the word that settles a member defined differently for a joined word and its written-apart spelling, a title too (`Ma/Ms`), a generation (`Ed Jr`), a joined generation (`(Ed, Jr/Sr)`), so put a dual, a generation and a joined word among the settlers of any twin grid, as `test_a_joined_member_reads_as_its_spelling_written_apart` now does), and `Ph. D.` merged by group into one flagged piece the peel's walk never holds -- #603 found #602's run-start predicate refusing it too, so `Smith, John Ph. D. Jones` kept middle 'Jones' where `Smith, John PhD Jones` read suffix 'PhD Jones') and the titles (`Prof.` period-marked and read at the end of a name, `Prof` bare and a name word there, and `Mr. and Mrs.` a run P3 joins, carrying a piece tag a one-word vocabulary test never sees -- PR #735's review found C12's hand copy of C13's title test (C8's until its 2026-10-19 split) reading `John Smith Jr., Mr. and Mrs. AD` as all suffix; ask C13's predicates in C13's order, `not is_suffix_piece` then `is_title_piece`, not the token tags, since `is_title_piece` alone reads the duals `Ms` and `Sr.` as titles). A listed acronym's CASE is a spelling too: #602's run start asked only whether the word was listed, so `Md` (Muhammad written short), `Ud`, `Bt` and `Pg` in Title case before a name word took it into the suffix (`Badrul Akmal Hisham Md Yusoff` → suffix 'Md Yusoff'), the Title case being a name word's writing, which `M.D.`, and `MD` and `md` in a name of mixed case, still start the run in, found by #1017's measurement and fixed by #1019 (#1394 then read `MD` and `md` in a name written wholly in one case as its Title case, the name's case saying nothing, and `JOHN SMITH MD JONES` with them); put `MD`, `Md`, `md` and `M.D.` in a credential rule's grid, each with a name word behind it, and the dotted and joined Title-case spellings (`M.d.`, `M.a.`, `Pa-c`): #1019's first build read a word's letters with its punctuation dropped, so those read as name words too, found by review. ### A word a rule only asks ABOUT diff --git a/nameparser/_pipeline/_assign.py b/nameparser/_pipeline/_assign.py index 205f9c35f..7c56fbf67 100644 --- a/nameparser/_pipeline/_assign.py +++ b/nameparser/_pipeline/_assign.py @@ -447,7 +447,7 @@ def _placed(read: TailRead, rest: list[int], # built, not `_replace`d: that is two frames on every read return names, tuple(titled), Peel( count, peel.numerals, peel.picks, peel.anchors, tuple(run_titles), - peel.absorbed) + peel.absorbed, peel.declined) def _assign_main(seg_idx: int, state: ParseState, @@ -690,6 +690,19 @@ def as_a_name(i: int) -> PendingReading: report = ambiguities[r] ambiguities[r] = copy_with( report, alternative=as_a_name(report.indices[0])) + # rules/S8: "nor, in a name written wholly in one case, does a + # credential that is also a given name written short" -- the run + # declined where nothing in the writing settles it, so the reading + # not taken is the credential's run (decisions/S8, #1394). Each such + # word stands before any run `run_start` starts, the walk returning + # the first, so it is in the name core and holds a name role + for i in peeled.declined: + ambiguities.append(PendingAmbiguity( + AmbiguityKind.SUFFIX_OR_NAME, + f"{tokens[i].text!r} is a credential and a given name " + f"written short, in a name written in one case; read as ", + (i,), field_tail=" rather than the credential", + alternative=suffix_reading(tokens[i]))) # after the trailing reports are given their name reading, which # the order report has none of if order_report is not None: diff --git a/nameparser/_pipeline/_classify.py b/nameparser/_pipeline/_classify.py index ba4f556f1..25e17f1f2 100644 --- a/nameparser/_pipeline/_classify.py +++ b/nameparser/_pipeline/_classify.py @@ -305,7 +305,9 @@ def _tags_for(token: WorkToken, n: str, state: ParseState, # rules/H2: "an abbreviation the vocabulary reads as a given name # written short is that given name" -- the reading H2's shape test # weighs (`_pieces.is_leading_title`); a membership, so any spelling - # carries it and only that test acts on it + # carries it. Read too by rules/C13's given-name Except + # (`_comma._given_name_written_short`) and rules/S8's one-case + # clause (`_pieces.short_given_name_in_one_case`, #1394) if n in lex._sets.given_name_abbreviations: tags.add(GIVEN_ABBREVIATION_TAG) # rules/O6, O7 and P10 read this: a name a community gives every diff --git a/nameparser/_pipeline/_group.py b/nameparser/_pipeline/_group.py index b7cbbba58..b58283047 100644 --- a/nameparser/_pipeline/_group.py +++ b/nameparser/_pipeline/_group.py @@ -1327,7 +1327,8 @@ def chain(tail: int) -> None: read = TailRead(read.tail, read.titles, read.run_titles, Peel( peel.names, peel.numerals, tuple([p for p in peel.picks if p not in took]), - peel.anchors, peel.run_titles, peel.absorbed)) + peel.anchors, peel.run_titles, peel.absorbed, + peel.declined)) # rules/P5: "a recognized bound given-name word joins the # word after it into one given name" (history: decisions/P5) # -- bound given names: the first non-title piece joins the next diff --git a/nameparser/_pipeline/_pieces.py b/nameparser/_pipeline/_pieces.py index 80ab75204..ae8c53021 100644 --- a/nameparser/_pipeline/_pieces.py +++ b/nameparser/_pipeline/_pieces.py @@ -66,7 +66,7 @@ from nameparser._pipeline._vocab import ( _CASELESS_LETTERS, _DIGRAPH_INITIALS, _PERIOD_ABBREV, _ROMAN, _SPELLED_INITIAL, Lean, ambiguous_lean, - in_unabbreviating_script, + in_unabbreviating_script, is_one_case, is_listed_numeral, is_single_letter_numeral, numeral_leans_to_the_name, numeral_settled_by_case, reads_as_generation, tag_marker_runs, ) @@ -1108,6 +1108,10 @@ class Peel(NamedTuple): #: run absorbed, which assign reports run_titles: tuple[int, ...] = () absorbed: tuple[tuple[int, ...], ...] = () + #: rules/S8 (#1394): the token indices of the given names written + #: short whose run a name word behind them declined in a name of one + #: case (`run_start`'s `declined`), which assign reports + declined: tuple[int, ...] = () # rules/S2: "a trailing word of the suffix vocabulary reads as a @@ -1561,28 +1565,45 @@ def behind_the_merged_credential(rest: Sequence[int], p: int, and "suffix" in ptags[rest[p] - 1]) -def _name_word_behind(piece: Sequence[int], ptags: Set[str], - tokens: Sequence[WorkToken], - one_case: bool | None) -> bool: - """Whether the piece behind a member its capitals settle, or behind - a credential acronym written in Title case, reads as a word of the +def _name_word_behind(credential: WorkToken, piece: Sequence[int], + ptags: Set[str], tokens: Sequence[WorkToken], + one_case: bool | None, + lower_is_name: bool = False) -> bool: + """Whether the piece behind `credential` (a member its capitals + settle, a credential acronym written in Title case, or a given name + written short in a name of one case) reads as a word of the name rather than a further credential, asked of its first word, since group has merged particle runs and connective joins by then ('de la Vega', 'Ortega y Gasset'): a particle, a word of a script with no case, or a cased word not written in lower case (Title case or capitals, title vocabulary included), that is no suffix word and no member its own capitals settle. A credential - merged across a space ('Pharm D', 'Ph. D.') is no name word. Asked - only through `declined_by_the_name_behind`, of a settled member or a - credential acronym written in Title case (`acronym_in_title_case`).""" + merged across a space ('Pharm D', 'Ph. D.') is no name word, nor is + a roman numeral S10 reads as the generation, listed or not + ('MD VI Jones'). Asked only through `declined_by_the_name_behind`, + of a settled member, a credential acronym written in Title case + (`acronym_in_title_case`) or a given name written short in a name + of one case (`short_given_name_in_one_case`); for the last alone + (`lower_is_name`) a word in lower case is a name word as one in + capitals is, lower case being the name's own writing there.""" if "suffix" in ptags or "split" in ptags: return False tok = tokens[piece[0]] if "particle" in tok.tags: return True # a word of a script with no case for the contrast is no word in - # lower case (_policy._SCRIPT_PROPERTIES, #1222) - if tok.text.translate(_CASELESS_LETTERS).islower(): + # lower case (_policy._SCRIPT_PROPERTIES, #1222), save behind a + # given name written short in a name of one case (#1394) + if (not lower_is_name + and tok.text.translate(_CASELESS_LETTERS).islower()): + return False + # a numeral S10 reads as the generation is the credential's + # company, no name word, asked of S10's predicate as + # `generation_word_before_a_name` asks it (decisions/S8, #1394) + text = tok.text.rstrip(".") + if (_ROMAN.match(text) is not None + and reads_as_generation(tok.text, tok.tags, credential.text, + one_case)): return False return ("vocab:suffix" not in tok.tags and SHAPE_ACRONYM_TAG not in tok.tags @@ -1661,7 +1682,47 @@ def generation_word_before_a_name(token: WorkToken, "vocab:maiden-marker"}) -# rules/S8: "not where a name word stands behind it" -- the three +# rules/S8: "nor, in a name written wholly in one case, does a +# credential that is also a given name written short" -- the clause +# this implements (decisions/S8, #1394) +def short_given_name_in_one_case(token: WorkToken, behind_at: int, + tokens: Sequence[WorkToken]) -> bool: + """Whether `token`, carrying classify's GIVEN_ABBREVIATION_TAG (a + given name written short: 'MD', 'md', 'MD.'; the caller asks that it + would start the run, so it is a credential too), stands in a name + written wholly in one case, where its case is the name's and says + nothing, with `tokens[behind_at]`, the first word of the piece + behind it, holding a letter of a script with case (_policy._SCRIPT_PROPERTIES, + #1222) and being no maiden marker. The caller has asked, inline + ahead of the call so a credential that is no such word pays no + frame, that `token` carries the tag and that `one_case` holds. The + case asked is rules/S6's: + `one_case`, the name's own words, for one of them, so appending a + clause changes nothing about it; for a word of a maiden clause or + of brackets, the WHOLE name's, which `one_case` does not cover, so a + word of a mixed-case clause is not read as one of a name of one + case ('JOHN SMITH née Ann Lee MD Jones'). A word is the clause's + where it already holds a role (extract's brackets) or a maiden + marker stands before it. A word of no cased script + behind it ('محمد علي MD حسن') keeps the run: the capitals of a Latin + 'MD' before it are the writer's choice of the credential's + spelling, not the case the words around it share. A maiden marker + behind it opens a clause (M2), no name word. The rest of the + name-word test is `_name_word_behind`'s, the caller's.""" + behind = tokens[behind_at] + cased = behind.text.translate(_CASELESS_LETTERS) + if (cased.upper() == cased.lower() + or "vocab:maiden-marker" in behind.tags): + return False + # rules/S6: "The case asked of a word in a maiden clause or between + # brackets is the whole name's" + if token.role is None and not any( + "vocab:maiden-marker" in t.tags for t in tokens[:behind_at]): + return True + return is_one_case([t.text for t in tokens]) + + +# rules/S8: "not where a name word stands behind it" -- the four # writings that decline the run there, one predicate for `run_start`, # P2's chain stop (`starts_the_run_here`) and the family part's suffix # pass in assign, which borrows it under rules/P2 before a family comma, @@ -1671,23 +1732,51 @@ def declined_by_the_name_behind(token: WorkToken, piece: Sequence[int], tokens: Sequence[WorkToken], one_case: bool | None) -> bool: """Whether a word that would start #602's run declines it because - of the word behind it, `piece`: a member its capitals settle, or a - credential acronym written in Title case, with a word of the name - behind it (`_name_word_behind`), or a generation word written out + of the word behind it, `piece`: a member its capitals settle, a + credential acronym written in Title case, or a given name written + short in a name of one case (`short_given_name_in_one_case`), with a + word of the name behind it (`_name_word_behind`), or a generation + word written out before a name (`generation_word_before_a_name`). The caller asks whether the word starts a run at all.""" - return ((AMBIGUOUS_ACRONYM_TAG in token.tags + # rules/S8: "nor, in a name written wholly in one case, does a + # credential that is also a given name written short" -- the tag + # tested inline, so a credential that is no such word pays no frame + short = (bool(one_case) and GIVEN_ABBREVIATION_TAG in token.tags + and short_given_name_in_one_case(token, piece[0], tokens)) + return ((short + or AMBIGUOUS_ACRONYM_TAG in token.tags and settled_by_case(token, one_case) # rules/S8: "nor does a credential acronym written in # Title case" -- the writing of a name word or acronym_in_title_case(token)) - and _name_word_behind(piece, ptags, tokens, one_case) + and _name_word_behind(token, piece, ptags, tokens, one_case, + short) # rules/S8: "nor does a generation word written out" -- a # filer's middle-name box, the family name behind it or generation_word_before_a_name(token, piece, ptags, tokens, one_case)) +def _declined_here(token: WorkToken, i: int, piece: Sequence[int], + ptags: Set[str], tokens: Sequence[WorkToken], + one_case: bool | None, + declined: list[int] | None) -> bool: + """`declined_by_the_name_behind` for `run_start`, recording in + `declined`, where the caller keeps one, the index `i` of a given + name written short whose run its own writing declined, the one + decline whose writing settles nothing (rules/S8's one-case clause, + #1394): assign reports it.""" + if not declined_by_the_name_behind(token, piece, ptags, tokens, + one_case): + return False + if (declined is not None and one_case + and GIVEN_ABBREVIATION_TAG in token.tags + and short_given_name_in_one_case(token, piece[0], tokens)): + declined.append(i) + return True + + # rules/S8: "A credential after the name core starts a run to the # end of its part" -- applied to a finished peel (#602), so every # reader of the trailing run (assign, P5's reserve, the maiden take) @@ -1699,7 +1788,8 @@ def run_start(rest: Sequence[int], names: int, tokens: Sequence[WorkToken], units: Sequence[int] | None = None, one_case: bool | None = None, - initials_cue: bool = True) -> int: + initials_cue: bool = True, + declined: list[int] | None = None) -> int: """Where #602's run starts in `rest[:names]`: the position of the first credential that starts one (`starts_a_credential_run`) with two name pieces in front of it, or `names` where none does -- with @@ -1756,9 +1846,10 @@ def run_start(rest: Sequence[int], names: int, # the walk leaves out (#827) and not behind_the_merged_credential( rest, p + 1, ptags) - and declined_by_the_name_behind( - tokens[pieces[q][0]], pieces[rest[p + 1]], - ptags[rest[p + 1]], tokens, one_case))): + and _declined_here( + tokens[pieces[q][0]], pieces[q][0], + pieces[rest[p + 1]], ptags[rest[p + 1]], + tokens, one_case, declined))): return p # a lone particle is not yet a name: 'de Mesnil' is one surname # -- unless it opens a chain run, which is then the surname @@ -2170,11 +2261,14 @@ def tail_reading(rest: list[int], pieces: Sequence[Sequence[int]], count_numeral=count_numeral) kept = trailing_titles(rest, pieces, ptags, tokens, end=peeled.names, salutations=salutations) + declined: list[int] = [] if kept == peeled.names: p = run_start(rest, peeled.names, pieces, ptags, tokens, units, - one_case, initials_cue) - return rest, (), (peeled if p == peeled.names else credential_run( + one_case, initials_cue, declined) + peeled = (peeled if p == peeled.names else credential_run( rest, peeled, p, pieces, ptags, tokens, one_case)) + return rest, (), (peeled._replace(declined=tuple(declined)) + if declined else peeled) # `rest[:hi]` stands as written; `behind` holds the peeled runs # the splices left after it, and `titled` the chained ones, each # back to front -- a pass's run goes in FRONT of what the pass @@ -2226,10 +2320,12 @@ def tail_reading(rest: list[int], pieces: Sequence[Sequence[int]], rest = rest[:hi] + [j for run in reversed(behind) for j in run] final = Peel(peeled.names, tuple(numerals), tuple(picks), None) p = run_start(rest, final.names, pieces, ptags, tokens, units, - one_case, initials_cue) + one_case, initials_cue, declined) + final = (final if p == final.names else credential_run( + rest, final, p, pieces, ptags, tokens, one_case)) return (rest, tuple(j for run in reversed(titled) for j in run), - final if p == final.names else credential_run( - rest, final, p, pieces, ptags, tokens, one_case)) + final._replace(declined=tuple(declined)) if declined + else final) class TailRead(NamedTuple): diff --git a/nameparser/_pipeline/_state.py b/nameparser/_pipeline/_state.py index 41e6103ab..f2a4fe452 100644 --- a/nameparser/_pipeline/_state.py +++ b/nameparser/_pipeline/_state.py @@ -233,7 +233,10 @@ def reported_suffix_fork(ambiguities: Sequence[PendingAmbiguity], #: On a word of `Lexicon.given_name_abbreviations`, a given name written #: short ('Chas.', 'Ma.'): rules/H2's shape test declines a word #: carrying it, so the given reading outranks the shape-derived title -#: (`_pieces.is_leading_title`, `_vocab.is_title_shaped`). +#: (`_pieces.is_leading_title`, `_vocab.is_title_shaped`); rules/C13's +#: given-name Except (`_comma._given_name_written_short`) and rules/S8's +#: one-case clause (`_pieces.short_given_name_in_one_case`, #1394) read +#: it too. GIVEN_ABBREVIATION_TAG = "vocab:given-abbreviation" #: On a word of `Lexicon.shared_names`, a name a community gives every diff --git a/tests/v2/cases.py b/tests/v2/cases.py index c2d2a9d05..ea79d6dee 100644 --- a/tests/v2/cases.py +++ b/tests/v2/cases.py @@ -9249,15 +9249,18 @@ def _check_cjk_shape_purity(self) -> None: notes="S8 (#1019): a joiner inside the word is a credential's " "writing whatever the case. 1.4.0 through 2.3.0 read " "middle 'Smith Pa-c', family 'Jones'"), - Case("one_case_credential_before_a_name_word_starts_the_run", + Case("one_case_given_name_written_short_before_a_name_word_stays_a_name", "BADRUL AKMAL HISHAM MD YUSOFF", - {"given": "BADRUL", "middle": "AKMAL", "family": "HISHAM", - "suffix": "MD YUSOFF"}, - classification="fix(#602)", - ambiguities=("suffix-or-name",), - notes="S8 (#1019): a name written in one case carries no Title " - "case to read, so the run starts. 1.4.0 through 2.3.0 " - "read middle 'AKMAL HISHAM MD', family 'YUSOFF'"), + {"given": "BADRUL", "middle": "AKMAL HISHAM MD", + "family": "YUSOFF"}, + ambiguities=("suffix-or-name",), + notes="S8 (#1394): in a name written in one case, Muhammad " + "written short reads before a name word as its Title case " + "does, reported, the credential the reading not taken; " + "#1019 had read the run here, the name carrying no " + "Title case, before #1383 gave md its given reading. 1.4.0 " + "through 2.3.0 read the same; 2.4.0 through 3.1 read " + "family 'HISHAM', suffix 'MD YUSOFF' (#602's run)"), Case("capitals_before_a_title_word_surname_stay_a_name", "Mary Jane MA Pope", {"given": "Mary", "middle": "Jane MA", "family": "Pope"}, @@ -16400,6 +16403,220 @@ def _check_cjk_shape_purity(self) -> None: ambiguities=("suffix-or-name",), notes="boundary: two words before the comma are a whole name, " "and C13's run stands, as for 'John Smith, PhD Jones'"), + # -- #1394: in a name written wholly in one case, a credential that + # is also a given name written short (md) with a name word behind + # it starts no credential's run (rules/S8), as its Title case does + # not; 3175314d read each fix row's MD and the rest of the name as + # the suffix, reported. Names invented, of the measured shape. + Case("md_in_capitals_before_a_name_word_is_a_name_word", + "SITI NORA MD YUSRI", + {"given": "SITI", "middle": "NORA MD", "family": "YUSRI"}, + ambiguities=("suffix-or-name",), + notes="S8 (#1394): the father's name opening with Muhammad " + "written short, as 'Siti Nora Md Yusri' reads"), + Case("md_dotted_in_capitals_before_a_name_word_is_a_name_word", + "SITI NORA MD. YUSRI", + {"given": "SITI", "middle": "NORA MD.", "family": "YUSRI"}, + ambiguities=("suffix-or-name",), + notes="S8 (#1394): its trailing period leaves it the given name " + "written short"), + Case("md_glued_in_capitals_before_a_name_word_is_a_name_word", + "SITI NORA MD.YUSRI", + {"given": "SITI", "middle": "NORA MD.", "family": "YUSRI"}, + ambiguities=("suffix-or-name",), + classification="fix(#1394)", + notes="S8 (#1394): divided at its full stop (T8), it reads as " + "the spaced form does. 1.4.0 read middle 'NORA', family " + "'MD.YUSRI'"), + Case("md_in_lower_case_before_a_name_word_is_a_name_word", + "siti nora md yusri", + {"given": "siti", "middle": "nora md", "family": "yusri"}, + ambiguities=("suffix-or-name",), + notes="S8 (#1394): a name wholly in lower case is one case too, " + "and lower case is its name words' writing"), + Case("md_in_capitals_ending_the_name_under_family_first", + "YUSRI SITI NORA MD", + {"given": "SITI", "middle": "NORA", "family": "YUSRI", + "suffix": "MD"}, + policy=Policy(name_order=FAMILY_FIRST), + notes="boundary: with no name word behind it, it ends the name " + "as the credential under every order"), + Case("md_in_capitals_before_a_name_word_is_placed_by_the_order", + "SITI NORA MD YUSRI", + {"given": "NORA", "middle": "MD YUSRI", "family": "SITI"}, + policy=Policy(name_order=FAMILY_FIRST), + ambiguities=("suffix-or-name",), + classification="fix(#1394)", + notes="S8 (#1394): out of the run, the words are name words the " + "declared order places"), + Case("md_in_capitals_behind_bin_joins_the_family", + "AHMAD BIN MD RAHMAN", + {"given": "AHMAD", "family": "BIN MD RAHMAN"}, + ambiguities=("suffix-or-name",), + classification="fix(#1394)", + notes="S8 (#1394) through P2's chain stop: the chain takes it " + "as it takes 'Ahmad bin Md Rahman'. 1.4.0 read middle " + "'BIN MD', family 'RAHMAN'"), + Case("md_in_capitals_in_a_family_part_before_a_comma", + "BIN MD RAHMAN, AHMAD", + {"given": "AHMAD", "family": "BIN MD RAHMAN"}, + classification="fix(#1394)", + notes="S8 (#1394) through assign's family-part pass behind a " + "particle, which borrows the decline (rules/P2). 1.4.0 " + "read family 'BIN RAHMAN', suffix 'MD'"), + Case("md_in_capitals_before_a_western_surname_reads_as_a_name", + "JOHN SMITH MD JONES", + {"given": "JOHN", "middle": "SMITH MD", "family": "JONES"}, + ambiguities=("suffix-or-name",), + notes="Accepted (rules/S8): in one case the degree before a " + "surname cannot be told from Muhammad written short; " + "'John Smith MD Jones' and 'JOHN SMITH M.D. JONES' keep " + "the run"), + Case("md_in_capitals_before_a_name_word_under_family_first_given_last", + "SITI NORA MD YUSRI", + {"given": "YUSRI", "middle": "NORA MD", "family": "SITI"}, + policy=Policy(name_order=FAMILY_FIRST_GIVEN_LAST), + classification="fix(#1394)", + ambiguities=("suffix-or-name",), + notes="S8 (#1394): the order whose given name moves to the end"), + Case("md_in_capitals_before_a_name_word_and_a_suffix_comma", + "SITI NORA MD YUSRI, JR", + {"given": "SITI", "middle": "NORA MD", "family": "YUSRI", + "suffix": "JR"}, + ambiguities=("suffix-or-name",), + notes="S8 (#1394): before a suffix comma the run's start asks " + "the same, as 'Badrul Hisham Md Yusoff, Jr.' does"), + Case("md_in_capitals_before_a_cyrillic_name_word_is_a_name_word", + "ИВАН ПЕТРОВ MD СИДОРОВ", + {"given": "ИВАН", "middle": "ПЕТРОВ MD", "family": "СИДОРОВ"}, + ambiguities=("suffix-or-name",), + notes="S8 (#1394): the word behind is asked for a letter of a " + "script with case, not for a Latin one"), + Case("md_in_capitals_before_a_title_word_reads_it_as_the_family", + "JOHN SMITH MD PROF", + {"given": "JOHN", "middle": "SMITH MD", "family": "PROF"}, + classification="fix(#1394)", + ambiguities=("suffix-or-name",), + notes="Accepted (rules/S8): a title behind it is a name word, as " + "behind a Title-case acronym ('John Smith Md Dr'); 3175314d " + "read title 'PROF', suffix 'MD'"), + Case("md_in_capitals_before_a_dotted_title_keeps_the_title", + "JOHN SMITH MD PROF.", + {"given": "JOHN", "family": "SMITH", "title": "PROF.", + "suffix": "MD"}, + classification="fix(#316)", + notes="boundary: a period-marked title ending the name comes off " + "first (rules/H5), so nothing stands behind the MD"), + Case("md_in_capitals_before_a_shape_numeral_starts_the_run", + "JOHN SMITH MD VI JONES", + {"given": "JOHN", "family": "SMITH", "suffix": "MD VI JONES"}, + classification="fix(#602)", + ambiguities=("suffix-or-name", "suffix-or-name"), + notes="boundary: a numeral S10 reads as the generation, listed or " + "not, is the credential's company, no name word (#1394's " + "review: the first build read family 'MD')"), + Case("md_title_case_before_a_shape_numeral_starts_the_run", + "John Smith Md VI Jones", + {"given": "John", "family": "Smith", "suffix": "Md VI Jones"}, + classification="fix(#1394)", + ambiguities=("suffix-or-name", "suffix-or-name"), + notes="S8 (#1394's review): the same predicate for the Title-case " + "acronym; 3175314d read middle 'Smith', family 'Md', " + "suffix 'VI Jones'"), + Case("md_in_capitals_before_a_nickname_and_a_shape_numeral", + "JOHN SMITH MD (B) VI JONES", + {"given": "JOHN", "family": "SMITH", "nickname": "B", + "suffix": "MD VI JONES"}, + classification="fix(#602)", + ambiguities=("suffix-or-name", "suffix-or-name"), + notes="boundary: the numeral is weighed behind the credential, " + "not behind the nickname between them (#1394's second " + "review: the first fix read family 'MD')"), + Case("capitals_member_before_a_shape_numeral_starts_the_run", + "John Smith MA VI Jones", + {"given": "John", "family": "Smith", "suffix": "MA VI Jones"}, + classification="fix(#1394)", + ambiguities=("suffix-or-name", "suffix-or-name"), + notes="S8 (#1394's review): a numeral S10 reads as the " + "generation is no name word behind a settled member " + "either; 3175314d read family 'MA', suffix 'VI Jones'"), + Case("md_in_capitals_behind_a_particle_chain_still_reports", + "JOHN VAN MD MA DE", + {"given": "JOHN", "middle": "VAN MD MA", "family": "DE"}, + classification="fix(#1394)", + ambiguities=("suffix-or-name", "suffix-or-name"), + notes="S8 (#1394's second review): the decline's report survives " + "group's rebuilt read where the chain took a member the " + "read had picked; 3175314d read suffix 'MD MA DE'"), + Case("md_in_a_mixed_case_maiden_clause_keeps_the_run", + "JOHN SMITH née Ann Lee MD Jones", + {"given": "JOHN", "family": "SMITH", "maiden": "Ann Lee", + "suffix": "MD Jones"}, + classification="fix(#602)", + ambiguities=("suffix-or-name",), + notes="boundary: the case asked of a word in a maiden clause is " + "the whole name's (rules/S6), which is mixed here, though " + "the name's own words are in one case (#1394's review)"), + Case("md_in_one_case_own_words_before_a_mixed_case_clause", + "JOHN SMITH MD JONES née Xyz", + {"given": "JOHN", "middle": "SMITH MD", "family": "JONES", + "maiden": "Xyz"}, + classification="fix(#1394)", + ambiguities=("suffix-or-name",), + notes="S8 (#1394): a word of the name's own words asks their " + "case, so a clause appended changes nothing about it " + "(rules/P3's own words)"), + Case("md_title_case_in_a_mixed_case_maiden_clause_keeps_the_run", + "JOHN SMITH née Ann Lee Md jones", + {"given": "JOHN", "family": "SMITH", "maiden": "Ann Lee", + "suffix": "Md jones"}, + classification="fix(#602)", + ambiguities=("suffix-or-name",), + notes="boundary: a word in lower case behind a Title-case acronym " + "is no name word in a name of mixed case, the one-case " + "reading of lower case being asked only behind a given name " + "written short (#1394's review)"), + Case("md_in_capitals_ending_the_name_stays_the_credential", + "JOHN SMITH MD", + {"given": "JOHN", "family": "SMITH", "suffix": "MD"}, + notes="boundary: no word behind it, so nothing declines it"), + Case("md_in_capitals_before_a_credential_stays_the_credential", + "JOHN SMITH MD PHD", + {"given": "JOHN", "family": "SMITH", "suffix": "MD PHD"}, + notes="boundary: a credential behind it is no name word"), + Case("md_in_capitals_before_a_generation_stays_the_credential", + "JOHN SMITH MD JR", + {"given": "JOHN", "family": "SMITH", "suffix": "MD JR"}, + notes="boundary: a suffix word behind it is no name word"), + Case("md_in_capitals_with_its_periods_starts_the_run", + "JOHN SMITH M.D. JONES", + {"given": "JOHN", "family": "SMITH", "suffix": "M.D. JONES"}, + classification="fix(#602)", + ambiguities=("suffix-or-name",), + notes="boundary: written with its periods it is the degree's " + "writing, no given name written short"), + Case("md_in_capitals_after_the_given_word_after_a_comma_starts_the_run", + "SMITH, JOHN MD JONES", + {"given": "JOHN", "family": "SMITH", "suffix": "MD JONES"}, + classification="fix(#602)", + ambiguities=("suffix-or-name",), + notes="boundary: after a family comma the cue does not reach, " + "as 'Smith, John Md Jones' keeps the run"), + Case("md_in_capitals_before_a_maiden_marker_starts_the_run", + "JOHN SMITH MD NÉE JONES", + {"given": "JOHN", "family": "SMITH", "suffix": "MD NÉE JONES"}, + classification="fix(#602)", + ambiguities=("suffix-or-name", "suffix-or-name"), + notes="boundary: a maiden marker behind it is no name word; " + "read as on 3175314d"), + Case("md_in_capitals_before_a_caseless_word_starts_the_run", + "محمد علي MD حسن", + {"given": "محمد", "family": "علي", "suffix": "MD حسن"}, + classification="fix(#602)", + ambiguities=("suffix-or-name",), + notes="boundary: a Latin MD in a name of a script with no case " + "shares no case with it, so its capitals stay the " + "credential's; read as on 3175314d"), Case("wm_dotted_trailing_is_a_name_word", "John Smith Wm.", {"given": "John", "middle": "Smith", "family": "Wm."}, notes="H5 read a listed `wm` as a title here from 2.3.0 " diff --git a/tests/v2/test_cases.py b/tests/v2/test_cases.py index 89be22320..45d05d8c1 100644 --- a/tests/v2/test_cases.py +++ b/tests/v2/test_cases.py @@ -490,9 +490,12 @@ def test_the_field_sweep_sees_the_claims_it_checks() -> None: # -> 2098, the third review's four rows under three orders; 2098 -> # 2101, 'Jane Doe, A.L., PhD' under three orders; 2101 -> 2107 on # 2026-11-18, #1455's 'Oude Luttikhuis' and 'Luttikhuis, Piet Oude', - # each reporting particle-or-given under three orders. - assert claims == 2107, ( - f"the field sweep checks {claims} claims, recorded as 2107 on " + # each reporting particle-or-given under three orders; 2107 -> 2187 + # the same day, #1394's rows under three orders or once where a row + # declares a policy: the decline's report on each moved row, and + # its boundary rows' run reports. + assert claims == 2187, ( + f"the field sweep checks {claims} claims, recorded as 2187 on " f"2026-11-18") @@ -567,6 +570,15 @@ def test_the_field_sweep_sees_the_claims_it_checks() -> None: ("Rahman, Md Sheikh Karim", None), ("Rahman, Md Sheikh Karim", 1), ("Rahman, Md Sheikh Karim", 2), ("Rahman, Md Dean", None), ("Rahman, Md Dean", 1), ("Rahman, Md Dean", 2), + # a name word in the maiden marker's or the numeral's place makes an + # 'MD' in capitals, or an 'Md', Muhammad written short (rules/S8, + # #1394) + ("JOHN SMITH MD NÉE JONES", None), ("JOHN SMITH MD NÉE JONES", 2), + ("JOHN SMITH MD VI JONES", None), ("JOHN SMITH MD VI JONES", 2), + ("John Smith Md VI Jones", None), ("John Smith Md VI Jones", 2), + ("JOHN SMITH MD (B) VI JONES", None), + ("JOHN SMITH MD (B) VI JONES", 2), + ("John Smith MA VI Jones", None), ("John Smith MA VI Jones", 2), } #: Reports whose deferred field assign could not name: the particle the @@ -957,8 +969,11 @@ def test_the_alternative_sweep_sees_the_fields_it_checks() -> None: # 456 -> 462, the coordinator's review's two rows; 462 -> 474, the # third review's four; 474 -> 477, the 'A.L.' row; 595 -> 598 on # 2026-11-18, #1455's 'Luttikhuis, Piet Oude' under the three orders, - # P6's report, each stand-in landing in the alternative's field - assert (checked, skipped) == (598, 477), (checked, skipped) + # P6's report, each stand-in landing in the alternative's field; + # 477 -> 494 and 598 -> 603 the same day, #1394's rows under the + # three orders, the declines' reports and the boundary rows' run + # reports, three of them stand-in rereads + assert (checked, skipped) == (603, 494), (checked, skipped) def test_every_case_name_is_unique() -> None: diff --git a/tests/v2/test_vocab.py b/tests/v2/test_vocab.py index 0287eda92..e41d1a75a 100644 --- a/tests/v2/test_vocab.py +++ b/tests/v2/test_vocab.py @@ -296,10 +296,11 @@ def test_the_shipped_short_forms_of_muhammad() -> None: #: The credential `md` in the shapes a plain given reading moved (#1383's #: measurement, the committed corpora and ClinicalTrials.gov), each read -#: as on master 3dadc263 save the glued `MD.NOOR` (below), which is -#: left wrong as before (#1394), and `Md` opening the part after a family -#: comma, which #1393 reads as the given name (the case table's `md_*` -#: rows, rules/C13). +#: as on master 3dadc263 save `Md` opening the part after a family +#: comma, which #1393 reads as the given name, and `MD` before a name +#: word in a name of one case (the glued `MD.NOOR` among them), which +#: #1394 reads as one (the case table's `md_*` rows, rules/C13 and +#: rules/S8). #: (Accepted, decisions/vocabulary-model 2026-11-13 #1383). _MD_KEEPS_ITS_CREDENTIAL = ( ("BERGER, MD", {"family": "BERGER", "suffix": "MD"}), @@ -316,9 +317,6 @@ def test_the_shipped_short_forms_of_muhammad() -> None: {"given": "John", "family": "Smith", "suffix": "MD Jones"}), ("Dr. Pope MD", {"title": "Dr.", "family": "Pope", "suffix": "MD"}), ("Md Rahman, PhD", {"given": "Md", "family": "Rahman", "suffix": "PhD"}), - # left wrong as before, not moved by #1383 (#1394) - ("SITI AMINAH MD.NOOR", - {"given": "SITI", "family": "AMINAH", "suffix": "MD. NOOR"}), ) @@ -330,9 +328,10 @@ def test_md_written_short_leaves_its_credential_reading( # on 2026-11-13): with `md` put back among the ambiguous acronyms # (the plain given reading of #1383's shape (a)), 10 of the 11 rows # move, all but `Md Rahman, PhD`; so do the case table's `John Smith - # Md` and `Smith (MD), John`. The glued `MD.NOOR` is the one shape - # the change moves (its stop now divides the word, the suffix still - # holding both halves) + # Md` and `Smith (MD), John`. 9 of 10 on 2026-11-18, the glued + # `SITI AMINAH MD.NOOR` gone to the case table, which #1394 reads as + # a name word (`Lexicon.default().add("md", kind="given", + # same_as=None)` as the mutation) got = {k: v for k, v in parse(text).as_dict().items() if v} assert got == fields, text diff --git a/tools/differential/corpus_rules.jsonl b/tools/differential/corpus_rules.jsonl index 1e9a9ae49..cc2b5aa5b 100644 --- a/tools/differential/corpus_rules.jsonl +++ b/tools/differential/corpus_rules.jsonl @@ -64,6 +64,7 @@ "ABRAMOVICH Roman" "ABRAMOVICH Roman MBA" "ABRAMOVICH Roman, MBA" +"AHMAD BIN MD RAHMAN" "AHMAD IBN-ʿALĪ" "AHMED Kyzy" "ALEXANDRE DUMAS DER ÄLTERE" @@ -537,8 +538,12 @@ "JOHN SMITH (m.a) (MA)" "JOHN SMITH JR JONES" "JOHN SMITH JR, AD" +"JOHN SMITH M.D. JONES" "JOHN SMITH MA" "JOHN SMITH MA JONES" +"JOHN SMITH MD JONES" +"JOHN SMITH MD MR" +"JOHN SMITH MD PHD" "JOHN SMITH NEE X X" "JOHN SMITH PH.D." "JOHN SMITH SAM E." @@ -1496,6 +1501,7 @@ "SIR John MD" "SIR John SMITH" "SIR John Smith" +"SITI NORA MD YUSRI" "SMITH VD MA, JOHN" "SMITH VD V, JOHN" "SMITH VD, JOHN" @@ -1504,6 +1510,7 @@ "SMITH, JOHN DO" "SMITH, JOHN GEN." "SMITH, JOHN I" +"SMITH, JOHN MD JONES" "SMITH, MA" "SMITH, MD DEAN" "SMITH, SAM E." @@ -1983,6 +1990,7 @@ "محمد بن سلمان" "محمد عبد القريشي" "محمد عبد الله أحمد" +"محمد علي MD حسن" "محمد علي و" "مُحَمَّد بِن سَلمان" "نوال عبد هاشم" diff --git a/tools/differential/snapshot.jsonl b/tools/differential/snapshot.jsonl index f9cde4ef3..c34ccc266 100644 --- a/tools/differential/snapshot.jsonl +++ b/tools/differential/snapshot.jsonl @@ -84,6 +84,7 @@ {"name": "ABRAMOVICH Roman", "given": "ABRAMOVICH", "family": "Roman", "initials": "A. R.", "capitalized_force": "Abramovich Roman"} {"name": "ABRAMOVICH Roman MBA", "given": "ABRAMOVICH", "family": "Roman", "suffix": "MBA", "initials": "A. R.", "capitalized_force": "Abramovich Roman MBA"} {"name": "ABRAMOVICH Roman, MBA", "given": "ABRAMOVICH", "family": "Roman", "suffix": "MBA", "initials": "A. R.", "capitalized_force": "Abramovich Roman, MBA"} +{"name": "AHMAD BIN MD RAHMAN", "given": "AHMAD", "family": "BIN MD RAHMAN", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: credential as suffix (vocabulary)"], "initials": "A. M. R.", "capitalized": "Ahmad bin Md Rahman", "patronymic": "BIN MD RAHMAN"} {"name": "AHMAD IBN-ʿALĪ", "given": "AHMAD", "family": "IBN-ʿALĪ", "initials": "A. I.", "capitalized": "Ahmad Ibn-ʿAlī"} {"name": "AHMED Kyzy", "given": "AHMED", "family": "Kyzy", "initials": "A. K.", "capitalized_force": "Ahmed Kyzy"} {"name": "AKIME Fuseena", "order": "FAMILY_FIRST", "given": "Fuseena", "family": "AKIME", "initials": "F. A.", "capitalized_force": "Akime Fuseena"} @@ -1685,8 +1686,12 @@ {"name": "JOHN SMITH (m.a) (MA)", "given": "JOHN", "family": "SMITH", "suffix": "m.a", "nickname": "MA", "ambiguities": ["SUFFIX_OR_NICKNAME"], "alternatives": ["SUFFIX_OR_NICKNAME: credential as suffix (vocabulary)"], "initials": "J. S.", "capitalized": "John \"Ma\" Smith M.A"} {"name": "JOHN SMITH JR JONES", "given": "JOHN", "middle": "SMITH JR", "family": "JONES", "initials": "J. S. J. J.", "capitalized": "John Smith Jr Jones"} {"name": "JOHN SMITH JR, AD", "given": "AD", "family": "JOHN SMITH", "suffix": "JR", "initials": "A. J. S.", "capitalized": "Ad John Smith Jr", "generation": "JR"} +{"name": "JOHN SMITH M.D. JONES", "given": "JOHN", "family": "SMITH", "suffix": "M.D. JONES", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: name as family (position)"], "initials": "J. S.", "capitalized": "John Smith M.D. Jones"} {"name": "JOHN SMITH MA", "given": "JOHN", "family": "SMITH", "suffix": "MA", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: name as family (declared)"], "initials": "J. S.", "capitalized": "John Smith MA"} {"name": "JOHN SMITH MA JONES", "given": "JOHN", "middle": "SMITH MA", "family": "JONES", "initials": "J. S. M. J.", "capitalized": "John Smith Ma Jones"} +{"name": "JOHN SMITH MD JONES", "given": "JOHN", "middle": "SMITH MD", "family": "JONES", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: credential as suffix (vocabulary)"], "initials": "J. S. M. J.", "capitalized": "John Smith Md Jones"} +{"name": "JOHN SMITH MD MR", "given": "JOHN", "middle": "SMITH MD", "family": "MR", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: credential as suffix (vocabulary)"], "initials": "J. S. M. M.", "capitalized": "John Smith Md Mr"} +{"name": "JOHN SMITH MD PHD", "given": "JOHN", "family": "SMITH", "suffix": "MD PHD", "initials": "J. S.", "capitalized": "John Smith MD PhD"} {"name": "JOHN SMITH NEE X X", "given": "JOHN", "family": "SMITH", "maiden": "X X", "initials": "J. S.", "capitalized": "John Smith (X X)"} {"name": "JOHN SMITH PH.D.", "given": "JOHN", "family": "SMITH", "suffix": "PH.D.", "initials": "J. S.", "capitalized": "John Smith Ph.D."} {"name": "JOHN SMITH SAM E.", "given": "JOHN", "family": "SMITH", "suffix": "SAM E.", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: name as family (position)"], "initials": "J. S.", "capitalized": "John Smith SAM E."} @@ -3802,6 +3807,7 @@ {"name": "SIR John MD", "title": "SIR", "given": "John", "suffix": "MD", "initials": "J.", "capitalized_force": "Sir John MD"} {"name": "SIR John SMITH", "title": "SIR", "given": "John", "family": "SMITH", "initials": "J. S.", "capitalized_force": "Sir John Smith"} {"name": "SIR John Smith", "title": "SIR", "given": "John", "family": "Smith", "initials": "J. S.", "capitalized_force": "Sir John Smith"} +{"name": "SITI NORA MD YUSRI", "given": "SITI", "middle": "NORA MD", "family": "YUSRI", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: credential as suffix (vocabulary)"], "initials": "S. N. M. Y.", "capitalized": "Siti Nora Md Yusri"} {"name": "SMITH CPA MST CGMA, JOHN", "given": "JOHN", "family": "SMITH", "suffix": "CPA MST CGMA", "initials": "J. S.", "capitalized": "John Smith CPA MST CGMA"} {"name": "SMITH VD MA, JOHN", "given": "JOHN", "family": "SMITH VD MA", "initials": "J. S. M.", "capitalized": "John Smith vd Ma"} {"name": "SMITH VD V, JOHN", "given": "JOHN", "family": "SMITH VD V", "initials": "J. S. V.", "capitalized": "John Smith vd V"} @@ -3811,6 +3817,7 @@ {"name": "SMITH, JOHN DO", "given": "JOHN", "family": "DO SMITH", "ambiguities": ["PARTICLE_OR_GIVEN"], "alternatives": ["PARTICLE_OR_GIVEN: name as middle (declared)"], "initials": "J. S.", "capitalized": "John do Smith"} {"name": "SMITH, JOHN GEN.", "title": "GEN.", "given": "JOHN", "family": "SMITH", "initials": "J. S.", "capitalized": "Gen. John Smith"} {"name": "SMITH, JOHN I", "given": "JOHN", "family": "SMITH", "suffix": "I", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: initial as middle (shape)"], "initials": "J. S.", "capitalized": "John Smith I", "generation": "I"} +{"name": "SMITH, JOHN MD JONES", "given": "JOHN", "family": "SMITH", "suffix": "MD JONES", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: name as middle (position)"], "initials": "J. S.", "capitalized": "John Smith MD Jones"} {"name": "SMITH, MA", "given": "MA", "family": "SMITH", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: credential as suffix (vocabulary)"], "initials": "M. S.", "capitalized": "Ma Smith"} {"name": "SMITH, MD DEAN", "family": "SMITH", "suffix": "MD DEAN", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: name as given (declared)"], "initials": "S.", "capitalized": "Smith, MD Dean"} {"name": "SMITH, SAM E.", "given": "SAM", "middle": "E.", "family": "SMITH", "initials": "S. E. S.", "capitalized": "Sam E. Smith"} @@ -6196,6 +6203,7 @@ {"name": "محمد عبد القريشي", "given": "محمد", "middle": "عبد", "family": "القريشي", "initials": "م. ع. ا."} {"name": "محمد عبد الله أحمد", "given": "محمد", "middle": "عبد الله", "family": "أحمد", "initials": "م. ع. ا. أ."} {"name": "محمد عطا", "given": "محمد", "family": "عطا", "initials": "م. ع."} +{"name": "محمد علي MD حسن", "given": "محمد", "family": "علي", "suffix": "MD حسن", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: name as family (position)"], "initials": "م. ع."} {"name": "محمد علي و", "given": "محمد", "family": "علي و", "initials": "م. ع."} {"name": "محمد نبيه المسيري", "given": "محمد", "middle": "نبيه", "family": "المسيري", "initials": "م. ن. ا."} {"name": "محمد و علي", "given": "محمد", "middle": "و", "family": "علي", "initials": "م. و. ع."}