Brain Tags

Spud Ai

Tags are used to perform various functions when the cell is activated. A colon : is used in front of normal numbers equals = is used in front of neural network codes.

Tag description example usage
<activate-b10+> cell number to activate is the output converted to base 10 then added to the
number after the + cells 2 upward are activated.
 
<activate-cell:> activates a cell in the Brain database  
<all> use all outputs sets NNETagAll = 1 <all>
<allowrepeat> sets the allow repeat variable allows repeated outputs. Normally the Ai wont allow a repeated output until 9 other outputs have been used.  
<atmfiic> add to matrix file if the input changes atmfiic.txt in weights file <atmfiic>
<b10-o> converts output to base 10 send to output  
<checkwords> ,this tag checks the ToPrint output variable against words in the Brain. Only normal words and words at the end of the brain are checked process codes are ignored. The words are jumbled up so its not useful as a output filter but it is useful for things like auto learn which sometimes output weard codes from web sites.  
<clear> empties the Ai output buffer, sets the ToPrint variable to nothing  
<code-o> sends the 9 bit digital output to output  
<dtlno> DT Learning creates new connections this tag stops the DTL routine from changing cell numbers in the NNE <dtlno>
<eventactivate> activate the cell if there is a Brain event. More detail bellow table <eventactivate>
<eventcell> writes the cell number to the file NNEEventCells.txt in the weights folder if its found as an event <eventcell>
<eventno> this stops the cell from being scanned by the nne event scanner. Events are none expected changes to input or output nodes of the cells 1000 to 2000 <eventno>
<f7-ifoabove:> the value is a base 10 number the output is converted to base ten and then compared to the number eg.<f7-ifoabove:5> if the output converted to base 10 is higher than 5 then the tag processor starts reading field 7 instead of the tags field  
<f8-ifobelow:> the value is a base 10 number the output is converted to base ten and then compared to the number eg.<f8-ifobelow:5> if the output converted to base 10 is lower than 5 then the tag processor starts reading field 8 instead of the tags field  
<f7-cell:>
<f8-cell:>
<f10-cell:>
<f11-cell:>
<f12-cell:>
use the contents of the field from the cell specified for the output. If set to 0 then the cell number found from a <lookup-cell> or <lookup-ac> tag will be used. E.G. <words-ifa:test><lookup-cell><f8-cell:0>
this will use the contents of field 8 from the cell associated to the word test

<f7-ifa>
<f8-ifa>
<f10-ifa>
<f11-ifa>

go to the field and continue processing tags if the cell is activated  
<f7-ifo=>
<f8-ifo=>
<f10-ifo=>
<f11-ifo=>
go to the field and continue processing tags if output code equals <f7-ifo=001100110>
<f7-ifi=>
<f8-ifi=>
<f10-ifi=>
<f11-ifi=>
go to the field and continue processing tags if input code equals <f7-ifi=001100110>
<filter:> UNDER DEVELOPMENT
<filter:n> where n is the filter number
filter:1 = input code used to control the words in the ToPrint variable. If the node is 1 then corresponding numbered word in the sentence is used, if 0 the word is omitted.
filter:2 = this is an upgrade for the prwordafter function. It is assumed that the cell word is a pattern, as defined by the Type field being set at 60. The cell word is looked for in the SC code created by the input if found then the ToPrint variable is set to the words after the word that the pattern corresponds to. The Order Field is used to control the position of the pattern in the SC code the value being the position it must be in the trigger the filtering. If Order = 0 then the pattern can be anywhere in the SC code. The input code is set to 110000000 if all criteria of the filter have been set and the filter used its set to 001100000 otherwise.
 
<grammar> processes the output through the grammar checker changing the output into proper english  
<i=cell:> changes the cell input to the input of the cell numbered  
<ifpi=i-ac:> if the input is the same as the previous input than activate the cell  
<inouttrain> like the button O to Train this tag puts the input and output code into the training box then trains the cells network the new data is only added if it doesn't already exist it doesn't check for conflict data. An example of conflict data is a repeated input code with a different output code, since only one output can be produced then the network would never achieve 100% accuracy.  
<keyword-ifo=> use keyword in the keyword field if the output equals  
<keyword-ifi=> use keyword in the keyword field if the input equals  
<keyword-ifa> use keyword if the cell is activated  
<log> logs the cell activation  
<lookup-ac> look in brain for the text output and if found activate the cell.  
<lookup-ac-add> same as <lookup-ac> but adds the contents of ToPrint variable to the BD if not found.  
<lookup-cell> This sets the variable LookUpNumber to the cell number of the found word looked up.  
<outtoin> puts the output into the Ai input  
<rq=> sets the reply quality variable  
<rq=nne> sets the reply quality to the NNE reply quality weight  
<nodewords-ifo=> use the words connected to the nodes if the output equal  
<nodewords-ifi=> use the words connected to the nodes if the input equal  
<nodewords-ifa> use the words connected to the nodes if the cell is activated  
<once> stops the cell being activated more than once during an activation  
<o-udp-cell:> send the output via UDP to the input of the cell
 
<playmidi> see below for details on this tag  
<sayprint> goes to the SayPrint routine which prints the output variable  
<speak>

uses windows speech to speak the cells output. The contents of the output variable ToPrint is sent to the speak routine that uses the windows com object Sapi.
Mode = 0 Asynchronous mode, similar to mode 2 but without the timed timer delay
Mode = 1 synchronous mode the program halts until the speech has finished. All program processes are halted including timers so if you have a timer running and it activates whilst speech is happening then it will be ignored.
Mode = 2 Asynchronous mode, the program continues to run whilst speech is happening, the main timer is restarted after a calculated time. Sometimes speech can be overrun or ignored which can cause problems. WARNING do not use mode 2 if the Ai is going to read out a file, the program crashes for some as yet unknown reason use mode 3 instead.
Mode = 3 this is a combination of mode 1 and 2 normally speech is handled in asynchronous mode but if ReadFile keyword has been invoked then the file is read out using synchronous mode.
If the swopvar is empty when a speak tag is invoked then the SwopVar variable is set to the output sent to the speak process.
The Speak tag will only work on Windows Vista and above.

 
<stop-m> stop processing the matrix file if one is being used to activate cells  
<stow> scan to weights see below for more details  
<swopvar> some functions set the swop var this tag sets the Brain output variable to the value of swopvar, not yet fully tested  
<swopvar=toprint> Sets the SwopVar variable to the value of the output variable ToPrint  
<swopvar-udp> Send the contents of SwopVar variable via UDP. The do: switch is set to o-o output to output  
<tagfile>

the file field is the file name of the text file holding more tags. Make sure each line is less than 250 caricatures

 
<toprint-f7>
<toprint-f8>
<toprint-f9>
<toprint-f10>
sets field mentioned of the cell number to the contents of the ToPrint variable. If the tags <lookup-cell> or <lookup-ac> has been used then the cell number is that of the lookup if found.  
<toprint+swopvar> contents of SwopVar are added to ToPrint instead of replacing the contents.  
<toprint=swopvar> Sets the output variable ToPrint to the value of the SwopVar variable.  
<uwbrowser>

This tag creates a browser window, mode left, operation down, order width, type height. Field 8 is the startup url if empty then it defaults to the computer home page. If activated the contents of the output are sent to the browser. Nine browsers can be created at the moment. At present there are no navigation functions other than the right click options and functions on the page. The browser window is not intended to replace a normal browser and lacks some of the functions. The embedded browser functions require Internet Explorer 4.0 or greater to be installed on the system. If the browser is used then the Ai's memory and processor use is increased, depending on the contents and elements within the web page. Browser settings, history etc is accessed using internet explorer.

 
<uwbutton> User Window tag, creates a button in the user window using the text in field 7 the button text is reset after activation so the text can be changed by altering the contents of field 7, mode=left position, operation=top position, order=window width. When the button is pressed the cell is activated. The file field and field 11 are the button images, file is the main image and field 11 is the roll over image. Images should be windows bitmap .bmp and should be in the image folder. The name in the file and 11 fields should be the image name only. Field 8 is the button text color and field 10 is the button color. If either the file or field 11 are empty then no image is loaded. If field 8 or 10 are empty then no colors are set the button defaults to gray with black text  
<uwface> User Window tag, draws face animation mouth and eye movements are controlled by the input code. If there is a NN code in field 11 then this is used for the eyes and the output code is used for the mouth.  
<uwimage> User Window tag, image for user window. The image file name is the full path
If Order and Type fields are 0 then no scaling is applied the image scale is set to that of the image.
If Order field is 0 and the Type field is higher than 0 then the image is set to the size of the user window
Mode is the horizontal starting position and Operation is the vertical starting position.
 
<uwprint> User Window tag, moves the print position using the mode and operation fields then prints the output  
<uwtextin> User Window tag, the text from the input box is put into field 8, field 7 is the size field 10 is the font, mode, operation, type and order are the coordinates and size. When the cell with the tag is activated the ToPrint output variable is set with the contents of the input box which is then cleared.  
<uwtextout> User Window tag, sends the output from the cell to the output box. If you want it to show the output after processing an input tick in settings Activate 1178 on output and use the tag <activate cell:> to activate the cell used by uwtextout. field 7 is the size field 10 is the font, mode, operation, type and order are the coordinates and size  
<words-ic> This turns the cells words output into the cells input code. The words in the ToPrint variable are converted into a number using there ASCII value this number is added together until it is higher than 255 then converted into a nine bit base 2 code used by the neural network. The variable NNIn is the cells neural network input code this is altered to the new value.  
<words-ifo=> use the words if the output equals <words-ifo=001100110hello>
<words-ifi=> use the words if the input equals  
<words-ifa:> use the words if the cell is activated  

More Detail
<eventactivate>, the cell is activated if an event occurs. An event is only recorded if a cell changes unexpectedly if a cell is constantly changing then this is classed as normal and the cell doesn't record an event. If the cell is activated then no more events will be recorded from that cell until the Ai has processed an input.

<stow> Scan TO Weights. This tag scans a section of the image 18 x 9 pixels and converts the color value of the pixel into a weight value. There are 160 weights used in each cells neural network. This tag is an attempt to put information directly into the neural network. This enables one cell to hold the information from 160 pixels and then use that data to process a 9 bit input code and produce a 9 bit output code. The weights data is stored in the weights variable associated to the cell like normal this data can be overwritten by training the cell using the TRAIN button. The data is averaged in order to cope with difference of light and dark. at the moment this routine is working well at recognizing different images very quickly. Future development is to use this method to work out objects in an image.
eg.

field contents
input code 000100000
tags <stow><words-ifo=111100111the jump image><words-ifo=111000000the art image><sayprint>
cell word stow

<playmidi> Field 10 is the format for play midi if mode = 1 then the midi file is played in the background if not then the program freeze until the midi string has finished being played.
The midi string is made up using a code described bellow n is the number value
A-G {#}n
Plays a note. The # specifies a sharp. n is the duration of the note and can be 1,2,4,8,16,32 or 64 representing whole note, half note, quarter note, eighth note, and so on.
On
Specifies the octave of the notes that follow. There are 11 octaves from 0 to 10 with octave 5 containing middle C. Each octave begins with the C note and ends with the B note.
In
Sets the instrument (patch) to be used for the notes that follow. n can be from 0 to 127.
Vn
Sets the velocity, or volume, of the notes that follow. n ranges from 0 which is completely silent to 127 for full velocity.
Nn
Sets the channel of the notes that follow. n is the channel number and can range from 0 to 15. The default channel is 0. Channel 9 is the built in drum channel for most sound cards.
Rn
Inserts a rest. n specifies the duration of the rest and are the same as note durations.
Tn
Sets the tempo of the music in beats per minute (bpm). Default is 120. n can range from 10 to 300
*
Begins a chord. Any commands between the * and ; are played at the same time index.
;
Ends a chord.

eg: T120 N0 I25 O5 *C2EG;D4EFG*A2O6CE; *C2EG;D4EFG*A2O7CE;