{"id":13468739,"url":"https://github.com/ppannuto/python-titlecase","last_synced_at":"2025-05-15T07:07:53.061Z","repository":{"id":16408168,"uuid":"19159192","full_name":"ppannuto/python-titlecase","owner":"ppannuto","description":"Python library to capitalize strings as specified by the New York Times Manual of Style","archived":false,"fork":false,"pushed_at":"2024-04-06T05:03:59.000Z","size":177,"stargazers_count":258,"open_issues_count":3,"forks_count":38,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-14T13:00:08.754Z","etag":null,"topics":["python","python-library"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ppannuto.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null}},"created_at":"2014-04-25T20:09:43.000Z","updated_at":"2025-03-19T06:19:34.000Z","dependencies_parsed_at":"2024-04-06T06:21:33.361Z","dependency_job_id":"7ca025a7-2753-41d5-9b99-d3bfa3c07199","html_url":"https://github.com/ppannuto/python-titlecase","commit_stats":{"total_commits":186,"total_committers":22,"mean_commits":8.454545454545455,"dds":0.564516129032258,"last_synced_commit":"c1855c514a55ca1964e187b0e862a954da4ca3d3"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppannuto%2Fpython-titlecase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppannuto%2Fpython-titlecase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppannuto%2Fpython-titlecase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppannuto%2Fpython-titlecase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ppannuto","download_url":"https://codeload.github.com/ppannuto/python-titlecase/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254292043,"owners_count":22046426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","python-library"],"created_at":"2024-07-31T15:01:17.976Z","updated_at":"2025-05-15T07:07:48.051Z","avatar_url":"https://github.com/ppannuto.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"Titlecase\n=========\n\n.. image:: https://codecov.io/gh/ppannuto/python-titlecase/branch/main/graph/badge.svg?token=J1Li8uhB8q\n    :target: https://codecov.io/gh/ppannuto/python-titlecase\n\nThis filter changes a given text to Title Caps, and attempts to be clever\nabout SMALL words like a/an/the in the input.\nThe list of \"SMALL words\" which are not capped comes from the New York\nTimes Manual of Style, plus some others like 'vs' and 'v'.\n\nThe filter employs some heuristics to guess abbreviations that don't need conversion.\n\n+------------------+----------------+\n| Original         | Conversion     |\n+==================+================+\n| this is a test   | This Is a Test |\n+------------------+----------------+\n| THIS IS A TEST   | This Is a Test |\n+------------------+----------------+\n| this is a TEST   | This Is a TEST |\n+------------------+----------------+\n\nMore examples and expected behavior for corner cases are available in the\n`package test suite \u003chttps://github.com/ppannuto/python-titlecase/blob/main/titlecase/tests.py\u003e`__.\n\nThis library is a resurrection of `Stuart Colville's\ntitlecase.py \u003chttps://muffinresearch.co.uk/titlecasepy-titlecase-in-python/\u003e`__,\nwhich was in turn a port of `John Gruber's\ntitlecase.pl \u003chttp://daringfireball.net/2008/05/title_case\u003e`__.\n\nIssues, updates, pull requests, etc should be directed\n`to github \u003chttps://github.com/ppannuto/python-titlecase\u003e`__.\n\n\nInstallation\n------------\n\nThe easiest method is to simply use pip:\n\n::\n\n    (sudo) pip install titlecase\n\n\nUsage\n-----\n\nTitlecase provides only one function, simply:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from titlecase import titlecase\n    \u003e\u003e\u003e titlecase('a thing')\n    'A Thing'\n\nA callback function may also be supplied, which will be called for every word:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e def abbreviations(word, **kwargs):\n    ...   if word.upper() in ('TCP', 'UDP'):\n    ...     return word.upper()\n    ...\n    \u003e\u003e\u003e titlecase.titlecase('a simple tcp and udp wrapper', callback=abbreviations)\n    'A Simple TCP and UDP Wrapper'\n\nThe callback function is supplied with an ``all_caps`` keyword argument, indicating\nwhether the entire line of text was entirely capitalized. Returning ``None`` from\nthe callback function will allow titlecase to process the word as normal.\n\n\nCommand Line Usage\n------------------\n\nTitlecase also provides a command line utility ``titlecase``:\n\n::\n\n    $ titlecase make me a title\n    Make Me a Title\n    $ echo \"Can pipe and/or whatever else\" | titlecase\n    Can Pipe and/or Whatever Else\n    # Or read/write files:\n    $ titlecase -f infile -o outfile\n\nIn addition, commonly used acronyms can be kept in a local file\nat `~/.titlecase.txt`. This file contains one acronym per line.\nThe acronym will be maintained in the title as it is provided.\nOnce there is e.g. one line saying `TCP`, then it will be automatically\nused when used from the command line.\n\n::\n\n    $ titlecase I LOVE TCP\n    I Love TCP\n\n\nLimitations\n-----------\n\nThis is a best-effort library that uses regexes to try to do intelligent\nthings, but will have limitations. For example, it does not have the contextual\nawareness to distinguish acronyms from words: us (we) versus US (United States).\n\nThe regexes and titlecasing rules were written for American English. While\nthere is basic support for Unicode characters, such that something like\n\"El Niño\" will work, it is likely that accents or non-English phrases will\nnot be handled correctly.\n\nIf anyone has concrete solutions to improve these or other shortcomings of the\nlibrary, pull requests are very welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppannuto%2Fpython-titlecase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fppannuto%2Fpython-titlecase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppannuto%2Fpython-titlecase/lists"}