augur.curate.titlecase module

Applies titlecase to string fields in a metadata record

augur.curate.titlecase.register_parser(parent_subparsers)
augur.curate.titlecase.run(args, records)
augur.curate.titlecase.titlecase(text, articles={}, abbreviations={})

Originally from nextstrain/ncov-ingest

Returns a title cased location name from the given location name tokens. Ensures that no tokens contained in the whitelist_tokens are converted to title case.

Return type:

Optional[str]

>>> articles = {'a', 'and', 'of', 'the', 'le'}
>>> abbreviations = {'USA', 'DC'}
>>> titlecase("the night OF THE LIVING DEAD", articles)
'The Night of the Living Dead'
>>> titlecase("BRAINE-LE-COMTE, FRANCE", articles)
'Braine-le-Comte, France'
>>> titlecase("auvergne-RHÔNE-alpes", articles)
'Auvergne-Rhône-Alpes'
>>> titlecase("washington DC, usa", articles, abbreviations)
'Washington DC, USA'