I ran a simple code involving a .xml extension file and python file. I got the error as shown. i didn't get the main reason behind it and cant figure out how to rectify it.
error shown is:
Loading brain from startup.xml...Error restoring PatternMgr from file startup.xml:
Traceback (most recent call last):
File "test.py", line 7, in <module>
kernel.bootstrap(brainFile="startup.xml")
File "C:UsersadithAppDataLocalProgramsPythonPython37libsite-packagesaimlKernel.py", line 134, in bootstrap
self.loadBrain(brainFile)
File "C:UsersadithAppDataLocalProgramsPythonPython37libsite-packagesaimlKernel.py", line 194, in loadBrain
self._brain.restore(filename)
File "C:UsersadithAppDataLocalProgramsPythonPython37libsite-packagesaimlPatternMgr.py", line 67, in restore
self._templateCount = marshal.load(inFile)
ValueError: bad marshal data (unknown type code)
File a.xml:
<aiml version="1.0.1" encoding="UTF=8">
<category>
<patern>HELLO THERE</pattern>
<template>
i am hitler!!!!!!!
</template>
<category>
</aiml>
File b.xml:
<aiml version="1.0.1" encoding="UTF=8">
<category>
<patterrn> I am *</pattern>
<template>
thats interesting that your dog name is<set name="dog"><star/></set>
</template>
</category>
<category>
<pattern> WHAT IS MY DOGS NAME </pattern>
<template>
your name is : <get name="dog"/>
</template>
</category>
</aiml>
File c.xml:
<aiml version="1.0.1" encoding="UTF=8">
<category>
<pattern>LETS DISCUSS MOVIES</pattern>
<template>yes<set name="topic">movies</set></template>
</category>
<category>
<pattern>LETS DISCUSS GAMES</pattern>
<template>yes<set name="topic">games</set></template>
</category>
<topic name ="MOVIES">
<category>
<pattern>SUGGEST</pattern>
<template> Batman</template>
</category>
</topic>
<topic name ="GAMES">
<category>
<pattern>SUGGEST</pattern>
<template> Pacman</template>
</category>
</topic>
</aiml>
File startup.aiml:
<aiml version="1.0.1" encoding="UTF=8">
<!--std-startup.xml -->
<!-- Category is an atomic AIML unit -->
<category>
<pattern> LOAD *</pattern>
<template>
<learn> <star>.xml</learn>
</template>
<category>
</aiml>
File test.py:
import aiml
import os
kernel=aiml.Kernel()
if os.path.isfile("bot_brain.brm"):
kernel.bootstrap(brainFile="bot_brain.brn")
else:
kernel.bootstrap(brainFile="startup.xml")
I=input(">>>>>")
while I!="exit()":
print(kernel.respond(I))
I=input(">>>>>")
kernel.saveBrain("bot_brain.brn")
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…