addtostar (line
501)
Deals with creating and adding to the star arrays
If a * or _ is part of the matched pattern, what is covered by that variable is then stored in the 'star arrays'. This function creates and adds words to that array or array element.
void
addtostar
(string $parton, string $word, array &$inputstarvals, array &$thatstarvals, array &$topicstarvals, integer $action)
-
string
$parton: Can be input, that, topic.
-
string
$word: The word that needs to be stored
-
array
&$inputstarvals: contents of the *'s when they are part of the matching pattern input string
-
array
&$thatstarvals: contents of the *'s when they are part of the matching pattern that string
-
array
&$topicstarvals: contents of the *'s when they are part of the matching pattern topic string
-
integer
$action: what action needs to be done, append to existing or create new.
arraytostring (line
673)
Turn an array into a string
take each element of the array and put all of them into one big string; one after the other.
string
arraytostring
(mixed $myarray, array $myarray
)
checkcache (line
607)
Check to see if exact input-that-topic exists in cache
GmCache is a log that contains all unique entries. If the exact same input-that-topic is requested that is found in GmCache, then it's template reference is used instead of traversing the binary AIML tree. Saving response time.
boolean
checkcache
(string $combined, mixed &$template, array &$inputstarvals, array &$thatstarvals, array &$topicstarvals, array &$patternmatched, array &$inputmatched)
-
string
$combined: the complete input in <input>word word<that>word word<topic>word word format.
-
array
&$inputstarvals: contents of the *'s when they are part of the matching pattern input string
-
array
&$thatstarvals: contents of the *'s when they are part of the matching pattern that string
-
array
&$topicstarvals: contents of the *'s when they are part of the matching pattern topic string
-
array
&$patternmatched: all the patterns that match input, i.e. multiple sentences are kept seperate.
-
array
&$inputmatched: all the matched input.
debugger (line
52)
The debugger function
When uncommented, it will print the messages several functions will call.
void
debugger
(string $msg, integer $val)
-
string
$msg: The message to be printed in debugger mode
-
integer
$val: no idea what this does, it's used in every function call but not in the function itself
dographquery (line
392)
Does a database query for graphwalker()
Retrieves the ID, ordera, isend of the word to be searched $query="select id,ordera,isend from patterns where word='" . addslashes($word) . "' or word is null and parent=$parent";
array
dographquery
(array &$whichresult, mixed $word, mixed $parent, string $query)
-
string
$query: The SQL code to be executed
-
array
&$whichresult: contains ID, ordera and isend from the query. note: call-by-reference
fastforward (line
556)
Fast forward to the processing of the next context
Remainder of the user's input covered by a *. So so add everything up to the next context (<that> & <topic>) to the star.
string
fastforward
(string $word, string $ffremains)
-
string
$word: Current processed word
-
string
$ffremains: Words that remain to be processed.
fillcache (line
651)
Add an entry in the GMcache table
void
fillcache
(string $combined, string $mytemplate, string $inputstarvals, string $thatstarvals, string $topicstarvals, string $patternmatched, string $inputmatched)
-
string
$combined: the complete input in <input>word word<that>word word<topic>word word format.
-
string
$mytemplate: the reply to the input
-
string
$inputstarvals: contents of the input star
-
string
$thatstarvals: contents of the that star
-
string
$topicstarvals: contents of the topic star
-
string
$patternmatched: the AIML category pattern that matches the input
-
string
$inputmatched: the input that matched the category.
findtemplate (line
467)
Retrieve the template from the templates table
Get the template from the templates table. and return it.
string
findtemplate
(integer $id)
-
integer
$id: The ID of the template to be returned
gettemplate (line
83)
Get the template for the input, that, and topic
Get the template for a paticular pattern and dialogue situation. If the pattern, including topic and that, was found in the cache, the mathcing routine is circumvented and that template used. This saves time.
string
gettemplate
(string $input, string $that, string $topic, array &$inputstarvals, array &$thatstarvals, array &$topicstarvals, array &$patternmatched, array &$inputmatched)
-
string
$input: The user's input
-
string
$that: The bot's previous output
-
string
$topic: The contents of the AIML tag <topic>
-
array
&$inputstarvals: contains the contents of the *'s when they are part of the matching pattern input string
-
array
&$thatstarvals: contains the contents of the *'s when they are part of the matching pattern that string
-
array
&$topicstarvals: contains the contents of the *'s when they are part of the matching pattern topic string
-
array
&$patternmatched: contains all patterns that were found. An input can have more than one sentence which are processed seperately.
-
array
&$inputmatched: contains all the individual sentences of a user's input.
graphwalker (line
152)
The graphwalker function finds the pattern that matches the combined input of input, that, and topic.
Then it returns the template that matches. It is recursive.
integer
graphwalker
(string $input, string $parent, string $timesthrough, boolean $onwild, string $parton, array &$inputstarvals, array &$thatstarvals, array &$topicstarvals, array &$patternmatched)
-
string
$input: The user's input
-
string
$parent: The word's parent ID
-
string
$timesthrough: Number of recursions????
-
boolean
$onwild: whether or not a wildcard is processed (Anne: I think)
-
string
$parton: Can be input, that, topic.
-
array
&$inputstarvals: contents of the *'s when they are part of the matching pattern input string
-
array
&$thatstarvals: contents of the *'s when they are part of the matching pattern that string
-
array
&$topicstarvals: contents of the *'s when they are part of the matching pattern topic string
-
array
&$patternmatched: contains all patterns that were found. A user's input can have more than one sentence.