Skip to content

Instantly share code, notes, and snippets.

@talfco
Created March 23, 2019 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talfco/15e77e0f6117f09a41389dab68e42f63 to your computer and use it in GitHub Desktop.
Save talfco/15e77e0f6117f09a41389dab68e42f63 to your computer and use it in GitHub Desktop.
def add_combinations_to_directory(self, comb_tuples, person_id, last_name):
for comb in comb_tuples:
if last_name in comb:
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