Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Omegle Bot : Python+XML

Name: Anonymous 2010-12-14 18:17

Python and XML - not Lisp - for AI

Python Omegle Bot which uses an Artificial Intelligence Markup Language. It’s basically a rule based xml language which is used by the AI engine to give a response (a.k.a. categories) based on a set of pre-loaded rules (a.k.a. topics). Such a topic-category definition is written in to a AIML file which the engine loads.

Find final listing here:

http://ravispeaks.wordpress.com/2009/09/16/diy-omegle-chat-bot/#viewSource

Can anyone get this running on mac? I'm getting parsing errors like crazy:

"/OmegleBot/' && '/usr/bin/pythonw' '/OmegleBot/omeglebot.py' && echo Exit status: $? && exit 1
Loading Adverbs.aiml... done (0.15 seconds)
PARSE ERROR: Unexpected <html:br> tag (line 44, column 68)
...."

I put the Annotated A.L.I.C.E. AIML files in a folder 'aaa' in the same directory as the python script, also put the PyAIML-0.8.6 aiml folder in the same directory as the .py

still the same parsing errors

What am I doing wrong? INb4MacFagSTFU

Name: Anonymous 2010-12-14 18:25

Apart from unmatched quotes and trying to execute a directory, I can't tell.

Name: Anonymous 2010-12-14 18:30

OP here, no in the terminal I'm just basically running: cd /directory with .py + aiml dir + xml aiml files dir

then python omeglebot.py

it compiles the brain file but it is all fucked... trying to figure out what the parsing errors are related to

Name: Anonymous 2010-12-14 18:45

source here:

#This omegle bot is based on the PyAIML and liberally uses code from PyOmegle
# PyAMIL:<a class="linkification-ext" href="http://pyaiml.sourceforge.net/" title="Linkification: http://pyaiml.sourceforge.net/">http://pyaiml.sourceforge.net/</a>;
# PyOmegle:<a class="linkification-ext" href="http://code.google.com/p/pyomegle/" title="Linkification: http://code.google.com/p/pyomegle/">http://code.google.com/p/pyomegle/</a>;

import aiml
import urllib2 as url
import urllib
import os
import time
import commands

k = aiml.Kernel()

if os.path.isfile("omeglebrain.brn"):
    k.bootstrap(brainFile = "omeglebrain.brn")
else:
    homedir=os.getcwd()
    #Change to the directory where the AIML files are located
    os.chdir('./aaa')
    list=os.listdir('./');
    for item in list:
      k.learn(item)
    k.setPredicate("name","omegle_bot")
    k.setPredicate("master","ravi")
    #Change back to homedir to save the brain for subsequent loads
    os.chdir(homedir)
    k.saveBrain("omeglebrain.brn")

# #conversation ID
def fmtId( string ):

    return string[1:len( string ) - 1]

# #The event listener
def listenServer( id, req ):

    while True:

        site = url.urlopen(req)
        rec = site.read()

        if 'waiting' in rec:
            print("Waiting...")

        elif 'strangerDisconnected' in rec:
            print('Stranger Disconnected!')
            omegleConnect()

        elif 'connected' in rec:
            print('Found one')
            print(id)
            talk(id,req,"hey")           

        elif 'typing' in rec:
            print("Stranger is typing...")

        elif 'gotMessage' in rec:
            input=rec[16:len( rec ) - 2]
        print "Stranger:",input
        result=k.respond(input)
            talk(id,req,result)

# #Send the bot's response to Omegle
def talk(id,req,msg):

    typing = url.urlopen('<a class="linkification-ext" href="http://omegle.com/typing" title="Linkification: http://omegle.com/typing">http://omegle.com/typing</a>;', '&id='+id)
    typing.close()
    time.sleep((len(msg))/5) #5 characters per second
    print "You:",msg
    msgReq = url.urlopen('http://omegle.com/send', '&msg='+msg+'&id='+id)
    msgReq.close()

# #Initiate connecton
def omegleConnect():

    site = url.urlopen('http://omegle.com/start','')
    id = fmtId( site.read() )
    print(id)
    req = url.Request('http://omegle.com/events', urllib.urlencode( {'id':id}))
    print('Finding stranger...')
    listenServer(id,req)

# MAIN
omegleConnect()

Name: Anonymous 2010-12-14 18:49

>>1
Python and XML - not Lisp - for AI
http://en.wikipedia.org/wiki/Greenspun%27s_Tenth_Rule

Name: Anonymous 2010-12-14 19:11

out of curiosity, can anyone get this running?

Name: Anonymous 2010-12-14 22:33

so I am assuming no one can get this working ?

Name: Anonymous 2010-12-14 23:57

>>6,7
Fuck off already

Name: HERR BRAUN 2010-12-15 0:00

THIS THREAD HAS BEEN REPLACED WITH THE FOLLOWING THREAD:

    Subject: LITHP
    Message: How to rub your penis while writing ENTERPRISE HASKAL while rubbing your tits while watching Naruto: shippuden

Name: Anonymous 2010-12-15 0:07

>>9
I don't watch Naruto Shitpuuden.

Name: Anonymous 2010-12-15 3:50

>>10
You totally should. It really takes off when they get to the Goron village and fight Jessica. After Naruto gets the mystic eyes of death perception, his brother opens a gap to the netherworld, and they rescue Zimbabwe and get the fire badge. Shit is so wild.

Name: Anonymous 2010-12-15 8:46

funny how this thread completely went over peoples heads

4chan you are a shell of your former self

And no i did not get this running successfully (CAPTCHAs)

Name: Anonymous 2010-12-15 8:52

>>12
I doubt you'll find anyone willing to help you with trivial things.

Name: Anonymous 2010-12-15 9:08

>>12
That might make sense if you were actually referring to 4chan. Don't let the domain name fool you, this place isn't 4chan.

Name: Anonymous 2010-12-15 9:11

>>14
Yes it is, ``faggot''.

Name: VIPPER 2010-12-15 9:15

>>15
JEWS ALERT!

Name: Anonymous 2010-12-15 21:19

>>1,14
Can't tell if I'm being trolled or not

Name: Anonymous 2010-12-15 22:16

>>17
I'm not trolling you. world4ch is not 4chan.

Name: Anonymous 2010-12-15 23:10

>>18
Ah. I meant to quote >>12 when I said that

Name: Anonymous 2010-12-16 1:23

CAPTCHAs will not let this run properly at least not without a delay

Name: Anonymous 2010-12-16 13:38

10.6.3 and I haven't gotten it to compile/run

Name: Anonymous 2010-12-16 13:41

pretty good bot idea really

Name: Anonymous 2010-12-16 16:45

Python and XML - not Lisp - for AI
Now you have way too many problems.

Name: Anonymous 2011-02-03 1:53

Name: Anonymous 2011-02-04 15:05

Name: Anonymous 2013-01-18 23:36

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

Name: Anonymous 2013-09-01 15:25


 In languages that do not provide explicit access to such values from the initial state of the program, but do implement the floating point data type, the infinity values might still be accessible and usable as the result of certain operations.

Don't change these.
Name: Email:
Entire Thread Thread List