fix(#459): repair one-case suffix acronyms to all-caps in case repair - #521
Open
IMGillusion wants to merge 1 commit into
Open
fix(#459): repair one-case suffix acronyms to all-caps in case repair#521IMGillusion wants to merge 1 commit into
IMGillusion wants to merge 1 commit into
Conversation
Gated on the SUFFIX role; exceptions map consulted first so md/phd keep their special casing. R4 example added; corpus regenerated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
HumanName('JOHN SMITH MBA').capitalize()returned'John Smith Mba'— a credential acronym title-cased as an ordinary word (#459).CAPITALIZATION_EXCEPTIONSonly carries the five pieces that need non-all-caps spelling (md,phd,ii,iii,iv); every othersuffix_acronymsentry fell through tostr.capitalize()and got title-cased (mba->Mba,jd->Jd,qc->Qc,mp->Mp).Fix
In
_cap_word, after the exceptions-map lookup and before the Mac/Mc rule, a word whose period-free form is a knownsuffix_acronymsentry repairs toword.upper().Gated on
role is Role.SUFFIXso a word that is in the vocabulary but parsed as a family name (anh van do->Anh Van Do) still repairs as an ordinary name word, not an acronym. The exceptions map is consulted first, somd->M.D.andphd->Ph.D.are unchanged.Out of scope
The issue's
QC MPexample: the parser assignsQCthe GIVEN role andMPthe SUFFIX role, so onlyMPrepairs to caps here. Uppercasing a word merely because it is a given name would break ordinary names that share a spelling with an acronym (e.g.ed->ED), so the GIVEN case is left to the parser. Flagging it here rather than widening the gate.Docs & tests
tests/test_capitalization.py(all-caps suffix, exceptions still win, family-name-in-vocab stays title-case).rules.mdR4: added ajohn smith mbaexample; regeneratedtools/differential/corpus_rules.jsonl.Full suite: 7610 passed, 179 skipped, 4 xfailed.