How to recognize gender by name
Show older comments
Hi!
I have a list (1 column, 601 rows) of the most popular male and female surnames and they are marked in another column as either M for male or F for female. I have another list of surnames of people from a statistical survey (which does not have the same dimensions as the list of names). I want to compare the names from the survey with the names in my list and mark them as either M or F if they are recognized. If they are not found in my list, I want to leave them blank. Does anyone know how I can do this?
Many thanks in advance.
Accepted Answer
More Answers (1)
Image Analyst
on 11 Jul 2018
0 votes
I'd get a distribution and then use k nearest neighbors. After all, there are several names with varying numbers of people in either gender, like chris, robin, ariel, sam, pat, etc.
2 Comments
Alexander Engman
on 11 Jul 2018
Image Analyst
on 11 Jul 2018
Then just use xlsread() to read in your reference name lists, and your "test/validation" set of names and use ismember(), something like (untested):
[numbers, names, raw] = xlsread(filename);
femaleNames = strings(:, 1); % Female names in column 1.
maleNames = strings(:, 2); % Male names in column 2.
testNames = strings(:, 3); % Test names in column 3.
for k = 1 : length(testNames)
inFemaleList(k,1) = ismember(testNames{k}, femaleNames);
inMaleList(k,2) = ismember(testNames{k}, maleNames);
end
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!