FIX firstname

This commit is contained in:
2024-06-20 03:27:45 +02:00
parent c060763356
commit 7278cb6883
3 changed files with 127 additions and 9 deletions

View File

@ -193,9 +193,15 @@ def call_split_name(fullname, call, verbose):
surname = surname.lower() + ' ' + name[0]
if verbose > 1:
print(f'## {fullname} --> {surname} ##')
case 'senarclens' : # Senarclens de Grancy
if fullname.lower().startswith('senarclens de grancy'):
name = fullname[21:].split(' ',1)
surname = 'Senarclens de Grancy'
if verbose > 1:
print(f'## {fullname} --> {surname} ##')
if len(name) > 1:
firstname = name[1]
firstname = name[1].lstrip() # FIX when there are more than 1 space b/w surname and firstname
else:
firstname = '<unknown>'
@ -236,7 +242,7 @@ def fix_typo(call, fullname, verbose=1):
case '#':
if verbose > 1:
print(line.rstrip())
case 'F':
case 'F' | 'N':
if verbose > 0:
print(line.rstrip())
print(fullname)
@ -251,6 +257,9 @@ def fix_typo(call, fullname, verbose=1):
fix_cnt += 1
if (surname1 != surname2):
fix_cnt += 1
# when the surname is splitted and wrong written:
if line[0] == 'N' and firstname2 in fullname:
if fix_cnt > 1: fix_cnt = 1
if fix_cnt == 0:
print(f'It is fixed! You can remove the line with the item {call} from the file {fixtypofile}!')
elif fix_cnt > 1: