Preserve already OKish entries.
This commit is contained in:
parent
8cc08d0ebc
commit
3ab099d9ef
@ -62,14 +62,22 @@ NOT_TITLE_CASE = [
|
||||
|
||||
TITLE_CASE_EXCEPTION_RE = re.compile('[0-9]')
|
||||
|
||||
def contains_upper_and_lower(s):
|
||||
return any(c.isupper() for c in s) and any(c.islower() for c in s)
|
||||
|
||||
|
||||
def title_case(s):
|
||||
if (TITLE_CASE_EXCEPTION_RE.search(s) or
|
||||
if (contains_upper_and_lower(s) or
|
||||
TITLE_CASE_EXCEPTION_RE.search(s) or
|
||||
s in NOT_TITLE_CASE or
|
||||
(len(s) <= 3 and s not in TITLE_CASE)):
|
||||
return s
|
||||
else:
|
||||
return s.title()
|
||||
|
||||
|
||||
# TODO: MCDONNELL -> McDonnell
|
||||
|
||||
def fix_type(s):
|
||||
if s is not None:
|
||||
tokens = [p for p in s.split(' ') if p]
|
||||
|
Loading…
Reference in New Issue
Block a user