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-1/

Title Case Formatter for Compound Phrases

A text formatting utility that converts compound phrases and names to proper title case according to journalistic style guidelines.

Capabilities

Hyphenated Compound Processing

  • Given the input "end-to-end testing", return "End-to-End Testing" @test
  • Given the input "state-of-the-art technology", return "State-of-the-Art Technology" @test
  • Given the input "twenty-first-century design", return "Twenty-First-Century Design" @test

Slash-Separated Phrase Processing

  • Given the input "yes/no answer", return "Yes/No Answer" @test
  • Given the input "mother/father and son", return "Mother/Father and Son" @test
  • Given the input "start/stop/restart commands", return "Start/Stop/Restart Commands" @test

Scottish and Irish Name Processing

  • Given the input "mcdonald's restaurant", return "McDonald's Restaurant" @test
  • Given the input "macintosh and mccoy", return "Macintosh and McCoy" @test
  • Given the input "mcfoo-mcbar connection", return "McFoo-McBar Connection" @test

Combined Pattern Processing

  • Given the input "mcgregor's state-of-the-art method", return "McGregor's State-of-the-Art Method" @test
  • Given the input "yes/no-maybe question", return "Yes/No-Maybe Question" @test

Implementation

@generates

API

def format_title(text: str) -> str:
    """
    Convert text to title case with proper handling of compound constructions.

    Handles:
    - Hyphenated compounds (e.g., "end-to-end" -> "End-to-End")
    - Slash-separated phrases (e.g., "yes/no" -> "Yes/No")
    - Scottish/Irish names with Mac/Mc prefixes (e.g., "mcdonald" -> "McDonald")
    - Combined patterns requiring nested processing

    Small words (a, an, and, as, at, but, by, en, for, if, in, of, on, or,
    the, to, v, v., via, vs, vs.) remain lowercase in middle positions of
    compound constructions.

    Args:
        text: The input text to format

    Returns:
        The text formatted in title case
    """
    pass

Dependencies { .dependencies }

titlecase { .dependency }

Provides title case conversion following journalistic style guidelines.

@satisfied-by

Version

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