CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-titlecase

tessl install tessl/pypi-titlecase@2.4.0

Python port of John Gruber's titlecase.pl for intelligent title case conversion with style guide compliance

Agent Success

Agent success rate when using this tile

79%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.92x

Baseline

Agent success rate without this tile

86%

task.mdevals/scenario-6/

Hyphenated Phrase Formatter

Build a text processing utility that properly formats hyphenated compound phrases for publication headers and titles. The utility should handle various hyphenated constructions while maintaining grammatical correctness.

Requirements

The system should process hyphenated phrases according to these rules:

  1. Each word component in a hyphenated phrase should be capitalized appropriately
  2. Grammatically minor words (articles, prepositions, conjunctions) within hyphenated phrases should remain lowercase when they appear in middle positions
  3. The first and last components of a hyphenated phrase should always be capitalized
  4. The processing should handle nested structures like multiple hyphens in a single phrase

Examples

The utility should transform text as follows:

  • Input: "state-of-the-art technology" Output: "State-of-the-Art Technology"

  • Input: "one-on-one meeting" Output: "One-on-One Meeting"

  • Input: "mother-in-law's advice" Output: "Mother-in-Law's Advice"

  • Input: "end-to-end solution" Output: "End-to-End Solution"

Implementation

@generates

Implement a function that processes text containing hyphenated phrases and returns the properly formatted result.

Test Cases

  • Processing a hyphenated phrase with small words in the middle produces correct capitalization @test
  • Processing multiple hyphenated phrases in a single sentence works correctly @test
  • The first word component in a hyphenated phrase is always capitalized @test
  • The last word component in a hyphenated phrase is always capitalized @test

Dependencies { .dependencies }

titlecase { .dependency }

Provides text formatting and title casing functionality following style guide rules.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/titlecase@2.4.x
tile.json