Book Image

Learning Robotics Using Python

Book Image

Learning Robotics Using Python

Overview of this book

Table of Contents (19 chapters)
Learning Robotics Using Python
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working with A.L.I.C.E. AIML files


The AIML files of A.L.I.C.E. chatter are freely available at https://code.google.com/p/aiml-en-us-foundation-alice/.

Extract the AIML files to a folder on the desktop or in the home directory and copy startup.xml to these AIML files. This startup.xml file will load all the other AIML files into memory. The following code is an example of a typical startup.xml file:

<aiml version="1.0">
<category>
  <pattern>LOAD AIML B</pattern>
  <template>
          <!-- Load standard AIML set -->
          <learn>*.aiml</learn>

  </template>
</category>
</aiml>

The preceding XML file will learn all the AIML files when we call the LOAD AIML B pattern.

Loading AIML files into memory

The following code will load all the AIML files into memory:

#!/usr/bin/env python

import aiml
import sys
import os

#Change the current path to your aiml files path
os.chdir('/home/lentin/Desktop/aiml-files')
mybot = aiml.Kernel...