The AutoChatEnginePreview script is a demo gui. Its fairly simple, click "Say" or press return after entering a statement. Press shift+enter if you want to add a linefeed to your statement (for w/e reason.) Run AutoChatEnginePreview to see the bot in action. Edit the brain.brain file to get a feel for how things work. Remember to update AceSymbols or AceFunctions if you add custom %symbol or &function icons (and let me know what you come up with!)
The <ace> tags encapsulate the entirety of a brain. A brain knows two basic pieces of information: <unkown> which is it's default response to a query, and <name> which I'm betting you can guess.
The <cog> tag encapsulates a cognitive unit. A cognitive unit can be a command, a part of a sentence, or an abstract concept. A cog consists of a <pattern> element and a <response> element. A pattern element can contain wildcards, and matches anything at the end of any statement (unless it has a wildcard at the beginning.)
The <response> elements have various formats. Some have plain text, others have symbols in them. There are 3 symbols that can go into a response, called Icons.
The @ icon simply indicates that the response for a different pattern should be used, similar to the <srai> tag in AIML. A response of @(hello) means that the response for the pattern hello will be used. This allows you to revert all similar cogs to a default response, if desired.
The % is a "symbol" icon representing a variable. %botname is one of the basic symbols, representing the name of the bot.
The & is a function icon, denoting an arbitrary function to be executed. This is the direct interface to AutoIt functions, where you can parse the conversation, log events, and do higher order processing on the chat as it develops.
Brains are very simple to put together. Symbols (variables) are defined in AceSymbols.au3, and can be used anywhere in a <response>. Functions are defined in AceFunctions.au3, and should follow the format of the example.
Infinite recursion is possible. If you're playing with @Link icons, be sure you don't link to anything in a previous chain, unless you're very sure what you're doing, as it can get stuck in an unending loop.
The idea behind the system is simple, and as I add more symbols and functions, cogs will become more expressive and powerful. The engine is a single layer processing model right now.
Single Layer model
Use preprocessing regexes to parse out iconics
execute functions and parse substitutions (if any)
return response (linked @response if necessary)
await further input
This model is identical to most chatbots out there, even if specific algorithms differ. The problem has never been one of the algorithm, at least at this level, though. Any bot you chat with quickly demonstrates it's inability to grasp obvious topics in a conversation, or some other shallow response. With built in recursion, and careful use of other AI tools, a conversational agent should be possible.
For example, the ACE_Respond function can be modified using symbols to branch across a decision tree defined in a brain, without altering the engine. I want to convert chat logs of real people into <cog> models that not only encompass the initial input and response, but the contextual and semantic data relevant to a conversation as well. I want to implement a dual layer goal seeking system that falls back on the single layer system, but I need to create a rich set of symbols and functions first.
Even without that, however, this should be at least as powerful as any Eliza, Hal, or Alice bot out there, backed up by easy and direct integration with AutoIt scripting. I'll be converting the standard Annotated Alice AIML sets and uploading as I go. If you have any comments, insights, or brains, please contribute!
Thanks to Theguy000, whose AIML chatbot was the basis for this system. The _ACE functions are bastardized _XML functions created by others.
Bugs/undocumented features list: First match instead of best match algorithm currently selecting the first pattern that matches input. This is fine, except you lose specificity if you place patterns with wildcards before patterns that are more complete. I might just leave it be, since it's immaterial to any sort of processing.
Edited by JRowe, 02 May 2010 - 10:49 AM.