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

French and Italian Name Formatter

A Python utility that formats French and Italian names with contractions (d', l', o') according to proper title case rules.

Requirements

Your task is to implement a function that properly formats names and titles containing French and Italian contractions that begin with d', l', or o' followed by a letter. The formatting should follow these specific rules:

  1. For contractions starting with a consonant letter (d, l): the letter before the apostrophe should be lowercase
  2. For contractions starting with a vowel letter (o): the letter before the apostrophe should be uppercase
  3. The letter immediately after the apostrophe should always be uppercase
  4. The function should handle possessive forms (e.g., names ending with 's)
  5. The function should work correctly with compound names containing slashes (/)
  6. The function should capitalize the first word and handle standard title case for any other words

Test Cases

  • Format "l'grange" to return "l'Grange" @test
  • Format "o'reilly" to return "O'Reilly" @test
  • Format "d'angelo" to return "D'Angelo" @test
  • Format "o'grange's problem" to return "O'Grange's Problem" @test
  • Format "o'melveny/o'doyle law firm" to return "O'Melveny/O'Doyle Law Firm" @test
  • Format "the l'arc de triomphe is beautiful" to return "The l'Arc De Triomphe Is Beautiful" @test

Implementation

@generates

API

def format_name(text: str) -> str:
    """
    Format text containing French/Italian contractions according to title case rules.

    Args:
        text: Input text containing names or titles with contractions

    Returns:
        Properly formatted text with correct capitalization
    """
    pass

Dependencies { .dependencies }

titlecase { .dependency }

Provides title case conversion functionality following style guide rules.

This dependency should be used to handle the title casing logic including proper handling of French/Italian contractions (d', l', o').

@satisfied-by

Version

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