<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bragisoft</title>
	<atom:link href="http://bragisoft.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://bragisoft.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Fri, 20 Jan 2012 13:19:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>About resonating neural networks</title>
		<link>http://bragisoft.com/2012/01/about-resonating-neural-networks/</link>
		<comments>http://bragisoft.com/2012/01/about-resonating-neural-networks/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 18:56:20 +0000</pubDate>
		<dc:creator>bragi</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://bragisoft.com/?p=319</guid>
		<description><![CDATA[An intro on the core concepts.]]></description>
			<content:encoded><![CDATA[<p>The concepts behind resonating neural networks can probably best be explained by means of the same mental exercise that I used for working out the core ideas. Basically, we are going to try and follow the journey that a single electrical impulse takes from start to end and translate this into a model.<br />
Now, there are many possible starts: a single hair can move inside your inner ear, a taste cell can be activated, a ray of light can hit a cell on your retina and fire an electrical impulse, and so on. For this exercise, we are going to use the last one: the journey of a single visual impulse.</p>
<h1>The process</h1>
<p>So, once the cell on the retina did it&#8217;s work and the electrical impulse is activated, it travels along a nerve to the brain. From there, that single impulse will most likely activate 1 or more other neurons. These in turn will activate yet another part of the brain and so on and so on. Sometimes the activity can return to the same neurons, causing loop backs. Most likely, this activity somehow finally gets less and less until it dies out (although maybe not completely).</p>
<h1>The model</h1>
<p>Now, from this simple  process, lets try and create a model that roughly mimics it. So lets pick up some points of interest from the previous description:</p>
<ul>
<li>the electrical impulse somehow divides itself over multiple path ways.</li>
<li>some of these paths die out, others grow.</li>
<li>there are loop backs</li>
<li>an electrical signal has a direction: it goes from one point to (an)other(s).</li>
<li>an electrical signal travels along a path (axons)</li>
<li>paths connect neural cells</li>
</ul>
<p>The first thing to notice: something must be happening to the signal cause it is changing. Now, here is where I put down a rule: whatever it is that&#8217;s causing these changes, it must either be another neural cell or a pathway (axon), nothing else allowed.</p>
<p>And this is when the idea of resonance was born: what if there are 1 ore more neural cells reacting to the very fact that there is an electrical signal travelling along a pathway, because a cell released some sort of chemicals or some sort of interaction between the 2?  Now, suppose that there are various types of neurons, some of which can change or manipulate other parts of the neural network. These cells could be grouped together into a single cluster and react in sequence to the electrical signal, thus giving the ability to manipulate and change the very signal that caused the activity in the first place.</p>
<p>And thus we get to a programmable network.</p>
<p>A second thing to notice is the &#8216;split&#8217; behaviour. If there are more neural cells than there are nerves coming into the brain, than the only way that those other neural cells can be activated, is if somehow the electrical impulse divides itself. To mimic this, I introduced the concept of  the &#8216;split&#8217; instruction. This is a neuron that&#8217;s able to change the electrical signal itself by duplicating it and it&#8217;s current processing state. Each duplicate however, has small, predetermined variations, causing each signal&#8217;s path to grow apart.</p>
]]></content:encoded>
			<wfw:commentRss>http://bragisoft.com/2012/01/about-resonating-neural-networks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automated testing</title>
		<link>http://bragisoft.com/2011/12/automated-testing/</link>
		<comments>http://bragisoft.com/2011/12/automated-testing/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 18:51:21 +0000</pubDate>
		<dc:creator>bragi</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://bragisoft.com/?p=298</guid>
		<description><![CDATA[With complex bots, re-testing every statement can quickly become a tedious task. Luckily the chatbot designer is able to automate this task for you.]]></description>
			<content:encoded><![CDATA[With complex bots, re-testing every statement can quickly become a tedious task. Luckily the chatbot designer is able to automate this task for you.]]></content:encoded>
			<wfw:commentRss>http://bragisoft.com/2011/12/automated-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data management</title>
		<link>http://bragisoft.com/2011/12/data-management/</link>
		<comments>http://bragisoft.com/2011/12/data-management/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 18:45:35 +0000</pubDate>
		<dc:creator>bragi</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://bragisoft.com/?p=294</guid>
		<description><![CDATA[With the windows application, you can manage thesauri, assets, topics, and much more, all from custom UI's. All data types can be exported and imported using xml.]]></description>
			<content:encoded><![CDATA[<p>The client application provides  various tools for managing all the different data sets used by a chatbot (or neural network in general). Furthermore, all data can be imported and exported using xml. You can script out an entire project or just a part.</p>
<h1>Thesaurus</h1>
<p>In the chatbot designer, the thesaurus data is used to express abstract knowledge/relationships between words (the plural of a word, conjugations, the opposite, &#8216;is a relationships,&#8230;) . The application provides extensive support for managing this type of data. You can add, delete, move around, import and export single nodes, a section or the entire thesaurus.</p>
<h1>Assets</h1>
<p>Assets are used to express concrete knowledge (as in: I have 2 sisters). The chatbot designer application provides a custom editor for managing assets.</p>
<h1>Topics</h1>
<p>Conversations are usually scripted in topics which can also be edited using an editor which is a mix of text processing and structured editors.</p>
<h1>More</h1>
<p>The neural network designer version provides many more editors that can be used to manipulate various data structures that can be used for visual recognition, audio processing, pattern matching,&#8230;</p>
<p>Most of these editors are in constant development. New features and improvements tend to be added as needed. If you have any special requests, you can always post it in the <a title="Forum" href="http://bragisoft.com/forum/">forum section</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bragisoft.com/2011/12/data-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Avatars</title>
		<link>http://bragisoft.com/2011/12/avatars/</link>
		<comments>http://bragisoft.com/2011/12/avatars/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 13:40:11 +0000</pubDate>
		<dc:creator>bragi</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://bragisoft.com/?p=288</guid>
		<description><![CDATA[Build your own avatars using standard drawing applications and include them with your chatbots.]]></description>
			<content:encoded><![CDATA[<p>Avatars are animations that can lip-sync with the speech output and play clips at controlled times relative to the words that are spoken.</p>
<p>At the time of writing, only the windows application provides support for avatars though this feature is also planned for the mobile and web versions.</p>
]]></content:encoded>
			<wfw:commentRss>http://bragisoft.com/2011/12/avatars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speech</title>
		<link>http://bragisoft.com/2011/12/speech/</link>
		<comments>http://bragisoft.com/2011/12/speech/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 13:07:43 +0000</pubDate>
		<dc:creator>bragi</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://bragisoft.com/?p=272</guid>
		<description><![CDATA[Both the windows and android versions support speech to text conversion by using the built in speech to text conversion tools of the operating system.]]></description>
			<content:encoded><![CDATA[<h1>Speech to text</h1>
<p>Both the windows and android versions support speech to text conversion. For the windows application, this is done through the managed SAPI libraries provided by Microsoft. The same is valid for android: speech input is provided by the operating system.</p>
<p>In both cases though, the network can be used to augment the input quality. Speech libraries usually provide a list of possible input statements, each with a &#8216;weight&#8217; to determine the likelihood. When the neural network is properly set up (read: not to many regular variables are used), it should be able to pick out the best match.</p>
<p>At the time of writing, speech input is not yet directly supported for the online version, although some browsers (<a href="https://www.google.com/chrome">chrome</a>) already support speech input and there is some effort to make it into a <a href="http://www.w3.org/2005/Incubator/htmlspeech/">web standard</a>.</p>
<h1>Text to speech</h1>
<p>All versions are also able to say the output statements that are generated by the neural network. In windows, this is again done through the SAPI libraries. Both the managed and non managed versions are supported so that the system can work with most voices currently available on the market.</p>
<p>The android app and web interface both make use of the <a href="http://espeak.sourceforge.net/">Espeak</a> library to generate the speech. This is a more limiting system since it only allows for synth based voices, so things sound more robotic. Still, espeak also allows you to select between different voices and both pitch and speed can be altered.</p>
<p>In the case of the android app, Espeak is used &#8216;by default&#8217; as this is usually the speech system that ships with the device. However, android is a fairly open platform: it allows users to replace the default espeak app with a different one. This is no problem for the chatbot application: it will automatically switch to the newly installed voice system.</p>
<h1>Future</h1>
<p>At the time of writing, the neural network is already able to &#8216;improve&#8217; input quality by checking multiple possible combinations with it&#8217;s known state. This system can still be improved by adding an extra verification layer.</p>
<p>For speech input, there are plans to build a custom input system that is able to more tightly integrate into the neural network. The idea being that this should provide more accuracy. However, this is still just a theory so&#8230;.</p>
<p>The same goes for speech rendering: with a better integration into the neural network, the system should be able to better control things like pitch, accentuation, speed, volume,&#8230; which should result into a more human-like (or emotionally loaded) voice.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://bragisoft.com/2011/12/speech/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started: chatting</title>
		<link>http://bragisoft.com/2011/12/getting-started-chatting/</link>
		<comments>http://bragisoft.com/2011/12/getting-started-chatting/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 20:12:07 +0000</pubDate>
		<dc:creator>bragi</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[getting started]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://bragisoft.com/2011/12/getting-started-chatting/</guid>
		<description><![CDATA[Off line Chatting with a chatbot can be done through the viewer or editor application. Both can be started from the windows-start menu. The software package works like a standard windows app: before you can begin, you need to open a project. For this tutorial, lets use one of the demo projects ‘Name &#38; age’ [...]]]></description>
			<content:encoded><![CDATA[<h3>Off line</h3>
<p>Chatting with a chatbot can be done through the viewer or editor application. Both can be started from the windows-start menu. The software package works like a standard windows app: before you can begin, you need to open a project. For this tutorial, lets use one of the demo projects ‘Name &amp; age’ (located in {my documents}\NND\Demos. After loading, you should see something like the next image:<a href="http://bragisoft.com/wp-content/uploads/2011/12/viewer_pro_main_window.jpg"><img style="background-image: none; margin: 7px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="viewer_pro_main_window" src="http://bragisoft.com/wp-content/uploads/2011/12/viewer_pro_main_window_thumb.jpg" alt="viewer_pro_main_window" width="488" height="395" border="0" /></a></p>
<p>Lets focus on the chatbot window for this tutorial. It contains a toolbar at the top, to the left, an input box and a conversation history. On the right, you can see the character.<br />
With the toolbar, you can perform the following actions</p>
<ul>
<li>Toggle audio output: select if the character speaks (and lip-syncs) the output (you also need to have a voice selected for speech output to work).</li>
<li>Toggle audio input: turn the mic on or off for using free form speech input. Text will appear in the textbox, you will still need to press enter for sending text.</li>
<li>Hide/display possible multiple variations that were detected by the speech input system so that you can select the correct one.</li>
<li>Select the voice used by the character.</li>
<li>cut, copy or clear the conversation history.</li>
<li>Select the character</li>
<li>Change the size of the character</li>
<li>Make the character free floating on the desktop or dock it in the application</li>
</ul>
<p>All windows clients have a ‘Stop’ button. This is used to terminate the pattern-matching process, in case that there is an error in the patterns (or code) and the system got stuck in an eternal loop or worse. Normally, you only use this while debugging patterns (and code).</p>
<h1>Online</h1>
<p>Coming soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://bragisoft.com/2011/12/getting-started-chatting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started: creating bots</title>
		<link>http://bragisoft.com/2011/12/getting-started-creating-bots/</link>
		<comments>http://bragisoft.com/2011/12/getting-started-creating-bots/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 20:11:19 +0000</pubDate>
		<dc:creator>bragi</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[getting started]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://bragisoft.com/2011/12/getting-started-creating-bots/</guid>
		<description><![CDATA[You can create your own bots from scratch, you can build upon an already existing bot or you can compose a new bot from exported sections of other bots (like a collage). A bot usually consists of the following parts or sections: The chatbot’s properties This can be opened from the menu (view/chatbot properties) or [...]]]></description>
			<content:encoded><![CDATA[<p>You can create your own bots from scratch, you can build upon an already existing bot or you can compose a new bot from exported sections of other bots (like a collage). A bot usually consists of the following parts or sections:</p>
<h1>The chatbot’s properties</h1>
<p><a href="http://bragisoft.com/wp-content/uploads/2011/12/Capture2_thumb11.jpg"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" title="Capture2_thumb1[1]" src="http://bragisoft.com/wp-content/uploads/2011/12/Capture2_thumb11_thumb.jpg" alt="Capture2_thumb1[1]" width="477" height="185" align="right" border="0" /></a>This can be opened from the menu (view/chatbot properties) or from the toolbar on the project tool-page (first button). In the properties, you can specify some global settings, specific to the current project. This includes some preferences like your and the bot’s name, birthday and gender. These values can be accessed in the patterns.</p>
<p>You can also specify if the system should try to resolve synonyms automatically or not. When first starting out using simple input-patterns, it’s best to use the auto resolve feature. If you are using lots of thesaurus variables in your input patterns however, all that this flag does, is create more unnecessary work and should best be turned off.<br />
A final flag is used to determine how output of multiple rules is combined. This flag only becomes useful if you use sub-topics/rules in your input patterns. For starting out, this can be left as is.</p>
<p>Useful sections for starting out:</p>
<ul>
<li>Say on startup: If you like your bot to start the conversation, this is where you put all the possible output statements that can be used as openings for a conversation. The bot will pick 1 at random. When this section is empty, the bot will wait until you initiate a conversation.</li>
<li>Fall back: If the bot can’t match any input-patterns against the input, it will return a default text ‘No output defined’. In this section, you can overwrite this default value with your custom output. If multiple outputs are specified, one will be picked at random.</li>
<li>Repetition: In this section you can specify global conditional outputs for handling repetition in the input. A system variable ($Repeatcount) provides access to the nr of repeating patterns that the bot found.</li>
</ul>
<p>Other sections include:</p>
<ul>
<li>Do on startup: this contains do-patterns that are executed when the bot is first started.</li>
<li>Do after output: this section also contains do-patterns, but which are executed after every input/output pair.</li>
<li>Context: The final section is used for declaring asset paths to memory that can be used in operations that require context.</li>
</ul>
<p>These properties and global patterns can be exported and imported to/from an xml file from the main menu (‘file/import’ and ‘file/export’).</p>
<h1>Thesaurus data</h1>
<p>A second piece of the puzzle consists out of the thesaurus. This is a collection of words that are grouped together in a tree-like structure. The default template and all the demos have an empty thesaurus. This allows you to use whichever thesaurus that you like, including one for a different language (although the current version is still mostly geared for English, particularly for verb conjugations).</p>
<p>To start with though, it’s probably easiest to download <a href="http://www.bragisoft.com/files/full.thesaurus.xml" target="_blank">the English thesaurus</a> and import it into your projects (right click on the thesaurus tool-frame, select import, thesaurus). This way, you already have a properly structured thesaurus with plenty of initial values. The file to import is in xml format, so you can edit this manually if you want, though this is only advised for building thesauri for other languages.<br />
Once you have a basic data set, you can extend this, either by <a href="http://www.youtube.com/watch?v=Sqr59YAoR_s&amp;feature=player_embedded" target="_blank">manually entering new words</a> or by importing more data, as other sub sections in xml format, or you can also import comma separated lists of words. Simply copy the list to the clipboard or a file, right click on the thesaurus node where the items should be added, select import). All the words in comma separated lists will become children of the selected node.</p>
<h1>Topics</h1>
<p>The next important part to think about are the topics. This is where you define how the bot needs to respond to different input. Like the other sections, you can import already existing topics (from the menu: file/import/topic). Importing multiple topics at once is also supported, just select multiple files in the dialog <a href="http://bragisoft.com/wp-content/uploads/2011/12/Capture2_thumb12.jpg"><img style="background-image: none; margin: 5px 7px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; padding-top: 0px; border: 0px;" title="Capture2_thumb1" src="http://bragisoft.com/wp-content/uploads/2011/12/Capture2_thumb1_thumb.jpg" alt="Capture2_thumb1" width="434" height="324" align="left" border="0" /></a>box. Imported topics will appear in the project view. From there, you can rename, organize or delete all the topics in the project. Note that every topic should have a unique name, topics with duplicate names get a red icon (and can’t be used as sub-topics).</p>
<h5>Creating new topics</h5>
<p>Of course, at some point, you will want to create your own content. To start a new topic, use one of the toolbar buttons or the insert menu. This will show a new topic (a unique name will automatically be generated) with an empty ‘you say’ and ‘bot says’ section.</p>
<p>To create a new rule, simply start typing in one of these sections. This will automatically create a new rule and input or output pattern. In the simplest form, you put the exact input text that needs to be matched on the left and the bot’s response to the right. When you are ready to move on to calculations and do-pattern, you can press ctrl-D to show/hide these sections (or press on the drop-down buttons). Shft-Ctrl-D will hide/show them all at once.</p>
<h2>Selecting and editing patterns</h2>
<p>You can either select a section of text within a single pattern (just like in any other text editor) or you can select multiple patterns at once (for deleting, copying,…). If you want to select all the patterns of a single section (for instance, all the ‘you say’ patterns in a rule), double-click on the title of the section. To select multiple patterns in different sections, keep the ctrl key pressed while clicking inside the patterns. Every selected pattern is displayed with a darker, heavier line. Rules can also be selected by clicking on the area around the patterns but outside of the text. Selected rules will also have a darker, heavier border. Press F2 for renaming the selected rule.<br />
Finally, you can use the arrow keys to move around anywhere on the topic, not just within a single pattern.</p>
<p>Delete, cut, copy and paste are done in the usual manner: with the delete button, ctrl-x, ctrl-c, ctrl-v, you know the drill. If you have a need to insert a rule or pattern somewhere, use the ctrl+I shortcut. Depending on the cursor position, a new pattern or rule will be inserted. The ‘Search and replace’ dialog can be shown with the Ctrl+F shortcut, the button on the toolbar or the menu command (Edit/view). To activate topic-search, make certain that the topic is selected. Many tool-frames also have search-capabilities, if one of them is active while pressing the search command, the search of the local tool-frame will be used.<br />
Finally, the topic editor has a spell checker that can be turned on/off in the options dialog (Tools/options – editing tab).</p>
<h2>Variables, questions and answers</h2>
<p><a href="http://bragisoft.com/wp-content/uploads/2011/12/Capture3_thumb5.jpg"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border: 0px;" title="Capture3_thumb5" src="http://bragisoft.com/wp-content/uploads/2011/12/Capture3_thumb5_thumb.jpg" alt="Capture3_thumb5" width="435" height="484" align="right" border="0" /></a>Even the simplest of bots needs a way to pass some data from the input to the output section and handle question/answer type of situations. The first can be done by using variables in the input patterns. The second example on the right (My name is $value [.]) contains a variable ($value). As you have probably already guessed, variables start with a ‘$’. To display the value in the output, simply use the same variable name in the output pattern.</p>
<p>The section that handles questions and answers can be accessed by expanding the output patterns. Each output-pattern has an extra ‘Response for’ and ‘When not replied’ part. When an output contains a question, and you want to say something specific when the user didn’t respond to that question, add some outputs to ‘When not replied’. This option is most likely not used often, unless you plan to build an SS-style interrogation bot (like the example to the right).<br />
’Response for’ is used on outputs of rules that are valid responses to previously stated questions. When a rule gets activated that has outputs with a ‘response for’ section, but no question is asked, only outputs will be used that don’t link to the pattern we got a response for.<br />
In the example to the right, the ‘Ok, so you&#8217;re called $value’ will only be rendered if the previous output was ‘Hi there! What’s your name’ Similarly, the ‘What do you mean with $value’ statement will only be rendered if the previous output is not ‘Hi there!…’</p>
<p>There are other ways that question-answers can be done, but that’s outside the scope of this tutorial.</p>
<h1>Creating characters</h1>
<p>If you feel like creating your own characters, this is certainly possible. The current system uses a set of images that are bundled together with an xml file. The images can easily be generated with tools like <a href="http://www.daz3d.com/" target="_blank">DAZ3D</a>, <a href="http://poser.smithmicro.com/" target="_blank">Poser</a>,… Basically, you need an image for each animation frame and mouth position. Some packages will allow you to semi-automate this export process. <a href="http://janbogaerts.name/files/DifImage.zip" target="_blank">Here’s</a> a small tool to automatically compress the images to only the difference. This way, you can use multiple animations at once.</p>
<p>At the time of writing, the xml files still need to be edited manually. The structure is an extension of <a href="http://www.verbots.com/wiki/Tools:Conversive_Character_Open_Specification" target="_blank">the CSS file format</a>. Basically, it consists out of the following sections:</p>
<ul>
<li>CharacterInfo: information about the character</li>
<li>Animations: a list of available animations and all the frames for each animation</li>
<li>VisemeGroups: defines which image goes with which letters.</li>
<li>IdleLevels: declares which animations should be played during idle time and how.</li>
<li>BackgroundAnimations: optionally animations that should always play in some sort of loop (useful for things like breathing)</li>
<li>Backgrounds: optionally a set of images that compose the background image. When multiple images are used, parts of the background can be hidden during animations.</li>
</ul>
<p>To install your newly created character, create a new directory in {my documents}\nnd\characters. Give the directory the same name as your character and put the xml file in the directory. The exact location of the images is specified in the xml file, but usually you put these together in the same dir or sub.</p>
]]></content:encoded>
			<wfw:commentRss>http://bragisoft.com/2011/12/getting-started-creating-bots/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The different file types</title>
		<link>http://bragisoft.com/2011/12/the-different-file-types/</link>
		<comments>http://bragisoft.com/2011/12/the-different-file-types/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 09:40:13 +0000</pubDate>
		<dc:creator>bragi</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[assets]]></category>
		<category><![CDATA[characters]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[features]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[test case]]></category>
		<category><![CDATA[thesaurus]]></category>
		<category><![CDATA[topics]]></category>

		<guid isPermaLink="false">http://bragisoft.com/2011/12/the-different-file-types/</guid>
		<description><![CDATA[The chatbot designer uses a number of different file types to accomplish different tasks. Here’s a short overview of all possible files (and sometimes directories): Projects A project contains the entire neural network (in binary form) together with a bunch of configuration files in a directory. This directory is accompanied by the main project file. [...]]]></description>
			<content:encoded><![CDATA[<p>The chatbot designer uses a number of different file types to accomplish different tasks. Here’s a short overview of all possible files (and sometimes directories):</p>
<h3>Projects</h3>
<p>A project contains the entire neural network (in binary form) together with a bunch of configuration files in a directory. This directory is accompanied by the main project file. Both have the same name.  When moving around a project, make certain you have both file and directory. When opening and saving projects, you only need to worry about the file, the directory will be created/managed automatically (done in such a way that extra directories like for version control systems, will remain functioning).<br />
The project files themselves (extension ‘.dpl’), are simple xml files which contain various configuration data for the designer. In general though, you don’t need to edit this file manually, all settings can be managed from within the designer.<br />
The most important files in the project directory are binary and should never be manually edited. Some files are xml based, but apart from the test-cases, should be left ‘as-is’ since they contain vital configurations for the internal network.</p>
<h3>Topic files</h3>
<p>Topics form a major component of a chatbot designer project. They define what the bot can do. Internally, topics are stored as neurons, but in order to share a topic across multiple projects and users, Topic files were introduced. This is an xml file (extension ‘topic.xml’) that contains all the rules defined in the project.</p>
<p>The designer provides functionality to import and export topics one by one or in bulk from the <em>File</em> menu or the context menu on the <em>Project</em> tool-window. So ideally, you should never be confronted with the internals of these files. For the die-hard text-editor fans, here’s a little more details on the structure:</p>
<p>A minimal topic file should contain a topic, name, rules and questions sections. Like:</p>
<blockquote><p>&lt;Topic&gt;<br />
&lt;Name&gt;Who has&lt;/Name&gt;<br />
&lt;Rules /&gt;<br />
&lt;Questions /&gt;<br />
&lt;/Topic&gt;</p></blockquote>
<p>And a bit more challenging, containing a single rule with 1 input and output pattern pattern:</p>
<blockquote><p>&lt;Topic&gt;<br />
&lt;Name&gt;Time&lt;/Name&gt;<br />
&lt;Rules&gt;<br />
&lt;Rule&gt;<br />
&lt;Name&gt;new rule 1&lt;/Name&gt;<br />
&lt;Patterns&gt;<br />
&lt;Pattern&gt;<br />
&lt;Expression&gt;What time is it [?]&lt;/Expression&gt;<br />
&lt;/Pattern&gt;<br />
&lt;/Patterns&gt;<br />
&lt;Conditionals /&gt;<br />
&lt;Outputs&gt;<br />
&lt;Output&gt;<br />
&lt;Expression&gt;It is $time:hour\:$time:minute\.&lt;/Expression&gt;<br />
&lt;QuestionCanFollow&gt;True&lt;/QuestionCanFollow&gt;<br />
&lt;/Output&gt;<br />
&lt;/Outputs&gt;<br />
&lt;IsOutputSequenced /&gt;<br />
&lt;DoPatterns /&gt;<br />
&lt;Calculate /&gt;<br />
&lt;/Rules&gt;<br />
&lt;Questions /&gt;<br />
&lt;/Topic&gt;</p></blockquote>
<p>For the curious, the expression: <em>$time:hour\:$time:minute\.  </em>is used to render something like 17:30. The expression has to be split up in 4 parts:</p>
<table width="915" border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="101"><em>time:hour </em></td>
<td valign="top" width="812">returns the hour</td>
</tr>
<tr>
<td valign="top" width="101">\:</td>
<td valign="top" width="812">we need to escape the : cause it is just after a variable path. If we don’t do this, the parser thinks that we will specify another function call.</td>
</tr>
<tr>
<td valign="top" width="101">time:minute</td>
<td valign="top" width="812">returns the minute part of the time value.</td>
</tr>
<tr>
<td valign="top" width="101">\.</td>
<td valign="top" width="812">The . also needs to be escaped, otherwise the parser thinks we are trying to further specify the path.</td>
</tr>
</tbody>
</table>
<h3>Global patterns</h3>
<p>In the ‘chatbot properties’ view (From the menu: View/chatbot properties), you can specify a bunch of global patterns like the opening statements, fallback values, ‘do-patterns’ that need to be executed at startup, just after each statement,…  This also includes all the OS function-mappings that were declared in the ‘<em>OS channel</em>’.  All these can be exported/imported using 1 file, with the extension ‘global.xml’. Import/export can be done from the menu: ‘<em>file/import/global patterns’</em> or ‘file/export/global patterns’.</p>
<p>As you probably already guessed, this is also in xml format, but like with the topics, the content can be fully managed from within the designer, so there is no need to edit it manually.</p>
<h3>Thesaurus files</h3>
<p>Thesaurus files are used to share, exchange or replace part of, or the entire thesaurus that is used in a single project (thesauri are project specific and not shared across different projects within the designer). It’s the same routine again as for the previous file types: the extension is ‘thesaurus.xml’, yes, it’s an xml file format and can be fully managed from within the designer. In fact, for the thesaurus, it is more than advised to use the designer and not edit it manually since a thesaurus node can be hard to define as there are multiple levels at which words are stored. The only scenario where you might have to do some manual editing, is when you create a new thesaurus, completely from scratch when all the functionality needs to be preserved and you don’t have access to a network-designer version of the chatbot designer. In that case, the ‘bindings’ section on certain words (numbers, pronouns like I, me, myself,.. needs to be done manually. Here’s a small example of a binding for the object ‘myself’:</p>
<blockquote><p>  &lt;Object Name=&#8221;myself&#8221;&gt;<br />
&lt;Text Value=&#8221;myself&#8221; Index=&#8221;0&#8243; POSGRP=&#8221;false&#8221; /&gt;<br />
&lt;Bindings&gt;<br />
&lt;ref&gt;I&lt;/ref&gt;<br />
&lt;ref&gt;Singular&lt;/ref&gt;<br />
&lt;/Bindings&gt;<br />
&lt;/Object&gt;</p></blockquote>
<p>Importing/exporting is done from the context menu on the thesaurus. If no node is selected, the entire thesaurus will be exported, or the content of the imported file will be added to the root. If a node is selected during an import operation, all items will be added as a child of the selected node. For export, only the selected item and all it’s children will be exported recursively.</p>
<p>It’s also possible to import or export just a single level of children of a selected node, in the form of comma-separated-value (csv) files.  For imports, you don’t even need to get the data from a file, but you can just as easily use the clipboard: just copy a csv list to the clipboard, go to the context menu of the parent node and select ‘<em>Import\wordlist from clipboard</em>’. This feature allows you to quickly build up trees of related words.</p>
<h3>Asset files</h3>
<p>Assets store concrete information like ‘you are reading this now’ and ‘I have written this text’. By now, the theme should have become clear to you: asset files are stored in the xml format, they have the extension ‘<em>asset.xml</em>’. But here’s where we stray a little from the path: currently asset import/export is only supported in the pro version (that is, it’s still a little bit under construction, so it will soon be available). The same for editing: the pro will have an asset editor, but not the basic version. The latter only has the chatbot window for adding input statements.</p>
<h3>Test cases</h3>
<p>Test case files aren’t independent files like ‘topic thesaurus, asset or global patterns’ files, but are rather part of the project directory. As such, you can’t currently export or import them automatically from within the designer (though you can fully manage them as in copy, delete, edit,.. from within the designer). That said, they do deserve a special mention since it could sometimes be useful to extract some test-cases and copy them to other projects. And, because a test-case file is actually a stand-alone xml file, this is certainly possible.</p>
<p>Test case files are located at {project directory}\DesignerData\  and have the extension ‘TESTCASE’. If you copy a test-case from one project to another, or you want to delete some manually, make certain that the project is closed.</p>
<h3>CCS files (characters)</h3>
<p>As a final file format, I’d like to talk a little about characters and their files. A character is stored as an xml file (extension ccs) together with a bunch of images. These images can be located in a subdirectory of the ccs file, as long as the path can be described, relative to the ccs file.</p>
<p>For the chatbot designer to be able to use a character, the files (and possibly directory structure) of the char need to be copied to the directory: {My documents}\NND\Characters\<em>CharName</em>,  where ‘Charname’ is the name of the character. Best to do this when the chatbot designer isn’t running.</p>
<p>Unfortunately, ccs files can’t yet be edited in the designer (or any other UI tool). They need to be created manually. Luckily, the structure is relatively simple and allows for lots of copy/paste. More info on the file structure will come shortly.</p>
]]></content:encoded>
			<wfw:commentRss>http://bragisoft.com/2011/12/the-different-file-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating your own characters</title>
		<link>http://bragisoft.com/2011/12/creating-your-own-characters/</link>
		<comments>http://bragisoft.com/2011/12/creating-your-own-characters/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 19:25:14 +0000</pubDate>
		<dc:creator>bragi</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[characters]]></category>
		<category><![CDATA[chatbot designer]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://bragisoft.com/2011/12/creating-your-own-characters/</guid>
		<description><![CDATA[It’s possible to create your own characters for the chatbot designer app. The process consists out of 2 parts: first you need to create a set of images, once that’s done, you need to make a ccs file that combines all the images.]]></description>
			<content:encoded><![CDATA[<p>It’s possible to create your own characters for the chatbot designer app. The process consists out of 2 parts: first you need to create a set of images, once that’s done, you need to make a ccs file that combines all the images.</p>
<h3>Images</h3>
<p>The animations and visemes are stored as a series of images which are displayed in rapid succession, much like how old school film works. Before you can display these images though, they need to be created. Now, in the olden days, they used to have big chunky camera’s for that. Things have changed a bit since. We can use tools like <a href="http://www.daz3d.com/" target="_blank">DAZ3d</a>, <a href="http://poser.smithmicro.com/poser.html" target="_blank">Poser</a>, <a href="http://www.blender.org/" target="_blank">Blender</a>,…</p>
<h4>Content</h4>
<p>What you put in the images is entirely up to you. There aren’t many limits with respect to content in the sense that there aren’t any ‘expected’ parts. That said, since we are dealing with chatbots, I’d try to put in something resembling a mouth somewhere, just to get some lip-syncing working. Most 3D tools these days, come with some way to manipulate mouth positions. The designer uses 21 different images for lip-sync (+ 1 for silence, which is actually the background image). Most 3D tools only provide morphs for 16 mouth positions. The remaining 5 visemes can be created by reusing other images or by creating your own, if the 3d app allows it. Here’s a good <a href="http://www.verbots.com/wiki/Tools:Conversive_Character_Studio_Sample_Visemes" target="_blank">visual overview of all the visemes</a>.</p>
<p>Animations like blinking eyes or moving hair also need to be exported from your 3D package as a series of images. Luckily most 3d software provides a feature to just that. Also, some animations can use the same image multiple times, it’s always best to reuse the same image in those cases, to save memory. For instance, an eye blink can be done with 2 or 3 images: eye fully open is provided by the background, half closed and fully closed.</p>
<h4>File formats</h4>
<p>Currently, the following file formats are supported:</p>
<table width="318" border="1" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="70">BMP</td>
<td valign="top" width="246">bitmap</td>
</tr>
<tr>
<td valign="top" width="74">GIF</td>
<td valign="top" width="246">Graphics interchange format</td>
</tr>
<tr>
<td valign="top" width="77">JPEG</td>
<td valign="top" width="246">Joint photographics experts group</td>
</tr>
<tr>
<td valign="top" width="79">PNG</td>
<td valign="top" width="246">Portable network graphics</td>
</tr>
<tr>
<td valign="top" width="81">TIFF</td>
<td valign="top" width="246">Tagged Image file format</td>
</tr>
</tbody>
</table>
<p>It should also be possible to use xaml files (to create flash typed characters) , but this is not yet tested and will most likely not yet work. Give me a shout if you would like to do this.</p>
<h3>Processing</h3>
<p>Once you have created all the images, it’s best to process them a little further. At this stage, every image always uses up the full viewable area of the character. That’s ok, if all you want to do is lip-sync and possibly a little animation during idle times. But in this setup, your character can’t blink while speaking. To accomplish this, we need to cut out only the valid parts of each image and make the rest transparent. This way, the system can overlay multiple images and create the illusion of different parts moving at the same time.<br />
Another added advantage of this process is that it usually (depending on the file type) shrinks the file. PNG files, when edited with the correct tools, will use less space if there is a bigger transparent area.</p>
<p>There are multiple ways you can crop the images. You can use the eraser tool found in most bitmap editing tools like <a href="http://www.paint.net/" target="_blank">paint.net</a>.  Though, I’ve noticed that at least some versions of Photoshop don’t shrink png files when using the eraser, so that’s maybe not the best tool for the job. Personally, I used a little home-made app to do the <a href="http://bragisoft.com/wp-content/uploads/2011/12/Capture5.jpg"><img style="background-image: none; margin: 3px 0px 2px 4px; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" title="Capture" src="http://bragisoft.com/wp-content/uploads/2011/12/Capture_thumb3.jpg" alt="Capture" width="525" height="350" align="right" border="0" /></a>job. You can download it from <a href="http://janbogaerts.name/files/DifImage.zip" target="_blank">here</a>.</p>
<p>It’s very simple to use. As you can see on the screenshot, there are 2 big buttons to the left which contain the source images. Press on each button to load the images. The top image should contain the root, in the bottom, you put the images that need to be cropped. To the right, on top, you see the result for the currently selected target image (seen in the bottom button). With the slider, you can scroll through the loaded images.<br />
On the next line, there is a checkbox and a slider. These control the calculation process: do you want the parts of the image that are different or the same, and with the slider you select the tolerance level used to calculate the difference. When you put the slider fully to the left, there is 0 tolerance, meaning that there can be no difference between the pixel in the source image and that of the image that needs cropping. Put the slider fully to the right and the difference has to be very big.<br />
Finally, with the button labeled ‘save’, you can save the processed images to a directory that you select (the original files are kept).</p>
<p>Depending on the way that the images are rendered in the 3D package, the file format and the quality of the rendering engine, there can be a bigger or smaller difference between parts of the images that should be the same. That’s why you normally have to play a little with the tolerance level. The lower, the better. Sometimes it’s better to keep a lower tolerance level and manually remove the remaining dots with an eraser in a bitmap editing package.</p>
<h3>CCS file</h3>
<p>When you’re ready with your images, it’s time to put them all together, a bit like a collage. Unfortunately, there currently isn’t yet a ready-made tool for this, so you are gonna have to do a little xml writing. Fortunately, there’s a lot of copy paste involved. The outer xml tag, the start of the file, is a &lt;Character&gt; tag, like so:</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;<br />
&lt;Character xmlns:xsi=&#8221;<a href="http://www.w3.org/2001/XMLSchema-instance&quot;">http://www.w3.org/2001/XMLSchema-instance&#8221;</a> xmlns:xsd=&#8221;<a href="http://www.w3.org/2001/XMLSchema&quot;">http://www.w3.org/2001/XMLSchema&#8221;</a>&gt;<br />
&lt;/Character&gt;</p></blockquote>
<p>Now, Let’s go over each section in order of the file content:</p>
<h4>Character Info</h4>
<p>The first section, and the easiest, is the character information. This is how it looks like:</p>
<blockquote><p>  &lt;CharacterInfo&gt;<br />
&lt;Name&gt;Mika&lt;/Name&gt;<br />
&lt;Author&gt;Ady Di Pierro&lt;/Author&gt;<br />
&lt;Copyright&gt;Copyright 2011 Ady Di Pierro&lt;/Copyright&gt;<br />
&lt;License /&gt;<br />
&lt;AuthorWebsite&gt;<a href="http://www.laticisimagery.com.au/">http://www.laticisimagery.com.au/</a>&lt;/AuthorWebsite&gt;<br />
&lt;CreationDate&gt;2011-08-07T14:43:26.602+02:00&lt;/CreationDate&gt;<br />
&lt;LastUpdateDate&gt;2011-08-07T14:43:26.602+02:00&lt;/LastUpdateDate&gt;<br />
&lt;Rating&gt;<br />
&lt;Rating&gt;Unknown&lt;/Rating&gt;<br />
&lt;Sexual&gt;false&lt;/Sexual&gt;<br />
&lt;Violence&gt;false&lt;/Violence&gt;<br />
&lt;Other&gt;false&lt;/Other&gt;<br />
&lt;Description /&gt;<br />
&lt;/Rating&gt;<br />
&lt;OnlineOptions&gt;<br />
&lt;OnlineCharacterBaseUrl /&gt;<br />
&lt;PreferredWidth&gt;150&lt;/PreferredWidth&gt;<br />
&lt;PreferredHeight&gt;150&lt;/PreferredHeight&gt;<br />
&lt;/OnlineOptions&gt;<br />
&lt;/CharacterInfo&gt;</p></blockquote>
<p>Just copy the above and paste it into your xml file, just under &lt;Character&gt;. This part only contains reference information about the character: what’s it’s name, who designed it, what’s the licence, possibly a website,… All of the info in this section is optional, you can leave the tags empty, but it’s best to include them. This information, by the way, is displayed in the popup window on the ‘chatbot window’ (the button in the lower-left corner on the images window).</p>
<p>Online options are currently still skipped but will probably be used in future, online versions.</p>
<h4>Background</h4>
<blockquote><p>&lt;Background&gt;<br />
&lt;ImageResource&gt;images\Kima00.png&lt;/ImageResource&gt;<br />
&lt;ImageResource&gt;images\KimaEars.png&lt;/ImageResource&gt;</p>
<p>&lt;/Background&gt;</p></blockquote>
<p>The background section defines the images that should be used as background (obviously). 2 things worth mentioning: a background is defined as an ImageResource. This is used often throughout the file. Whenever you want to reference an image file, you use this element. The text part of the xml element defines the relative path to the image (that is relative to the CCS file).</p>
<p>Also, and that’s perhaps the weirdest part, you can declare multiple backgrounds. Every image in this list will be displayed as a background, unless an animation turned one of the images <em>off</em>. And that’s the main usage of having multiple backgrounds: so that animations can turn part of the background <em>off</em> while playing. A good example are Mika’s ears.  They are drawn in a separate background image, so that the ‘flip-ears’ animation, can hide the background-ears while it’s playing. We do this cause some images in the animation sequence are smaller then the ears in rest, which would otherwise give ugly results with half an ear overlapped and the rest still visible. I’m certain there are plenty of other cool tricks to done with this feature. Hiding a background image is explained in the ‘Animations’ section.</p>
<h4>Animations</h4>
<p>The ‘Animations’ section is one of the bigger parts of the file. This is where you declare all the animation sequences available to the character for emotional expressions and idle times. The background animations (which run all the time, not jus at idle times), are declared somewhere else. Anyway, here’s how an animation definition looks like:</p>
<blockquote><p>  &lt;Animations&gt;<br />
&lt;Animation&gt;<br />
&lt;AnimationFrames&gt;<br />
&lt;AnimationFrame&gt;<br />
&lt;Duration&gt;5&lt;/Duration&gt;<br />
&lt;ImageResource&gt;images\other\Kima Ears (01).png&lt;/ImageResource&gt;<br />
&lt;VisemeGroupName/&gt;<br />
&lt;/AnimationFrame&gt;<br />
&lt;Duration&gt;5&lt;/Duration&gt;<br />
&lt;ImageResource&gt;images\other\Kima Ears (01).png&lt;/ImageResource&gt;<br />
&lt;VisemeGroupName /&gt;<br />
&lt;/AnimationFrame&gt;<br />
&lt;/AnimationFrames&gt;<br />
&lt;EnableFrameSpeaking&gt;true&lt;/EnableFrameSpeaking&gt;<br />
&lt;HoldLastFrameForSpeak&gt;false&lt;/HoldLastFrameForSpeak&gt;<br />
&lt;FirstFrameUnderlay&gt;false&lt;/FirstFrameUnderlay&gt;<br />
&lt;BackgroundSuppress&gt;KimaEars.png&lt;/BackgroundSuppress&gt;<br />
&lt;Name&gt;earsmove1&lt;/Name&gt;<br />
&lt;ZIndex&gt;0&lt;/ZIndex&gt;<br />
&lt;/Animation&gt;<br />
&lt;/Animations&gt;</p></blockquote>
<p>The section starts with an <em>&lt;Animations&gt;</em> element, which can contain 0, 1 or more <em>&lt;Animation&gt;</em> elements. Each animation defines a series of ‘frames’, where a frame represents a single image in the animation. A frame contains a Duration section, an ImageResource and a VisemeGroupName. The last one, you can forget about, it’s there because of backward compatibility reasons with the original CCS file format and should always be empty (for now). We’ve already been over the ImageResource element and the duration simply declares how long that the image should be displayed. This is expressed in milliseconds.</p>
<p>Underneath the frames, you need to declare some more info about the animation. Besides the name of the animation, which is used to start the animation in a rule’s output patterns, you have:</p>
<table border="1" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="205">EnableFrameSpeaking</td>
<td valign="top" width="699">When true, speech is allowed during the animation. When false, speech will wait until the animation is done.</td>
</tr>
<tr>
<td valign="top" width="210">HoldLastFrameForSpeak</td>
<td valign="top" width="695">Is currently not used and can be true or false.</td>
</tr>
<tr>
<td valign="top" width="214">FirstFrameUnderlay</td>
<td valign="top" width="691">When true, the complete background is hidden and the first frame of the animation is used as background</td>
</tr>
<tr>
<td valign="top" width="218">BackgroundSuppress</td>
<td valign="top" width="688">This element can be declared multiple times. Each element contains the name of a background image that needs to be hidden while the animation is running.</td>
</tr>
<tr>
<td valign="top" width="221">ZIndex</td>
<td valign="top" width="685">Optionally determines the ZIndex at which the animation is displayed. This is useful to move parts in front or behind other parts. The background always has a ZIndex of 0.</td>
</tr>
</tbody>
</table>
<p>It might seem a tremendous task at first to declare every frame in an animation like this. But it turns out that most animations can be build using between 3 and 7 images, sometimes reusing images to build sequences of about 10-20 frames. So all in all, this is still manageable.</p>
<h4>VisemeGroups</h4>
<p>The next section declares the images used for lip-syncing. The basic structure looks like the following xml snippet (note that it doesn’t contain an entry for all 22 viseme images, just the first 2).</p>
<blockquote><p>  &lt;VisemeGroups&gt;<br />
&lt;VisemeGroup&gt;<br />
&lt;Name&gt;Default&lt;/Name&gt;<br />
&lt;ZIndex&gt;1&lt;/ZIndex&gt;<br />
&lt;VisemeImages&gt;<br />
&lt;VisemeImage&gt;<br />
&lt;VisemeIndex&gt;0&lt;/VisemeIndex&gt;<br />
&lt;ImageResource&gt;images\Kima00.png&lt;/ImageResource&gt;<br />
&lt;/VisemeImage&gt;<br />
&lt;VisemeImage&gt;<br />
&lt;VisemeIndex&gt;1&lt;/VisemeIndex&gt;<br />
&lt;ImageResource&gt;images\Visemes\Kima03 EH.png&lt;/ImageResource&gt;<br />
&lt;/VisemeImage&gt;<br />
&lt;/VisemeImages&gt;<br />
&lt;/VisemeGroup&gt;<br />
&lt;/VisemeGroups&gt;</p></blockquote>
<p>The file format already allows for multiple viseme groups to be declared, although at the time of writing, only the first one is used (and supported). Multiple viseme groups could be useful for moving heads: a viseme group for each head position.  As such, the ‘name’ element for each group would be used to reference a group. But, as already mentioned, this is something for the future.</p>
<p>The ZIndex element defines the Z-order that should be applied to the viseme images. This allows you to manipulate the order of the images. For instance, you could use this to move a part of the background image on top of the viseme images.</p>
<p>Next comes the ‘VisemeImages’ group, with a ‘VisemeImage’ for each mouth position + optionally 1 extra image for the silence position.  Each VisemeImage contains an ImageResource (as described above) and an Index (VisemeIndex), which determines the letter that the image represents (so the order in which the VisemeImages are declared, is irrelevant).</p>
<p>The silence is primarily for backward compatibility with verbot characters (which don’t have a separate background section). If you have a ‘Background’ section, the viseme image at index 0, will be skipped, otherwise it’s used as the background. That’s why the ‘background’ section has to be declared before the VisemeGroups.</p>
<h4>IdleLevels</h4>
<p>Idle time is the time when a bot doesn’t have anything to say or any emotion to show. In other words, nothing’s happening. In order to create the illusion of being alive during this period, you can use idle levels to start animations (that were declared in the ‘Animations’ section) when the bot is idle. Here’s the definition:</p>
<blockquote><p>  &lt;IdleLevels&gt;<br />
&lt;IdleLevel&gt;<br />
&lt;MinStartDelay&gt;5&lt;/MinStartDelay&gt;<br />
&lt;MaxStartDelay&gt;15&lt;/MaxStartDelay&gt;<br />
&lt;MinDuration&gt;5&lt;/MinDuration&gt;<br />
&lt;MaxDuration&gt;15&lt;/MaxDuration&gt;<br />
&lt;MinInterval&gt;2&lt;/MinInterval&gt;<br />
&lt;MaxInterval&gt;8&lt;/MaxInterval&gt;<br />
&lt;AnimationNames&gt;<br />
&lt;AnimationName&gt;earsmove1&lt;/AnimationName&gt;<br />
&lt;AnimationName&gt;eyes squint&lt;/AnimationName&gt;<br />
&lt;/AnimationNames&gt;<br />
&lt;/IdleLevel&gt;<br />
&lt;/IdleLevels&gt;</p></blockquote>
<p>Like most other sections, you can again declare multiple IdleLevels. In this example, we only have 1 though. The idea behind multiple IdleLevels is this: when the idle time starts, the first idle level is activated, but when the duration of the level has ended, the next one is activated until the last one is reached, which remains running until some activity happens. This way, you can have a bot act differently after x amount of idle time, progressively.</p>
<p>Each idle level contains 4 bits of information: 3 time ranges and a list of animation-names that the idle level can use. Each range has a Min and Max component, indicating the lower and upper part of the range. The different times are used for:</p>
<table border="1" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="61">Delay</td>
<td valign="top">A value is selected at random from this range to delay the start of the animation (which is otherwise immediately after the last output)</td>
</tr>
<tr>
<td valign="top" width="61">Duration</td>
<td valign="top">A value is selected from this range to determine the duration of the idle level. This is only used if the level isn’t the last in the list.</td>
</tr>
<tr>
<td valign="top" width="61">Interval</td>
<td valign="top">Each time an animation finishes, a value is selected from this range to determine how long the system should wait before it starts another animation from the list (this is selected at random).</td>
</tr>
</tbody>
</table>
<h4>BackgroundAnimations</h4>
<p>Idle levels are very useful to create a sense of liveliness, but they can be expanded upon. Sometimes, it’s also useful to have animations run all the time in the background, even while speaking. A good example of this could be breathing or eye blinking. For this purpose, there is the final section, called ‘BackgroundAnimations’, which contains a series of special animation definitions, all of which will run all the time, in a loop. Here’s the definition:</p>
<blockquote><p>  &lt;BackgroundAnimations&gt;<br />
&lt;Animation&gt;<br />
&lt;AnimationFrames&gt;<br />
&lt;AnimationFrame&gt;<br />
&lt;Duration&gt;10&lt;/Duration&gt;<br />
&lt;ImageResource&gt;images\other\Kima Nose Flare (01).png&lt;/ImageResource&gt;<br />
&lt;VisemeGroupName/&gt;<br />
&lt;/AnimationFrame&gt;<br />
&lt;AnimationFrame&gt;<br />
&lt;Duration&gt;10&lt;/Duration&gt;<br />
&lt;ImageResource&gt;images\other\Kima Nose Flare (02).png&lt;/ImageResource&gt;<br />
&lt;VisemeGroupName /&gt;<br />
&lt;/AnimationFrame&gt;<br />
&lt;/AnimationFrames&gt;<br />
&lt;Name&gt;nosebreath&lt;/Name&gt;<br />
&lt;LoopStyle&gt;VarTimer&lt;/LoopStyle&gt;<br />
&lt;MinStartDelay&gt;1&lt;/MinStartDelay&gt;<br />
&lt;MaxStartDelay&gt;3&lt;/MaxStartDelay&gt;<br />
&lt;ZIndex&gt;2&lt;/ZIndex&gt;<br />
&lt;/Animation&gt;<br />
&lt;/BackgroundAnimations&gt;</p></blockquote>
<p>Unlike idle levels, the animation is declared inline this time.  That’s because there is a small difference in declaration between this type and idle/emotion animations. Another reason is to make certain that background animations can’t be used as emotions (they run all the time anyway, no need to start them separately).</p>
<p>The way that the individual frames are declared is the same as with regular animations: a list of ‘AnimationFrame’ objects that define the image, the duration and an optional viseme group. The difference is in the extra options: there is an extra ‘LoopStyle’ and ‘StartDelay’ range. ZIndex is also the same as in animations: It determines the Z-Order at which the animation is displayed, the higher the number, the more to the top it will be.</p>
<p>The ‘StartDelay’ range is used to build in a small idle time between each animation loop. Each time that the animation needs to be started, a value is selected at random from within the range. That’s the delay which will be used. Not every loop-style makes use  of this delay, some do, others skip it.</p>
<p>Finally, the LoopStyle element can have the following values:</p>
<table border="1" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="100">None</td>
<td valign="top">The least useful: no looping at all.</td>
</tr>
<tr>
<td valign="top" width="100">Jojo</td>
<td valign="top">At each start, the end frame is selected at random from the entire list of frames. When this end is reached, the animation is played in reverse until the first frame is reached and the loop starts again.  Each start is delayed by x amount of time, where x is a random number picked from the StartDelay range.</td>
</tr>
<tr>
<td valign="top" width="100">FrontToBack</td>
<td valign="top">The images is played continuously, front to back without pauses.</td>
</tr>
<tr>
<td valign="top" width="100">VarTimer</td>
<td valign="top">The images is played front to back in loop, but each time with a delay that is selected from the StartDelay range.</td>
</tr>
</tbody>
</table>
<p>And that’s it. Once you’ve got all these sections laid down, you’ve got yourself a character. All that remains, is to copy the files to the {my documents}\NND\Characters dir and restart the chatbot designer. Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://bragisoft.com/2011/12/creating-your-own-characters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a bot&#8217;s memory</title>
		<link>http://bragisoft.com/2011/12/using-a-bots-memory/</link>
		<comments>http://bragisoft.com/2011/12/using-a-bots-memory/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 19:22:23 +0000</pubDate>
		<dc:creator>bragi</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[chatbot designer]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://bragisoft.com/2011/12/using-a-bots-memory/</guid>
		<description><![CDATA[A bot has 2 types of memory at it’s disposal: short and long term memory, but with some tricks, a mid term memory function can also be simulated. Short term memory Or also called ‘volatile’ as it’s content is lost in time, can be accessed through the use of variables in the patterns.&#160; Input patterns [...]]]></description>
			<content:encoded><![CDATA[<p>A bot has 2 types of memory at it’s disposal: short and long term memory, but with some tricks, a mid term memory function can also be simulated.</p>
<h1>Short term memory</h1>
<p>Or also called ‘volatile’ as it’s content is lost in time, can be accessed through the use of variables in the patterns.&#160; Input patterns support 2 types of variables: regular variables, which can collect any type of content and thesaurus variables, which can only collect words that are equal to or are children of the thesaurus item referenced by the variable (in other words, they are filters). Asset variables, a third type of variable, is theoretically also possible, but not yet implemented. These are also filters, like thesaurus variables, except that they filter on concrete (asset) data instead of abstract (thesaurus) data.</p>
<p>The basic usage of this short term memory is simple: to provide a mechanism for collecting values of variable parts in the input patterns so that these values can later be used in the output and do-patterns for providing a response and feeding the long term memory.</p>
<h2>Regular variables</h2>
<p>As already mentioned, regular variables can’t filter on the values that they collect, but they are optionally able to limit the number of words that they collect, either as a specific number or a range. Here are some short <em>input-pattern</em> examples:</p>
<blockquote><p><code>
<p>I’m called $var[.]</p>
<p>I’m called $var:1[.]</p>
<p>I’m called $var:1-3[.]</p>
<p>I’m called $var:4:CollectSpaces[.]</p>
<p>Copy $from:collectSpaces to $to:collectspaces</p>
<p>   </code></p></blockquote>
<p>The $var constitutes the variable (‘$’ is the variable operator, followed by the name). Every word (except spaces, if ‘CollectSpaces’ is not specified) is collected by this variable until the pattern matcher finds a word in the input that follows the variable in the pattern or until the range is fully used. This variable can then be used in the output and do-patterns of the same rule (and also from other rules, if you are certain that the input-pattern is part of the result set, which can be checked upon, more on that&#160; later). </p>
<h2>Thesaurus variables</h2>
<p>Thesaurus variables are a special type of input variable: they provide a mechanism for filtering possible input to a sub-branch of the thesaurus. If the input can’t be found in that branch, the pattern wont be activated. So, this is a filtering mechanism. The actual value that was found, can be accessed like any regular variable, through it’s name. There is no mechanism for providing length or range values though since they have no meaning here: it’s either an exact match with a thesaurus node or it isn’t. Here are some examples:</p>
<blockquote><p><code>
<p>I’m called ^var:noun [.]</p>
<p>I’m called ^var:noun.name [.]</p>
<p>I’m called ^var:noun.(first name) [.]</p>
<p>I’m ^var:number years old[.]</p>
<p>   </code></p></blockquote>
<p>A thesaurus variable always starts with&#160; a ‘^’ followed by it’s name. The ‘:’ indicates the start of the thesaurus path and should always be followed with a POS (part of speech). These are the supported POS values: </p>
<p><strong><em>noun, verb, adjective (or adj), adverb (or adv), article (or art), pronoun (or pron), conjunction (or conj), interjection (or inter), preposition (or prep), number, integer (or int), double</em></strong>.</p>
<p>You can stop there, which would indicate that you want any word of the specified part of speech. You can also continue the path with a ‘.’ followed by a text value (put into brackets if it’s multiple words).&#160; This allows you to further refine the thesaurus path. Note that you don’t need to start at the root of the thesaurus that you are using, just as long as you are comfortable that it will point to a unique word within the tree (otherwise you can have multiple matches,… which might also be desirable). Note that the last 3 POS values (number, int and double) can’t have any further path specifiers, they have to stop at the POS value.</p>
<h2>Collecting multiple values</h2>
<p>It’s possible to use the same variable name multiple times in the same input pattern. This allows you to collect a list of values for the same variable. Thesaurus and regular variables can be intermixed. Here are some examples:</p>
<blockquote><p><code>
<p>{$name ,} and ^name:noun.name are here&#160; //catches something like: <em>Tom, Flint and Warner are here</em></p>
<p>   </code></p></blockquote>
<p> <code></code>
<p>Note that there is a difference when a regular variable collects multiple words at a single location compared to when it collects single words at multiple locations in the pattern. When a single location collects multiple words, this group of words is combined into a compound word (as in ‘baby gear’), but when words are collected at multiple locations, a list is created. This list can later-on (in the long term memory) be labeled as AND, OR or LIST (unspecified).</p>
<h2>Using short term memory</h2>
<p>Up until now, we’ve only been talking about how to collect the values for the short term memory.&#160; Of course, there’s no point in doing that unless you can actually do something with these values. That’s done in the output and do-patterns. As already mentioned, you access the content through the variable names. Here are some output-pattern examples:</p>
<blockquote><p><code>
<p>Ok, I see, your name is $var\.</p>
<p>So you are $var, nice to meet you!</p>
<p>So, you can $verb:Infinitive, can you?</p>
<p>I see, $name:interleaf(&quot;\, &quot;, &quot; and &quot;)</p>
<p>   </code></p></blockquote>
<p>At it’s most basic form you specify the ‘$’ operator followed by the name of the variable that you want to render. Note that you should always use the ‘$’ operator while rendering, even if the value was collected using a thesaurus variable ( ^ ). This is because the ^ operator is used to access the long-term, abstract memory (the thesaurus data itself).</p>
<p>Rendering the value as it was collected, is useful but often we want to do a little more, sometimes we need to do some kind of change or transformation to the values, like conjugating a verb, get the plural of a noun or find the attribute for the value (see later),…&#160; This is done through functions that you define in the path. A function starts with a ‘:’ followed by the name of the function (a list of all the available functions will come shortly) and optionally a list of arguments for the function, specified between brackets and separated by a ‘,’. Note: if you use the ‘,’ sign as an argument value, it must always be escaped with a \ Also, if you need to preserve spaces, the argument should be placed between brackets (as in the last example).</p>
<h1>Long term memory</h1>
<p>The second major type of memory that’s available to the bot is used to store and retrieve values so that they can cross the boundary of the single-shot input/response system, in other words: <em>long term memory</em>. Currently, there are 2 types: <a href="http://janbogaerts.name/index.php/2010/07/12/objects-and-assets-abstract-and-concrete/" target="_blank">a thesaurus structure for storing abstract information and assets which maintain concrete knowledge</a>.&#160; Typically, you use this data to compare against short-term variables, render previously stored data or store newly acquired knowledge.</p>
<h2>The thesaurus</h2>
<p>As already mentioned, thesaurus variables are used in the input-patterns so that the valid content for a variable can be filtered.&#160; When the ‘^’ operator is used in output, conditional or do patterns however, it behaves a little bit different: it becomes a value generator instead of collector.&#160; Consider the following output patterns:</p>
<blockquote><p>We are in ^noun.month[$time:month-1]</p>
<p>I like ^noun.food.(Italian food):random</p>
<p>I ^verb.be:conjugate(#bot) trying something complicated&#160;&#160; //render: I am trying something complicate</p>
</blockquote>
<p>As you can see, a thesaurus output-path contains a mix of statics and functions which eventually result into 0, 1 or 2 values. Because they render values and don’t collect it, no name is required. You can use the [] operator to select a child at a specific index position, like in the first example, which is used the generate the name of the month instead of a number. Note that the index is 0 based. In case that a static path item contains multiple words (like ‘Italian food’), use () brackets to group them. Also, if there are no values found for the path, any spaces that follow it in the output are stripped.</p>
<p>You can also store new data in the thesaurus. This is done in the calculation or do-sections. There are basically 2 operations that you can do at 2 different levels: you can add or remove values either as thesaurus children or as conjugations/references. To explain the difference between children and conjugations or references, take the following examples and how they are stored:</p>
<table border="1" cellspacing="0" cellpadding="2" width="620">
<tbody>
<tr>
<td valign="top" width="326">A house is a building</td>
<td valign="top" width="292">^noun.building += house</td>
</tr>
<tr>
<td valign="top" width="326">The plural of bird is birds</td>
<td valign="top" width="292">^noun.bird-&gt;plural = birds</td>
</tr>
<tr>
<td valign="top" width="326">The opposite of good is bad</td>
<td valign="top" width="292">^adj.good-&gt;opposite = bad</td>
</tr>
<tr>
<td valign="top" width="326">seagulls are a type of the singular of birds</td>
<td valign="top" width="292">^noun.birds-&gt;singular += seagull</td>
</tr>
<tr>
<td valign="top" width="326">The superlative of the opposite of good is worst</td>
<td valign="top" width="292">^adj.good-&gt;opposite-&gt;superlative = worst</td>
</tr>
</tbody>
</table>
<p>In the first example, we are declaring a child relationship: house is a building. If you have done any coding before, the syntax might be vaguely familiar: the left part of the statement contains the thesaurus path, the ‘+=’ operator to indicate that we want to create an ‘is child’ relationship, and on the right-side comes the value that needs to be stored. This could be a variable reference, an asset, another thesaurus path,….</p>
<p>The second and third examples look identical and for all intent and purpose, they are. The only difference is on the inside: in the first example ‘plural’ is a known conjugation form, ‘opposite’ is not. The statement used for storing this information, is a little bit different. First of, the thesaurus path ends with a ‘-&gt;’ followed by the name of the relationship that you would like to edit. Next, we use the ‘=’ assign operator instead of ‘+=’ to indicate that we want to change the relationship value.</p>
<p>The 2 last examples demonstrate what happens when you use the –&gt; operator together with the += assignment or when you use multiple –&gt; operators. When combining += with –&gt;, you will first calculate the full result of the left side.&#160; So in our example, we first take the singular value of ‘birds’, then we add a child to this result, which is ‘bird’. A similar thing happens when you use multiple –&gt; operators: the value is calculated.</p>
<p>Except for the POS value at the start of the path, every other item in a thesaurus path can be a static, a variable reference, an asset path or another thesaurus path. This allows for tremendous flexibility in the way that you store data. We could generalize some of the previous statements like this:</p>
<blockquote><p>^noun.building += $value</p>
<p>^noun.($singular)-&gt;plural = $value</p>
<p>^adj.good-&gt;($relationship) = $value</p>
</blockquote>
<p>Removing values from the thesaurus is done using the ‘-=’ operator or by assigning to the ‘null’ value. Like with storing, all parts can be static or variable. This is probably best explained with some examples:</p>
<table border="1" cellspacing="0" cellpadding="2" width="368">
<tbody>
<tr>
<td valign="top" width="186">A house is not a building</td>
<td valign="top" width="180">^noun.building -= house</td>
</tr>
<tr>
<td valign="top" width="186">Bird has no plural</td>
<td valign="top" width="180">^noun.bird-&gt;plural = null</td>
</tr>
<tr>
<td valign="top" width="186">A $value is not a $node [.]</td>
<td valign="top" width="180">^noun.($node) -= $value</td>
</tr>
</tbody>
</table>
<h2>Assets</h2>
<p>As already mentioned, assets could theoretically also be used in the input, but that’s not yet supported. If someone has a need for this, let me know, it’s not that tremendously difficult to add, it just creates a little more overhead.</p>
<p>Anyway, like thesaurus paths, asset paths can be used in output, do and conditional patterns. They are declared in much the same way as thesaurus paths by using the ‘.’ (dot) or ‘:’ (function) operators, except that they start with a # and ‘–&gt;’ (links) are not supported.&#160; For the thesaurus path, the ‘.’ (dot) operator selected a child node, for assets, this selects an attribute value. Here are a few output examples:</p>
<blockquote><p>My name is #bot.name</p>
<p>your children are called #user.child.name:interleaf(“\, “, “ and “)</p>
<p>a book is made of $(#(^noun.book).component.name):interleaf(“\, “, “ and “)</p>
</blockquote>
<p><em>Bot</em> and <em>User</em> are hardcoded assets and refer to <em>me</em> and <em>you</em> respectively, from the bot’s point of view. In the third example, the first value in the asset path, is actually a thesaurus path. This results in concrete information about abstract data (a book is made of paper, ink, glue,…). </p>
<p>Also in the last example, the entire asset is the first value in a normal variable path, because an asset path will always calculate it’s result based on 1 value, if the previous path item resulted in multiple values (like ‘component), the next part of the path is calculated as if there was only 1 result (internally, a split is done), and only at the end of the path, all results are joined. This doesn’t work for ‘:interleaf’, it expects a list of values to combine. A variable path can do this, hence this construct.</p>
<p>To store asset data, the = (assign), += (assign add), != (assign not) and !+= (assign add not) operators are used. Removing data is done with the –= (assign remove) operator.&#160;&#160; Take the following examples (input statement to the left, how to store/remove it to the right): </p>
<table border="1" cellspacing="0" cellpadding="2" width="431">
<tbody>
<tr>
<td valign="top" width="214">My eyes are blue</td>
<td valign="top" width="215">#user.eye.color = blue</td>
</tr>
<tr>
<td valign="top" width="214">I have a dog.</td>
<td valign="top" width="215">#user += dog</td>
</tr>
<tr>
<td valign="top" width="214">My dog’s name is not doggy</td>
<td valign="top" width="215">#user.dog.name != doggy</td>
</tr>
<tr>
<td valign="top" width="214">I don’t have a tiger</td>
<td valign="top" width="215">#user !+= tiger</td>
</tr>
<tr>
<td valign="top" width="214">I have big blue eyes</td>
<td valign="top" width="215">#user.eye.color:extra.size = big</td>
</tr>
<tr>
<td valign="top" width="214">My eyes are also brown</td>
<td valign="top" width="215">#user.eye.color &amp;= brown</td>
</tr>
<tr>
<td valign="top" width="214">my eyes are brown or blue</td>
<td valign="top" width="215">#user.eye.color = brown          <br />#user.eye.color |= blue</td>
</tr>
<tr>
<td valign="top" width="214">my eyes are brown, blue</td>
<td valign="top" width="215">#user.eye.color = blue          <br />#user.eye.color ;= blue</td>
</tr>
<tr>
<td valign="top" width="214">Remove my dog</td>
<td valign="top" width="215">#user –= dog</td>
</tr>
<tr>
<td valign="top" width="214">remove my eye color</td>
<td valign="top" width="215">#user.eye –= color</td>
</tr>
</tbody>
</table>
<p>When you use the ‘=’ (assign) operator, you declare an ‘is’ relationship: ‘color’ becomes the attribute, ‘blue’ the value. Since ‘blue’ is not an asset, but just a word, we have a terminator: blue can’t have any more children.&#160; But, there is a way to cross this border, by using the ‘:extra’ function, as in the 5th example.    <br />If instead, you want to declare that something <em>is not</em> y, you can use the not-assign operator (!=). This allows you to still store the information that something <em>is not</em>. Be careful though, there is a thin line between <em>being</em> and <em>not being</em>, if you don’t check on this in the conditions, you might say that something is, while it isn’t (sounds familiar?).</p>
<p>The ‘+=’ or assign-add operator is used to create ‘has’ relationships, like in the second example. The major difference with the first one is that ‘dog’ becomes the attribute and the value becomes a new asset that will represent the dog. There is also the not version:&#160; !+= which is used to indicate that the asset doesn’t have something.</p>
<p>If you want to create a list of values, you can use either the ‘;=’, ‘|=’ or ‘&amp;=’ operators. The first one creates (or adds to) a generic list, the second is for OR lists and the last for AND lists. The generic list operator can add to any type of list without modifying it’s type. The |= and &amp;= operators will change a generic list to OR and AND respectively. When you try to add an item to an OR list with an AND operator, you create a new list object that contains the original OR list and the newly added item. the same goes for an OR operator with an AND list.</p>
<p>Finally, you can also actually remove an attribute value. This is done with the ‘-=’ operator. The&#160; right-side should be the name of the attribute that you want to remove. The value that is removed get’s cleaned up automatically, so if the value was another asset which isn’t referenced anymore after the remove, the entire asset will be destroyed. (Removing items from a list has to be done with the ‘:Remove’ function.)</p>
<p>As already mentioned, every asset value can always use the ‘:extra’ function to get to a sub-asset. There are a few other functions worth mentioning which allow you to expand the dataset that the asset can store. These are used to declare things like when, where, why, how, amount,… Functions are:</p>
<table border="1" cellspacing="0" cellpadding="2" width="767">
<tbody>
<tr>
<td valign="top" width="67">:why</td>
<td valign="top" width="415">provides access to the ‘reason’ path</td>
<td valign="top" width="283">#user.dog:why = “likes dogs”</td>
</tr>
<tr>
<td valign="top" width="67">:when</td>
<td valign="top" width="415">provides access to the ‘time’ path</td>
<td valign="top" width="283">#user.dog:when = “10 years ago”</td>
</tr>
<tr>
<td valign="top" width="67">:where</td>
<td valign="top" width="415">provides access to the ‘location’ path</td>
<td valign="top" width="283">#user:where.preposition = in          <br />#user:where.object = chair           <br />or #user:where = “in the chair”</td>
</tr>
<tr>
<td valign="top" width="67">:how</td>
<td valign="top" width="415">provides access to the ‘method’ path</td>
<td valign="top" width="283">#user.dog:how = received from some friends who had a bit of an accident</td>
</tr>
<tr>
<td valign="top" width="67">:amount</td>
<td valign="top" width="415">Allows you to specify that the same value should be counted multiple times. When the value is an asset, it indicates how many identical assets should be counted.</td>
<td valign="top" width="283">#User.hand:count = 2</td>
</tr>
<tr>
<td valign="top" width="67">:who</td>
<td valign="top" width="415">provides access to the ‘persons’ path</td>
<td valign="top" width="283">#user.see:who = man&#160; //user sees a man</td>
</tr>
<tr>
<td valign="top" width="67">:what</td>
<td valign="top" width="415">provides access to the ‘objects’ path</td>
<td valign="top" width="283">#user.eat:what = food&#160; //user eats food</td>
</tr>
<tr>
<td valign="top" width="67">:then</td>
<td valign="top" width="415">provides access to the causality path</td>
<td valign="top" width="283">#user.eat:then.who = #user          <br />#user.eat:then.attribute = state           <br />#user.eat:then.value != hungry           <br />or #user.eat:then = “I’m not hungry”</td>
</tr>
</tbody>
</table>
<h2>Mid term memory</h2>
<p>Some functions, like the ‘:attribute’ function (which is able to extract, for instance,&#160; ‘color’ from ‘blue’, or ‘name’ from ‘Jan), make use of context, if it is declared. This context is usually a list of asset paths that point to some memory region of the bot. The idea is that, together with a response, you also generate the meaning of what was said and store this information in the asset that you declared as <em>context</em>. If you refresh this context on each run, you effectively have simulated mid term memory.</p>
<p>The basic setup for using mid term memory consist out of:</p>
<ul>
<li>a global context declaration so that the system knows where to go look for contextual info. </li>
<li>some global do-after-each-statement patterns. These are responsible for erasing the previously collected data and possibly creating an echo. </li>
<li>some global do-on-startup patterns which will remove any data from the previous run. </li>
<li>do-patterns on each rule to actually collect the knowledge about what is being said. </li>
</ul>
<blockquote><p>Context:</p>
<p>#bot.memory.subject</p>
<p>#bot.memory.attribute</p>
<p>#bot.memory.object</p>
<p>#bot.PrevMem.subject</p>
<p>#bot.PrevMem.attribute</p>
<p>#bot.PrevMem.object</p>
<p>&#160;</p>
<p>Do after output:</p>
<p>#bot.prevmem = #bot.memory</p>
<p>#bot –= memory</p>
<p>&#160;</p>
<p>do on startup:</p>
<p>#bot –= memory</p>
<p>#bot –= prevmem</p>
<p>&#160;</p>
<p>on pattern (example pattern = I like $value [.])</p>
<p>#bot.memory.subject = #user</p>
<p>#bot.memory.attribute = like</p>
<p>#bot.memory.object = $value</p>
<p>&#160;</p>
</blockquote>
<p>Mid term memory also becomes very useful once you start working with recursive sub rules/topics. This technique allows you to rebuild the extracted data. </p>
<h1>Patterns</h1>
<p>All the different types of patterns (input, output, conditional) could also be considered as a form of long term memory. Internally, they are stored in exactly the same manner as all the other data. As such, they can also be manipulated in a similar manner as the other long term data. Although, at the time of writing, there is still limited support for this.&#160; More on that to come.</p>
]]></content:encoded>
			<wfw:commentRss>http://bragisoft.com/2011/12/using-a-bots-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.bragisoft.com @ 2012-02-22 22:23:14 -->
