###### ###### ##
# ## # ##
## ##
## ##
## #### ######
## #####
## ## ##
## ##
## ## ## ##
## ##
## ## ## ## ##
#### ######
#### ###
Installation
Guide
Version 1.00
By P.E.Colla (LU7DID) (c)
2000,2001
-------------------------------------------------------------------------------
DISCLAIMER
AIML is
(c) the AI Foundation 2000
All
experimental tags implemented by TBot doesn't have support from the
AI
Foundation nor there is any guarantee it would ever be supported, use
them at
your own risk.
-------------------------------------------------------------------------------
Main Bot Configuration File (bot.ini)
TBot is
a collection of objects implementing an alicebot, AIML compliant bot.
The
main purpose of the implementation is to support research activities,
as
such, it's not intended to be used under heavy load or where reliability
of
operation is a prime concern.
The
implementation has been made using Delphi 5.0 Enterprise Edition.
The bot
itself is a collection of Delphi Objects which implements the
different
components.
An
actual implementation of a bot requires a "host" program that
instantiates
those objects and manages the interface; two sample programs
are
included in this distribution.
TBot
- A simple, single-user, console oriented bot.
BotServ - A multiuser, HTTP/Telnet server
bot.
Also
some miscellaneous utilities are included in the distribution.
The bot
objects uses extensively freeware Delphi objects, the packages
are
included in the distribution at source level.
* Download the latest distribution of the bot
(TBOTVxxxx.EXE).
* Download the latest patch of the bot
(TBOTPxxxx.ZIP).
* Download the latest AIML standard set from
www.alicebot.org
* Execute the distribution (automated setup).
* UnZip the TBOTPxxxx.ZIP file on the
directory the bot had been installed,
use the override (-o) option.
The
distribution comes with a series of executable that implements
* Install the AIML standard set (std-*.aiml
files only) into the AIML path.
* Configure the file startup.aiml to include
the AIML files required
(do not remove sys-*.aiml files or the bot
might lack critical
initialization steps).
* Configure the bot.ini file located in the
main directory where the
bot had been installed.
* Optionally, configure the bot properties
thru the editing of the
sys-botproperties.aiml located in the
.\aiml directory.
* Run TBot.EXE to verify the configuration.
* Run BotServ.EXE and verify it could be
accessed thru both a Web Browser
and a Telnet Client.
The
main configuration of the bot is performed thru the bot.ini file.
It's a
standard windows INI file that must be in the "default" directory
of the
bot; which is the current directory from where the bot is executed.
All
relative paths used in the configuration refers to the directory the
bot.ini
file is located.
The
content of the file is as follows:
[session] <- Session
Configuration (BOTSERV)
porthttp=2001 <- HTTP Port to
listen
porttelnet=23 <- Telnet Port to
listen
htmlpath=.\html\ <- HTML Root directory
timeout=20 <- Session
TimeOut
<-
[bot.properties] <- Bot Properties
name=Lola <- Could be
accessed using
qthloc=gf05te <- <bot name="xxxx"/>
birthday=20
Jun 2001 <-
location=Adrogue <- Bot properties
could be freely
master=Pedro <- defined,
definition here will
birthplace=Adrogue <- override definitions
performed
boyfriend=free <- thru AIML using
the <property>
favoriteband=U2 <- tag
favoritebook=A
brief history of Time <-
favoritecolor=cobalt
blue <-
favoritefood=gnocci <-
favoritemovie=Star
War <-
favoritesong=Let
it be <-
forfun=radio <-
friends=alice <-
girlfriend= <-
kind_music=rock <-
look_like=cute <-
question=Do
you like cakes? <-
sign=gemini <-
talk_about=cheat
chat <-
wear=informal <-
gender=female <-
kindmusic=Rock <-
engine=megahal <-megahal/mkdict if
enabled
<-
[aiml] <-AIML
Engine Configuration
trace=1 <-Logging
Trace level [0..5]
#xsl=.\aiml\startup.xsl <-Optional XSL Sheets
log=.\logs\ <-Log Location
aiml=.\aiml\ <-AIML files
location
root=root.xml <-Top Most File
Loaded
maxllc=50 <-Maximum
Recursion Level
enforce=false <-Enforce strict
AIML
logfile=tbot.log <-Logfile name
sessionid=715 <-Session Id (do not alter)
importext=aiml <-Default AIML file
extensions
mkdict=FALSE <-Activate mkdict
as the 2nd brain
megahal=TRUE <-Activate megahal
as the 2nd brain
<-
<-
[mkdict] <-MkDict (2nd
Brain) Configuration
PATH=.\dict\ <-Path where files
are located
TRAIN=mkdict.trn <-Trainning Set
SWAP=mkdict.swp <-Person
Transformations
REMOVE=mkdict.ban <-Keys to be removed
KEYS=mkdict.aux <-Auxiliary Keys
LEARNLOG=mkdict.out <-Logging
MARGIN=100 <-Threshold for
pattern resolution
<-
[megahal] <-MegaHal (2nd
Brain) Configuration
PATH=.\dict\ <-Path where files
are located
BRAIN=megahal.brn <-Brain file
TRAIN=megahal.trn <-Train File
AUX=megahal.aux <-Auxiliary Keys
GRT=megahal.grt <-Person
Transformation
BAN=megahal.ban <-Banned Keys
SWAP=megahal.swp <-Person Shift
<-
[AIML.TAG] <-Parse but
ignore
applet=true <-
<-
[AIML.EMPTY] <-Parse but ignore
applet=true <-
TBot
relies on AIML to perform configuration processes, a set of
files
named sys-*.aiml are included in the distribution.
This
configuration process implies:
* Implementation of AIML 0.9 and
non-primitive AIML 1.0 tags
thru custom tags and macros.
sys-aiml09.aiml
sys-aiml09-deprecated.aiml
sys-aiml10.aiml
sys-aiml10-nonkosher.aiml
sys-aimltransition.aiml
* Definition of Bot properties
(sys-botproperties.aiml), this
will be overrided by definitions made at
the bot.ini file.
* Definition of system macros
(sys-macros.aiml).
* Handler for system global events
(sys-aimlevents.aiml); system
events are special events generated by
the bot engine while
processing requests. Main events to
consider:
ONRESET - Every time a GraphMaster completes the load.
ONSESSION- Every time a session is
initiated.
ONSTART - Every new input (Normalization is performed here).
ONEND - A response is ready (Normalization is performed here).
ONLLC - Triggered when the recursion level exceeds LLC.
ONVAR - Triggered every time a variable changes value.
The
order of the sys-*.aiml file is critical since it ensures the proper
sequences
of initialization.
To run the bot just execute at a DOS prompt for the console bot
TBot {–x} {–v n} {-t}
-x Support for <timer></timer>
activated.
-v If system is voice enabled text to speech
with voice n
-t Activate trace on console
To run the bot just execute at the DOS prompt
BotServ
After loading the HTTP and Telnet Server could be separately made
active and the port where they will listec
could be changed.
TBot
includes a XSL processor which become activated by the configuration
of the
[AIML].XSL entry on the bot.ini file.
When
active all the transformations indicated in the supplied file are
exercised
every time an AIML file is loaded (with <learn></learn).
The
supplied file startup.xsl is actually a bootstrap for the actual
xsl
files to be applied; it's recommended that transformations are actually
made on
separate files and included in the bootstrap rather than edited
directly
on it.
XSL
allows the replacement of all the custom tags defined in a XML consistent
way, a
set to implement all custom tags and macros is supplied; when loaded
the
relevant sys-*.aiml files must be removed from the startup.aiml file.
The XSL
implementation relies on the usage of MSXSL Version 3.0 or higher,
so
Internet Explorer 5.0 or higher must be installed for it to work.
The
HTML templates used by the HTTP program (BOTSERV) could be customized
to
carry a different content than the default.
To
build content the bot relies to the .\html\default.htm file, the
content
is assumed static. Variable replacement is made when the page is
dynamically
built.
Allowed
variables are:
<#BOT_{property}> Bot Properties
<#GET_{varname}> Variable name
<#CLIENTSAIDx> Previous entries from client (1-->N)
<#BOTSAIDx> Previous responses from the bot
(1-->N)
<#INPUT> Current input from client
<#RESPONSE> Current response from the bot
<#SESSION> Session ID number
<#VERSION>
Bot Version
<#DATE> Page creation date
<#TIME> Page creation time
<#COUNT> Number of concurrent sessions
TBot is
able to execute JavaScript scriptlets (<javascript></javascript>
tag)
thru
the interface with the MS JScript.EXE Script Hosting facility of
Windows.
In
order for this feature to properly work all scriptlets used in the
AIML
files must be represented as CDATA, otherwise the XML normalization
process
might damage them.
When
the scriptlet is loaded a custom header is attached to it in order
to make
variables and properties available to it. Also, a method to
produce
output to the bot is also provided.
The
actual header supplied is:
//*==========================================================================
//* Standard
TBot-JavaScript Interface Header
//*==========================================================================
//*--------------------------------------------------------------------------
//* Environment dependant "write" method -- Send to
StdOut
//*--------------------------------------------------------------------------
function strwrite(sResponse) {
WScript.Echo(sResponse);
}
//*--------------------------------------------------------------------------
//* aimlbot object, initialize properties of the bot
//*--------------------------------------------------------------------------
function botproperty() {
this.{property} = 'value';
.....
}
//*--------------------------------------------------------------------------
//* aimlbot object, initialize with properties at run time
//*--------------------------------------------------------------------------
function aimlbot() {
//*--------------------------(( Index Variables
))---------------------------
this.{index} = new Array();
.....
//*--------------------------(( Index Content
))-----------------------------
this.{index}[n] = 'value';
//*--------------------------(( Bot Properties ))---------------------------
this.bot = new
botproperty();
//*--------------------------(( AIML Variables ))---------------------------
this.{variable} = "value";
}
//*--------------------------------------------------------------------------
//* Define instance of the object and associate std methods
//*--------------------------------------------------------------------------
//*--- Establish standard object for the AIML bot
var alicebot = new aimlbot();
//*--- Define standard bot methods
aimlbot.prototype.write = strwrite;
//*====>> Script within <JavaScript></JavaScript> starts
here <<=============
This header will ensure the scriptlet by
default will have a rudimentary
document model to access the bot
properties, variables and indexes and
also a method to provide content back.
An example of a JavaScript scriptlet would
be
<template>
Today is <javascript>
<![CDATA[
var t = new Date();
var m = t.getMonth();
var d = t.getDate();
var dow = t.getDay();
var y = t.getFullYear();
switch (dow) {
case 0:
dow = "Sunday";
break;
case 1:
dow = "Monday";
break;
case 2:
dow = "Tuesday";
break;
case 3:
dow = "Wednesday";
break;
case 4:
dow = "Thursday";
break;
case 5:
dow = "Friday";
break;
case 6:
dow = "Saturday";
break;
}
switch (m) {
case 0:
m = "January";
break;
case 1:
m = "February";
break;
case 2:
m = "March";
break;
case 3:
m = "April";
break;
case 4:
m = "May";
break;
case 5:
m = "June";
break;
case 6:
m = "July";
break;
case 7:
m = "August";
break;
case 8:
m = "September";
break;
case 9:
m = "October";
break;
case 10:
m = "November";
break;
case 11:
m = "December";
break;
}
alicebot.write(dow+" "+m+"
"+d+","+y+" according to "+alicebot.bot.name);
]]>
</javascript>
</template>
TBot
could execute external programs in response to <system></system>
tags.
In
order for this feature to properly work all scriptlets used in the
AIML
files must be represented as CDATA, otherwise the XML normalization
process
might damage them.
Essentially
any command that could be executed on the Windows DOS command
processor
could also be executed on this tag.
An
example of a system shell out would be
<category>
<pattern>testsystem</pattern>
<template>
<system>
<![CDATA[
dir *.aim
]]>
</system>
</template>
</category>