Reputation: 11
using Python 3.8.10 on Linux Mint
I have stripped my aiml down to a minimal version to test with but the loadBrain
method does not sucessfully load the brain saved.
here is the aiml code, as 'q.aiml'
<?xml version="1.0" encoding="UTF-8"?>
<aiml>
<category>
<pattern>*</pattern>
<template>test successful</template>
</category>
</aiml>
and here is the python, hugely simple
from pyaiml21 import Kernel
k=Kernel()
# k.loadBrain('q.brn')
k.learn('q.aiml')
while True:
a=input('>')
if a == 'quit':
break
else:
print (k.respond(a,'luke'))
k.saveBrain('q.brn')
you can see that I run it using the learn
method the first time. Then on the next run I comment that out and uncomment the loadBrain
line. No joy.
I just get
>test
unknown
as output, when I am expecting 'test successful' obviously. Note that the saveBrain
method does save a non-empty file. Can I assume it is loadBrain
that is broken??
Upvotes: 1
Views: 89
Reputation: 173
The prolog <?xml version="1.0" encoding="UTF-8"?>
is unnecessary and is the culprit of your question. Just delete it and try again.
Upvotes: 0