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

Text Formatter with Dash Delimiter Support

Overview

Build a text formatting tool that processes multi-part titles containing various types of dash delimiters. The tool should properly capitalize text segments separated by different dash characters commonly used in typography.

Requirements

Your implementation should:

  1. Process dash-delimited titles: Accept text input containing different Unicode dash characters as segment separators
  2. Handle multiple dash types: Support the following dash characters:
    • Hyphen-minus: - (U+002D)
    • En dash: (U+2013)
    • Figure dash: (U+2012)
    • Em dash: (U+2014)
    • Horizontal bar: (U+2015)
  3. Capitalize after dashes: Ensure that the first word following any dash delimiter is properly capitalized
  4. Preserve dash characters: Maintain the original dash type in the output

Test Cases

Basic Dash Handling { .section }

@test Input: "episode 7 — the force awakens" Expected output: Properly capitalize "the" after the em dash

@test Input: "new york – london flight" Expected output: Properly capitalize "london" after the en dash

Multiple Dash Types { .section }

@test Input: "part one — introduction: part two – the story begins" Expected output: Handle both em dash and en dash correctly, capitalizing words after each

Implementation Notes

  • Focus on correctly identifying and handling different dash types as phrase delimiters
  • The solution should work with Unicode text processing
  • Test your implementation with the provided test cases

Deliverables

  1. formatter.py - Main implementation file containing the text formatting logic
  2. tests.py - Test file with test cases demonstrating correct dash handling

Dependencies { .dependencies }

titlecase { .dependency }

Provides intelligent title case conversion with support for various punctuation marks and delimiters.

Version

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