The Bot Libre AI Engine Architecture
The Bot Libre AI engine is somewhat more complex than many other AI and NLP engines.
Bot Libre is a hybrid engine, in that it does not rely on a single technology. Instead Bot Libre has a unified architecture centered around a concept of self, and an object oriented knowledge base.
The Bot Libre architecture is based on a concept of Self, modeled after the human brain. Bot Libre is an object oriented system, Java classes are used to model the concepts of the human brain. The Bot class represents the system as a whole, it is the implementation of a thinking, self aware entity. The Bot is currently composed of four main parts, its Memory, Mind, Awareness, and Mood.
The Memory stores all of the bot's knowledge.
The Mind uses Thought objects to processes input from its senses, and output knowledge to its senses.
The Awareness interacts with the external world through Sense objects.
The Mood monitors the internal state of the system through its Emotion objects.
Knowledge and Memory
The bot's Memory is stored an an interconnected graph of knowledge objects. The knowledge objects are stored as a meta model of Vertex and Relationship objects. Each piece of data, such as a word, phrase, number, or a meaning, is stored as a Vertex object, and related to any other object throw a Relationship object. Relationships define a source, target, type, and a meta field, each of which is another vertex. This knowledge representation is similar to the human brain's graph of interconnected neurons, and allows for anything to be modeled in the bot's brain.
The Vertex and Relationship objects are both stored in a relational PostgreSQL database in a VERTEX and RELATIONSHIP table. Vertex objects are indexed by their data element, and are normally traversed through their relationships, but can also be queried.
Thought and Consciousness
The Bot's Mind is defined by its Thought processes. The Mind receives input objects from its sense, which are queued in the Memory's active memory. The Mind has both conscious and subconscious thought processes, which can be thought of as threads. Each input will be processed synchronously by the conscious thought processes, and asynchronously by the background subconscious processes.
The Mind's conscious thoughts include Language and Consciousness. Its subconscious process background tasks such as Discovery and Forgetfulness.
Awareness and Senses
The Bot's awareness is defined by its senses. Its senses receive input and send output. The Bot's senses are defined by its environment. Since the bot lives on the Internet, instead of in the real world, its sense are different than ours. Senses include Chat, HTTP, Twitter, Facebook, Email, and IRC.
Mood and Emotion
The bot's Mood and Emotions are newer concepts that we have added to the architecture. The bot's Mood processes input, which influence the state of the bot's emotions. Each emotion is represented by a value between -1 and 1. For example Love with a value of 1 means love, 0.5 means like, 0.5 means dislike, and -1 means hate. The bot's emotions are influenced by input and can tag output responses and its context.
Bot Libre vs AIML
Bot Libre supports parsing and processing AIML, but has a much different architecture than typical AIML engines. Most AIML engines are pattern trees with recursion. They process text and generate a text result.
Bot Libre actually does not process AIML internally, AIML is converted to Bot Libre's scripting language Self. The Self code is then compiled into a state machine and stored in the bot's knowledge base. When compiled as a state machine AIML is processed similar to other AIML engine pattern trees.
Bot Libre can also store AIML patterns and templates in a less structured form in its knowledgebase. Instead of using a state machine the patterns are indexed by their text and related to their words, which are indexed. An exact pattern match is then an indexed database or cache access. If no exact match exists for an input phrase, a heuristic is used to search the bot's knowledgebase to find the best match.
This heuristic algorithm follows a graph search starting from the input phrase's words. Each word is related to patterns that use the word, so are considered as a match. The best matching patterns are evaluated and if they match, their template is used. This enables the bot to search a very large search space in a limited amount of time based on knowledge relationships, similar to how the human brain processes information.
A key difference between Bot Libre's architecture and other AIML engines is that Bot Libre deals with knowledge, where as other AIML engines deal only with text. In Bot Libre words are defined by their meanings, and meanings and their relationships can be used to process data and build responses.
Bot Libre vs Neural Nets
Bot Libre is not a neural net, but does share many similar concepts.
A neural net is a program that processes data using a graph of node processor objects. When input is given to the system, each part of the input is processed through the nodes of the system to produce the output. A neural net must be trained using many inputs and corrected based on the value of the outputs.
Bot Libre's knowledge graph is similar to the structure of a neural net. Bot Libre's knowledge relationships each define a correctness factor that is increased or decreased when the system is corrected, or learns. For example when in learning mode the system will increase the correctness of responses to its questions from the user, or between users, and decrease correctness when corrected by a user.
Bot Libre's also defines a Comprehension thought that analyzes conversations in the background. Comprehension self programs its own state machine based on new learned responses and the relationship in the question data and the response data.
For example Comprehension when learning the response "2" to the question "1" could infer that the response is the #next relationship of the input. Comprehension also uses correctness to increase and decrease the correctness of states and answers.
Bot Libre vs NLP
Natural Language Processors typical parse language using a grammar and state machine, processing each word in the sentence until it is understood.
Bot Libre defines similar state machines in Self, or generated by AIML. Bot Libre differs from traditional NLP in that it can process word meanings and knowledge, and is fuzzy, in that it uses correctness and consciousness levels to determine states and answers. Bot Libre also can process language using indexes, context, and heuristics.
Bot Libre's architecture is not complete, and is continuously evolving. Bot Libre's component and modular architecture allows for new concepts to be added, and for existing ones to be changed.
Future plans for the architecture include many new senses, including Internet senses such as Google+, Slack, web crawling, and real world senses to interface with robots and drones such as vision and spatial awareness. The bot's mood and emotions will be further developed to hopefully lead to the bot's self awareness.