NAME
Text::GenderFromName
- Guess the gender of a "Christian" first name.
SYNOPSIS
use Text::GenderFromName;
print gender("Jon"); # prints "m"
Text::GenderFromName is available at a CPAN site near you.
DESCRIPTION
This module provides a lone function: gender()
, which returns one of three values: "m" for male, "f" for female", or UNDEF if it doesn't know. For instance, gender("Chris") is UNDEF.
The original code assumed a default of male, and I am happy to contribute to the destruction of the oppressive Patriarchy by returning an UNDEF value if no rule triggers. Ha ha! Seriously, it'll be useful to know when gender()
has no clue.
For the curious, I ran Text::GenderFromName on The Perl Journal's subscriber list. The result?
Male: 68%
Female: 32%
BUGS
gender()
can never be perfect.
I'm sure that many of these rules could return immediately upon firing. However, it's possible that the original author arranged them in a very deliberate order, with more specific rules at the end overruling earlier rules. Consequently, I can't turn all of these rules into the speedier form return "f" if /.../
without throwing away the meaning of the ordering. If you have the stamina to plod through the rules and determine when the ordering doesn't matter, let me know!
The rules should probably be made case-insensitive, but I bet there's some funky situation in which that'll lose.
AUTHOR
Jon Orwant
The Perl Journal and MIT Media Lab
orwant@tpj.com
This is an adaptation of an 8/91 awk script by Scott Pakin in the December 91 issue of Computer Language Monthly.
Small contributions by Andrew Langmead and John Strickler.