0

I would like to set up grokitbot to chat locally with the user through a terminal.

Grokitbot is hooked up to speak directly to an irc server using twisted.

Looking at the sourcecode, it seems that Grokitbot.py does all the irc stuff, and AIMLBot.py does all the actual work, so I'm discarding the former file. This is AIMLBot.py

There is another script called AIMLBayes.py which does all the Bayes stuff.

In my first question, I was running the code without a string to send as a name. therefor a training file could not be created.

So, rephrasing my original question:

from AIMLBot import AIMLBot

bot = AIMLBot("Joe")

while True:
    line = raw_input()
    print bot.on_MSG_IN("netanel", line)

Here is the log from the script:

Loading data/aiml/startup.xml... done (0.11 seconds)
Loading data/aiml\example.aiml... done (0.01 seconds)
Loading data/aiml\goodbye.aiml... done (0.00 seconds)
Loading data/aiml\hello.aiml... done (0.01 seconds)
Loading data/aiml\main.aiml... done (0.01 seconds)
Loading data/aiml\thanks.aiml... done (0.00 seconds)
Loading data/aiml\tools.aiml... done (0.01 seconds)
Loading data/aiml\unknown.aiml... done (0.00 seconds)
Interpreter Version Info: PyAIML 0.8.6
Kernel bootstrap completed in 0.18 seconds
[Alert] Failed to load bayesian brain - Joe.bay, creating it now
hello
Loading data/aiml/training/netanel.aiml... done (0.00 seconds)
Sorry, I don't understand. What do you mean?
hello
[Handler] TRAINING
Failed to learn
OK, I grok that

This code is failing on Windows. But the same code works on a Linux machine running Debian..

Netanel
  • 55
  • 6
  • By the way, I tried inserting a std-hello.aiml file into the AIML folder, and It successful starts it up, and can respond with the commands as specified in the AIML file. However, the bot still won't learn new phrases. the module comes with an hello.aiml, but I get no respond when I load the default AIML files. – Netanel Feb 15 '15 at 04:07

1 Answers1

0

Looks like you need to give a name instead of an empty string for on_MSG_IN:

    print a.on_MSG_IN("steve", line)

After making that change it works for me:

$ ../bin/python bot.py
Loading data/aiml/startup.xml... done (0.03 seconds)
Loading data/aiml/example.aiml... done (0.00 seconds)
Loading data/aiml/goodbye.aiml... done (0.00 seconds)
Loading data/aiml/hello.aiml... done (0.00 seconds)
Loading data/aiml/main.aiml... done (0.00 seconds)
Loading data/aiml/thanks.aiml... done (0.00 seconds)
Loading data/aiml/tools.aiml... done (0.00 seconds)
Loading data/aiml/unknown.aiml... done (0.00 seconds)
Interpreter Version Info: PyAIML 0.8.6
Kernel bootstrap completed in 0.03 seconds
[Bayes] Brain loaded ok
hi
[Guess] hello
[Topic] hello
Hallo Pooh
greetings
Loading data/aiml/training/steve.aiml... done (0.00 seconds)
Sorry, I don't understand. What do you mean?
hello
[Guess] hello
[Handler] TRAINING
OK, I grok that
greetings
[Guess] hello
[Topic] hello
Hello steve

I just taught it that "greetings" is another way to say hello.

If it still doesn't work can you give us the output of the script? Are you seeing an error? Does it have the same output lines I have? ("Loading...", "[Guess]", etc.).

Steven Kryskalla
  • 14,179
  • 2
  • 40
  • 42
  • This seems to work alright on linux, but on windows I'm still getting errors. here's the log from the linux machine, (I've cut the loading aimls) Kernel bootstrap completed in 0.03 seconds [Alert] Failed to load bayesian brain - Joe.bay, creating it now > hello Loading data/aiml/training/netanel.aiml... done (0.00 seconds) Sorry, I don't understand. What do you mean? > hello means hello [Handler] TRAINING OK, I grok that > hello [Guess] hello [Topic] hello elo So this obviously work, except not on windows. it's weird though that I have to train him hello and you don't? Btw, thanks! – Netanel Feb 15 '15 at 06:46
  • No problem! Oh.. I'm using windows too (but with cygwin for python). You should edit your original question to include those log messages. You say it gives an error on windows, what was the error? If it works on one platform and not the other you could try debugging step by step (`python -m pdb bot.py`) to see what's different. Or since it seems like this program relies on those *.aiml and *.bot files a lot, try inspecting those on linux vs. windows before/after training. Re: training the hello part, I might have trained it earlier, I forget. That output I posted was my second time using it. – Steven Kryskalla Feb 15 '15 at 17:29
  • It's really not an issue for me so much. It's all going to run on a Linux machine anyway.. One thing I just couldn't do, is running a callback function from a handler in an AIML file.. teaching the bot that example means example, It returns a string "This is an example" supposedly you can take this callback to run an on_EXAMPLE() function as specified [here](http://www.suttree.com/code/GrokItBot/features/) I tried tapping into that, but the function is never called.. – Netanel Feb 16 '15 at 01:20