Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: (nrd) Cool Uses For Perl? AIM-BOTS!

by newrisedesigns (Curate)
on Mar 11, 2003 at 13:31 UTC ( [id://242015]=note: print w/replies, xml ) Need Help??


in reply to Cool Uses For Perl? AIM-BOTS!

mousey helps run wired bots, while batkins created milkbone, an all-Perl AIM client. theorbtwo has helped you before. He wrote perlmonkscb an AIM robot that works with the Perl Monks chatterbox. Me? Well, I just confuse people with my robots (as TStanley pointed out).

You're preaching to the converted. Next time, do a search. ;)

John J Reiser
newrisedesigns.com

Replies are listed 'Best First'.
Re: Re: (nrd) Cool Uses For Perl? AIM-BOTS!
by AssFace (Pilgrim) on Mar 11, 2003 at 17:04 UTC
    Have you thought of using a markov matrix type setup for text generation of your bots response?

    I see that you have one that responds back with random lines out of a file - but it seems to me if you had one that actually learned from "real life" text and then spat that back at a person, that would be a lot cooler.
    Although I suspect "a lot cooler" is in the eye of the beholder.

    I have already posted my Radiohead song generator, and in the past I have written a Poe generator (just need to scrouge through my backup cds to see where that code went to - I could easily enough just use the Radiohead code as long as I made up the Poe XML correctly). Poe is easy/fun to make as a generator because via Project Gutenberg you can get all of his works as well as his personal writings that are available. Becuase so much text is available to train on - his generator will output better reading text than the radiohead one which has less text to learn on.
    Obviously the same could be made of pretty much anything else (Willy The Shake - or even do as I have done and point it to scan the web, or chat boards - or for real fun, the newsgroups).

    I'm pretty busy at work right now - but sometime later (maybe tonight?) I will try to look at your code for the bots and see if I can easily write a quick port over to a Markov Matrix type bot.
      I was out at a birthday party for a friend of my finacee this evening, so I didn't have much time to work on this.

      If you take this code (See code below) and add it to your bot - call the "grabMarkovPhrase" and it will return a string for you to return to the user talking to your bot. That way instead of just random text, it will return text that is more in the style of... well, whatever text that you train it on.
      (you could log all of the responses that users give your bots into a file, then you could train this bot against that file - that way it would talk back to them in a manner similar to the way they talk to it... that would likely degrade since there will be a lot of mimicry that it will learn on)
      The variables at the top control the minimum and maximum size of the string that it will return (counting "words" - really it just splits on a space and then looks to see how many array spots that creates).
      I just real quickly tore this code out of my radiohead song generator stuff and also created just a flat file of all of the radiohead text.

      There are a ton of things that could make this far better:
      • It will cut off words at the end. I just haven't bothered to address this issue yet in my markov stuff. Judging by the fractured conversations that I've had with people on AIM, I'm not sure it matters too much what this thing does in terms of grammar or "typing".
      • It could written much better in terms of looks and especially in terms of performance. All I did was spend 5 mins and glance through your code (enough to thinnk that you could just call this method and return that string to the user) and then yank this stuff out so that it could work in your code.
      • One huge performance issue is that each time this is called, it reads in the file and generates the hash. It would obviously be much better to create the hash from a fixed set of text, and then save out that premade hash and then only load that in when run. On my Athlon 1G M laptop running ActiveState Perl, it takes around 1 second to return its string.
      • It would be nice if it could look at the user response, and then determine how to respond to that instead of totally randomly. Like if they use words that are indicitive of a question, then respond with a certain range of starting words, etc. But that is beyond what I feel like doing right now - I feel like sleeping, as always.
      • There is likely more, but I think I'm off to bed - this was just a fun thing for me to think about and try to quickly bang out - not like I would recommend this in a production environment. The text file isn't anything special - it can be replaced with any text file - I don't strip out that many special characters - so if you change the text, be wary of characters that you don't want showing up - if there are any.


      Some examples of running this a few times:
      1. White-washed me alive we've gotta dig it up on the main
      2. Immerse I'd telling to shreds. You find another mess
      3. Gave me a minute the underground. Let down Why don't really since in a jack the best you ca
      4. Bill My uncle Bill to try Oh, it's OK And why should turn animals Living in the beach wi
      5. And he's see me a message I can't afford to
      6. Karma police arrest when I got something My
      7. A Kid A Kinetic Kinetic Kinetic Kinetic Kinetic Kinetic Kinetic... oh no, pop it died a bag
      8. IA, the world astral carefully Burning in a prises, I wish I could be and it hard, t

      (See code below)
Re: Re: (nrd) Cool Uses For Perl? AIM-BOTS!
by Sleepaholic88 (Novice) on Mar 22, 2003 at 00:44 UTC
    I wasnt preaching to the converted, i was just sugesting to the unconverted =), i have two bots (REALLY BAD BOTS, but its a start =)) if you want, feel free to talk to TestAIMBot or BabblerAIMBot.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://242015]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2024-03-28 11:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found