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]')
|
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):
|
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
|
s in NOT_TITLE_CASE or
|
||||||
(len(s) <= 3 and s not in TITLE_CASE)):
|
(len(s) <= 3 and s not in TITLE_CASE)):
|
||||||
return s
|
return s
|
||||||
else:
|
else:
|
||||||
return s.title()
|
return s.title()
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: MCDONNELL -> McDonnell
|
||||||
|
|
||||||
def fix_type(s):
|
def fix_type(s):
|
||||||
if s is not None:
|
if s is not None:
|
||||||
tokens = [p for p in s.split(' ') if p]
|
tokens = [p for p in s.split(' ') if p]
|
||||||
|
Loading…
Reference in New Issue
Block a user