-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLA.py
executable file
·35 lines (26 loc) · 840 Bytes
/
LA.py
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
35
#!/usr/bin/env python
import aiml
import os
import sys
class LA():
def __init__(self):
self.kernel = aiml.Kernel()
def initialize(self):
if os.path.isfile("LABrain.brn"):
self.kernel.bootstrap(brainFile="LABrain.brn")
else:
self.kernel.bootstrap(learnFiles="std.xml", commands="load aiml b")
self.kernel.saveBrain("LABrain.brn")
properties_file = open(os.sep.join(["LA/lib/system","rosie.properties"]))
for line in properties_file:
parts = line.split('=')
key = parts[0]
value = parts[1]
self.kernel.setBotPredicate(key,value)
while True:
print(self.kernel.respond(raw_input("~> ")))
def main():
la = LA()
la.initialize()
if __name__ =='__main__':
main()