FIX gender function
This commit is contained in:
		@@ -107,7 +107,7 @@ def is_clubstation(call):
 | 
			
		||||
	assert(len(call) > 3)
 | 
			
		||||
	if call[3].upper() == 'X' or call.upper() == 'OE5SIX': # special case with OE5SIX (Clubstation)
 | 
			
		||||
		return True
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	return False
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -126,7 +126,7 @@ def replace_substring_with_line(path, search_substring, verbose=0):
 | 
			
		||||
		print(f'The file {path} was not found.')
 | 
			
		||||
	except Exception as e:
 | 
			
		||||
		print(f'An error occurred: {e}')
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	return search_substring
 | 
			
		||||
 | 
			
		||||
replace_substring_with_line.lines = None
 | 
			
		||||
@@ -138,8 +138,8 @@ def gender_substring(path, search_substring, verbose=0):
 | 
			
		||||
				gender_substring.lines = file.readlines()
 | 
			
		||||
 | 
			
		||||
		for line in gender_substring.lines:
 | 
			
		||||
			if search_substring[2:].lower() in line.lower():
 | 
			
		||||
				return line[0]
 | 
			
		||||
			if line[2:].strip() == search_substring: # search from position 2 and remove all spaces or \n chars
 | 
			
		||||
				return line[0] # return the char of gender i.e. 'f' or 'm'
 | 
			
		||||
	except FileNotFoundError:
 | 
			
		||||
		print(f'The file {path} was not found.')
 | 
			
		||||
	except Exception as e:
 | 
			
		||||
@@ -172,9 +172,9 @@ def call_split_name(fullname, call, verbose):
 | 
			
		||||
 | 
			
		||||
	name = fullname.split(' ', 1)
 | 
			
		||||
	surname = name[0]
 | 
			
		||||
	# several special cases like surname "de Lijezer", "van Dijk", "el Shamaa", etc.
 | 
			
		||||
	# several special cases like surname "de Lijezer", "van Dijk", "el Shamaa", "da Silva", etc.
 | 
			
		||||
	match surname.lower():
 | 
			
		||||
		case 'de' | 'el':
 | 
			
		||||
		case 'de' | 'el' | 'da':
 | 
			
		||||
			name = fullname[3:].split(' ',1)
 | 
			
		||||
			surname = surname.lower() + ' ' + name[0]
 | 
			
		||||
			if verbose > 1:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user