Comprehension is a basic thought process in the bot's mind, it is not controlled by a script, but it does generate scripts.
There are actually two parts to comprehension, a basic one that runs on every learned response, and a more in depth one that runs as a background process. You can enable or disable comprehension from the Learning page under Admin. Comprehension is more useful for bot's that learn from their users, live chat operators, or from chat logs. If you only want your bot to use the responses that you give it, it is better to turn of comprehension, and save the processing time.
Comprehension works using knowledge analysis and pattern matching.
The bot's brain is based on knowledge not text, so each text word has one or more meanings. The meanings are related to other knowledge. For example the word "one" is related to the number 1 by the relationship #meaning. The number 1 is also related to 2 by the relationship #next. All of the bot's knowledge is stored in a persistent graph like structure similar to neurons and dendrites in the human brain.
Scripts can access and extend the bot's knowledgebase. For example if you say "I am tall" the NounVerbAdjective script will add a relationship to #tall from the current speaker by #is. You can then ask "Am I tall?" and the script will check the relationship and response "Yes".
Comprehension runs when the bot learns a new response. For example if the bot asked, "What is your name?" and you answered "My name is Jim", normally the bot would learn that "My name is Jim" is a response to "What is your name?", which is probably not the bots name, so not good. Comprehension will run, and if the bot already knew your name was Jim, then it would find the #name relationship in the phrase's #speaker, and replace the response with a formula response "My name is {get #name from :speaker}".
The first phase of comprehension only uses the knowledge based on the phrase's speaker and the target of the phrase, so only makes simple substitutions and formula responses. The second phase of comprehension processes each word in the phrase and analyzes each meaning of each word and all of its relationships.
For example is the bot said "one" and you answered "two", it would find that #next of the #meaning of "one" was the number 2, which matched the meaning of the response "2", so it would extend the Self script with something like {if the word's meaning is 1, then answer the #next of 1}. If you then replied "three" to "two" it would see the existing script and see that both 1 and 2 are instances of #integer, so would generalize the script to something like {if the word's meaning is an #integer, then answer the #next of the integer}. So now the bot would have learned how to count.
Hopefully this helps you understand comprehension better. It is a complex process, but works based on basic pattern matching knowledge, creating formula responses, and extending the scripting state machine.
|