Last active
August 29, 2015 14:21
-
-
Save podrezo/3d34106005c3581c2934 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/* Inspired by this DailyWTF http://thedailywtf.com/articles/genderize | |
* I have used the same algorithm to genderize the 100 most popular boys names | |
* and 100 most popular girls names in 2014, then spew out the results table | |
* as well as the final number of correct guesses for each. Enjoy! */ | |
var boysNames = ['Jackson', | |
'Aiden', | |
'Liam', | |
'Lucas', | |
'Noah', | |
'Mason', | |
'Ethan', | |
'Caden', | |
'Jacob', | |
'Logan', | |
'Jayden', | |
'Elijah', | |
'Jack', | |
'Luke', | |
'Michael', | |
'Benjamin', | |
'Alexander', | |
'James', | |
'Jayce', | |
'Caleb', | |
'Connor', | |
'William', | |
'Carter', | |
'Ryan', | |
'Oliver', | |
'Matthew', | |
'Daniel', | |
'Gabriel', | |
'Henry', | |
'Owen', | |
'Grayson', | |
'Dylan', | |
'Landon', | |
'Isaac', | |
'Nicholas', | |
'Wyatt', | |
'Nathan', | |
'Andrew', | |
'Cameron', | |
'Dominic', | |
'Joshua', | |
'Eli', | |
'Sebastian', | |
'Hunter', | |
'Brayden', | |
'David', | |
'Samuel', | |
'Evan', | |
'Gavin', | |
'Christian', | |
'Max', | |
'Anthony', | |
'Joseph', | |
'Julian', | |
'John', | |
'Colton', | |
'Levi', | |
'Muhammad', | |
'Isaiah', | |
'Aaron', | |
'Tyler', | |
'Charlie', | |
'Adam', | |
'Parker', | |
'Austin', | |
'Thomas', | |
'Zachary', | |
'Nolan', | |
'Alex', | |
'Ian', | |
'Jonathan', | |
'Christopher', | |
'Cooper', | |
'Hudson', | |
'Miles', | |
'Adrian', | |
'Leo', | |
'Blake', | |
'Lincoln', | |
'Jordan', | |
'Tristan', | |
'Jason', | |
'Josiah', | |
'Xavier', | |
'Camden', | |
'Chase', | |
'Declan', | |
'Carson', | |
'Colin', | |
'Brody', | |
'Asher', | |
'Jeremiah', | |
'Micah', | |
'Easton', | |
'Xander', | |
'Ryder', | |
'Nathaniel', | |
'Elliot', | |
'Sean', | |
'Cole']; | |
var girlsNames = ['Sophia', | |
'Emma', | |
'Olivia', | |
'Ava', | |
'Isabella', | |
'Mia', | |
'Zoe', | |
'Lily', | |
'Emily', | |
'Madelyn', | |
'Madison', | |
'Chloe', | |
'Charlotte', | |
'Aubrey', | |
'Avery', | |
'Abigail', | |
'Kaylee', | |
'Layla', | |
'Harper', | |
'Ella', | |
'Amelia', | |
'Arianna', | |
'Riley', | |
'Aria', | |
'Hailey', | |
'Hannah', | |
'Aaliyah', | |
'Evelyn', | |
'Addison', | |
'Mackenzie', | |
'Adalyn', | |
'Ellie', | |
'Brooklyn', | |
'Nora', | |
'Scarlett', | |
'Grace', | |
'Anna', | |
'Isabelle', | |
'Natalie', | |
'Kaitlyn', | |
'Lillian', | |
'Sarah', | |
'Audrey', | |
'Elizabeth', | |
'Leah', | |
'Annabelle', | |
'Kylie', | |
'Mila', | |
'Claire', | |
'Victoria', | |
'Maya', | |
'Lila', | |
'Elena', | |
'Lucy', | |
'Savannah', | |
'Gabriella', | |
'Callie', | |
'Alaina', | |
'Sophie', | |
'Makayla', | |
'Kennedy', | |
'Sadie', | |
'Skyler', | |
'Allison', | |
'Caroline', | |
'Charlie', | |
'Penelope', | |
'Alyssa', | |
'Peyton', | |
'Samantha', | |
'Liliana', | |
'Bailey', | |
'Maria', | |
'Reagan', | |
'Violet', | |
'Eliana', | |
'Adeline', | |
'Eva', | |
'Stella', | |
'Keira', | |
'Katherine', | |
'Vivian', | |
'Alice', | |
'Alexandra', | |
'Camilla', | |
'Kayla', | |
'Alexis', | |
'Sydney', | |
'Kaelyn', | |
'Jasmine', | |
'Julia', | |
'Cora', | |
'Lauren', | |
'Piper', | |
'Gianna', | |
'Paisley', | |
'Bella', | |
'London', | |
'Clara', | |
'Cadence']; | |
function tabName(name) { | |
if(name.length > 7) { | |
return(name + '\t'); | |
} else { | |
return(name + '\t\t'); | |
} | |
} | |
function genderize(name) { | |
if(/(ua|pher|andy|elijah)$/i.test(name)) { | |
return 'M'; | |
} | |
if(/(a|i|y|ah|ee|et|ette|elle|fer|ine|lyn|ie|anne|een|en|er|yn|ynn|kim|rachel|lind|pam|sue)$/i.test(name)) { | |
return 'F'; | |
} | |
return 'M'; | |
} | |
var boysCorrect = 0; | |
for(var i in boysNames) { | |
var r = genderize(boysNames[i]); | |
console.log(tabName(boysNames[i]) + '\tM\t' + r + '\t' + (r === 'M' ? 'X' : ' ')); | |
if(r === 'M') { | |
boysCorrect++; | |
} | |
} | |
var girlsCorrect = 0; | |
for(var i in girlsNames) { | |
var r = genderize(girlsNames[i]); | |
console.log(tabName(girlsNames[i]) + '\tF\t' + r + '\t' + (r === 'F' ? 'X' : ' ')); | |
if(r === 'F') { | |
girlsCorrect++; | |
} | |
} | |
console.log('Boys names correctly guessed: ' + boysCorrect + '%'); | |
console.log('Girls names correctly guessed: ' + girlsCorrect + '%'); | |
// Jackson M M X | |
// Aiden M F | |
// Liam M M X | |
// Lucas M M X | |
// Noah M F | |
// Mason M M X | |
// Ethan M M X | |
// Caden M F | |
// Jacob M M X | |
// Logan M M X | |
// Jayden M F | |
// Elijah M M X | |
// Jack M M X | |
// Luke M M X | |
// Michael M M X | |
// Benjamin M M X | |
// Alexander M F | |
// James M M X | |
// Jayce M M X | |
// Caleb M M X | |
// Connor M M X | |
// William M M X | |
// Carter M F | |
// Ryan M M X | |
// Oliver M F | |
// Matthew M M X | |
// Daniel M M X | |
// Gabriel M M X | |
// Henry M F | |
// Owen M F | |
// Grayson M M X | |
// Dylan M M X | |
// Landon M M X | |
// Isaac M M X | |
// Nicholas M M X | |
// Wyatt M M X | |
// Nathan M M X | |
// Andrew M M X | |
// Cameron M M X | |
// Dominic M M X | |
// Joshua M M X | |
// Eli M F | |
// Sebastian M M X | |
// Hunter M F | |
// Brayden M F | |
// David M M X | |
// Samuel M M X | |
// Evan M M X | |
// Gavin M M X | |
// Christian M M X | |
// Max M M X | |
// Anthony M F | |
// Joseph M M X | |
// Julian M M X | |
// John M M X | |
// Colton M M X | |
// Levi M F | |
// Muhammad M M X | |
// Isaiah M F | |
// Aaron M M X | |
// Tyler M F | |
// Charlie M F | |
// Adam M M X | |
// Parker M F | |
// Austin M M X | |
// Thomas M M X | |
// Zachary M F | |
// Nolan M M X | |
// Alex M M X | |
// Ian M M X | |
// Jonathan M M X | |
// Christopher M M X | |
// Cooper M F | |
// Hudson M M X | |
// Miles M M X | |
// Adrian M M X | |
// Leo M M X | |
// Blake M M X | |
// Lincoln M M X | |
// Jordan M M X | |
// Tristan M M X | |
// Jason M M X | |
// Josiah M F | |
// Xavier M F | |
// Camden M F | |
// Chase M M X | |
// Declan M M X | |
// Carson M M X | |
// Colin M M X | |
// Brody M F | |
// Asher M F | |
// Jeremiah M F | |
// Micah M F | |
// Easton M M X | |
// Xander M F | |
// Ryder M F | |
// Nathaniel M M X | |
// Elliot M M X | |
// Sean M M X | |
// Cole M M X | |
// Sophia F F X | |
// Emma F F X | |
// Olivia F F X | |
// Ava F F X | |
// Isabella F F X | |
// Mia F F X | |
// Zoe F M | |
// Lily F F X | |
// Emily F F X | |
// Madelyn F F X | |
// Madison F M | |
// Chloe F M | |
// Charlotte F M | |
// Aubrey F F X | |
// Avery F F X | |
// Abigail F M | |
// Kaylee F F X | |
// Layla F F X | |
// Harper F F X | |
// Ella F F X | |
// Amelia F F X | |
// Arianna F F X | |
// Riley F F X | |
// Aria F F X | |
// Hailey F F X | |
// Hannah F F X | |
// Aaliyah F F X | |
// Evelyn F F X | |
// Addison F M | |
// Mackenzie F F X | |
// Adalyn F F X | |
// Ellie F F X | |
// Brooklyn F F X | |
// Nora F F X | |
// Scarlett F M | |
// Grace F M | |
// Anna F F X | |
// Isabelle F F X | |
// Natalie F F X | |
// Kaitlyn F F X | |
// Lillian F M | |
// Sarah F F X | |
// Audrey F F X | |
// Elizabeth F M | |
// Leah F F X | |
// Annabelle F F X | |
// Kylie F F X | |
// Mila F F X | |
// Claire F M | |
// Victoria F F X | |
// Maya F F X | |
// Lila F F X | |
// Elena F F X | |
// Lucy F F X | |
// Savannah F F X | |
// Gabriella F F X | |
// Callie F F X | |
// Alaina F F X | |
// Sophie F F X | |
// Makayla F F X | |
// Kennedy F F X | |
// Sadie F F X | |
// Skyler F F X | |
// Allison F M | |
// Caroline F F X | |
// Charlie F F X | |
// Penelope F M | |
// Alyssa F F X | |
// Peyton F M | |
// Samantha F F X | |
// Liliana F F X | |
// Bailey F F X | |
// Maria F F X | |
// Reagan F M | |
// Violet F F X | |
// Eliana F F X | |
// Adeline F F X | |
// Eva F F X | |
// Stella F F X | |
// Keira F F X | |
// Katherine F F X | |
// Vivian F M | |
// Alice F M | |
// Alexandra F F X | |
// Camilla F F X | |
// Kayla F F X | |
// Alexis F M | |
// Sydney F F X | |
// Kaelyn F F X | |
// Jasmine F F X | |
// Julia F F X | |
// Cora F F X | |
// Lauren F F X | |
// Piper F F X | |
// Gianna F F X | |
// Paisley F F X | |
// Bella F F X | |
// London F M | |
// Clara F F X | |
// Cadence F M | |
// Boys names correctly guessed: 71% | |
// Girls names correctly guessed: 80% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adding 'er' suffix to the male group instead of female, changes the results to 82% / 77% if anyone's interested (for names like Alexander, Christopher, etc.)