Created
August 31, 2011 21:59
-
-
Save emmapersky/1184847 to your computer and use it in GitHub Desktop.
get_gender_for_name
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
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