You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should John Smith Ph. D. read suffix 'Ph. D.' under a lexicon that lists no phd, such as parser_for(locales.PT, strict=True) or Lexicon.empty()? #1000
The spaced pair Ph.D. is merged into one credential by a fixed pattern (_vocab.split_pair's first branch, v1's fix_phd: "the Ph./D. pair whatever the vocabulary", decisions/phd-merge). The joined spelling PhD is read through the lexicon. So the two spellings part as soon as the lexicon does not list phd. Measured on master 854087b:
Parser
John Smith Ph. D.
John Smith PhD
Parser()
suffix 'Ph. D.'
suffix 'PhD'
parser_for(locales.PT)
suffix 'Ph. D.'
suffix 'PhD'
parser_for(locales.PT, strict=True)
suffix 'Ph. D.'
family 'PhD'
Parser(lexicon=Lexicon.empty())
suffix 'Ph. D.'
family 'PhD'
The token's reading says Reading('credential' as 'suffix', 'vocabulary', ...) in every row, though in the last two no vocabulary lists the word. Before 4i-d it also said in en, a file the strict pt lexicon does not hold. Since 4i-d, Reading.languages names the files on in the parse's own lexicon, so these rows report (), and the source vocabulary with no file is what is left of the mismatch.
Two questions
Is the parse wrong? A strict choice keeps only the chosen languages' vocabulary (decisions/vocabulary-model, 2026-10-30, file-strict). Reading an English credential there arguably contradicts what the caller asked for, and the joined spelling already declines. Options:
(a) Gate the Ph./D. branch on the lexicon listing phd (the fold of the pair). The spaced and joined spellings then agree under every lexicon. The default and every plain choice are unchanged, since all of them list phd. Moves only strict choices and caller lexicons without phd.
(b) Keep the pattern as a shape, unconditional, as v1 had it. Accept that the two spellings part under a lexicon without phd, and record it in decisions/phd-merge.
What source should the reading carry? Under (a) the pair is read only when listed, so vocabulary is right. Under (b) it is read by a fixed pattern whatever the lexicon, so shape would describe it, where the lexicon does not list it.
Before deciding (a), measure strict-choice and empty-lexicon moves over the committed corpora: the spaced pair after a name, mid-name, after a family comma (Smith, Ph. D. Jr.) and at the head (Ph. D. Van Johnson, which S2 already declines).
687 names in all. Where credentials are typed at all (ClinicalTrials.gov), the spaced spelling is about 0.6% of the doctorates written.
Where the spellings read differently. Each of the 687 was parsed as written and again with the pair rewritten PhD, and the seven role fields compared:
parser
spellings disagree
of which local
Parser()
16
ctgov 5, orcid 3
parser_for(locales.PT, strict=True)
504
ctgov 448, orcid 14, fec 13, cz 1
parser_for(locales.ES, strict=True)
504
the same
Parser(lexicon=Lexicon.empty())
504
the same
Under the default all 16 open the string with the pair, where rules/S2 declines the merge (Ph. D. Van Johnson); this issue does not reach them. The 504 are this issue's case: the spaced pair reads suffix 'Ph. D.', the joined spelling a name word, after a family comma the given name (John Smith, PhD → given 'PhD', family 'John Smith').
For scale: the joined spelling loses far more under strict than the spaced pair would gain or lose either way. Of ctgov's 100,908 names with a joined PhD, the suffix holds it in 100,560 under Parser() and in 45,469 under strict pt, since strict reads only the chosen files and phd is in en's. Option (a) would move the 504 onto that reading; option (b) leaves them the one spelling of the credential a strict pt choice still reads.
Recompute: scan the committed corpora and the cached local corpora (corpus_build.cache_dir('local')/*/corpus.jsonl) for (?<![^\W\d_])ph\.?\s+d\.?(?![^\W\d_]) (case-insensitive); parse each hit under the four parsers above, and again with the first match replaced by PhD, comparing title, given, middle, family, suffix, nickname and maiden. The comparator is the same parser on the joined spelling, which is what option (a) would make the spaced spelling read.
Activity
derek73 commentedon Nov 3, 2026
How often the spaced pair is written, and how often the two spellings part (measured 2026-11-02 on master
b2b75948; nothing here quotes a real name)The pattern counted is the one
_vocab.split_pairmerges:PhthenD, with or without periods, in any case, standing as words (Ph. D.,Ph D,PH. D).PhD/Ph.D.tools/differential/corpus*.jsonl)687 names in all. Where credentials are typed at all (ClinicalTrials.gov), the spaced spelling is about 0.6% of the doctorates written.
Where the spellings read differently. Each of the 687 was parsed as written and again with the pair rewritten
PhD, and the seven role fields compared:Parser()parser_for(locales.PT, strict=True)parser_for(locales.ES, strict=True)Parser(lexicon=Lexicon.empty())Under the default all 16 open the string with the pair, where rules/S2 declines the merge (
Ph. D. Van Johnson); this issue does not reach them. The 504 are this issue's case: the spaced pair reads suffix 'Ph. D.', the joined spelling a name word, after a family comma the given name (John Smith, PhD→ given 'PhD', family 'John Smith').For scale: the joined spelling loses far more under strict than the spaced pair would gain or lose either way. Of ctgov's 100,908 names with a joined
PhD, the suffix holds it in 100,560 underParser()and in 45,469 under strictpt, since strict reads only the chosen files andphdis inen's. Option (a) would move the 504 onto that reading; option (b) leaves them the one spelling of the credential a strictptchoice still reads.Recompute: scan the committed corpora and the cached local corpora (
corpus_build.cache_dir('local')/*/corpus.jsonl) for(?<![^\W\d_])ph\.?\s+d\.?(?![^\W\d_])(case-insensitive); parse each hit under the four parsers above, and again with the first match replaced byPhD, comparing title, given, middle, family, suffix, nickname and maiden. The comparator is the same parser on the joined spelling, which is what option (a) would make the spaced spelling read.Test that an empty Lexicon names no file directly (#1000)
Leave an ambiguous phd's Ph./D. pair to the other pairs' path (#1000 …
Gate the Ph./D. pair on phd as unambiguous suffix vocabulary of eithe…
Read the Ph./D. pair as two words wherever phd is not unambiguous (#1000
Read the spaced Ph. D. as a credential only where the lexicon lists p…