Repository navigation
fix(utils): keep dotted acronyms uppercase in str_title_case - #392
Sanjays2402 wants to merge 2 commits into
Conversation
Titles like S.W.A.T. and M.A.S.H. were rendered as S.W.a.T. and M.a.S.H. because the single-letter lowercase exception 'a' matched the acronym component: '.' is a padding character, so the 'a' looked left- and right-partitioned like a standalone word. Skip the lowercase transformation when a single-letter exception is flanked by dots. Multi-word titles are unaffected. Adds a regression test covering S.W.A.T. and M.A.S.H.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: adcd5c4a08
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| is_acronym_letter = ( | ||
| word_length == 1 and prev_char == "." and next_char == "." | ||
| ) |
There was a problem hiding this comment.
Preserve lowercase articles in dot-delimited titles
When periods are word separators rather than acronym punctuation, this condition misclassifies every internal a as an acronym component. For example, str_title_case("Once.Upon.a.Time") previously returned Once.Upon.a.Time but now returns Once.Upon.A.Time; these values flow through the movie and episode metadata setters into renamed paths. Distinguish a run of single-letter dotted components from an article merely surrounded by dot-delimited words.
Useful? React with 👍 / 👎.
|
Good catch — confirmed that |
Closes #297
str_title_caserenderedS.W.A.T.asS.W.a.T.(andM.A.S.H.asM.a.S.H.):.is inpadding_chars, so the single-letter lowercase exceptionalooked left- and right-partitioned like a standalone word. The lowercase transformation is now skipped when a one-letter exception is flanked by dots; multi-word titles are unchanged.Regression test
test_str_title_case__lower__dotted_acronymfails without the fix and passes with it;tests/local/test_utils.pyis green (198 passed).