The AIML Chatbot kernel wraps the pyAIML Python library to create a conversational bot within a notebook. The bot behaviour is defined by loading AIML categories. A "category" in AIML is akin to a rule, and defines a pattern-template pair
Input cells are messages for the bot, which get interpreted and the bot output is the result of the cell execution. Additionally, a few magics for both control (cells starting with apercent sign) are available; these are not passed to the bot as user messages, but executed to change the bot behaviour in some way.
In [1]:
Hello
In [2]:
%help
And the %lsmagics
command lists all available magics with their meaning
In [3]:
%lsmagics
The most important of these magics is %learn
, which loads an AIML database into the bot.
There are three versions for that:
%learn alice
or %learn standard
. AIML categories defined in the DB will be automatically loaded.%learn <directory>
where directory is a directory containing a set of AIML files to learn, plus an startup.xml
file referencing them. A load <name>
command is needed afterwards to load the learned rules into the bot%learn <file.xml>
or %learn <file.aiml>
See 02-chatbot-alice.ipynb for an example of the first type.
An additional way of creating rules is by writing them directly in notebook cells, using the %aiml
magic. Such rules are immediately added to the bot when the cell is executed. You can: