端末を介してユーザーとローカルでチャットするように grokitbot をセットアップしたいと思います。
Grokitbot は、twisted を使用して irc サーバーと直接通信するように接続されています。
ソースコードを見ると、Grokitbot.py がすべての irc 処理を行い、AIMLBot.py がすべての実際の作業を行っているように見えるので、前のファイルは破棄しています。 これは AIMLBot.py です
すべてのベイズ処理を行うAIMLBayes.pyという別のスクリプトがあります。
最初の質問では、名前として送信する文字列なしでコードを実行していました。そのため、トレーニング ファイルを作成できませんでした。
だから、私の元の質問を言い換えます:
from AIMLBot import AIMLBot
bot = AIMLBot("Joe")
while True:
line = raw_input()
print bot.on_MSG_IN("netanel", line)
スクリプトのログは次のとおりです。
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
このコードは Windows で失敗します。しかし、Debian を実行している Linux マシンでも同じコードが機能します。