Skip to content

Instantly share code, notes, and snippets.

@talfco
Last active March 16, 2019 23:17
Show Gist options
  • Save talfco/6d64fffc9c981b33d32b79f7404ca153 to your computer and use it in GitHub Desktop.
Save talfco/6d64fffc9c981b33d32b79f7404ca153 to your computer and use it in GitHub Desktop.
def add_combinations_to_directory(self, comb_tuples, person_id):
for comb in comb_tuples:
concat_name = self.generate_normalized_name(comb)
metaphone_tuple = doublemetaphone(concat_name)
if metaphone_tuple[0] in self.__lookup_dict[0]:
if not person_id in self.__lookup_dict[0][metaphone_tuple[0]]:
self.__lookup_dict[0][metaphone_tuple[0]].append(person_id)
else:
self.__lookup_dict[0][metaphone_tuple[0]] = [person_id]
if metaphone_tuple[1] in self.__lookup_dict[1]:
if not person_id in self.__lookup_dict[1][metaphone_tuple[1]]:
self.__lookup_dict[1][metaphone_tuple[1]].append(person_id)
else:
self.__lookup_dict[1][metaphone_tuple[1]] = [person_id]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment