Skip to content

Instantly share code, notes, and snippets.

@frostu8
Created August 29, 2026 08:06
Show Gist options
  • Select an option

  • Save frostu8/914601b2af0d3679e3e7d8999dfa0239 to your computer and use it in GitHub Desktop.

Select an option

Save frostu8/914601b2af0d3679e3e7d8999dfa0239 to your computer and use it in GitHub Desktop.
import csv
from itertools import islice
import Levenshtein
# Why are people named Dante and Deante
BAD_DISTANCE = 3
names = [
"Ashley", "Grace", "Isaac", "Hannah", "James", "Olivia", "Noah", "Emma",
"Liam", "Ava", "Ethan", "Mia", "Lucas", "Sofia", "Mason", "Amelia",
"Logan", "Harper", "Elijah", "Evelyn", "Henry", "Abigail", "Jack", "Ella",
"Leo", "Scarlett", "Owen", "Luna", "Caleb", "Nora", "Miles", "Chloe",
]
initial_len = len(names)
with open('./girl_boy_names_1990.csv') as file:
reader = csv.reader(file)
for row in islice(reader, 1, None):
for name in row[1:]:
names.append(name)
# remove names that are too similar
filtered_names = names[:initial_len]
for name in names[initial_len:]:
# Check other names for similarity
accept = True
for accepted_name in filtered_names:
dist = Levenshtein.distance(accepted_name, name)
if dist < BAD_DISTANCE:
#print(f'bad: {accepted_name} > {name}')
accept = False
break
if accept:
filtered_names.append(name)
with open('./ace-id-names.txt', 'w+') as file:
file.writelines(f'{x}\n' for x in filtered_names)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment