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
All-caps input: apostrophe-second names come out as d'ARTEMIS / O'BRIEN instead of d'Artemis / O'Brien #105
Passing all-caps headlines through titlecase() produces visibly broken mixed-case output for names with a leading-apostrophe second letter:
>>>fromtitlecaseimporttitlecase>>>titlecase("D'ARTEMIS OF LONDON")
"d'ARTEMIS of London">>>titlecase("O'BRIEN AND D'ARCY")
"O'BRIEN and d'ARCY"
Every other word in the sentence gets normalized and re-cased (OF LONDON → of London), but these words come out as d'ARTEMIS / O'BRIEN — half original-caps, half lowercased, neither correct.
The APOS_SECOND branch fires before the all-caps line is normalized, and it only ever changes word[0] and the letter right after the apostrophe (word[2]), appending the rest of the word unchanged:
So for all-caps input D'ARTEMIS the tail RTEMIS keeps its shouted caps, and for O'BRIEN the consonant/vowel test picks the word[0].upper() path and the whole word stays uppercase. Mixed-case input like d'artemis of london works fine (d'Artemis of London), so this is specific to all-caps lines, which elsewhere are assumed to carry no intentional casing.
PR #101 previously described this (for O'BRIEN'S HOUSE IS FOR SALE / D'ARTAGNAN AND THE THREE MUSKETEERS) but was closed unmerged, so the bug is still live on main.
One possible fix is to lowercase the word first when all_caps is true, before applying the apostrophe handling — then the existing APOS_SECOND transform produces d'Artemis / O'Brien.
Activity