Skip to content
This repository has been archived by the owner on Oct 11, 2019. It is now read-only.

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
bigeagle committed Feb 5, 2012
0 parents commit ea5eaa1
Show file tree
Hide file tree
Showing 19 changed files with 2,725 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.swp
*~
*.pyc
*.pyo
28 changes: 28 additions & 0 deletions TalkBot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/python2
# -*- coding: utf8 -*-
import aiml
import os
import config as cfg

class TalkBot(aiml.Kernel):
def __init__(self,properties=cfg.BOT_PROPERTIES):
aiml.Kernel.__init__(self)
self.verbose(cfg.DEBUG)
if os.path.isfile("xdtuxbot.brn"):
self.bootstrap(brainFile = "xdtuxbot.brn")
else:
self.init_bot()
self.saveBrain("xdtuxbot.brn")
for p in properties:
self.setBotPredicate( p, properties[p] )

def init_bot(self):
for file in os.listdir(cfg.AIML_SET):
if file[-4::]=="aiml":
self.learn(os.path.join(cfg.AIML_SET,file) )


if __name__=="__main__":
bot = TalkBot()
while True: print bot.respond(raw_input("> "))

2 changes: 2 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__all__ = []
from TalkBot import TalkBot
Loading

0 comments on commit ea5eaa1

Please sign in to comment.