How to make my chatbot learn permanently?
<p>I am using <code>pyAIML v1.0</code> to create an offline chatbot in Python.</p>

<p>This type of response is pretty easy with AIML:</p>

<blockquote>
  <p>Human: Hi <br>
  Bot: Hi what is your name? <br>
  Human: My name is Dev <br>
  Bot: Nice to meet you Dev <br>
  Human: What is my name? <br>
  Bot: Your name is Dev <br></p>
</blockquote>

<p>Hence Bot can learn my learn but it has no storage that's why I have to tell
my name again when I restart the bot.</p>

<p>So my question is: <strong>Is there anyway to store the data learned during chat permanently?</strong></p>

<h3>Edit:</h3>

<p>Here's my code to main python script</p>

<pre><code>import aiml
import sys

kern = aiml.Kernel()

#It builds cache Ultimates!

brainLoaded = False
forceReload = False
while not brainLoaded:
    if forceReload or (len(sys.argv) &gt;= 2 and sys.argv[1] == "reload"):

        kern.bootstrap(learnFiles="Database.xml", commands="load aiml b")
        brainLoaded = True
        # Now that we've loaded the brain, save it to speed things up for
        # next time.
        kern.saveBrain("Ultima_Cache.brn")
    else:
        # Attempt to load the brain file.  If it fails, fall back on the Reload
        # method.
        try:
            # It is our cache file.
            kern.bootstrap(brainFile = "Ultima_Cache.brn")
            brainLoaded = True
        except:
            forceReload = True

# Enter the main input/output loop.
print "\nUltima v0.1"
while(True):
    print kern.respond(raw_input("&gt; "))
</code></pre>

<p>I think you should call <code>saveBrain</code> (<a href="https://github.com/creatorrr/pyAIML/blob/master/Kernel.py#L162" rel="nofollow">https://github.com/creatorrr/pyAIML/blob/master/Kernel.py#L162</a>) in a regular manner to store your progress. e.g.:</p>

<pre><code># Enter the main input/output loop.
print "\nUltima v0.1"
while(True):
    print kern.respond(raw_input("&gt; "))
    kern.saveBrain("Ultima_Cache.brn")
</code></pre>

python aiml