This is a script-checker which checks ukrainian first names and middle names in the database. Some names could have typos or wrong translations from old languages. The script has a standartized names list. Almost all the names are imported from the book: “УКРАЇНСЬКА МОВА. (за професійним спрямуванням). Для студентів юридичного факультету. Хмельницький, 2009”.
Also its possible to add separate names to ignore list via person attributes. The attribute name is “Ignore Checker UA name”
[Gramps SuperTool script file]
version=1
[title]
First Name and Patronymic Checker
[description]
Checks the first names and patronymics of people against predefined lists. The first name and patronymic are separated by a space. If not found in the list, an error is printed.
[category]
People
[initial_statements]
# Define male name and patronymic list
male_data = [
{
"name": "Абакум",
"mname_m": "Абакумович",
"mname_f": "Абакумівна"
},
// more names here
]
# Define female name list
female_name_data = [
{
"name": "Августа",
},
// more names here
]
id_set = set()
separator = "$|^"
print(f"-------------------First Name and Patronymic Checker----------------------")
# Function to clean name by removing '?' and splitting by both ' ' and '|'
def clean_and_split_name(name):
# Remove '?' and strip spaces
cleaned_name = name.replace('?', '').strip()
# Split by both '|' and spaces
return [part.strip() for part in cleaned_name.replace(' ', '|').split('|') if part.strip()]
# Function to check names for males
def check_male_names(names, ignore_list, gramps_id):
for name in names:
if name in ignore_list:
continue # Skip checking this name if it's in the ignore list
name_found = any(entry["name"] == name or entry["mname_m"] == name for entry in male_data)
if not name_found:
print(f"Person. {gramps_id} has an unknown name: {name}")
id_set.add(gramps_id)
# Function to check names for females
def check_female_names(names, ignore_list, gramps_id):
for name in names:
if name in ignore_list:
continue # Skip checking this name if it's in the ignore list
name_found = any(entry["name"] == name for entry in female_name_data) or any(entry["mname_f"] == name for entry in male_data)
if not name_found:
print(f"Person. {gramps_id} has an unknown name: {name}")
id_set.add(gramps_id)
# Function to get ignore list from attributes
def get_ignore_list(attributes):
ignore_list = []
for attribute in attributes:
key, value = attribute # Розпаковуємо кортеж на ключ і значення
if key == "Ignore Checker UA name":
ignore_list.extend(clean_and_split_name(value))
return ignore_list
[statements]
for nameobj in nameobjs:
# Get the ignore list for the current person
ignore_list = get_ignore_list(attributes)
# Split and clean names
names = clean_and_split_name(nameobj.get_first_name())
# Check based on gender
if gender == "M":
check_male_names(names, ignore_list, gramps_id)
elif gender == "F":
check_female_names(names, ignore_list, gramps_id)
[filter]
[expressions]
print("First Name and Patronymic Checker is done. All people with the issue: " + "^" + separator.join(id_set) + "$")
[scope]
all
[unwind_lists]
False
[commit_changes]
False
[summary_only]
True