Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

whitelist Mc- and Mac- last names #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brchristian
Copy link

@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

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