스크립트를 실행할 때 AIML을 사용하는 Python 프로젝트를 시작합니다. '일치하지 않습니다.'오류가 발생합니다.Python AIML 오류
import aiml
kernel = aiml.Kernel()
kernel.learn("bot.aiml")
while True:
print kernel.respond(raw_input("\n>>"))
그냥 간단한 AIML 커널 : 이것은 파이썬 코드입니다. 그게 뭔가 잘못 됐니? 당신이
import aiml
import sys <br>
brainLoaded = False
forceReload = False
while not brainLoaded:
if forceReload or (len(sys.argv) >= 2 and sys.argv[1] == "reload"):
kern.bootstrap(learnFiles="Database.xml", commands="load aiml b")
brainLoaded = True
kern.saveBrain("Cache.brn")
else:
# Attempt to load the brain file. If it fails, fall back on the Reload
try:
# It is our cache file.
kern.bootstrap(brainFile = "Cache.brn")
brainLoaded = True
except:
forceReload = True
# Enter the main input/output loop.
print "Enter your message for the chatbot"
while(True):
print kern.respond(raw_input("> "))
주 관심이 있다면
에서 '인쇄'문을 제거하십시오 : 다음과 같은 기본 응답을 포함하려고? –