--- Program M - AIML interpreter, A.L.I.C.E. Chat Robot --- (c) 2002 Dr. Richard S. Wallace - drwallace@alicebot.org --- ALICE A.I. Foundation, Inc. - Www.AliceBot.Org --- Free software distributed under the terms of --- the GNU General Public Lincense as published by the --- Free Software Foundation, Inc. --- var VersionString := 'Program M (AIML in SETL) version version 0.5 03/04/2002'; --- M = Graphmaster + Substitutions + Matching + AIML Parser + Autochat + --- Loebner Interface + Targeting ---- Usage: ---- setl M.setl : default mode (Loebner) ---- setl M.setl -x test : run test function. ---- setl M.setl -x build : build the Graphmaster graph from AIMLFiles. ---- setl M.setl -x update : update the Graphmaster graph from DATADIR/new.aiml ---- setl M.setl -x update F : update the Graphmaster graph from file F ---- setl M.setl -x loebner : Console Loebner Contest-style interface. ---- setl M.setl -x autochat : Robot chats to itself and creates targets. ---- setl M.setl -x autochat N : AutoChat for N iterations ---- setl M.setl -x Any other text statement or query. : Produces a ---- "one-shot" response to a single sentence input. Make sure the ---- query is not one of: test, build update, loebner, or autochat! --- Not fully implemented yet: --- , --- (partial implementation), . --- Macro: #define flatten(path, m, n) +/[x+' ' : x in path(m..n)] --- Global variables: var ROOT := 'graph'; -- ROOT of the Graphmaster graph as a folder. var DATADIR := 'data'; --- location of output data file directory. var CLIENTDIR := 'data/clients'; --- location client information. var CONFIGDIR := 'config'; --- location of configuation files (must exist). ---- The following files must exist: var aimlfiles := unstr getfile(CONFIGDIR+'/files.txt'); -- AIML source Files var delims := unstr getfile(CONFIGDIR+'/delims.txt'); -- Delimeters, Abbre- var abbrevs := unstr getfile(CONFIGDIR+'/abbrevs.txt'); -- viations var pronouns := unstr getfile(CONFIGDIR+'/pronouns.txt'); -- Pronouns var defaults := unstr getfile(CONFIGDIR+'/defaults.txt'); -- Predicate Defaults var normsubs := unstr getfile(CONFIGDIR+'/normsubs.txt'); -- Normalization substs. var macrosubs := unstr getfile(CONFIGDIR+'/macrosubs.txt'); -- Macro tag substs. var formalsubs := unstr getfile(CONFIGDIR+'/formalsubs.txt'); -- substs. var personsubs := unstr getfile(CONFIGDIR+'/personsubs.txt'); -- substs. var person2subs := unstr getfile(CONFIGDIR+'/person2subs.txt');-- substs. var prompt := '% '; --- Initial Prompt for Loebner interface ---- Magic numbers: var DialogDepth := 4; --- Depth of memory for and var TargetLimit := 25; --- Maximum number of suggested categories generated. var DeepestDepth := 64; -- Limit of AIML Template parser recursion depth. var AutoChatIterations := 1000; --- Number of iterations to run Auto Chat. var NCategories := 45000; --- Estimated number of categories. var NVocabulary := 8000; --- Estimated vocabulary size var RAM := '100K'; --- Estimated vocabulary size --- This group of definitions is ASCII-centric: var numerals := "0123456789"; -- Arabic Numerals var uppercase := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -- Capital Letters var lowercase := "abcdefghijklmnopqrstuvwxyz"; -- small letters var alphanumerics := uppercase+lowercase+numerals; -- All of the above. var doublequote := '"'; -- Insidious double-quote character var singlequote := "'"; -- Insidious single-quote character var quotemarks := doublequote+singlequote; -- Insidious duo. var escapechars := "\n\\ "; -- Peksy escape charachters. var glyphs := '.?!@#$%^&*[]{}()_-~`:;,/+=|'; -- Cave Man Drawings. --- templatechars is the set of all text chars allowed outside tags --- in the AIML '); p := split(c, ''); if #p=2 then [pattern, template] := p; break(template, '<'); match(template, ''); q := split(template, ''); if #q=2 then [that, template] := q; end if; break(template, '<'); match(template, '