samsonp81 has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Gender prediction
by agianni (Hermit) on Jun 04, 2007 at 17:33 UTC

    While the task sounds odd and has undesirable social implications (IMHO), from a technical perspective, you should be able to do it.

    The index function should take you most of the way, assuming you're looking for exact matches of names. Since you won't know about case, you'll probably want to lc everything before you do the comparison.

    If you are concerned about efficency, sort all of your baby name and email information first so you can short circuit when you hit something alphabetically larger.

    perl -e 'split//,q{john hurl, pest caretaker}and(map{print @_[$_]}(joi +n(q{},map{sprintf(qq{%010u},$_)}(2**2*307*4993,5*101*641*5261,7*59*79 +*36997,13*17*71*45131,3**2*67*89*167*181))=~/\d{2}/g));'
Re: Gender prediction
by princepawn (Parson) on Jun 04, 2007 at 19:05 UTC
    Text::GenderFromName could help, but it mainly deals with English names.


    Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality
Re: Gender prediction
by raptur (Acolyte) on Jun 04, 2007 at 21:52 UTC
    You should also look into identifying close matches. janetP should be recognized as close to Janet. You might be able to finagle spell for these purposes instead of writing your own transformation distance algorithm, using the -c -b flags and processing your baby-name table into a dictionary that spell can use.

    Although I am a bit concerned about the social implications too. what is this for?

    -=-raptur-=-

Re: Gender prediction
by DrHyde (Prior) on Jun 05, 2007 at 09:44 UTC
    <sniff sniff> - I smell homework.

    Even if it's not homework, you still forgot to show us what you've done so far. Monks will be delighted to *help* you, but not to do all the work for you.

      That's not homework you smell, but spam. There is a distinct spam smell about the OP. I'm sure we will be told what the task is really for and will all feel silly however.


      DWIM is Perl's answer to Gödel
        Although I tried answering the question, I could easily smell spam... good that Grandfather expressed it clearly. Can samsonp81 explain why he wants such kind of script?
Re: Gender prediction
by sanPerl (Friar) on Jun 05, 2007 at 09:29 UTC
    You can
    1) Strip digits. Convert _ to whitespaces etc. Perform a good cleanup of email address.
    2) Take reminder of email name after cleanup. Compare it with Baby names using String::Silimarity, select the best match as per number returned by this module
Re: Gender prediction
by tubaandy (Deacon) on Jun 05, 2007 at 17:40 UTC
    I'm with DrHyde, might be nice to see what you've tried first.

    As for the social implications, that assumes people pick their userid relative to their gender, correct? While that is typically the case, what Sam is trying can be approximate at best. A few examples:

    tubaandy - Sure, I'm a male who plays tuba. tubaandi might be a female.

    Sam (or chris or pat or ...) - could be male or female.

    You get the point, and these are just the english names. (I'd like to know how one would label 005 in Sam's example above. :) ) How often do we find people on the 'net masquerading as someone they're not?

    tubaandy
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Gender prediction
by 13warrior (Acolyte) on Jun 05, 2007 at 09:09 UTC
    Hi,
    To access tables from Database you can use Jeremy Zawodany's Dbix::Dwiw module.
    You can store the name and gender in a hash with name as key and gender as value.
    You can get the result as a hash from the Dbix:Dwiw module.
    Take the input as email-id and parse it using a regex.
    You can then to do lookup in the hash.
    If you need further help you can send me a pvt.message
    HTH
    Sharad
      Hello Sharad! Thanx for your response. am new to perl n so am looking for help. Sharad as i have said i have the requred data i.e the baby names table and email ids table.. i think u have the structurre with you.. All i have to do is 1. take an email id from emails suppose rajan@yahoo.com . now i have to consider the string before @ i.e rajan 2.Compare rajan with names field in the baby names table .. 3.if there is a match. print the corresponding gender of the baby to this email id.. the baby names tables has a vast list of all possible names. can u help me?
Re: Gender prediction
by Anonymous Monk on Jun 06, 2007 at 03:16 UTC
    First: of all what have you tried so far??

    Second: of all this has to be one of the weirdest posts I have seen and I have seen some real doosies.

    Third: This is probably homework and its obvious you signed up to Perlmonks just to ask this question hoping that someone would just whip this out for you.

    Fourth: What the hell is an "aboce task"?

    Enjoy the third world!
A reply falls below the community's threshold of quality. You may see it by logging in.