Skip to content

Instantly share code, notes, and snippets.

@emmapersky
Created August 31, 2011 21:59
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 emmapersky/1184847 to your computer and use it in GitHub Desktop.
Save emmapersky/1184847 to your computer and use it in GitHub Desktop.
get_gender_for_name
def get_gender_for_name(name)
freq_female = female_data(name) || 0
freq_male = male_data(name) || 0
factor = 1 / (freq_female + freq_male)
# 0.9 is our chosen level of significance
if (freq_female * factor > 0.9) return "female"
if (freq_male * factor > 0.9) return "male"
return "unknown"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment