https://github.com/capjamesg/title-prettier

A Python tool to normalize titles into a consistent format.

https://github.com/capjamesg/title-prettier

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.2%) to scientific vocabulary

Keywords

web
Last synced: 5 months ago · JSON representation

Repository

A Python tool to normalize titles into a consistent format.

Basic Info
  • Host: GitHub
  • Owner: capjamesg
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 31.3 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
web
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

title-prettier

An opinionated Python tool to change titles into a consistent format, and to add useful context to titles.

This tool is ideal for bookmarking tools, where you may want to regularize titles given a specific set of rules.

This tool applies a few transformations:

  • Text after common separators (i.e. |, -) is removed.
  • [video] is appended to titles where the URL is from a listed video site.
  • [code] is appended to titles where the URL is from a listed code sharing site.
  • [podcast] is appended to titles where the URL is from a podcast hosting page.
  • [image] is appended to titles if a source is an image.
  • Titles are turned to lowercase if a URL is provided. See "Preserving proper nouns in titles" later in this document for more information.

Usage

First, install the package:

pip install title-prettier

Then, import the get_pretty_title function and specify either a title or a URL:

```python from titleprettier import getprettytitle title = getpretty_title(url="https://jamesg.blog/2024/06/20/python-packages/")

Python packages I love

title = getprettytitle(title="How the Square Root of 2 Became a Number | Hacker News")

How the square root of 2 became a number

```

Examples

Building a full-text search engine in 150 lines of Python code · Bart de Goede -> Building a full-text search engine in 150 lines of Python code Poets’ Odd Jobs | Academy of American Poets -> Poets’ Odd Jobs Python packages I love | James' Coffee Blog -> Python packages I love

Preserving proper nouns in titles

When you provide a URL, title-prettier aims to turn the contents of the title to lowercase. But, you may wonder: what about proper nouns?

Suppose a page has the title:

My Review Of ‘The Tortured Poets Department’

The Tortured Poets Department is a proper noun; an album name.

This package aims to preserve proper nouns with a heuristic. If a word is used more in uppercase than lowercase, its capitalisation is retained.

After being run through titke-prettier, the title above will become:

My review of ‘The Tortured Poets Department’

License

This project is licensed under an MIT license.

Owner

  • Name: James
  • Login: capjamesg
  • Kind: user
  • Location: Scotland
  • Company: @Roboflow

from words, wonder.

GitHub Events

Total
Last Year

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 29
  • Total Committers: 1
  • Avg Commits per committer: 29.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 29
  • Committers: 1
  • Avg Commits per committer: 29.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
capjamesg j****g@j****g 29
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v2 composite
.github/workflows/test.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v2 composite
setup.py pypi
  • bs4 *
  • fastapi *
  • requests *
  • slowapi *