Random name generator!

Discussion in 'Ruby' started by Dss Jss, Apr 10, 2008.

  1. Dss Jss

    Dss Jss Guest

    Hello to all;

    I'm testing out different ways to output randomly generated names. I've
    toyed with some basic algorithms but recently I've become hooked on the
    idea of using a Markov chain in the process to generate names based on a
    text file. Below is a link to my first effort - I won't even begin to
    start on what a catastrophe it is and I don't expect you to understand
    it:

    http://pastie.textmate.org/178820

    It's hideous. I'm never going near it again. It basically looks at each
    line of a text file and throws the adjacent letter pairings into a big
    hash with probability weightings, moves through the probability hash
    coughing out likely letter results based on the previous entry. I think
    the term for it is "first-order Markov chain".

    What I'd like to see if anyone has any suggestions, or more importantly
    examples of how this should be done? I'm fairly certain there are more
    elegant ways about doing this. Thanks.
    --
    Posted via http://www.ruby-forum.com/.
    Dss Jss, Apr 10, 2008
    #1
    1. Advertising

  2. Dss Jss

    Ken Bloom Guest

    On Thu, 10 Apr 2008 16:40:17 -0500, Dss Jss wrote:

    > Hello to all;
    >
    > I'm testing out different ways to output randomly generated names. I've
    > toyed with some basic algorithms but recently I've become hooked on the
    > idea of using a Markov chain in the process to generate names based on a
    > text file. Below is a link to my first effort - I won't even begin to
    > start on what a catastrophe it is and I don't expect you to understand
    > it:
    >
    > http://pastie.textmate.org/178820
    >
    > It's hideous. I'm never going near it again. It basically looks at each
    > line of a text file and throws the adjacent letter pairings into a big
    > hash with probability weightings, moves through the probability hash
    > coughing out likely letter results based on the previous entry. I think
    > the term for it is "first-order Markov chain".
    >
    > What I'd like to see if anyone has any suggestions, or more importantly
    > examples of how this should be done? I'm fairly certain there are more
    > elegant ways about doing this. Thanks.


    http://rubyquiz.com/quiz74.html

    The solutions are for word markov chains, but you could easily adapt any
    of them for letter markov chains.

    --Ken

    --
    Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory.
    Department of Computer Science. Illinois Institute of Technology.
    http://www.iit.edu/~kbloom1/
    Ken Bloom, Apr 11, 2008
    #2
    1. Advertising

  3. I would suggest using combinations of phonemes rather than letters. It
    would simplify the problem and generate more natural sounding
    combinations.


    --
    Posted via http://www.ruby-forum.com/.
    Sean Mehonoshen, Apr 11, 2008
    #3
  4. Dss Jss

    Ken Bloom Guest

    On Fri, 11 Apr 2008 04:47:20 -0500, Sean Mehonoshen wrote:

    > I would suggest using combinations of phonemes rather than letters. It
    > would simplify the problem and generate more natural sounding
    > combinations.


    <hat role="computational linguistics">
    Too hard, because then you have to specify what they are. Use a higher-
    order markov model (like 4 or 5), and you'll get pronouncable results.

    One of my colleagues wrote http://lingcog.iit.edu/~scubed/cgi-bin/
    gibberish.sh, which is a 4th-order markov model of English letters. It
    shoudl be relatively pronouncable, and might suit your needs.
    </hat>

    --
    Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory.
    Department of Computer Science. Illinois Institute of Technology.
    http://www.iit.edu/~kbloom1/
    Ken Bloom, Apr 11, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Martin Maurer
    Replies:
    3
    Views:
    4,815
    Peter
    Apr 19, 2006
  2. TheDustbustr
    Replies:
    1
    Views:
    447
    Sami Hangaslammi
    Jul 25, 2003
  3. Daniele C.
    Replies:
    0
    Views:
    420
    Daniele C.
    May 28, 2006
  4. globalrev
    Replies:
    4
    Views:
    753
    Gabriel Genellina
    Apr 20, 2008
  5. VK
    Replies:
    15
    Views:
    1,152
    Dr J R Stockton
    May 2, 2010
Loading...

Share This Page