summaryrefslogtreecommitdiff
path: root/megahal_local.py
blob: 024d0537cd0cde4c452f3ca971411604bcbd08c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import mh_python
import pyPgSQL.PgSQL

mh_python.initbrain()


conn = pyPgSQL.PgSQL.connect(database="omegle")

cur = conn.cursor()
cur.execute("""
SELECT message FROM omegle_messages
WHERE NOT ( message ILIKE '%www.%'
         OR message ILIKE '%http:%'
         OR message ILIKE '%@%.%');
""")
c=0
while True:
	messages = cur.fetchmany(1000)
	if len(messages)==0:
		break
	for message in messages:
		c+=1
		if c%50==0:
			print "%s%s" % ("\033[2K\033[E",c),
		mh_python.learn("%s"%message[0])

print "all learned"
cur.close()
conn.close()
import sys
while True:
	print ">>> ",
	x=sys.stdin.readline().strip()
	print "<<< %s " % mh_python.doreply(x)