Normalize a possessive all-caps word in ToTitleCase the same as the word alone [patch] - #92
Merged
Merged
Conversation
…ord alone [patch] LowercaseAllCapsWords judged a word by all its letters, so the lowercase "s" of "CEO's" made it mixed case and it was preserved as an acronym, while "CEO" on its own was normalized. Judge a word by the letters before its first in-word apostrophe instead. Fixes #90 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N3tMVtLPuNwsQF7rUEBTMQ
|
This was referenced Sep 28, 2026
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.



Fixes #90
What was wrong
LowercaseAllCapsWordscounts an apostrophe and the letters after it as part of the word. The lowercasesinCEO'stherefore made the word mixed case, so it was skipped, andTextInfo.ToTitleCasekeptCEOas an acronym."the CEO office"gaveThe Ceo Office, but"the CEO's office"gaveThe CEO's Office. That is the kind of neighbour-dependent inconsistency that #72 set out to remove.Change
A word is now judged all caps by its stem: the letters before its first in-word apostrophe, found with the existing
IsApostropheWithinWord. If the stem is all caps, the whole word is lowercased, andTextInfo.ToTitleCasethen givesCeo's. A word with no in-word apostrophe is judged exactly as before. A leading or trailing apostrophe, such as a quote mark, is not in-word, so it does not change the stem.Tests
ToTitleCaseShouldNormalizeAPossessiveAllCapsWordLikeTheWordAlone:"the CEO office"→The Ceo Office(reference row)"the CEO's office"→The Ceo's Office"NASA's mission"→Nasa's Mission"O'Neil"→O'neil(unchanged behaviour)With
CaseConverter.csreverted, theCEO'sandNASA'srows fail. With the change, all 69 tests pass on net10.0, and the solution builds for every target with 0 warnings.The
’s(U+2019) form of this also needs #89's fix, which is in #91. That is why this PR has no U+2019 row: the two PRs stand alone and can merge in either order.🤖 Generated with Claude Code
https://claude.ai/code/session_01N3tMVtLPuNwsQF7rUEBTMQ
Generated by Claude Code