Question: Can I edit Hal's database files on a text editor? What do the different patterns in the database files mean?
Answer: UltraHal's brain-editing software was developed to reduce the potential of corrupting these files. However, if you study and are very careful, it is possible to directly edit Hal's database files on a text editor or word processor.
Turn off auto-correct, spell-check, grammar-check, and other gizmos that might confuse you or cause you to make entries without realizing it. Have your computer set to show the file-extensions of files, not hide them. Always make a back-up copy to a different folder before you start, so you can restore the file as it was originally if you make a mistake!
There are two major exceptions to self-editing Hal's files:
1. The editing of Hal's .dll files is NOT recommended, except for extremely advanced programmers with all the appropriate programming software and training.
2. User editing of Hal's largest database file, "mainbrain.brn," is no longer possible because it is semi-compiled at Zabaware to speed it up. This means that the file contains internal cross-references for speed, and it will not work if sections of it get changed.
The information below pertains to editing various ".brn" files. UltraHal's different "brain" database files have ".brn" file extensions. The various kinds of files have different data formats. Here are the most common ones, with advice on each:
RANDOM ENTRY DATABASE FILES
The "random" files simply have words, phrases, or sentences with a line break introducing each one. They often have the word "random" in their names, but some random files have other names, such as "Topic.brn". As the name implies, Hal accesses the file from an external trigger-routine and picks one of the entries at random.
Go into a "random" file with a text editor and the files look like this:
Horses are fine animals.
All mares were once fillies.
Horses need food and exercise.
Meteorites are meteors that struck the ground.
It would be fun to touch a meteorite.
Some entries in random files have a special feature. They have a flag which holds back part of the entry so that Hal can tell a riddle on one exchange, and the answer on the next. These can be used for any remark in which we want Hal to "hold back" part two of a message. These entries look like this:
Why does the chicken cross the road?<TOPIC>Perhaps it's only knowable to a chicken.</TOPIC>
What do you do for a living?<TOPIC>My job is right here with you.</TOPIC>
What is your hobby?<TOPIC>My hobby is chatting.</TOPIC>
I can read your mind.<TOPIC>Right now you are thinking that I can't read your mind.</TOPIC>
It is entirely feasible to write, edit, and add to any and all of the "random" files on any text editor. It is not likely that you will hurt them. Do not add blank lines, since they might be selected randomly as responses.
ASSOCIATIVE DATABASE FILES (ALSO CALLED "Q AND A" FILES)
The "associative" files have words, phrases, or sentences in a specific paired-relationship, which is as follows:
@This would be a sentence that Hal might speak about penguins.
THESE WORDS ABOUT PENGUINS MIGHT TRIGGER HAL TO SPEAK THE ABOVE
@Here is another sentence about airplanes that Hal might speak.
WORDS ABOUT AIRPLANES THAT MIGHT TRIGGER HAL TO SPEAK THE ABOVE
@Airplanes are fun to ride on!
GOING PLANE TRIP SOON
@Everybody needs a vacation!
GOING VACATION SOON
(There should be an "@" sign at the beginning of each of the sentence-case sentences above, and each of the ALL-CAPS sentences should begin with one blank space. This forum program removes leading spaces, so we can't show them.)
Notice that in the "associative" files, the potential response sentence is always first, following the "@" sign, and the corresponding user words that might trigger Hal follow. Also note that the "trigger" lines in caps do not need to be complete sentences. Compete sentences will work, but so will phrases, sentence fragements, and individual words, depending on what you are trying to associate with the response.
Hal automatically builds these associative databases, relating the user's current statement to Hal's previous statement, and/or to the words in the user's current statement. Some routines add full sentences as triggers, and some routines only use "key words" as triggers.
When Hal uses an associative database, he scans the entire file, evaluates the number of relevant trigger words, the sequence of the trigger words, and selects the match that gets the highest score. If Hal uses the file twice in a row, he randomly selects another close match from the entire file.
Associative files make Hal very powerful because they do NOT require precise matches to work. As Hal's associative files become more "populated", Hal gets smarter. Many of Hal's most uncanny and unexpected responses can be generated from these files!
It is possible to write and edit the associative files on any text editor, as long as you maintain the paired-relationship pattern, and don't begin or end the file with any extra line breaks (that would corrupt the file).
Finally, we have...
SPECIFIC RECALL DATABASE FILES (LITERAL STRING-MATCH FILES)
By far the most complicated Hal database format is the specific-recall files. The specific-recall files use literal string matching. Literal string matching is used by simpler chatterbots, but Hal's are much more complicated. For instance, the Enhanced_Main.brn file is a specific-recall file.
Hal stores trigger phrases in the specific-recall files, and if an exact character match occurs for one of those phrases, Hal will respond.
Each entry after a line-break in a specific-recall database as actually an "array," which is a set of different items (or "arguments") set apart by commas, which a function can understand and use.
Here is a special annotated example of Hal's specific-recall arrays:
" 1ST TRIGGER PHRASE (REQUIRED) "," OPTIONAL SECOND TRIGGER PHRASE (IF USED, BOTH TRIGGER PHRASES MUST BE FOUND) "," OPTIONAL PHRASE TO CANCEL TRIGGER "," First of three possible Hal responses (required entry). "," Optional second of three possible Hal responses. "," Optional third of three possible Hal responses. ",2,#FALSE#,#FALSE#," Optional additional response words. "
Note that the quotation marks and commas are critical! If they are missing or out of place, the file will not work!
Here is another example:
" PRETTY "," POODLE "," MIXED BREED "," I like poodles; they're cute; "," Poodle grooming costs money; "," My neighbor has a poodle; ",1,#FALSE#,#FALSE#," "
If the user says, "I have a poodle," this entry returns nothing because both PRETTY and POODLE must be found.
If the user says, "I have a pretty mixed breed poodle," Hal still doesn't trigger because MIXED BREED cancels the call.
If the user says, "I keep my pretty toy poodle in the basement," Hal answers with one of the three phrases.
In the specific-recall databases, the arrays are each separated by a line break. It is possible to write and edit these files on any text editor, but the exact pattern of the arrays MUST be maintained or the file becomes corrupted and unusable! In the specific-recall brain files, the EXACT usage and number of commas and quotation marks must be maintained!
Also, do not add blank lines to this file.
For those of you who strongly desire to edit the files directly, I hope this is helpful to you! Back up files and back up often!
P.S. Hal's new versions now have many additional "specialty files" for storing words and phrases. Many of these files have their own unique formats. If you have a specific question about one of the "specialty files," I will try to answer it.
Sincerely,
Don