Skip to content

Read Md., Mohd and Moh as Muhammad written short, MD still the degree - #1395

Merged
derek73 merged 7 commits into
masterfrom
feat/issue-1383-muhammad-short-forms
Nov 15, 2026
Merged

derek73 merged 7 commits into
masterfrom
feat/issue-1383-muhammad-short-forms

Conversation

@derek73

@derek73 derek73 commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Md., Mohd and Moh read as Muhammad written short, and the medical degree MD keeps its reading. Md opening the given part after a family comma reads as the given name where its writing says so (#1393). This is #1383's shape (a), with the two parts decided after measurement (#1383's amendment comment). It reverses the 2026-10-27 ruling that kept a leading Md. a title (decided for this PR).

What changes

A leading Md. is the given name.

  • md gains a given reading carrying same_as, in mul.toml, as wm and chas have.
  • parse("Md. Abdul Karim") gives given Md., middle Abdul. 1.4.0 through 3.0.1 gave title Md. (wheels run outside the tree).

Md after a family comma (#1393, rules/C13's new Except). Where the part opens, behind any titles, with an unambiguous credential that is also a given name written short, and no whole name stands before the comma (C3's count, a title counting as a word), it opens the given part:

  • Alone in the part, with no title in front. In a name of mixed case, it opens the given part where it is written with a lower-case letter its credential's own case mask does not write (Rahman, Md, Rahman, Md.).
  • With a name word behind it, titles in front or not (Rahman, Md Abdul, RAHMAN, MD ABDUL, Uddin, Mr Md Karim, Smith, MD J). A name word is no conjunction and has no suffix or title reading of any kind. It is no half of a split credential, and it holds a letter. In a name of mixed case it is no word in capitals, but an initial counts, counted in letters so Rahman, Md É reads alike composed and decomposed.
  • Elsewhere the part stays the postnominal one: RAHMAN, MD, rahman, md., Smith, MD PhD, Smith, Md PhD, Smith, Md XYZ, SMITH, MD DEAN, SMITH, MD SHEIKH, RAHMAN, MD 2, Rahman, Md and Karim, Dr. Rahman, Md, Rahman Khan, Md Abdul.
  • Alone behind a title it reads as on master, title and suffix 'Md' (Smith, Dr. Md, Uddin, Mr Md, Rahman, Mr. Md.).
  • Where the Except fires it reports suffix-or-name, the credential as the alternative, as ma reports in the same slot.
  • Rules amended: C8 and H2 point at the Except, and C13's Signal line names what it reads.

md's credential moves to mul.toml beside its given reading (decided 2026-11-14). A strict choice keeps only its languages' files and mul.toml. So with the credential in en.toml and the given reading in mul.toml, every strict pack read John Smith, MD. as given 'MD.'; master's strict packs read John Smith, MD as given 'MD' already. This reverses, in part, the 2026-11-02 #1005 decision that kept md in en.toml. That decision's reason, strict bn reading Rahman, Md as a credential, is answered by #1393.

A given name written short makes no acronym ambiguous (decided in #1383's amendment), and, as an implementation choice, no suffix word either.

  • One predicate, ReadingProperties.marks_a_clash, is read by the compile, the build and Lexicon.
  • It reaches md alone; ma keeps its ambiguity.
  • Its limit, by its reason: a title or a particle beside a short form still marks the fork, since both stand at the head of a name. And a short form gates no agnomen, so check 11 refuses one whose only name reading is written short.

same_as may be a list.

  • Where it applies: build check 7, the file order (which follows a list's first word), the cycle check, compile_readings, and Lexicon.add(same_as=[...]) (a single word is kept as its text).
  • words(same_as=...) matches a reading by any word it names.
  • Errors follow the taxonomy: TypeError for a wrong type, ValueError for a list or text naming no word. same_as="" raised TypeError through 3.0.1, which the release log notes.

add("md", kind="given") changes nothing now: add updates only the properties it is given. docs/customize.rst gives the working calls as doctests:

  • same_as=None for 3.0's plain given reading;
  • remove("md", kind="given") for 3.0's Md. title.

Pickles: a 3.1 pickle does not load under 3.0.x, and did not before this PR (master's fail on 3.0.1 on its title readings' same_as and its new PolicyPatch fields). The pickle bullet says so.

The lists, by the first word of ORCID's given boxes, recounted 2026-11-14 (recipe in decisions/vocabulary-model):

Short form Where Lists First-word counts there
md Bangladesh muhammad, mohammad, mohammed, muhammed, mohamed mohammad 1,787, muhammad 429, mohammed 272, muhammed 35, mohamed 6, mohamad 1
mohd Malaysia muhammad, mohamad, mohammad, mohammed, mohamed muhammad 1,971, mohamad 627, mohammad 433, mohamed 183, mohammed 164, muhammed 12
moh Indonesia the same five muhammad 8,570, mohammad 789, mohamad 429, mohammed 21, mohamed 13, muhammed 4

md adding muhammed was decided 2026-11-14. Whether mohd and moh list it (12 and 4 there; Turkey writes it 2,544 times) is not decided, and they don't.

What moved

Snapshot (re-recorded after every entry was read):

  • Md. Abdul Karim title → given;
  • Uddin, Mr Md Karim suffix → title, given, middle, reporting suffix-or-name;
  • the comma rows report suffix-or-name;
  • John Smith, MD MEng and john smith, md ma alternative source position → declared;
  • plus the new rule examples and case rows.

The CLDR and Wikidata agreement records match.

Corpus names holding md after a comma (,[^,]*\bmd\b, case-insensitive, this branch against 3dadc26):

Every pack, plain and strict (160,441 names holding md, mohd or moh, this branch against 3dadc26):

Choice Names moved Cause
every plain pack and the default 3,397 to 3,400 3,095 leading Md./Mohd. title → given; 279 to 281 glued Md.Word divides; 21 or 22 #1393; 1 other (improved)
VI plain 3,399 the same names, placed by its family-first order (3,092 read family Md.)
every strict pack 141,190 to 141,201 137,813 to 140,007 now read as the plain choice does, the credential restored (Anna Weber, MD: given 'MD' → suffix 'MD')
strict vs plain gap over these names 138,846–139,416 → 2,260 (ES_AR) to 4,842 (JA) the remainder is other languages' particles and titles a strict choice drops, as on master

RU, TR_AZ and ZH refuse strict=True.

match_diff.py --base <checkout of merge base aad9ca8e> (NAMEPARSER_TOOLS_CACHE a folder of its own): 31,376 pairs under 22 settings. The key guarantee holds. 10,074 of 690,272 rows move, every one a pair holding Md., Md, Mohd or Moh.

Verdict Rows Read
not consistent → consistent 783 the short forms' listed spellings (Md Rahman / Muhammed Rahman among them), the name written both ways round a comma
consistent → not, Accepted 33 Md. Rahman / RAHMAN, MD (16), a Mohammed. title (17)
consistent → not, lenient settings 4 Md is now a given name on both sides, conflicting with another given name (J. R. / Dr. Md. Rahman)
consistent → not, a refused outcome 8 -folded (Md. against Md), -one-side (the middle name on one side)

Accepted, recorded

  • MD in capitals alone after a family comma stays the degree: RAHMAN, MD cannot be told from NOVAK, MD, which 107 ClinicalTrials.gov officials write.
  • A lone Md behind a title after a family comma stays the credential (master's reading). So Md. Rahman / Rahman, Mr Md (and Mrs Md, Dr. Md) is given-one-side with no shared key, consistent only under +given-one-side. Master read it consistent because neither side had a given name. The (title, given 'Md') reading that would make it consistent needs a change in assign's given-part walk, not built. Recorded in rules/C13's Accepted section and decisions/name-matching.
  • A mixed-case Md before a title that may be a name stays the credential (Rahman, Md Sheikh Karim, Rahman, Md Dean): no local corpus writes the shape (,\s*Md\.?\s+(Sheikh|Dean|King|Shekh|Prince|Sheik|Shaikh)\b, case-sensitive, 0 matches).
  • A mixed-case Md before a name in capitals stays the credential (Rahman, Md KARIM): ,\s*Md\.?\s+[A-Z]{2,} in a name not wholly in capitals matches 5 ctgov entries, every one the degree before another credential behind a whole name. Under strict bn this moves from master's given 'Md', middle 'KARIM' to the suffix, as the default reads it; Rahman, Md Karim reads given there.
  • The degree written before a given name reads as Muhammad written short (SMITH, MD JANE), 1 of FEC's 9 such movers.
  • A whole name before the comma keeps the credential (Dr. Rahman, Md, Rahman Khan, Md Abdul).
  • A full spelling of Muhammad written with a full stop is an H2 title (Mohammed. Rahman): 10 of 22,986 ORCID names opening with a long spelling write it.
  • Not transitive across two long spellings: Mohammad Rahman ~ Md Rahman ~ Muhammad Rahman.
  • mst keeps its cost (Begum, Mst Amina → suffix), having no given reading.
  • Left to their own issues: MD inside a name in capitals reads as the degree and takes the father's name (MARIAM HAFIZAH MD MOKHTAR gives suffix 'MD MOKHTAR') #1394 (SITI AMINAH MD.NOOR) and Read Ab at the head of a name as a given name, Abdul written short (Malay Ab Hamid Mohd Nazahar gives title Ab) #1178.

Tests and controls

  • One mutant per clause of the Except (12, and the third review's three: a code-point length, no conjunction test, no lower-case test), each failing at least one test: the lone arm's title and case tests, the case mask, each tag prefix, the initial clause, the credential requirement (Smith, Wm Jones reports nothing), the letter test, the whole-name guard, the report, the title loop.
  • With the Except off: every fix(#1393) row, C13's examples, the property test (66 pairs) and both sweep counts fail.
  • With the compile rule off (rebuilt): 55 case rows, 34 rules examples and 3 tests in tests/test_suffixes.py fail.
  • _MD_KEEPS_ITS_CREDENTIAL (11 rows): 10 move with md ambiguous again. The agnomen clause, the _heads last-head mutant and the title/particle limit each have their row.
  • Recorded counts, each dated in its test: the field sweep 1,899 → 1,971; the alternative sweep's skipped pairs 363 → 372 (Smith, Md XYZ under three orders; SMITH, MD DEAN and SMITH, MD SHEIKH join _STAND_IN_REREADS, as Smith, MD Pharm D and SMITH, MD MBA, JANE did last round).
  • Coverage: ce5b824 covers the Except's all-titles path.
  • All names in new tests and docs are made up.

Should the Except be its own rule? (open follow-up, not decided)

I recommend it, in a follow-up. It now has its own When (a credential that is also a given name written short), its own signal (the word's writing and the word behind it), and C3's count as a precondition. C8 and H2 both point at it, and C13 is left holding an Except larger than its Then. Splitting it would give it a When / Then / Because of its own and let C13 return to the credential run alone. Not done here.

Merged with #1390

MD in capitals is both Muhammad written short and #1351's capitals word. #1351's rule is asked only where a pair is not otherwise consistent, so MD Rahman / Mohammad Dewan Rahman reads listed-spelling. _CAPITALS' control moves from 16 rows to 15.

Checks

  • uv run pytest: 48,424 passed. uv run pytest -n0 -m serial: 38 passed.
  • The suite without namedivider-python, and on Python 3.15, each in its own environment: 48,424 passed each.
  • uv run mypy and uv run ruff check.
  • sphinx-build -b doctest: 912 tests, 0 failures. python -m doctest README.rst.
  • tools/vocab/build.py --check, snapshot.py --record after reading every move, cldr_agreement.py.
  • match_diff.py --base, the pack sweep and the corpus comparison, as above.

Review aspects run

  • pr-review-toolkit:code-reviewer on 0cbe551: findings fixed in a8f932f.
  • The coordinator's combined review of a8f932f (A1–A7, B1–B12): fixed in a7755a4.
  • The independent review of a7755a4 (items 1–19) and the 2026-11-14 decisions (the mul move, muhammed): 1e2103d, with ce5b824 (coverage).
  • The review of 1e2103d (items 1–16, the closing round): this round's commit, the rule's code changed only by its items 1–3.

Closes #1383
Closes #1393

🤖 Generated with Claude Code

derek73 and others added 2 commits November 13, 2026 21:58
`md` gains a given reading carrying `same_as`, so a leading `Md.` is
the given name (`Md. Abdul Karim` gives given 'Md.', middle 'Abdul',
where 1.4.0 through 3.0.1 gave title 'Md.'). A given reading carrying
`same_as`, a name written short, now marks no clash with a suffix
reading, so the medical degree stays an unambiguous credential
(`John Smith, MD`, `AGAPE, MD`, `John Smith Md`); on the shipped
vocabulary the rule reaches `md` alone, `ma` keeping its plain name
readings and its ambiguity.

A `same_as` may be a list, in the files and in `Lexicon.add`, kept as
its text where it names one word. `md`, `mohd` and `moh` list the
long spellings written where each is (muhammad, mohammad, mohammed,
mohamed, and for mohd and moh mohamad), so the name match reads
`Mohd Rahman` / `Mohammad Rahman` as `listed-spelling` by default.

Closes #1383

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The review of 0cbe551 found `Lexicon.words(kind="given",
same_as="muhammad")` dropping `mohd` and `moh` once each listed
several long spellings: a reading's `same_as` is now carried where
every word asked is among the words it names. docs/customize.rst says
a list is taken and that a given name written short takes a
credential's doubt away (`Smith Jd` under a caller's `jd` edit);
docs/matching.rst no longer overstates how the long spellings agree;
nameparser/vocab/AGENTS.md's `md` example says the abbreviation is now
recorded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@derek73 derek73 added this to the 3.1 milestone Nov 14, 2026
@derek73 derek73 added enhancement vocabulary Fixed by a word-list entry: per-word vocabulary and language packs matching Name matching: Parser.matching(), check() and keys() titles Titles and honorifics (rules/H) labels Nov 14, 2026
@derek73 derek73 self-assigned this Nov 14, 2026
derek73 and others added 5 commits November 14, 2026 13:01
#1390's capitals rule meets `MD`, now a listed short form of Muhammad:
`MD Rahman` / `Mohammad Dewan Rahman` reads its listed spelling before
the rule is asked, so its `_CAPITALS` row moves to the already-consistent
group and the recorded control from 16 rows to 15. A test pins both
readings of `MD`, and the decisions entry records the interplay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… of #1383

#1393: rules/C13 gains an Except. A credential that is also a given
name written short (`md`) opens the given part after a family comma,
behind no whole name, where it is written with a lower-case letter in a
name of mixed case or a name word follows it (`Rahman, Md`, `RAHMAN, MD
ABDUL` -> given 'Md'); in capitals alone, before a credential or half
of one, or behind a whole name it stays the degree. rules/H2 gains the
matching Except.

The review's items:
- `md`'s credential moves to mul.toml beside its given reading, so a
  strict choice keeps the degree (`John Smith, MD.` read given 'MD.'
  under every strict pack); measured over every pack, plain and strict.
- one predicate, `ReadingProperties.marks_a_clash`, for the suffix
  markers, check 11's agnomen clause and `Lexicon._check_pool`: a given
  name written short gates no agnomen; its title and particle limit is
  pinned with its reason.
- `same_as` errors follow the taxonomy, each message offering code a
  test runs; a row kills the `_heads` last-head mutant.
- `add("md", kind="given")` is documented with the `same_as=None` and
  `remove` recipes as doctests; the pickle bullet covers 3.0.x.
- decisions: indic-honorifics, C3, C13, vocabulary-model and
  name-matching record what this reverses and why, the recipes
  corrected and re-run, the counts dated; made-up names throughout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…xcept

The Except asks the first word behind the part's titles; a part whose
every word is a title asks none. No shipped word reaches that path, so
codecov/patch counted the line uncovered: a caller's word that is a
title, a particle and a given name written short does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The second review of a7755a4:
- a lone Md behind a title after a family comma read the title as the
  given name; it keeps master's reading, title and suffix 'Md', the
  Except firing there only where a name word follows
- the Except reports suffix-or-name, the credential as its alternative,
  as `ma` does in the same slot
- narrowed to the record: the lower-case arm reads a word alone in the
  part, and a name word carries no suffix or title tag of any kind (one
  prefix test), so `Smith, Md PhD`, `Smith, Md XYZ` and `SMITH, MD DEAN`
  stay the degree; the arm compares the word with its credential's case
  mask; each clause has a row only it refuses, mutation-checked
- `md` lists `muhammed` (decided 2026-11-14); the mul move recorded as
  decided
- rules C8 and H2 point at the Except, C13's Signal line names what it
  reads; the docs' stale strict, before-reading, count and attribution
  passages corrected, each count with its recipe and date

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The closing review of 1e2103d. The rule's code changes by two lines:
an initial behind `Md` is counted in letters (`composed_len`), so
`Rahman, Md É` reads alike composed and decomposed; and a conjunction
behind it is no name word (`Rahman, Md and Karim` reads as on master).
The alone arm's lower-case test is pinned (`Smith, PHD`).

Recorded as Accepted, each with a rule example, a case row and a dated
line: a mixed-case Md before a title that may be a name, before a name
in capitals (a move under strict bn), and a lone Md behind a title (the
match reads Md. Rahman / Rahman, Mr Md one-sided). The docs restating
the Except before its narrowing point at rules/C13; the measured
figures are re-taken once and stated alike; the AmbiguityKind docstring
names the new report; a real official's name is replaced.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement matching Name matching: Parser.matching(), check() and keys() titles Titles and honorifics (rules/H) vocabulary Fixed by a word-list entry: per-word vocabulary and language packs

Projects

None yet

1 participant