Improve language

This commit is contained in:
2024-06-17 20:59:16 +02:00
parent fab3edc45a
commit ce67b2f5ba
2 changed files with 12 additions and 18 deletions

View File

@ -111,7 +111,7 @@ def is_clubstation(call):
def replace_substring_with_line(path, search_substring, verbose=0):
try:
if not replace_substring_with_line.lines:
with open(path, 'r') as file:
@ -119,11 +119,7 @@ def replace_substring_with_line(path, search_substring, verbose=0):
for line in replace_substring_with_line.lines:
if search_substring[0:46].lower() in line.lower():
modified_line = line.strip()
# Replace the substring with the whole line
## line = line.lower().replace(search_substring.lower(), modified_line)
modified_line = line
return modified_line
return line.strip()
except FileNotFoundError:
print(f'The file {path} was not found.')
@ -233,7 +229,7 @@ def fix_typo(call, fullname, verbose=1):
fix_typo.spaces = [line.index(words[1]), line.index(words[2]), line.index(words[3])]
else:
if call in line[2:8]:
if verbose > 0:
if verbose > 1:
print(f'Call: {call} found')
match line[0]:
case '#':
@ -241,8 +237,8 @@ def fix_typo(call, fullname, verbose=1):
print(line.rstrip())
case 'F':
if verbose > 0:
print(fullname)
print(line.rstrip())
print(fullname)
firstname1, surname1, gender1 = call_split_name(fullname, call, 0)
fullname2 = line[fix_typo.spaces[1]:fix_typo.spaces[2]-1].rstrip() + ' ' + line[fix_typo.spaces[2]:-1]
if verbose > 0:
@ -262,8 +258,8 @@ def fix_typo(call, fullname, verbose=1):
fullname = fullname2
case 'X': # exchange the surname with firstname
if verbose > 0:
print(fullname)
print(line.rstrip())
print(fullname)
firstname1, surname1, gender1 = call_split_name(fullname, call, 0)
fullname2 = line[fix_typo.spaces[1]:fix_typo.spaces[2]-1].rstrip() + ' ' + line[fix_typo.spaces[2]:-1]
if verbose > 0: