AIML Tutorial on AIML First Application

let us start creating first bot which will simply greet a user with hello user! when a user types hello alice.

create the project structure

as in aiml environment setup, we've extracted content of program-ab in c > ab with the following directory structure.

s.no. directory & description
1

c:/ab/bots

stores aiml bots

2

c:/ab/lib

stores java libraries

3

c:/ab/out

java class file directory

4

c:/ab/run.bat

batch file for running program ab

now, create a directory test inside c > ab > bots and create the following directories in it.

s.no. directory & description
1

c:/ab/bots/test/aiml

stores aiml files

2

c:/ab/bots/test/aimlif

stores aimlif files

3

c:/ab/bots/test/config

stores configuration files

4

c:/ab/bots/test/sets

stores aiml sets

5

c:/ab/bots/test/maps

stores aiml maps

create source files

create test.aiml inside c > ab > bots > test > aiml and test.aiml.csv inside c > ab > bots > test > aimlif directories.

test.aiml

<?xml version = "1.0" encoding = "utf-8"?>
<aiml version="1.0.1" encoding = "utf-8"?>
   <category>
      <pattern> hello alice </pattern>
      
      <template>
         hello user
      </template>
      
   </category>
</aiml>

test.aiml.csv

0,hello alice,*,*,hello user,test.aiml

execute the program

open the command prompt. go to c > ab > and type the following command −

java -cp lib/ab.jar main bot = test action = chat trace = false

verify the result

you'll see the following output −

working directory = c:\ab

program ab 0.0.4.2 beta -- ai foundation reference aiml 2.0 implementation
bot = test
action = chat
trace = false
trace mode = false
name = test path = c:\ab/bots/test

c:\ab
c:\ab/bots
c:\ab/bots/test
c:\ab/bots/test/aiml
c:\ab/bots/test/aimlif
c:\ab/bots/test/config
c:\ab/bots/test/logs
c:\ab/bots/test/sets
c:\ab/bots/test/maps

preprocessor: 0 norms 0 persons 0 person2
get properties: c:\ab/bots/test/config/properties.txt
addaimlsets: c:\ab/bots/test/sets does not exist.
addcategories: c:\ab/bots/test/aiml does not exist.
aiml modified tue apr 07 22:24:29 ist 2015 aimlif modified tue apr 07 22:26:53 i
st 2015
no deleted.aiml.csv file found
no deleted.aiml.csv file found
loading aiml files from c:\ab/bots/test/aimlif

reading learnf file
loaded 1 categories in 0.009 sec
--> bot test 1 completed 0 deleted 0 unfinished
(1[6])--hello-->(1[5])--alice-->(1[4])--<that>-->(1[3])--*-->(1[2])--<topic>-->(
1[1])--*-->(0[null,null]) hello user...
7 nodes 6 singletons 1 leaves 0 shortcuts 0 n-ary 6 branches 0.85714287 average
branching
human:

type hello alice and see the result and then type anything else to see the changed result.

human: hello alice
robot: hello user
human: bye
robot: i have no answer for that.
human: