diff options
Diffstat (limited to 'megahal_local.py')
-rw-r--r-- | megahal_local.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/megahal_local.py b/megahal_local.py index cb96a0f..b17316f 100644 --- a/megahal_local.py +++ b/megahal_local.py @@ -2,20 +2,27 @@ import mh_python import pyPgSQL.PgSQL mh_python.initbrain() -print "\033[2J" conn = pyPgSQL.PgSQL.connect("") cur = conn.cursor() -cur.execute("SELECT message FROM omegle_messages") -messages = cur.fetchall() +cur.execute(""" +SELECT message FROM omegle_messages +WHERE NOT ( message ILIKE '%www.%' + OR message ILIKE '%http:%' + OR message ILIKE '%@%.%'); +""") c=0 -for message in messages: - c+=1 - if c%20==0: - print "%s%s/%s" % ("\033[2K\033[E",c,len(messages)), - mh_python.learn(message[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 "" cur.close() |