Skip to content

whitelist Mc- and Mac- last names#5

Open
brchristian wants to merge 1 commit intomattstevens:masterfrom
brchristian:patch-1
Open

whitelist Mc- and Mac- last names#5
brchristian wants to merge 1 commit intomattstevens:masterfrom
brchristian:patch-1

Conversation

@brchristian
Copy link
Copy Markdown

@brchristian brchristian commented Jul 14, 2019

As noted in #1, this extension works like a dream except with words that start with "mc" or "mac", which get horribly butchered.

For instance:

macabre           =>  MacAbre
macadam           =>  MacAdam
macademia nut     =>  MacAdemia Nut
Macao             =>  MacAo
macaroni          =>  MacAroni
macaroon          =>  MacAroon
macaw             =>  MacAw
mace              =>  MacE
Macedonia         =>  MacEdonia
Mach five         =>  MacH Five
(Papier) Mache    =>  (Papier) MacHe
machete           =>  MacHete
machine           =>  MacHine
machine learning  =>  MacHine Learning
machinery         =>  MacHinery
machinist         =>  MacHinist
macho             =>  MacHo
macroeconomics    =>  MacRoeconomics
macrocosm         =>  MacRocosm

...which, I think you'll agree, is...not the desired behavior.

In fact, even a great many words that seem like surnames that should get a second capital letter in fact do not. Consider:

Macauley
Macbeth
Maclean
Machiavelli
Macintosh
Mackenzie
Mackinac
Mackintosh
Macleod

None of these should get a second capital in most cases.

This PR includes a whitelist for common names that generally should get a second capital, so that other words beginning with "mac" will be properly left with a single capital.

@jpcirrus
Copy link
Copy Markdown

If you replace ./titlecase/__init__.py with an updated version of the original from https://github.com/ppannuto/python-titlecase/tree/master/titlecase this issue seems to be resolved. A sample of your examples are working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants