Nascent Artificial Intelligence (NAI)
for Alf 1.1


This only applies to Alf as Alfredo uses AIML. In fact, all NAI does is emulate 5 AIML operators, the same 5 that in my opninion come most in handy when trying to make a bot's responses sound life-like.

The NAI goes in 2 arrays which are located in alf_brains.txt: "questionArray" and "answerArray".

1. Exact pattern match (AIML <pattern>)

Example: ...&questionArray=how are you|do you like cats&answerArray=I wish life were more fair.|The only good cat is a stir-fried cat.&...

The elements of each array are separated by "|" and the nth element of the questionArray corresponds to the nthelement of the answerArray. In this example, when you ask the bot "How are you?", it will respond: "I wish life were more fair". If you ask "Do you like cats?", the answer will be: "The only good cat is a stir-fried cat."

Note: questionArray elements are case-insensitive.

2. Wildcard for inclusion (AIML _ input *)

Example: ...&questionArray=how are you|*do you like cats&answerArray=I wish life were more fair.|The only good cat is a stir-fried cat.&...

The wildcard * goes before the string that has to be part of the input in order to trigger the output specified in the answerArray. In this example, asking the bot "Do you like cats?" and "How do you like cats?" will both result in the answer: "The only good cat is a stir-fried cat."

3. Absolute wildcard (AIML *)

Example:
...&questionArray=how are you|*do you like cats|*&answerArray=I wish life were more fair.|The only good cat is a stir-fried cat.|Are you talking to me?&...

In this example, if the input doesn't match the first 2 elements of the questionArray, the bot will match it with the absolute wildcard * of the third and the response will be: "Are you talking to me?"

4. Random output options (AIML <li>)

Example: ...&questionArray=how are you|*do you like cats|*&answerArray=[I wish life were more fair.#I'm not bad]|The only good cat is a stir-fried cat.|Are you talking to me?&...

Random output options in the answerArray are surrounded by square brackets and separated by "#". In this example, if you ask the bot "How are you?", half of the time it will answer "I wish life were more fair." and half of the time it will answer "I'm not bad." You can include as many random output options as you like.

5. Remembers previous answer (AIML <that>)

Example: ...&questionArray=how are you|*do you like cats|yes<that>Are you talking to me?|*&answerArray=[I wish life were more fair.#I'm not bad]|The only good cat is a stir-fried cat.|I was afraid you were.|Are you talking to me?&...

In the questionArray the input to be matched is separated from the previous bot response (to which it might be the reply) by "<that>". In this example, if you answer "Yes" to the bot's previous question "Are you talking to me?", it will respond: "I was afraid you were."


IMPORTANT NOTE: Remember to surround both questionArray and answerArray with &-signs. Clear cache before viewing changes in browser.

© 2005 The Bot Factory

For support, character templates and tools, visit www.thebotfactory.com