Fixes for AS 350 helicopters.
This commit is contained in:
parent
24ab89d6a6
commit
825b29144e
@ -73,6 +73,20 @@ SUBSTITUTIONS = {
|
||||
}
|
||||
|
||||
|
||||
RE_SUBSTITUTIONS = [
|
||||
[re.compile(r'\bAS.?350.?B.?1'), 'AS 350 B1'],
|
||||
[re.compile(r'\bAS.?350.?B.?2'), 'AS 350 B2'],
|
||||
[re.compile(r'\bAS.?350.?B.?3'), 'AS 350 B3'],
|
||||
]
|
||||
|
||||
def do_re_substitutions(s):
|
||||
new_s = s
|
||||
for regex, replacement in RE_SUBSTITUTIONS:
|
||||
new_s = regex.sub(replacement, new_s)
|
||||
if new_s != s:
|
||||
print([s, new_s])
|
||||
return new_s
|
||||
|
||||
def contains_upper_and_lower(s):
|
||||
return any(c.isupper() for c in s) and any(c.islower() for c in s)
|
||||
|
||||
@ -95,6 +109,7 @@ def fix_type(s):
|
||||
tokens = [title_case(t) for t in tokens]
|
||||
tokens = [SUBSTITUTIONS.get(t.lower(), t) for t in tokens]
|
||||
s = ' '.join(tokens)
|
||||
s = do_re_substitutions(s)
|
||||
return s
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user