I have a text file with a list of names:
Aaron
Abren
Adrian
Albert
When I run the following code:
import gender_guesser.detector as gender
d = gender.Detector()
file1 = open('names.txt','r')
count = 0
while True:
count += 1
line = file1.readline()
guess = d.get_gender(line)
print(line)
print(guess)
if not line:
break
print(count)
I get the following:
Aaron
unknown
Abren
unknown
Adrian
unknown
Albert
male
unknown
5
It looks like it is only able to evaluate the last name in the file (Albert), and I think it has to do with how it parses through the file. If I add a line break after Albert, it no longer detects Albert as male.
Any thoughts?