ALICE is the original chatbot created with AIML. The distribution of pyAIML, in which this kernel is based, contains the free version of Alice. It can be learned by using the appropriate magic:
In [1]:
%learn alice
Once learned, we can start to talk with the bot
In [2]:
Hi
In [3]:
How are you?
In [4]:
I'm ok
In [5]:
Do you like reading?
In [6]:
I don't know
Note that we can write more than one sentence. Alice will process both sentences and produce each output in sequence
In [7]:
What's the meaning of life? Do you like music?
In [8]:
What's your name?
In [9]:
%setp bot name Alice
In [10]:
What's your name?
In [11]:
# Let's define a few more bot predicates, from among the ones used in Alice categories
%setp bot master Richard Wallace
%setp bot master Botmaster
%setp bot favoritebook Tale of Two Cities
%setp bot favoritemovie Blade Runner
%setp bot location Moonbase Alpha
# Other bot predicates used in ALICE DB:
# emotions celebrity friend friends size gender age
# kingdom order family genus species
We can inspect the currently defined bot predicates and we will see that they have been defined
In [12]:
%show bot
In [13]:
What's your favorite book?
In [14]:
Not yet
In [15]:
What's your favorite movie?
In [16]:
No
In [17]:
What did you like most?
To inspect the bot state there are a few magics available. We have already seen %show bot
, which shows the defined bot predicates. Another one is %show session
, which shows the session predicates.
In [18]:
%show session
And the %bot size
magic shows the number of defined categories
In [19]:
%show size
In [20]:
%save alice-predicates nobrain nosub rawfiles
This file can be loaded later on with %load
. There are additional options to make it save the full brain state (all defined categories, in compiled form) and substitution strings. See 03-chatbot-inline for additional examples.