hometask 1: delee print
This commit is contained in:
parent
9b381a5e96
commit
4e9e2dc4be
|
@ -32,7 +32,7 @@ for mail, names in emails.items():
|
||||||
|
|
||||||
import json
|
import json
|
||||||
with open('email_dupes.json', 'w') as f:
|
with open('email_dupes.json', 'w') as f:
|
||||||
json.dump(email_pairs, f)
|
json.dump(email_pairs, f, indent=4, sort_keys=True)
|
||||||
|
|
||||||
# Search for similar names using SequenceMatcher from difflib
|
# Search for similar names using SequenceMatcher from difflib
|
||||||
# (combinations from itertools might come useful as well). Set similarity score at 85%.
|
# (combinations from itertools might come useful as well). Set similarity score at 85%.
|
||||||
|
@ -53,6 +53,5 @@ for (str1, str2) in combinations(names, 2):
|
||||||
if similarity >= threshold:
|
if similarity >= threshold:
|
||||||
name_pairs.append((str1, str2, similarity))
|
name_pairs.append((str1, str2, similarity))
|
||||||
|
|
||||||
print(name_pairs)
|
|
||||||
with open('name_dupes.json', 'w') as f:
|
with open('name_dupes.json', 'w') as f:
|
||||||
json.dump(name_pairs, f, indent=4, sort_keys=True)
|
json.dump(name_pairs, f, indent=4, sort_keys=True)
|
Loading…
Reference in New Issue