import os from people_walk import living_in, check_photos from people_walk import get_all_names import sys import difflib def remove_titles(s): return s if __name__ == "__main__": dir_mds = os.environ.get("CK_DIR") all_names = get_all_names(dir_mds) short_name_in_years = all_names["short_names_in_years"] skeys = sorted(short_name_in_years.keys()) long_name_in_years = all_names["long_names_in_years"] print(short_name_in_years) for skey in skeys: values = short_name_in_years[skey] if (len(values) > 1): for value in values: vcopy = list(values) vcopy.remove(value) close_matches = difflib.get_close_matches( remove_titles(value), [remove_titles(x) for x in vcopy]) if close_matches: print("{}: {}, {}".format(skey, value, close_matches))
all_persons[key_name].set_name(child) if is_father: all_persons[key_name].father = all_persons[rel] else: all_persons[key_name].mother = all_persons[rel] all_persons[rel].set_name(rel) all_persons[rel].children.add(all_persons[key_name]) if rel in short_name_lines_to_long_name_lines: long_rel_names = short_name_lines_to_long_name_lines[rel] for long_rel_name in long_rel_names: all_persons[long_rel_name].set_name(long_rel_name) all_persons[long_rel_name].children = all_persons[ long_rel_name].children.union( all_persons[rel].children) all_persons[rel].set_name(long_rel_name) process_rel_list(fathers) process_rel_list(mothers, False) return all_persons if __name__ == "__main__": dir_mds = os.environ.get("CK_DIR") ck_people = get_ck_people() ppl_file = os.path.join(dir_mds, 'people.md') all_names = get_all_names(dir_mds, ppl_file, ck_people) persons = get_all_persons(all_names) for person_key, person in persons.items(): print(person)