WorldHistoricalGazetteer / whg3

Version 3 in development
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

Vision of Britain #166

Open docuracy opened 1 month ago

docuracy commented 1 month ago

Alternative Strategy

Write Python script:

Customise titlecase

from titlecase import titlecase

def custom_titlecase(word, **kwargs):
    small_words = "a an and as at but by for if in nor of on or so the to up yet".split()
    return titlecase(word, callback=lambda w, **_: w.lower() if w.lower() in small_words else w.title())

converted_place_names = [custom_titlecase(name) for name in place_names]