<?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>Neural Network Design blog</title>
	<atom:link href="http://janbogaerts.name/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://janbogaerts.name</link>
	<description>My take on neural networks, AI and more</description>
	<lastBuildDate>Sun, 13 May 2012 08:11:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Aici for android 0.1.7</title>
		<link>http://janbogaerts.name/index.php/2012/04/30/aici-for-android-0-1-7/</link>
		<comments>http://janbogaerts.name/index.php/2012/04/30/aici-for-android-0-1-7/#comments</comments>
		<pubDate>Mon, 30 Apr 2012 13:41:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AICI]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[releases]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/?p=935</guid>
		<description><![CDATA[Just did a new release of the android app. Not much new: it can now report battery state, voltage and temp + some speed improvements. Read more on the release post.]]></description>
			<content:encoded><![CDATA[<p>Just did a new release of the android app. Not much new: it can now report battery state, voltage and temp + some speed improvements. Read more on <a href="http://bragisoft.com/2012/04/aici-for-android-1-7/" target="_blank">the release post</a>.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=935" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2012/04/30/aici-for-android-0-1-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chatbot battles</title>
		<link>http://janbogaerts.name/index.php/2012/04/24/chatbot-battles/</link>
		<comments>http://janbogaerts.name/index.php/2012/04/24/chatbot-battles/#comments</comments>
		<pubDate>Tue, 24 Apr 2012 11:57:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bots]]></category>
		<category><![CDATA[competitions]]></category>
		<category><![CDATA[chatbot battles]]></category>
		<category><![CDATA[chatterbox challenge]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/?p=930</guid>
		<description><![CDATA[Looks like there is a new competition in town. It’s going to replace the chatterbox challenge, which had it’s last competition this year (it turns out this is something extra, separate from the chatterbox challenge). Kudos to Steve Worswick for getting it up and running so fast.]]></description>
			<content:encoded><![CDATA[<p>Looks like there is a <a href="http://www.chatbotbattles.com/" target="_blank">new competition in town</a>. <del datetime="2012-04-24T12:06:15+00:00">It’s going to replace the chatterbox challenge, which had it’s last competition this year</del> (it turns out this is something extra, separate from the chatterbox challenge). Kudos to Steve Worswick for getting it up and running so fast.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=930" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2012/04/24/chatbot-battles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New release</title>
		<link>http://janbogaerts.name/index.php/2012/04/20/new-release-2/</link>
		<comments>http://janbogaerts.name/index.php/2012/04/20/new-release-2/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 14:58:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[releases]]></category>
		<category><![CDATA[Roadmap]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/?p=927</guid>
		<description><![CDATA[There is finally a new release available (well, actually a set of new releases). You can get them from the download section. This round took much longer than originally anticipated. I spend lots of time on wordnet and even more on improving speed / memory usage (primarily for the android platform, this is still very <a href='http://janbogaerts.name/index.php/2012/04/20/new-release-2/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>There is finally a new release available (well, actually a set of new releases). You can get them from the <a href="http://bragisoft.com/download/" target="_blank">download section</a>. This round took much longer than originally anticipated. I spend lots of time on wordnet and even more on improving speed / memory usage (primarily for the android platform, this is still very much an ongoing task). And lets not forget all the preparations I have already made for the next release.</p>
<p>So, what’s new: </p>
<ul>
<li>android version </li>
<li>manage the android device from within the application </li>
<li>updated asset editor </li>
<li>a new chat-log history view (view/tool windows/chatlog history) </li>
<li>some internal fixes </li>
<li>improved voice input (new setting available for this in the ‘chatbot properties’ window) </li>
<li><a href="http://www.ebswift.com/OpenSource/WordNetSQLServer/" target="_blank">a</a> new import of <a href="http://www.ebswift.com/OpenSource/WordNetSQLServer/" target="_blank">wordnet</a> has been made (+ the importer updated) </li>
<li>thesaurus search has been improved. </li>
<li>thesaurus import has been improved </li>
<li>thesaurus paths (in input patterns) have an extra pos&#160; filter type: ‘any’, for allowing any part of speech. </li>
<li>thesaurus paths (in input and output patterns) have an extra optional part for selecting the relationship type (ex: ^w<em>-&gt;pertainym</em>:<em>any</em>.something) </li>
<li>Rule layout has been changed: the ‘Response for’ field has been moved from the ‘output’ items to the root of the rule </li>
<li>the ‘questions-answers’ demo has been updated. </li>
<li>InvalidRespones: the list can now be assigned sequential or random (for selecting an item) </li>
<li>InvalidResponse: a single invalid response can now determine if the bot needs to continue waiting for a valid response or not. </li>
<li>thesaurus variables in input patterns </li>
<li>the layout of topic editors has been updated (use the first toolbar button to toggle between editing modes) </li>
<li>generic data import has been added which uses topics to declare how data needs to be imported. </li>
<li>changed the labeling from ‘bot says’ to ‘output’ and ‘you say’ to ‘input’ to better reflect all the usage cases and not just for defining chat statements. </li>
<li>websites can now be installed to any server you like (path can be defined) (servers must support .net 4, MVC3) </li>
<li>the css file is properly used in the websites (which allows customization) </li>
</ul>
<p>Known issues on the android:</p>
<ul>
<li>contact info needs to be partially imported at the moment, hoping to change this in the future. </li>
<li>the contact info sync screen closes extremely slow when the process is done (most likely due to&#160; garbage collection). </li>
<li>the first input is processed much slower then the rest. This is due to disk access latencies. </li>
<li>Accessing the disk is generally very slow so better caching needs to be added. </li>
<li>The contact info search algorithms are very limited at the moment, this will be fixed </li>
</ul>
<p>Coming up: lots of things are currently ‘in the docks’, sort of: </p>
<ul>
<li>My own text-to-speech engine is half way. When done, this should allow me to provide some proper lip-sync on android and web + a path for future improvements. So far, I’ve only been working on this now and again. Soon it will get my full attention and things should start to move in this area.</li>
<li>I have finally made a proper programming language to go with the neural network engine. In the past, I programmed it directly by laying out the neurons manually. This was starting to become a problem: upgrading big projects (like those that contain a wordnet db) is faster if only the code can be replaced instead of all the data. I also needed some more power in the pattern matcher statements + an easy way to extend the functionality. And finally, I would like to recover some old code I wrote for parsing images. Hence this side step. Both parser and source code generator have already been made, only the neuron renderer still needs some work.</li>
<li>I’d like to add a new view to the designer for better managing conversation flow</li>
<li>I’ve starting doing testing with my own STT. This is definitely a long term project.</li>
</ul>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=927" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2012/04/20/new-release-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>query wordnet bot</title>
		<link>http://janbogaerts.name/index.php/2012/03/28/query-wordnet-bot/</link>
		<comments>http://janbogaerts.name/index.php/2012/03/28/query-wordnet-bot/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 14:04:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bots]]></category>
		<category><![CDATA[wordnet]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/?p=917</guid>
		<description><![CDATA[This is a bot that’s been online for a while now. I’ve recently updated it and thought I should mention something about it. Basically, all it can do, is return the meaning of a word, as defined in wordnet. The latest version shows how to use the new ‘any’ pos type. If you use this, <a href='http://janbogaerts.name/index.php/2012/03/28/query-wordnet-bot/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>This is a bot that’s been online for a while now. I’ve recently updated it and thought I should mention something about it. Basically, all it can do, is return the meaning of a word, as defined in <a href="http://www.ebswift.com/OpenSource/WordNetSQLServer/" target="_blank">wordnet</a>. The latest version shows how to use the new ‘<em>any</em>’ <strong>pos type</strong>. If you use this, it will return all the occurrences of a word in the thesaurus, across all pos types. It’s used as a backup mechanism, in case the sentence doesn’t reveal what type of word should be returned (no ‘a(n)’, the, to,…). A simple fallback rule looks like:</p>
<blockquote><p><strong>input:</strong> define ^value:any<br />
<strong>calculate</strong>: $result = $value[0]:wordnetmeaning<br />
<strong>Output</strong>: ‘$value’ means $result</p></blockquote>
<p>Pretty simple.  ‘$value[0]’ is used to select the first occurrence in the thesaurus.</p>
<p>And here’s the bot itself:</p>

<!-- Iframe plugin v.2.2 (wordpress.org/extend/plugins/iframe/) -->
<iframe src="http://salesbot.bragisoft.com" width="80%" height="120" scrolling="no" class="iframe-class" frameborder="0"></iframe>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=917" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2012/03/28/query-wordnet-bot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QA1WATT</title>
		<link>http://janbogaerts.name/index.php/2012/03/28/qa1watt/</link>
		<comments>http://janbogaerts.name/index.php/2012/03/28/qa1watt/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 08:12:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AICI]]></category>
		<category><![CDATA[bots]]></category>
		<category><![CDATA[qa1watt]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/?p=913</guid>
		<description><![CDATA[Over on the Robitron list, an interesting conversation emerged about question-answer systems and how best to drive advances in this field. A proposal was made to set up a website where multiple bots could be asked the same question at once, called qa1watt. Every bot has to answer with only 1 word, and this word <a href='http://janbogaerts.name/index.php/2012/03/28/qa1watt/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Over on the <a href="http://tech.groups.yahoo.com/group/Robitron/" target="_blank">Robitron list</a>, an interesting conversation emerged about question-answer systems and how best to drive advances in this field. A proposal was made to set up a <a href="http://www.qa1watt.com/index.jsp" target="_blank">website where multiple bots could be asked the same question at once</a>, called qa1watt. Every bot has to answer with only 1 word, and this word has to come from a pre-determined list of possible words. If no answer can be found or the answer isn’t in the word-list, another word should be returned from the list that somehow relates to the answer or the question.</p>
<p>I thought this was an interesting setup, so I created a small test bot that tries to find a word in the word-list that is somehow related (in <a href="http://www.ebswift.com/OpenSource/WordNetSQLServer/" target="_blank">wordnet</a>) to 1 or more words in the question as a fallback when it can’t find the correct response. Besides this rule, it currently has 1 other rule to deal with some simple date-time questions. I’ll most likely add some more in the future, for testing things through. There are still some issues, but results can sometimes be interesting, surprising and bizarre.</p>
<p>Try it out for yourself here:</p>

<!-- Iframe plugin v.2.2 (wordpress.org/extend/plugins/iframe/) -->
<iframe src="http://qa1watt.bragisoft.com" width="80%" height="120" scrolling="no" class="iframe-class" frameborder="0"></iframe>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=913" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2012/03/28/qa1watt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android has no native STT</title>
		<link>http://janbogaerts.name/index.php/2012/03/23/android-has-no-native-stt/</link>
		<comments>http://janbogaerts.name/index.php/2012/03/23/android-has-no-native-stt/#comments</comments>
		<pubDate>Fri, 23 Mar 2012 08:48:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AICI]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[native]]></category>
		<category><![CDATA[STT]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/?p=910</guid>
		<description><![CDATA[I had a bit of a surprise a couple of days ago when I wanted to test android’s built-in speech-to-text module that I am currently using in Aici’s android version. It kept saying ‘No network connection’. What? I thought that this thing was native? Turns out that it isn’t. Android’s STT is using the google <a href='http://janbogaerts.name/index.php/2012/03/23/android-has-no-native-stt/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I had a bit of a surprise a couple of days ago when I wanted to test android’s built-in speech-to-text module that I am currently using in Aici’s android version. It kept saying ‘No network connection’. What? I thought that this thing was <a href="http://androidcookbook.com/Recipe.seam;jsessionid=5424397F3130CE7769FF47DD67742911?recipeId=1246&amp;recipeFrom=ViewTOC" target="_blank">native</a>? Turns out that it isn’t. Android’s STT is using the google web service to perform it’s trick, so it needs to ‘phone home’. The only thing that’s native, is the API. Well, that’s no good. So I’ll just have to build my own I guess… Damn</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=910" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2012/03/23/android-has-no-native-stt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wordnet databases</title>
		<link>http://janbogaerts.name/index.php/2012/03/15/wordnet-databases/</link>
		<comments>http://janbogaerts.name/index.php/2012/03/15/wordnet-databases/#comments</comments>
		<pubDate>Thu, 15 Mar 2012 18:38:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[wordnet]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2012/03/15/wordnet-databases/</guid>
		<description><![CDATA[I found some missing data in the windows version of the wordnet dataset. It turned out that the linux release had been updated, but not the windows installer. All of the sql database versions that I know about appear to be based on this windows version, and are therefor outdated. So I reran Bernard Bou’s <a href='http://janbogaerts.name/index.php/2012/03/15/wordnet-databases/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I found some missing data in the windows version of the <a href="http://www.ebswift.com/OpenSource/WordNetSQLServer/" target="_blank">wordnet</a> dataset. It turned out that the linux release had been updated, but not the windows installer. All of the sql database versions that I know about appear to be based on this windows version, and are therefor outdated. So I reran Bernard Bou’s <a href="http://wnsqlbuilder.sourceforge.net/" target="_blank">wordnet sql builder tool</a> on the latest wordnet files. The results can be downloaded from my <a href="http://bragisoft.com/download/" target="_blank">new download page</a>.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=904" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2012/03/15/wordnet-databases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Waiting for a profiler</title>
		<link>http://janbogaerts.name/index.php/2012/03/03/waiting-for-a-profiler/</link>
		<comments>http://janbogaerts.name/index.php/2012/03/03/waiting-for-a-profiler/#comments</comments>
		<pubDate>Sat, 03 Mar 2012 09:53:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[developement]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2012/03/03/waiting-for-a-profiler/</guid>
		<description><![CDATA[I’ve been waiting to release the android version until I got a change to profile the application cause there is a clear bottle-neck going on in the engine. Unfortunately, the performance profiler isn’t ready yet, but being built. I have a few ideas of where the problem might be, but there is no guarantee, so <a href='http://janbogaerts.name/index.php/2012/03/03/waiting-for-a-profiler/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I’ve been waiting to release the android version until I got a change to profile the application cause there is a clear bottle-neck going on in the engine. Unfortunately, the performance profiler <a href="http://stackoverflow.com/questions/8953134/method-profiler-for-mono-for-android" target="_blank">isn’t ready yet, but being built</a>. I have a few ideas of where the problem might be, but there is no guarantee, so better wait until the tool is available.</p>
<p>In the mean time though, I think I’ll prepare a simple release, which will run pretty slow.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=903" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2012/03/03/waiting-for-a-profiler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Version 0.8.8</title>
		<link>http://janbogaerts.name/index.php/2011/12/15/version-0-8-8/</link>
		<comments>http://janbogaerts.name/index.php/2011/12/15/version-0-8-8/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 18:43:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/12/15/version-0-8-8/</guid>
		<description><![CDATA[There’s a new release available which supports online bots. The bot is managed and maintained from the designer. Once done, you can upload it to the net.&#160; You can download it from here. I still have a few beta accounts left, if anyone is interested to run an online version (free), drop me a mail <a href='http://janbogaerts.name/index.php/2011/12/15/version-0-8-8/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>There’s a new release available which supports online bots. The bot is managed and maintained from the designer. Once done, you can upload it to the net.&#160; You can <a href="http://janbogaerts.name/index.php/downloads/" target="_blank">download it from here</a>.    <br />I still have a few beta accounts left, if anyone is interested to run an online version (free), drop me a mail and I’ll set you up (if there’s still room left).</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=898" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/12/15/version-0-8-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorials</title>
		<link>http://janbogaerts.name/index.php/2011/12/13/tutorials/</link>
		<comments>http://janbogaerts.name/index.php/2011/12/13/tutorials/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 20:14:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Documentation]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/12/13/tutorials/</guid>
		<description><![CDATA[I finally managed to update all the tutorials. Since it’s so close to the release date, I figured to go ahead and put them up on the new site over at www.bragisoft.com/tutorials. The site itself is still a bit of a mess, but the tutorial section is coming along nicely.]]></description>
			<content:encoded><![CDATA[<p>I finally managed to update all the tutorials. Since it’s so close to the release date, I figured to go ahead and put them up on the new site over at <a href="http://www.bragisoft.com/tutorials">www.bragisoft.com/tutorials</a>. The site itself is still a bit of a mess, but the tutorial section is coming along nicely.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=895" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/12/13/tutorials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>website woes</title>
		<link>http://janbogaerts.name/index.php/2011/12/08/website-woes/</link>
		<comments>http://janbogaerts.name/index.php/2011/12/08/website-woes/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 12:24:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/12/08/website-woes/</guid>
		<description><![CDATA[Argg, while doing some maintenance with the ‘online file explorer’ instead of a regular ftp manager, I accidentally wiped out the entire root directory. The database remained in tacked though, so no posts were lost, but lots of images are gone. I’m hoping that by tomorrow everything is up again. Sorry for the inconvenience. Ahh <a href='http://janbogaerts.name/index.php/2011/12/08/website-woes/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Argg, while doing some maintenance with the ‘online file explorer’ instead of a regular ftp manager, I accidentally wiped out the entire root directory. The database remained in tacked though, so no posts were lost, but lots of images are gone. I’m hoping that by tomorrow everything is up again. Sorry for the inconvenience.    <br />Ahh well, lets just file this one under: win some, loose some.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=883" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/12/08/website-woes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New release</title>
		<link>http://janbogaerts.name/index.php/2011/12/01/new-release/</link>
		<comments>http://janbogaerts.name/index.php/2011/12/01/new-release/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 18:27:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[releases]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/12/01/new-release/</guid>
		<description><![CDATA[With today’s post comes a new release: version 0.8.7. Not just so that it includes the demo for the new tutorial, but also to clean up some bugs. Most important items: The spell checker has been cleaned up some. The custom dictionary is now shared across the entire application. There was still a bug in <a href='http://janbogaerts.name/index.php/2011/12/01/new-release/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>With today’s post comes a new release: version 0.8.7. Not just so that it includes the demo for the new tutorial, but also to clean up some bugs. Most important items:</p>
<ul>
<li>The spell checker has been cleaned up some. The custom dictionary is now shared across the entire application. </li>
<li>There was still a bug in the core split functionality that sometimes resulted in incorrect weights for an object when the same object was the result of multiple paths, but with different weights. </li>
<li>Asset editors now have a child topic-editor by default in the project view. </li>
<li>Some cleanups in the import/export functionality of the thesaurus and assets. </li>
<li>a bug in the handling of variables in patterns (which resulted in invalid value refs sometimes) is also fixed.</li>
<li>a new tutorial that shows how to do questions, answers and redirections. </li>
</ul>
<p>Get the latest release from <a href="http://janbogaerts.name/index.php/downloads/" target="_blank">the download page</a>.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=858" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/12/01/new-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scraping the Internet</title>
		<link>http://janbogaerts.name/index.php/2011/11/13/scraping-the-internet/</link>
		<comments>http://janbogaerts.name/index.php/2011/11/13/scraping-the-internet/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 12:48:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[chatbot designer]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Screencasts]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[scraping]]></category>
		<category><![CDATA[screencasts]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/11/13/scraping-the-internet/</guid>
		<description><![CDATA[Getting information from the internet into a chatbot’s output can be very useful at some times. Not only to show continuously changing values, like weather information, but it can potentially also be used for learning, although the latter is obviously a little trickier. Retrieving, or scraping info from the internet can be done remarkably easy <a href='http://janbogaerts.name/index.php/2011/11/13/scraping-the-internet/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Getting information from the internet into a chatbot’s output can be very useful at some times. Not only to show continuously changing values, like weather information, but it can potentially also be used for learning, although the latter is obviously a little trickier.</p>
<p>Retrieving, or scraping info from the internet can be done remarkably easy with the chatbot designer. Here’s a screencast of a bot that retrieves weather information from the <a href="http://googleweather.riaforge.org/" target="_blank">google weather api</a>.</p>
<div class="lyMe hidef" id="WYL_ppfuKxQkSJo" style="width:640px;height:360px;"><noscript><a href="https://youtu.be/ppfuKxQkSJo"><img src="https://img.youtube.com/vi/ppfuKxQkSJo/0.jpg" alt="" width="640" height="340" /><br />Watch this video on YouTube</a> Embedded with WP YouTube Lyte.</noscript></div>
<div class="lL"></div>
<p>In the video, a .net plug-in is used to retrieve information from the internet by means of XPaths. This plugin is included by default in the application. Note though that plug-ins are only supported in the pro version.  Basic users will be able to use these projects, but they can’t create or edit any patterns that rely on plug-ins. Also, plug-ins are loaded on a project by project basis. So if you want to use the scraping features in your own project, you will first need to make certain that the correct .net functions have been loaded. Once this has been set up though, all plug-ins will <a href="http://janbogaerts.name/wp-content/uploads/2011/11/Capture1.jpg"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" title="Capture" src="http://janbogaerts.name/wp-content/uploads/2011/11/Capture_thumb1.jpg" alt="Capture" width="396" height="212" align="right" border="0" /></a>automatically be loaded when the project is opened.</p>
<h3>Loading</h3>
<p>To load a plug-in, go to <em>view/communication channels/OS</em>. This will bring up a view like the one on the right. From here, you can load and unload dlls, classes and functions. First up is the dll. This can be loaded with one of the buttons on the toolbar. The first one gives access to the cache (dlls that have already been loaded). With the next button, you can select a file from disk. Note that, even though the ‘<em>CmdShell.dll’</em> file (which contains the scraping functions) is part of the installation, it isn’t guaranteed that it’s already loaded in cache, so you might have to select it from the ‘<em>program files/Chatbot designer pro/’</em> path. By the way, you can remove a dll by selecting it and pressing delete. Functions can be selected/deselected with the checkbox in front of the name. You can alternatively (de)select the entire class or lib at once. Notice the blue label behind each function name: this is the name that you can use in the patterns. You see, the do-patterns evaluator has no knowledge whatsoever of namespaces, classes or functions, it just knows a single name. This means that all function names should be unique across a single project. If you try to enter a duplicate name, a red box will be displayed round the newly mapped name.</p>
<p>There are quite a few functions available for scraping. Basically though, there are 3 groups: some functions to open/close web-pages, some functions to get data from those opened pages and finally the same functions that don’t require you to first open/close any files but which can do a scrape directly.</p>
<h3>Short scrapes</h3>
<p>Depending on how much data you need to retrieve, you can use one or the other technique. If there is only 1 xpath that you have to run on a page, then you can probably best use the short/direct functions that don’t require you to first open the web-page. Instead the address is supplied as an argument, together with the xpath. Here’s a list of the available quick scrapers:</p>
<table width="554" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="128"><strong>Name</strong></td>
<td valign="top" width="108"><strong>Arg 1</strong></td>
<td valign="top" width="58"><strong>Arg 2</strong></td>
<td valign="top" width="258"><strong>result</strong></td>
</tr>
<tr>
<td valign="top" width="129">ScrapeText</td>
<td valign="top" width="108">file or web path</td>
<td valign="top" width="58">XPath</td>
<td valign="top" width="258">0, 1 or more text values</td>
</tr>
<tr>
<td valign="top" width="129">ScrapeInt</td>
<td valign="top" width="108">file or web path</td>
<td valign="top" width="58">XPath</td>
<td valign="top" width="258">0, 1 or more int values</td>
</tr>
<tr>
<td valign="top" width="129">ScrapeDouble</td>
<td valign="top" width="108">file or web path</td>
<td valign="top" width="58">XPath</td>
<td valign="top" width="258">0, 1 or more floating point values</td>
</tr>
<tr>
<td valign="top" width="129">ScrapeDate</td>
<td valign="top" width="108">file or web path</td>
<td valign="top" width="58">XPath</td>
<td valign="top" width="258">0, 1 or more dates</td>
</tr>
</tbody>
</table>
<p>And a short usage example to get the temperature info from the google API for a city that’s defined in ‘<em>$place</em>’:</p>
<blockquote><p>$value = ScrapeText(&#8220;<a href="http://www.google.com/ig/api?weather=">http://www.google.com/ig/api?weather=</a>$place:interleaf(+)&#8221;, “<a href="mailto:“/xml_api_reply/weather/current_conditions/temp_c/@data">/xml_api_reply/weather/current_conditions/temp_c/@data</a>”)</p></blockquote>
<p>As you can see, the first argument specified the web-page to open. The second is an xpath to the data attribute of the ‘temp_c’ element. Note that we use ‘<em>:interleaf(+)</em>’  cause the google API expects city-names that contain multiple words to be separated with a ‘+’ like: New+York.</p>
<h3>More scraping</h3>
<p>The second scraping method is primarily useful if you need to run multiple xpaths on the same content. In this case, it’s far more economical to first retrieve the page, run all the queries on the cached file and finally, when done, release it again. This can be accomplished with the remaining scrape functions.</p>
<p>You open a file or webpage with either ‘OpenScraper’ or ‘OpenScraperHTML’. The first works on xml content, the second on html. That is, the second will convert html to xml so that the xpath can be run on it. Both return an integer that needs to be used in subsequent calls. Basically, the integer replaces the filename as a reference. It allows you to have multiple files open and to have the system run multi-threaded and let it serve multiple people at the same time.</p>
<p>The scraping functions themselves are almost identical as the quick versions, except that they take an integer as first argument instead of a path. Other then that, usage is exactly the same, with the same types: one for text, integers, doubles and dates.</p>
<p>Once you are done with the file, you have to call ‘CloseScraper’ with, as argument, the integer that was returned by ‘OpenScraper(HTML)’, so that resources can be cleaned up. This is important, if you forget to do this, the system will eventually buckle, crack and give up.<br />
In a normal usage situation, you would do a short salvo: open a page, do a few scrapes and close it again, all in 1 block, but this is not a requirement, you can keep the page open across multiple inputs. As long as you maintain a reference to the scraper (the integer) somewhere in memory so that you don’t loose track of it.</p>
<h3>Html scraping</h3>
<p>As already mentioned, html scraping is done by first converting the page into xml before the xpath is executed. This conversion can cause some ‘changes’ in the structure of the file. In other words, the path that you would calculate, based on the html file might not be correct for the xml version. This means that you best build your xpaths based on the xml version of the HTML pages.</p>
<p>The conversion routine that’s internally used by the chatbot designer is based on the <a href="http://developer.mindtouch.com/SgmlReader" target="_blank">SGMLReader</a> library. This provides a command-line tool to manually convert html to xml files. This can be very useful for building the correct query. I’ve included a direct download for the <a href="http://www.janbogaerts.name/files/sgmlreader.zip" target="_blank">command line html to xml conversion tool</a>. Here’s a short description on how to use it (taken from the original documentation):</p>
<blockquote><p>sgmlreader &lt;options&gt; [InputUri] [OutputFile]</p></blockquote>
<table width="811" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="113">-e &#8220;file&#8221;</td>
<td valign="top" width="696">Specifies a file to write error output to. The default is to generate no errors. The special name &#8220;$stderr&#8221; redirects errors to stderr output stream.</td>
</tr>
<tr>
<td valign="top" width="115">-proxy &#8220;server&#8221;</td>
<td valign="top" width="695">Specifies the proxy server to use to fetch DTD&#8217;s through the fire wall.</td>
</tr>
<tr>
<td valign="top" width="116">-html</td>
<td valign="top" width="694">Specifies that the input is HTML.</td>
</tr>
<tr>
<td valign="top" width="117">-dtd &#8220;uri&#8221;</td>
<td valign="top" width="693">Specifies some other SGML DTD.</td>
</tr>
<tr>
<td valign="top" width="118">-base</td>
<td valign="top" width="692">Add an HTML base tag to the output.</td>
</tr>
<tr>
<td valign="top" width="119">-pretty</td>
<td valign="top" width="691">Pretty print the output.</td>
</tr>
<tr>
<td valign="top" width="120">-encoding name</td>
<td valign="top" width="690">Specify an encoding for the output file (default UTF-8)</td>
</tr>
<tr>
<td valign="top" width="121">-noxml</td>
<td valign="top" width="689">Stops generation of XML declaration in output.</td>
</tr>
<tr>
<td valign="top" width="122">-doctype</td>
<td valign="top" width="688">Copy &lt;!DOCTYPE tag to the output.</td>
</tr>
<tr>
<td valign="top" width="123">InputUri</td>
<td valign="top" width="687">The input file name or URL. Default is stdin. If this is a local file name then it also supports wildcards.</td>
</tr>
<tr>
<td valign="top" width="124">OutputFile</td>
<td valign="top" width="686">The optional output file name. Default is stdout. If the InputUri contains wildcards then this just specifies the output file extension, the default being &#8220;.xml&#8221;.</td>
</tr>
</tbody>
</table>
<p><strong>Examples: </strong></p>
<blockquote><p>sgmlreader -html *.htm *.xml<br />
Converts all .htm files to corresponding .xml files using the built in HTML DTD.</p></blockquote>
<blockquote><p>sgmlreader -html http://www.msn.com -proxy myproxy:80 msn.xml<br />
Converts all the MSN home page to XML storing the result in the local file &#8220;msn.xml&#8221;.</p></blockquote>
<blockquote><p>sgmlreader -dtd ofx160.dtd test.ofx ofx.xml<br />
Converts the given OFX file to XML using the SGML DTD &#8220;ofx160.dtd&#8221; specified in the test.ofx file.</p></blockquote>
<h3>Building an XPath</h3>
<p>Once you have your xml file, getting the xpath to the element that you want can still be a little challenging. Html files simply aren’t designed with this type of usage in mind (and hey, if it can be easier for xml files, why not). Enter <a href="http://getfirebug.com/" target="_blank">FireBug</a>, an add-on for <a href="http://www.mozilla.org/" target="_blank">Firefox</a> that allows developers to get a closer look at the html…. Or xml. After you have installed firebug and loaded up the xml file into firefox, go to <em>tools/Web developer/Firebug/Open firebug</em> so that you can see the debug panel. In this panel, select the element that you which to query, open the context menu and select ‘<em>copy XPath</em>’. And that’s it, simply paste this path in the chatbot designer and your done.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=721" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/11/13/scraping-the-internet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Numbers, time, dates, durations</title>
		<link>http://janbogaerts.name/index.php/2011/11/12/numbers-time-dates-durations/</link>
		<comments>http://janbogaerts.name/index.php/2011/11/12/numbers-time-dates-durations/#comments</comments>
		<pubDate>Sat, 12 Nov 2011 14:43:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[chatbot designer]]></category>
		<category><![CDATA[demos]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/11/12/numbers-time-dates-durations/</guid>
		<description><![CDATA[Besides text, a chatbot should also be able to handle other types of basic data, like numbers, date-time and time-spans. Numbers The engine of the chatbot designer app will automatically convert every part of the input text that it can, into an integer or double. Furthermore, with the aid of the thesaurus, you are also <a href='http://janbogaerts.name/index.php/2011/11/12/numbers-time-dates-durations/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Besides text, a chatbot should also be able to handle other types of basic data, like numbers, date-time and time-spans.</p>
<h3>Numbers</h3>
<p>The engine of the chatbot designer app will automatically convert every part of the input text that it can, into an integer or double. Furthermore, with the aid of the thesaurus, you are also able to pick up words that represent numbers and convert them into their corresponding number values. This allows us to easily work with and manipulate these numbers. Here are a few input pattern examples:</p>
<blockquote><p>^n:number</p>
<p>^n:integer</p>
<p>^n:double</p>
<p>^n:noun.(language unit).numeral</p></blockquote>
<p>The first 3 examples are the simplest: you can read a double (floating number), an integer or if you don’t care which, you can simply use ‘number’. The last one is a bit more interesting. Here we use the thesaurus to catch words like ‘one’, ‘two’,… Of course, that’s very limiting, cause this way, you’d have to declare a thesaurus-entry for every single number in the universe, which is, well…, impossible. So better to write the last pattern like so:</p>
<blockquote><p>^n:noun.(language unit).numeral { [and] ^n:noun.(language unit).numeral}</p></blockquote>
<p>The {} operator is used to find a repeating block in the input. So this catches things like: <em>two thousand and five hundred</em>.  As you can see, we use the same variable name for the number in the front and repeating part. This means that most likely, the ‘n’ variable will contain a list of words instead of just 1. Also, we don’t collect the ‘and’ cause it would screw up the conversion procedure. A small warning about the {} operator though: <em><strong>The application can’t find duplicate patterns when the {} operator is used</strong>,</em> so watch out for this.</p>
<p>For completion, you could also include a pattern that handles mixed numbers and words. The conversion algorithm is perfectly capable of handling this mixed type of input.</p>
<h3>Working with numbers</h3>
<p>So, now that we can read in the numbers, lets look at how we can use them. let me just pick up where we ended: with word-numbers. Right now, the variable is still containing words (or a mix of words and numbers), but we actually need a single number, so this needs to be converted. Luckily, you don’t need to do this manually, but there’s already a function available for this. Here’s a usage example:</p>
<blockquote><p>$value = $n:ToNumber</p></blockquote>
<p><em>:ToNumber</em> will convert the content of the variable into a number (only integers are currently supported, a ‘.’ is not yet recognized). Each individual word is converted using the thesaurus and finally added/multiplied together to form a single number. Now, this conversion algorithm is language dependent and at the time of writing, there is only an implementation for English. If you need it for a different language, best to contact me.</p>
<p>Of course, the primary purpose for having real numbers, is so that we can do calculations with them. As you’ll soon see though, this is done a little bit different compared to a traditional programming language. That’s because the chatbot designer’s pattern definition language is text oriented and not math. This means that if you were to type something like $n + $w, it would not perform the calculation, but print/store the ‘+’ sign in between the 2 numbers. So, to perform arithmetic, you need to use functions. here are some examples:</p>
<blockquote><p>$result = $n:add</p>
<p>$result = $n:add($w)</p>
<p>$result = $n:subtract($w,$d,$f)</p>
<p>$result = $n:subtract($w,$d,$f:Add($h))</p>
<p>…</p></blockquote>
<p>The basic principle is always the same: since a variable can contain a list of items (a set), it doesn’t really need arguments to perform the arithmetic operation, as long as it has enough items in the list. Because of this, most mathematical operations can be performed on more then 2 items. So you don’t write <em>a+b+c</em>, but if all 3 are in the same variable, you simply write <em>:add</em>.</p>
<p>If the variable doesn’t contain enough values or you want to include additional values, you can add those as arguments. For most functions, this list is unlimited and can always be nested, so you can do mathematical operations inside others.</p>
<p>For completion, here are all the currently supported mathematical operators:</p>
<table width="564" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="143"><strong>Function</strong></td>
<td valign="top" width="309"><strong>Description</strong></td>
<td valign="top" width="110"><strong>Nr of arguments</strong></td>
</tr>
<tr>
<td valign="top" width="143">Add</td>
<td valign="top" width="309">Adds all the numbers</td>
<td valign="top" width="110">any length</td>
</tr>
<tr>
<td valign="top" width="143">Subtract</td>
<td valign="top" width="308">subtracts each item from the first</td>
<td valign="top" width="110">any length</td>
</tr>
<tr>
<td valign="top" width="143">Multiply</td>
<td valign="top" width="307">multiplies each item with the first</td>
<td valign="top" width="110">any length</td>
</tr>
<tr>
<td valign="top" width="143">Divide</td>
<td valign="top" width="307">divides each item with the first</td>
<td valign="top" width="110">any length</td>
</tr>
<tr>
<td valign="top" width="143">Modulus</td>
<td valign="top" width="307">returns the modulus of the 2 numbers</td>
<td valign="top" width="110">2 items</td>
</tr>
<tr>
<td valign="top" width="143">Complete</td>
<td valign="top" width="307">completes the sequence of the 3 numbers</td>
<td valign="top" width="110">3 items</td>
</tr>
<tr>
<td valign="top" width="143">Count</td>
<td valign="top" width="307">counts the nr of items in the list</td>
<td valign="top" width="110">any length</td>
</tr>
<tr>
<td valign="top" width="143">StDev</td>
<td valign="top" width="307">calculates the standard deviation of the values</td>
<td valign="top" width="110">any length</td>
</tr>
<tr>
<td valign="top" width="143">Min</td>
<td valign="top" width="307">returns the smallest number in the list</td>
<td valign="top" width="110">any length</td>
</tr>
<tr>
<td valign="top" width="143">Max</td>
<td valign="top" width="307">returns the biggest number in the list</td>
<td valign="top" width="110">any length</td>
</tr>
<tr>
<td valign="top" width="143">Avg</td>
<td valign="top" width="307">gets the average of all the values.</td>
<td valign="top" width="110">any length</td>
</tr>
<tr>
<td valign="top" width="143">Complement</td>
<td valign="top" width="307">removes all the items in the argument from the input variable and returns the result (the difference between the 2).</td>
<td valign="top" width="110">any length</td>
</tr>
<tr>
<td valign="top" width="143">Reverse</td>
<td valign="top" width="307">Reversed the order of the items in the list (last becomes first)</td>
<td valign="top" width="110">any length</td>
</tr>
<tr>
<td valign="top" width="143">Distinct</td>
<td valign="top" width="307">Removes all duplicates. If there are any arguments, these are first added to the end of the list before duplicates are removed.</td>
<td valign="top" width="110">any length</td>
</tr>
<tr>
<td valign="top" width="143">Union</td>
<td valign="top" width="307">Adds the arguments to the end of the input items.</td>
<td valign="top" width="110">any length</td>
</tr>
</tbody>
</table>
<h3>Date and time</h3>
<p>Next on the menu are dates and times. These are very closely related to numbers. Internally, the system doesn’t see a difference between a date and a time, it’s always a DateTime. Depending how you use the value, you can regard it as a date, time or DateTime.</p>
<p>First of, there is a special variable to get to the current system date/time: <strong>$time</strong>. This returns a DateTime-cluster which contains a list of numbers that together form the date and time. The order is predetermined by the system to make it language independent. For ease of use, there are functions to get to each part of the date, so you don’t need to memorize each position in the format (though it helps for putting dates back together). Here’s a table of all the functions to get each part of the date list (+ the index position of the item in the list):</p>
<table width="553" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="49"><strong>Index</strong></td>
<td valign="top" width="90"><strong>Function</strong></td>
<td valign="top" width="412"><strong>Meaning</strong></td>
</tr>
<tr>
<td valign="top" width="49">0</td>
<td valign="top" width="90">Year</td>
<td valign="top" width="412">Gets the year number.</td>
</tr>
<tr>
<td valign="top" width="49">1</td>
<td valign="top" width="90">Month</td>
<td valign="top" width="412">Gets the month of the year.</td>
</tr>
<tr>
<td valign="top" width="49">2</td>
<td valign="top" width="90">Day</td>
<td valign="top" width="412">Gets the day of the month.</td>
</tr>
<tr>
<td valign="top" width="49">3</td>
<td valign="top" width="90">Hour</td>
<td valign="top" width="412">Gets the hour (24 hours in a day)</td>
</tr>
<tr>
<td valign="top" width="49">4</td>
<td valign="top" width="90">Minute</td>
<td valign="top" width="412">gets the minutes (60 per hour)</td>
</tr>
<tr>
<td valign="top" width="49">5</td>
<td valign="top" width="90">Second</td>
<td valign="top" width="412">gets the nr of seconds (60 per minute)</td>
</tr>
<tr>
<td valign="top" width="49">6</td>
<td valign="top" width="91">DayOfWeek</td>
<td valign="top" width="412">gets the nr day number of the week (0=Sunday, 1= Monday,…)</td>
</tr>
</tbody>
</table>
<p>And here are some output patterns to show how you can use them:</p>
<blockquote><p>$time:day/$time:month/$time:year</p>
<p>$time:hour : $time:minutes : $time:second</p>
<p>The current month is ^noun.month[$time:month-1]</p></blockquote>
<p>Note that I deliberately put spaces between the variables and the  time indicator (‘:’)  to avoid using the escape character (\). Also, in the last example, we get the name of the month from the thesaurus through the index number.  A thesaurus child at a specific index position can be accessed with the [] operator in the variable path. Because there’s no point of putting words between the brackets and this so often requires a small calculation (0 vs 1 based indexes), I have opted here for a more traditional calculus notation. Supported operators are: +-*/%.</p>
<p>Often it’s also useful to recompose a date, based on a series of numbers. For instance, to build the birthday of someone. As you probably already suspected, there are functions to do just that. Here are some examples:</p>
<blockquote><p><span style="background-color: #ffffff;">$date = $list:ToDate</span></p>
<p><span style="background-color: #ffffff;">$time = $list:ToTime</span></p>
<p><span style="background-color: #ffffff;">$date = $year:ToDate($month,$day)</span></p></blockquote>
<p>For building the date, the first value in the list has to be the year. This is the only required item, but more can follow: month, day, hour, minute, second. In that order.  To build a time value, the first item has to be the hour. Minutes and seconds are optional, but have to be provided in the previously mentioned order. If you want to omit the minutes (or any other) part , use 0 instead.</p>
<p>Why not simply store the date values as individual numbers in memory fields yourself, you might wonder instead of going through the hassle of converting a number into another number (which these conversion functions basically do). Well, that will become apparent in the next section.</p>
<h3>querying on date</h3>
<p>The date and time values are stored in such a way that a year, month, day, minute, second or week in a date is always represented by the same neuron. This means that you can easily find all the dates (and therefor the attached assets) that meet certain criteria (all in the month June for instance). This is very useful in queries like “Who else is born in the same year and month as I am?”. Getting the date objects is real easy. Here’s an example:</p>
<blockquote><p>$people= #user.birthday:year:GetDates:ValueFor(birthday)</p>
<p>$people = $people:Complement(#user)</p>
<p>$people = #($people).name</p>
<p><em>&#8211;or, for year and month:&#8211;</em></p>
<p>$people= #user.birthday:year:GetDates(#user.birthday:Month):ValueFor(birthday)</p>
<p>$people = $people:Complement(#user)</p>
<p>$people = #($people).name</p></blockquote>
<p>Note: For a full example, check the Date-Time demo found at <em>{documents}\nnd\demos\dateTime.dpl</em>.</p>
<p>In the first line, we get the year section of the user’s birthday. With the ‘:GetDates’ function, we retrieve all the date objects that the system has stored for the same year as the user’s birthday.  If you supply extra arguments, those values will also have to be included in the date, as is shown in the second example. With ‘:ValueFor’ we retrieve all the assets that link to the date. The ‘birthday’ argument, specifies that we only want the assets that link to the date value with the ‘birthday’ attribute. We could have omitted this, in which case we would have gotten all the assets, no matter how they are linked (it could be a ‘when’ reference for instance). Or, we could also have given more arguments, specifying a list of possible attribute values.</p>
<p>At this point, we have a list of assets that reference a date of the same year as the user’s birthday. There are still 2 things that need to be done: first we need to remove the ‘#user’ from the asset list, cause the ‘GetDates’ returns all objects, including the date object that represents the user’s birthday, but since the bot was asked ‘who else’, we need to remove the ‘#user’. This is done with the ‘:complement’ function. This is a mathematical function (borrowed from set-theories) and will return a list that contains all the items from the input with all the arguments removed.</p>
<p>We do the call to ‘:Complement’ on a different code line and not on the first one for a very specific reason: asset paths, like in the first assignment, always provide a single value as input to each function in the path, so even if ‘GetDates’ returns a list of items, ‘ValueFor’ will always work on a single value. At the end, the asset path joins all the results together. This, of course, is of no use for the <em>Complement</em> function, cause we need to remove the items from the list and not from a single value. Luckily, regular variable paths do provide a list of items as input values. That’s why we started a new assignment, using a variable path to calculate the complement. There are a couple of other functions (like Interleaf, Filter, Add, Multiply, Avg, Min, Max,…) which require a list of items as input. These should never be used in an asset path, but only in variable paths, for the reason explained above.</p>
<p>In the last line, we get the name value of all the assets that we found. This is again on a different line cause we need an asset path to get the ‘name’ of an asset. Regular variable paths don’t know how to do this. Hence the extra 3th line.  And thus, we get the names of the known objects that have a birthday in the same year as the user.</p>
<h3>Time ranges</h3>
<p>Besides the Date-Time type, there is also a Time-Span type. This specifies a length of time instead of a specific moment. You get a Time-Span by building it with a function, or as the result of some Date-Time calculations (see later). To build a time range (or time-span), you can do something like:</p>
<blockquote><p><span style="background-color: #ffffff;">$range = $list:ToTimeSpan</span></p>
<p><span style="background-color: #ffffff;">$range = $days:ToTimeSpan($Hours)</span></p></blockquote>
<p>Unlike a DateTime, a timespan contains the number of: days, hours, minutes and seconds (no year or month sections). so there are only 4 elements in the list. The first item in the list should always be the nr of days, possibly followed by the hours,… Missing data is set to 0. Like with :ToDate and :ToTime, you can also specify missing data as arguments. The same order applies.</p>
<p>For retrieving values in a TimeSpan, you can use the same functions as for the DateTime. They operate in exactly the same way, but the index position of the actual items in the list is different compared to a DateTime. here’s an overview:</p>
<table width="553" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="49"><strong>Index</strong></td>
<td valign="top" width="90"><strong>Function</strong></td>
<td valign="top" width="412"><strong>Meaning</strong></td>
</tr>
<tr>
<td valign="top" width="49">1</td>
<td valign="top" width="90">Day</td>
<td valign="top" width="412">Gets the total nr of days in the range.</td>
</tr>
<tr>
<td valign="top" width="49">2</td>
<td valign="top" width="90">Hour</td>
<td valign="top" width="412">Gets the remaining nr of hours.</td>
</tr>
<tr>
<td valign="top" width="49">3</td>
<td valign="top" width="90">Minute</td>
<td valign="top" width="412">gets the remaining nr of minutes.</td>
</tr>
<tr>
<td valign="top" width="49">4</td>
<td valign="top" width="90">Second</td>
<td valign="top" width="412">gets the remaining nr o seconds.</td>
</tr>
</tbody>
</table>
<p>At the time of writing, TimeSpans don’t yet support the same level of querying as the DateTime object does. If anyone has an urgent need for this, let me know, and I’ll see what I can do.</p>
<h3>Calculating with dates and times</h3>
<p>Like with regular numbers, you can also perform some calculations on dates, like subtracting one date from another. The syntax for arithmetic with dates/times is exactly the same as with numbers. Here’s an overview of what’s supported:</p>
<table width="564" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="143"><strong>Function</strong></td>
<td valign="top" width="309"><strong>combination</strong></td>
<td valign="top" width="110"><strong>results</strong></td>
</tr>
<tr>
<td valign="top" width="143">Add</td>
<td valign="top" width="309">Time + {range}</td>
<td valign="top" width="110">Time</td>
</tr>
<tr>
<td valign="top" width="143"></td>
<td valign="top" width="308">range + {range}</td>
<td valign="top" width="110">Range</td>
</tr>
<tr>
<td valign="top" width="143">Subtract</td>
<td valign="top" width="308">Time &#8211; {Time}</td>
<td valign="top" width="110">Range</td>
</tr>
<tr>
<td valign="top" width="143">Min</td>
<td valign="top" width="308">Time, Time,…</td>
<td valign="top" width="110">Time</td>
</tr>
<tr>
<td valign="top" width="143"></td>
<td valign="top" width="308">range, range,..</td>
<td valign="top" width="110">Range</td>
</tr>
<tr>
<td valign="top" width="143">Max</td>
<td valign="top" width="308">Time, Time,…</td>
<td valign="top" width="110">Time</td>
</tr>
<tr>
<td valign="top" width="143"></td>
<td valign="top" width="308">range, range,..</td>
<td valign="top" width="110">Range</td>
</tr>
<tr>
<td valign="top" width="143">Avg</td>
<td valign="top" width="308">Time, Time,…</td>
<td valign="top" width="110">Time</td>
</tr>
<tr>
<td valign="top" width="143"></td>
<td valign="top" width="308">range, range,..</td>
<td valign="top" width="110">Range</td>
</tr>
<tr>
<td valign="top" width="143">StDev</td>
<td valign="top" width="308">Time, Time,…</td>
<td valign="top" width="110">Time</td>
</tr>
<tr>
<td valign="top" width="143"></td>
<td valign="top" width="308">range, range,..</td>
<td valign="top" width="110">Range</td>
</tr>
</tbody>
</table>
<h3></h3>
<p>In general, the principle is always the same: the function input determines the type of the result, except for ‘Subtract’ which always returns a range and only works on Time values.</p>
<h3>Boolean operations</h3>
<p>As a final topic, perhaps a word about logical or Boolean operations on numbers, dates and ranges. Well, for the most part, these work as you would expect both for regular numbers and times/ranges. There’s just 1 small twist. The mathematical people out there will probably have noticed that set-theory is very present in this system: all variables can contain a list of items. This means that Boolean operators need to be prepared for this. Here’s an overview on how each operator handles lists:</p>
<ul>
<li>Equality (==): If the left part contains a list, the right side must have the exact same list: with the same nr of items, in the same order.</li>
<li>Difference (!=) If the left part contains a list, the right side is different if it contains a different amount of items, the sequence is different or one or more of the items differ.</li>
<li>Contains (contains): The right side of the operator should be part of the list found on the left side of the operation.</li>
<li>doesn’t contain (!Contains): The right side of the operator should not be part of the list found on the left side of the operation.</li>
<li>&gt;, &gt;=, &lt;, &lt;= (Bigger, bigger or equal, smaller, smaller or equal): If the left part contains a list, each item in the list will be evaluated to each item found on the right side. The operation succeeds if all items are compared and none failed.</li>
</ul>
<p>There is plenty more to say about this topic. But my time-range has run out, a time to move on has been reached. All that’s left for me to say is: Stay tuned and CY later.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=717" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/11/12/numbers-time-dates-durations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why? because! :Invert</title>
		<link>http://janbogaerts.name/index.php/2011/11/08/why-because-invert/</link>
		<comments>http://janbogaerts.name/index.php/2011/11/08/why-because-invert/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 15:03:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[demos]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Getting started]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[because]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[have]]></category>
		<category><![CDATA[like]]></category>
		<category><![CDATA[why]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/11/08/why-because-invert/</guid>
		<description><![CDATA[‘A because B’ and ‘Why C’ are 2 tricky statement types for a chatbot to handle correctly. Not only does the data need to be stored and retrieved correctly, but often, some words need to be replaced, like ‘I’ vs ‘you’. Here are some possible techniques you can use with the chatbot designer to handle <a href='http://janbogaerts.name/index.php/2011/11/08/why-because-invert/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>‘<em>A because B’</em> and ‘<em>Why C</em>’ are 2 tricky statement types for a chatbot to handle correctly. Not only does the data need to be stored and retrieved correctly, but often, some words need to be replaced, like ‘I’ vs ‘you’. Here are some possible techniques you can use with the chatbot designer to handle such input.</p>
<h3>Because</h3>
<p>Let me first give an example of a ‘because’ statement that a user might say:</p>
<blockquote><p>I have a dog because I like animals.</p></blockquote>
<p>This statement is a bit of an oversimplification, perhaps just right for an example.   It doesn’t only specify why I have a dog, but also <em>that</em> I have a dog and that I like animals. All this data should be stored and retrievable so that the system can answer questions like:</p>
<blockquote><p>Why do I have a dog?</p>
<p>Do I have a dog?</p>
<p>Do I like animals?</p></blockquote>
<p>So, before we can store the data, we need to find an input pattern that’s able to handle ‘<em>I have a dog because I like animals</em>’. To start with, we could do something like:</p>
<blockquote><p><span style="background-color: #ffffff;">I have a $value because $reason [.]</span></p></blockquote>
<p>This can work for many possible input values, except that the ‘I&#8217; vs ‘you’ change is difficult to do since there is no knowledge of the context (‘you’ can change into ‘I’, ‘me’,… depending on the context), so this is the least usable pattern, but there are other possibilities.  For example, lets take:</p>
<blockquote><p>I have a $value because I like $object [.]</p>
<p>or better:</p>
<p>I have a ^value:noun because I like ^object:noun [.]</p></blockquote>
<p>With this input pattern, we are able to extract all the valid data so that it can be stored in memory and we also have static text for ‘I’, which can easily be transferred manually. A small improvement might be to replace ‘$value’ with ‘^value:noun’ so that only a proper noun can be captured instead of things like ‘I have a <em>pretty big keyboard on my lap sitting there</em> because I like typing’. The same goes for ‘$object’. As in the previous example, ‘typing’ could probably better be transformed to ‘type’ before you store it, so in the pattern you could replace ‘$object’ with ‘^object:verb’ or ‘^object:noun’,… Anyway, lets take a look at how the do-patterns would look like for storing this info:</p>
<blockquote><p>#user += $value</p>
<p>#user.like.($object) = yes</p>
<p>#user.($value):why = “because you like $object”</p></blockquote>
<p>In the first line, we create a ‘has’ data item for ‘$value’. The second line adds the ‘object’ to the ‘like’ list, with the value ‘yes’ so that it’s clear the user likes it. And the third line stores the reason why the user has a ‘value’. ‘:why’ is a function that provides access to the ‘reason’ data-tree. What you store in ‘:why’ is completely up to you. In this example, we store a text, between brackets, cause I wanted to preserve the spacing, but you could also treat it as a sub asset (or anything else, like a link to another rule), allowing you to write paths like <em>#user.($value):why.object</em>.</p>
<h3>Why</h3>
<p>Once you have stored  the information, you can retrieve it again if the user asks a <em>why</em> question. Here’s a possible input pattern that you could use for capturing this question:</p>
<blockquote><p>Why do I have a $value [?]</p>
<p>or better:</p>
<p>Why do I have a ^value:noun [?]</p></blockquote>
<p>And the output pattern could look something like:</p>
<blockquote><p>You have a $value #user.($value):why</p>
<p>or better:</p>
<p><strong>Bot says when</strong>:  #user.($value):why</p>
<p>You have a $value #user.($value):why</p>
<p><strong>else:</strong></p>
<p>I don’t know why you have a $value</p></blockquote>
<p>That was easy enough. The first line is the most basic approach, the only problem with it: if the bot doesn’t know, it returns ‘<em>You have a</em>’. Which is no good. Better to put it in a conditional and check if there is a ‘why’ value, if there is non, let the bot say it doesn’t know. To check if there is a ‘why’ value, simply put the path in the ‘when’ close. This will check if the result of the path has a value. To check if it doesn’t have a value, use the not (!) operator in front of the pattern, like so:</p>
<blockquote><p><strong>Bot says when</strong>: !#user.($value):why</p>
<p>I don’t know why you have a $value</p>
<p><strong>else:</strong></p>
<p>You have a $value #user.($value):why</p></blockquote>
<h3>Improvements</h3>
<p>Right now, we have a working system to handle because/why type of things, but it’s not very flexible, I mean, there are tons of reasons why you can have something, and not just because you <em>like</em> something else. Also, there are more people then just ‘I’, so lets improve the input patterns a bit and make things more flexible.</p>
<h4>Using the Thesaurus</h4>
<p>Lets start with ‘I’. As you had probably already guessed, the thesaurus variables are ideally suited for this. So, here’s an improved input pattern:</p>
<blockquote><p>^s:pronoun.subject (have|has) a ^value:noun because ^w:pronoun.subject like ^object:noun [.]</p></blockquote>
<p>Ok, that’s already a bit more complicated. The <em>^s </em>variable can capture any child of the pronoun ‘<em>subject</em>’.  If you check in <a href="http://www.janbogaerts.name/files/full.thesaurus.xml" target="_blank">the thesaurus</a>, under the pronoun POS, there are a bunch of greyed-out items, one of which is ‘subject’. These are ‘placeholders’, that is: these thesaurus items don’t actually contain a word, only a label. So our ^s variable can’t actually catch the word ‘subject’, but only it’s children: <em>I, you, he, she, they, we, it</em>.</p>
<p>The do-patterns also become a bit more complicated, since we will now have to calculate the inverse of the pronoun and we also have to extract the asset out of it. Luckily, there are some helper functions for this:</p>
<blockquote><p>#($s:ResolvePerson) += $value</p>
<p>#($w:ResolvePerson).like.($object) = yes</p>
<p>#($s:ResolvePerson).($value):why = “because &amp;w:InvertPerson ^verb.like:conjugate($w:ResolvePerson) $object”</p></blockquote>
<p>:ResolvePerson is able to extract the asset (or concrete representation) out of a word.  At the time of writing: I and you  are supported. Names, ‘He’, ‘she’, ‘it’,… need some further testing.<br />
:InvertPerson uses thesaurus links to jump from one person to it’s inverse, if there is one. So ‘you’ becomes ‘I if ‘you’ was used as a subject.<br />
:Conjugate will try to find the correct conjugation of a verb, based on the argument that is supplied. This has to be an asset, usually the asset representation of the sentence-subject. So if you want to conjugate for ‘I’, you pass in ‘#bot’. ‘You’ becomes ‘#user’, and so on.</p>
<h4>Split the patterns</h4>
<p>The second improvement that we can make to the pattern is a bit more radical and relies on a special feature of the pattern matcher. You see, the pattern matching process is not restricted to finding just 1 pattern in the input. It will try to find the longest possible sequence of patterns that it can. That is, if the same words can be caught with a single pattern, this pattern will get precedence over a sequence of patterns. But if the pattern matcher can do a longer match by using 2 patterns instead of 1, that will become the result. This allows us to split up the first part of the sentence: ‘<em>I have a $value’ </em>from ‘<em>I like $object</em>’. opening up a whole new range of possibilities, and more importantly: saving use lots of duplicate work. The do-patterns become a little different though. First the input-patterns:</p>
<blockquote><p><strong>Topic: HAVE</strong></p>
<p>^s:pronoun.subject (have|has) a ^value:noun</p>
<p>because ^s:pronoun.subject (have|has) a ^value:noun</p>
<p>&nbsp;</p>
<p><strong>Topic: LIKE</strong></p>
<p>^w:pronoun.subject (like|likes) ^object:noun [.]</p>
<p>because ^w:pronoun.subject (like|likes) ^object:noun [.]</p></blockquote>
<p>As you can see, not much has changed except that they are now 2 sets of patterns and each set has a version with and without ‘because’ in the front. We could also have written them as:</p>
<blockquote><p><strong>Topic: HAVE</strong></p>
<p>[because] ^s:pronoun.subject (have|has) a ^value:noun</p>
<p><strong>Topic: LIKE</strong></p>
<p>[because] ^w:pronoun.subject (like|likes) ^object:noun [.]</p></blockquote>
<p>But we aren’t. Instead, we keep each input-pattern in it’s own rule so that each can have it’s own set of do-patterns. This way, the ‘because’ version can be treated differently. Basically, what it comes down to is this: when there is no ‘because’, we simply store an extra memory field called ‘subj’ which allows us to recall the left part of the asset operation (excluding the attribute). When we have a because, we check if the ‘subj’ field is set and if so, we store the ‘:why’ in this field. Here are the do patterns:</p>
<blockquote><p><strong>Topic: HAVE</strong></p>
<p>#bot.who = $s:ResolvePerson</p>
<p>#bot.Inverted = &#8220;#bot.Inverted because $s:InvertPerson ^verb.have:conjugate(#bot.who) a $value&#8221;</p>
<p>#bot.attribute = $value</p>
<p>#bot.who += $value</p>
<p>#bot.value = #bot.who.($value)</p>
<p>#bot.Subj = #bot.Who</p>
<p>#bot.Subj.(#bot.attribute):why = &#8220;because $s:InvertPerson ^verb.have:conjugate(#bot.who) a $value&#8221;</p>
<p><strong>Topic: LIKE</strong></p>
<p>#bot.who = $s:ResolvePerson</p>
<p>#bot.Inverted = &#8220;#bot.Inverted because $s:InvertPerson ^verb.like:conjugate(#bot.who) $value&#8221;</p>
<p>#bot.value = yes</p>
<p>#bot.attribute = $value</p>
<p>#bot.who.like.($value) = yes</p>
<p>#bot.Subj = #bot.who.like</p>
<p>#bot.Subj.(#bot.attribute):why = &#8220;because $s:InvertPerson ^verb.like:conjugate(#bot.who) $value&#8221;</p></blockquote>
<p>The full code example can be found in <em>{documents}\NND\Demos\Why_Because2.dpl</em>. As you can see, it’s a bit more code then where we originally started. Though if you look a little closer, a lot of it is boiler-plate stuff: store who, attribute, value, subj, inverted.<br />
Key advantage here: with only a few patterns we can have any type of combination: have because like, like because have,  have because have, like because like, because have, because like, have, like, have because like because have,….</p>
<p>The basic set-up is always the same, we dissect the sentence into it’s parts so that they can be reused in other parts. here’s what we need:</p>
<ul>
<li>calculate ‘who’ (the asset form of the subject part in the sentence = I, you, he,…) so we can reuse it and don’t have to recalculate it each time.</li>
<li>store the the inverted sentence, for output generation (can always be useful)</li>
<li>the attribute and value (‘color’ is the attribute of ‘yellow’). In this example, strictly speaking not really required, but other parts of the concept rely on this data, so best to get used to it.</li>
<li>subj: sometimes, the ‘who’ isn’t enough to find out where some data needs to be stored. ‘like’ (and most other verbs) is a good example of this. So if we want to get to the correct data path later on, we need to store this new path, hence the existence of ‘subj’.</li>
<li>If ‘when’, ‘where’, ‘how’,… is also present in the sentence, these are all data parts that can be stored like attribute, value or more complex sub structures.</li>
</ul>
<p>There are a few extra do-patterns required to get this working correctly. The ‘who, inverted, value, attribute, subj’,… fields of the #bot are all temporarily, that is: they are supposed to be used as mid-term memory, for as long as the current input is being processed, so that the information can be passed along from one pattern to another. This means that we need to remove the data after the input has been processed so that it wont interfere with any of the next input. This can be done from the <em>Chatbot’s properties view </em>(select the menu item view/chatbot properties, next go to the ‘<em>Do after output</em>’ tab.). here’s how it would look like for this example (can be simplified, which we will do in the next example):</p>
<blockquote><p>#bot –= Inverted</p>
<p>#bot –= Who</p>
<p>#bot –= Subj</p>
<p>#bot –= attribute</p>
<p>#bot -= value</p></blockquote>
<p>Also, in this example, I only used thesaurus variables. You can achieve similar results with regular variables, but there has to be a small change in the pattern definition for it to work properly. Everything has to do with the fact that a regular variable can only determine it’s end by what is defined after the variable, and if the pattern definition ends with a regular variable, it will collect the remainder of the input and never jump to another pattern. So we need to put something behind the variable if the ‘because xxx’ needs to be handled correctly. This can be done by moving the ‘because’ from front to back like so:</p>
<blockquote><p><strong>Topic: HAVE</strong></p>
<p>I have a $value [.]</p>
<p>I have a $value because</p>
<p><strong>Topic: LIKE</strong></p>
<p>I like $value [.]</p>
<p>I like $value because</p></blockquote>
<p>The biggest disadvantage: you need extra patterns to handle a ‘because xxx’ (not shown or included in the demo), but on the plus side, the do-patterns become a little simpler using this type of pattern definition style. For a complete example, see: <em>{Documents}\NND\Why_Because.dpl</em>.</p>
<h4>Sub topics</h4>
<p>There’s one more trick we can use to make the patterns more flexible and which will also resolve a final problem caused by using multiple rules as we did in the previous step. You see, finding a list of unrelated rules is primarily done to recognize multiple sentences in the input and not for splitting up a single sentence. That’s because all the outputs from those rules are always automatically combined. So you can’t change the order or content. This can make output management a little tricky.</p>
<p>The solution comes in the form of sub-topics or sub-rules. With this technique, it’s possible to reference a topic or rule by it’s name from within a pattern in the same or other topic. This allows us to split the ‘because’ out into a third topic and then group them all back together into a single rule, which will be the final, single result. So, on the input side, it becomes more flexible, and thanks to a special variable ‘$output’ and a switch in the <em>chatbot properties</em>, we can also take control of the output side. more on that later, lets first start with the input patterns, how do you declare sub-topics?</p>
<blockquote><p><strong>Topic: HAVE</strong></p>
<p>^s:pronoun.subject (have|has) a ^value:noun</p>
<p><strong>Topic: LIKE</strong></p>
<p>^s:pronoun.subject (like|likes) ^value:noun [.]</p>
<p><strong>Topic: BECAUSE</strong></p>
<p>because</p>
<p><strong>Topic: BECAUSEHANDLER</strong></p>
<p>~have</p>
<p>~like</p>
<p>~becauseHandler ~because ~becauseHandler</p></blockquote>
<p>The first 2 input patterns should be familiar by now, nothing has changed since before, only the ‘because’ version has been eliminated. The first new topic is also nothing special, just a single word ‘because’.  The magic happens in the last topic, which groups all the other topics together.</p>
<p>~ is used to indicate a Topic reference. It’s always followed by the name of a topic and possibly a dot followed by the name of a rule. It’s meaning is simple: include all the patterns in the rule(s) of the specified topic at the location of the reference. Here’s an example for sub rules:</p>
<blockquote><p>~have.statement because ~like.statement //presumes that topics ‘have’ and ‘like’ have a rule labeled ‘statement’</p></blockquote>
<p>Now, if you look at the last topic: ‘BECAUSEHANDLER’ you’ll notice that it only contains references to other topics, it’s a root topic. In this example, it’s purpose is to provide a place to declare the output for every topic, so we can combine things correctly + it also stores the ‘why’ relationship. Also, if you look at the last pattern, it references it’s own topic, 2 times. This is recursion and allows us to recognize a sequence of ‘becauses’ like: <em>I have x because I like y because I have z,…</em>.</p>
<p>You might be wondering why it’s the <em>BECAUSEHANDLER</em> that stores the &#8216;:why’ link and not the ‘BECAUSE’ itself. That is because at the time of the ‘Because’ pattern, the reason is not yet known (this is defined in the next pattern, which hasn’t been processed yet), so it can’t link anything up yet. To overcome this, we make certain that there is an extra rule that gets executed after every other part of the sentence: the BECAUSEHANDLER.  In other words, the ‘becauseHandler’ is a way to perform some code after all the patterns have been processed.</p>
<p><em></em><em><span style="color: #8064a2;">By the way: topic names can be edited in the ‘project view’ (select the topic, press F2 or right mouse click/rename). A topic name should be unique within the project if you want to use it as a sub-topic, otherwise it’s not that important, but the UI will always warn about duplicate names and those topics will have a red icon instead of blue. The name of a rule is always visible in the ‘description view’s title when the rule is selected.  It can be changed in the topic editor: select the entire rule (don’t click on a pattern, but on the background of the rule). With F2, you get a dialog to change the name.</span></em></p>
<p>Let’s continue with the do patterns.  For ‘have’, ‘why’ and ‘like’, they remain very similar: the patterns are used to store the inverted sentence, who (asset), the attribute, the value and the ‘subject’. In this example though, instead of directly storing it under the ‘bot’, it is stored underneath ‘mem’ so that we can move the entire result set with 1 statement later on. So here’s a small example of the ‘have’ do-patterns:</p>
<blockquote><p>#bot.mem.attribute = $value</p>
<p>#bot.mem.who = $s:ResolvePerson</p>
<p>…</p></blockquote>
<p>And so on. The really interesting stuff happens in the ‘BECAUSE’ and ‘BECAUSEHANDLER’ topics. Note that this time, we have some do-stuff in the ‘calculate’ area and others in the ‘do’ section. The major difference here: ‘Calculate’ is done, just before any of the conditions are evaluated, so this allows us to do pre-calculations that can be used in those conditions.</p>
<blockquote><p><strong>Topic BECAUSE:</strong></p>
<p>#bot.because = #bot.mem</p>
<p>#bot -= mem</p>
<p><strong>Topic BECAUSEHANDLER:</strong></p>
<p><em><strong>Rule ~becauseHandler ~because ~becauseHandler</strong></em></p>
<p><em><span style="text-decoration: underline;">Calculate:</span></em></p>
<p>$result = &#8220;because #bot.mem.Inverted&#8221;</p>
<p>$path = #bot.because.Subj.(#bot.because.attribute)</p>
<p><em><span style="text-decoration: underline;">Output when</span></em>: #($path):why == $result</p>
<p>Yes, I now #bot.because.inverted because #bot.mem.inverted\.</p>
<p><em><span style="text-decoration: underline;">else</span></em></p>
<p>I see, #bot.because.inverted because #bot.mem.inverted\.</p>
<p><strong>       </strong><em><span style="text-decoration: underline;">Do</span></em></p>
<p>#($path):why = $result</p>
<p><strong><em>Rule ~have</em></strong></p>
<p>$output</p></blockquote>
<p>First off, BECAUSE: this moves the ‘mem’ field to ‘because’ and ‘mem’ is cleaned/deleted. Basically, we store the data of the previous sentence and prepare to collect the data for the next sentence. The ‘because’ field will later on be used to link to the newly collected ‘mem’ field. Note that this rule doesn’t generate any output.</p>
<p>Secondly comes the ‘BECAUSEHANDLER’. This builds up the result that needs to be stored in ‘:why’ and calculates the location where this info needs to be stored (in $path). Before actually committing the data to memory though, a check is done to see if it was already known. If so, a different response is given compared to when it is not yet known. In the latter case, the info is also stored.</p>
<p>For the other rules (~have and ~like), we simply declare the $output variable in the output section, indicating that we want to reproduce the output of previous topic.  Note that the use of this $output variable can be controlled in the <em>chatbot’s properties view</em>. When turned off, it will function as a regular variable, and the output of all the patterns will simply be combined. This allows you to select between a simple styled bot or something more advanced.</p>
<p>Finally, as already mentioned, we still need to do some clean-up after the input. Since we have grouped all the mid-term memory in 2 fields: ‘mem’ and ‘because’, cleanup becomes a little simpler (Note: sometimes the ‘because’ part doesn’t exist, but that’s ok, nothing will be removed in this case):</p>
<blockquote><p>#bot –= Mem</p>
<p>#bot -= because</p></blockquote>
<p>I guess that’s about it for now.</p>
<p>Well, we went from simple, straight forward, fire-cracker-leveled patterns to something that’s more akin to ‘rocket science’. The combination of memory, thesaurus and sub-topics might just turn out to be a very explosive mix. I for one, am very interested to see where all this will eventually lead too… Stay tuned.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=713" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/11/08/why-because-invert/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Latest release available</title>
		<link>http://janbogaerts.name/index.php/2011/11/07/latest-release-available/</link>
		<comments>http://janbogaerts.name/index.php/2011/11/07/latest-release-available/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 15:07:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[releases]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/11/07/latest-release-available/</guid>
		<description><![CDATA[The latest release, version 0.8.5 is now available for download. The major changes in this version is centered round speech input and output. support for multiple speech engines The first, and most fundamental change is the fact that the system now supports multiple speech engines.&#160; At the moment, there is an implementation for the managed <a href='http://janbogaerts.name/index.php/2011/11/07/latest-release-available/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>The latest release, version 0.8.5 is now available for <a href="http://janbogaerts.name/index.php/downloads/" target="_blank">download</a>. The major changes in this version is centered round speech input and output.</p>
<h4>support for multiple speech engines</h4>
<p><a href="http://janbogaerts.name/wp-content/uploads/2011/11/Capture.jpg"><img style="background-image: none; border-right-width: 0px; margin: 0px 9px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Capture" border="0" alt="Capture" align="left" src="http://janbogaerts.name/wp-content/uploads/2011/11/Capture_thumb.jpg" width="320" height="75" /></a>The first, and most fundamental change is the fact that the system now supports multiple speech engines.&#160; At the moment, there is an implementation for the managed and unmanaged Microsoft SAPI versions. Others might follow. The major reason for this feature is that the SAPI libraries behave differently on different systems and OS’s. This was most apparent in the fact that some voices aren’t properly supported in the managed version. That’s why the unmanaged version has become the default, since it is the most powerful and most stable (also in terms of timing), but XP for instance doesn’t support SAPI 5.3, so this requires the managed version. To select the engine you want to use, go to the menu item: tools/options, select the ‘Speech’ tab and use the combo box to select one of the engines.&#160; Note: before switching engine, it’s best to turn off audio input/output on all chatbot channels.</p>
<h4><a href="http://janbogaerts.name/wp-content/uploads/2011/11/alternates.jpg"><img style="background-image: none; border-right-width: 0px; margin: 0px 0px 0px 2px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="alternates" border="0" alt="alternates" align="right" src="http://janbogaerts.name/wp-content/uploads/2011/11/alternates_thumb.jpg" width="258" height="196" /></a>Alternate input</h4>
<p>Also new in this version is the ability to select between alternative input text for voice recognition. The system wont yet automatically be trained with this information though. You can turn this on/off with a new button on the chatbot-local toolbar, to the right of the Audio-in button. When turned on, and the speech engine can provide alternate text values, a dropdown-box will be displayed just below the text (one for each speech salvo). You can select an alternate text from this box. Note that if there aren’t any alternatives, no dropdown is shown. Also, the managed engine can give different results compared to the non-managed version.</p>
<h4>New demos</h4>
<p>Finally, there are a few new demos included in the installer. 3 new demos that show different ways to implement why-because (and also show how to do have and like). The previous release also had a demo for why-because, but it still had some issues.</p>
<p>That’s it for now, more things to follow…</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=710" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/11/07/latest-release-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Version 0.8.3 released</title>
		<link>http://janbogaerts.name/index.php/2011/11/01/version-0-8-3-released/</link>
		<comments>http://janbogaerts.name/index.php/2011/11/01/version-0-8-3-released/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 14:56:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[releases]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/11/01/version-0-8-3-released/</guid>
		<description><![CDATA[I just had to get a release out on this date, I mean: 1/11/11, ye! For the curious, there are actually a number of fixes/updates all over the place: Importing/exporting part of a thesaurus has been fixed. There was a problem in the ‘rebuild project’ procedure for the thesaurus which has been fixed. A do-statement <a href='http://janbogaerts.name/index.php/2011/11/01/version-0-8-3-released/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I just had to get a release out on this date, I mean: 1/11/11, ye! </p>
<p>For the curious, there are actually a number of fixes/updates all over the place:</p>
<ul>
<li>Importing/exporting part of a thesaurus has been fixed.</li>
<li>There was a problem in the ‘rebuild project’ procedure for the thesaurus which has been fixed.</li>
<li>A do-statement of the form #x.z = #y&#160; now gets a correct y value.</li>
<li>There’s a new CmdShell extension for scraping xml and html files (from the internet or disk)</li>
</ul>
<p>2 new demo projects:</p>
<ul>
<li>weather.dpl: uses the scraper extension to get the weather info from the Google weather api.</li>
<li>Why_because.dpl: shows a way how you can correctly handle why/because statements. In the process, it also shows how to do ‘be’, ‘have’ and ‘like’. 2 more versions of this demo will follow shortly.</li>
</ul>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=704" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/11/01/version-0-8-3-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a bot&#8217;s memory</title>
		<link>http://janbogaerts.name/index.php/2011/10/28/using-a-bots-memory/</link>
		<comments>http://janbogaerts.name/index.php/2011/10/28/using-a-bots-memory/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 15:45:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[chatbot designer]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/10/28/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.  Input patterns <a href='http://janbogaerts.name/index.php/2011/10/28/using-a-bots-memory/' class='excerpt-more'>[...]</a>]]></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>
<h3>Short term memory</h3>
<p>Or also called ‘volatile’ as it’s content is lost in time, can be accessed through the use of variables in the patterns.  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>
<h4>Regular variables</h4>
<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>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></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  later).</p>
<h4>Thesaurus variables</h4>
<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>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></blockquote>
<p>A thesaurus variable always starts with  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).  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>
<h4>Collecting multiple values</h4>
<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>{$name ,} and ^name:noun.name are here  //catches something like: <em>Tom, Flint and Warner are here</em></p></blockquote>
<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>
<h4>Using short term memory</h4>
<p>Up until now, we’ve only been talking about how to collect the values for the short term memory.  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>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(&#8220;\, &#8220;, &#8221; and &#8220;)</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),…  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>
<h3>Long term memory</h3>
<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>.  Typically, you use this data to compare against short-term variables, render previously stored data or store newly acquired knowledge.</p>
<h4>The thesaurus</h4>
<p>As already mentioned, thesaurus variables are used in the input-patterns so that the valid content for a variable can be filtered.  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.  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   //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 width="620" border="1" cellspacing="0" cellpadding="2">
<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.  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 width="368" border="1" cellspacing="0" cellpadding="2">
<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>
<h4>Assets</h4>
<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.  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.   Take the following examples (input statement to the left, how to store/remove it to the right):</p>
<table width="431" border="1" cellspacing="0" cellpadding="2">
<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.  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:  !+= 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  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 width="767" border="1" cellspacing="0" cellpadding="2">
<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  //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  //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>
<h3>Mid term memory</h3>
<p>Some functions, like the ‘:attribute’ function (which is able to extract, for instance,  ‘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>&nbsp;</p>
<p>Do after output:</p>
<p>#bot.prevmem = #bot.memory</p>
<p>#bot –= memory</p>
<p>&nbsp;</p>
<p>do on startup:</p>
<p>#bot –= memory</p>
<p>#bot –= prevmem</p>
<p>&nbsp;</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>&nbsp;</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>
<h3>Patterns</h3>
<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.  More on that to come.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=696" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/10/28/using-a-bots-memory/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating your own characters</title>
		<link>http://janbogaerts.name/index.php/2011/10/25/creating-your-own-characters/</link>
		<comments>http://janbogaerts.name/index.php/2011/10/25/creating-your-own-characters/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 14:48:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[characters]]></category>
		<category><![CDATA[chatbot designer]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[documentation]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/10/25/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. Images The animations and visemes are stored as a series of images <a href='http://janbogaerts.name/index.php/2011/10/25/creating-your-own-characters/' class='excerpt-more'>[...]</a>]]></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 border="1" cellspacing="0" cellpadding="2" width="318">
<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>.&#160; 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://janbogaerts.name/wp-content/uploads/2011/10/Capture1.jpg"><img style="background-image: none; border-right-width: 0px; margin: 3px 0px 2px 4px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Capture" border="0" alt="Capture" align="right" src="http://janbogaerts.name/wp-content/uploads/2011/10/Capture_thumb1.jpg" width="525" height="350" /></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><code>
<p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;        <br />&lt;Character xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance&quot;">http://www.w3.org/2001/XMLSchema-instance&quot;</a> xmlns:xsd=&quot;<a href="http://www.w3.org/2001/XMLSchema&quot;">http://www.w3.org/2001/XMLSchema&quot;</a>&gt;         <br />&lt;/Character&gt;</p>
<p>   </code></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><code>
<p>&#160; &lt;CharacterInfo&gt;        <br />&#160;&#160;&#160; &lt;Name&gt;Mika&lt;/Name&gt;         <br />&#160;&#160;&#160; &lt;Author&gt;Ady Di Pierro&lt;/Author&gt;         <br />&#160;&#160;&#160; &lt;Copyright&gt;Copyright 2011 Ady Di Pierro&lt;/Copyright&gt;         <br />&#160;&#160;&#160; &lt;License /&gt;         <br />&#160;&#160;&#160; &lt;AuthorWebsite&gt;<a href="http://www.laticisimagery.com.au/">http://www.laticisimagery.com.au/</a>&lt;/AuthorWebsite&gt;         <br />&#160;&#160;&#160; &lt;CreationDate&gt;2011-08-07T14:43:26.602+02:00&lt;/CreationDate&gt;         <br />&#160;&#160;&#160; &lt;LastUpdateDate&gt;2011-08-07T14:43:26.602+02:00&lt;/LastUpdateDate&gt;         <br />&#160;&#160;&#160; &lt;Rating&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;Rating&gt;Unknown&lt;/Rating&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;Sexual&gt;false&lt;/Sexual&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;Violence&gt;false&lt;/Violence&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;Other&gt;false&lt;/Other&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;Description /&gt;         <br />&#160;&#160;&#160; &lt;/Rating&gt;         <br />&#160;&#160;&#160; &lt;OnlineOptions&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;OnlineCharacterBaseUrl /&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;PreferredWidth&gt;150&lt;/PreferredWidth&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;PreferredHeight&gt;150&lt;/PreferredHeight&gt;         <br />&#160;&#160;&#160; &lt;/OnlineOptions&gt;         <br />&#160; &lt;/CharacterInfo&gt;</p>
<p>   </code></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><code>
<p>&lt;Background&gt;        <br />&#160;&#160; &lt;ImageResource&gt;images\Kima00.png&lt;/ImageResource&gt;         <br />&#160;&#160; &lt;ImageResource&gt;images\KimaEars.png&lt;/ImageResource&gt;         </p>
<p>&lt;/Background&gt;</p>
<p>   </code></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.&#160; 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><code>
<p>&#160; &lt;Animations&gt;&#160; <br />&#160;&#160;&#160; &lt;Animation&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;AnimationFrames&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;AnimationFrame&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Duration&gt;5&lt;/Duration&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ImageResource&gt;images\other\Kima Ears (01).png&lt;/ImageResource&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;VisemeGroupName/&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/AnimationFrame&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Duration&gt;5&lt;/Duration&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ImageResource&gt;images\other\Kima Ears (01).png&lt;/ImageResource&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;VisemeGroupName /&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/AnimationFrame&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;/AnimationFrames&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;EnableFrameSpeaking&gt;true&lt;/EnableFrameSpeaking&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;HoldLastFrameForSpeak&gt;false&lt;/HoldLastFrameForSpeak&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;FirstFrameUnderlay&gt;false&lt;/FirstFrameUnderlay&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;BackgroundSuppress&gt;KimaEars.png&lt;/BackgroundSuppress&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;Name&gt;earsmove1&lt;/Name&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;ZIndex&gt;0&lt;/ZIndex&gt;         <br />&#160;&#160;&#160; &lt;/Animation&gt;         <br />&#160; &lt;/Animations&gt;</p>
<p>   </code></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><code>
<p>&#160; &lt;VisemeGroups&gt;        <br />&#160;&#160;&#160; &lt;VisemeGroup&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;Name&gt;Default&lt;/Name&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;ZIndex&gt;1&lt;/ZIndex&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;VisemeImages&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;VisemeImage&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;VisemeIndex&gt;0&lt;/VisemeIndex&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ImageResource&gt;images\Kima00.png&lt;/ImageResource&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/VisemeImage&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;VisemeImage&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;VisemeIndex&gt;1&lt;/VisemeIndex&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ImageResource&gt;images\Visemes\Kima03 EH.png&lt;/ImageResource&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/VisemeImage&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;/VisemeImages&gt;         <br />&#160;&#160;&#160; &lt;/VisemeGroup&gt;         <br />&#160; &lt;/VisemeGroups&gt;</p>
<p>   </code></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.&#160; 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.&#160; </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.&#160; 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><code>
<p>&#160; &lt;IdleLevels&gt;        <br />&#160;&#160;&#160; &lt;IdleLevel&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;MinStartDelay&gt;5&lt;/MinStartDelay&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;MaxStartDelay&gt;15&lt;/MaxStartDelay&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;MinDuration&gt;5&lt;/MinDuration&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;MaxDuration&gt;15&lt;/MaxDuration&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;MinInterval&gt;2&lt;/MinInterval&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;MaxInterval&gt;8&lt;/MaxInterval&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;AnimationNames&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;AnimationName&gt;earsmove1&lt;/AnimationName&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;AnimationName&gt;eyes squint&lt;/AnimationName&gt;&#160; <br />&#160;&#160;&#160;&#160;&#160; &lt;/AnimationNames&gt;         <br />&#160;&#160;&#160; &lt;/IdleLevel&gt;         <br />&#160; &lt;/IdleLevels&gt;</p>
<p>   </code></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><code>
<p>&#160; &lt;BackgroundAnimations&gt;        <br />&#160;&#160;&#160; &lt;Animation&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;AnimationFrames&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;AnimationFrame&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Duration&gt;10&lt;/Duration&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ImageResource&gt;images\other\Kima Nose Flare (01).png&lt;/ImageResource&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;VisemeGroupName/&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/AnimationFrame&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;AnimationFrame&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Duration&gt;10&lt;/Duration&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ImageResource&gt;images\other\Kima Nose Flare (02).png&lt;/ImageResource&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;VisemeGroupName /&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/AnimationFrame&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;/AnimationFrames&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;Name&gt;nosebreath&lt;/Name&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;LoopStyle&gt;VarTimer&lt;/LoopStyle&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;MinStartDelay&gt;1&lt;/MinStartDelay&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;MaxStartDelay&gt;3&lt;/MaxStartDelay&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;ZIndex&gt;2&lt;/ZIndex&gt;         <br />&#160;&#160;&#160; &lt;/Animation&gt;&#160;&#160;&#160; <br />&#160; &lt;/BackgroundAnimations&gt;</p>
<p>   </code></p></blockquote>
<p>Unlike idle levels, the animation is declared inline this time.&#160; 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&#160; 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.&#160; 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>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=693" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/10/25/creating-your-own-characters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The different file types</title>
		<link>http://janbogaerts.name/index.php/2011/10/24/the-different-file-types/</link>
		<comments>http://janbogaerts.name/index.php/2011/10/24/the-different-file-types/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 13:50:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Documentation]]></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://janbogaerts.name/index.php/2011/10/24/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. <a href='http://janbogaerts.name/index.php/2011/10/24/the-different-file-types/' class='excerpt-more'>[...]</a>]]></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.&#160; 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><code>
<p>&lt;Topic&gt;        <br />&#160; &lt;Name&gt;Who has&lt;/Name&gt;         <br />&#160; &lt;Rules /&gt;         <br />&#160; &lt;Questions /&gt;         <br />&lt;/Topic&gt;</p>
<p>   </code></p></blockquote>
<p>And a bit more challenging, containing a single rule with 1 input and output pattern pattern:</p>
<blockquote><p><code>
<p>&lt;Topic&gt;        <br />&#160; &lt;Name&gt;Time&lt;/Name&gt;         <br />&#160; &lt;Rules&gt;         <br />&#160;&#160;&#160; &lt;Rule&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;Name&gt;new rule 1&lt;/Name&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;Patterns&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Pattern&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Expression&gt;What time is it [?]&lt;/Expression&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Pattern&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;/Patterns&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;Conditionals /&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;Outputs&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Output&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Expression&gt;It is $time:hour\:$time:minute\.&lt;/Expression&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;QuestionCanFollow&gt;True&lt;/QuestionCanFollow&gt;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Output&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;/Outputs&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;IsOutputSequenced /&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;DoPatterns /&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;Calculate /&gt;         <br />&#160; &lt;/Rules&gt;         <br />&#160; &lt;Questions /&gt;         <br />&lt;/Topic&gt;</p>
<p>   </code></p></blockquote>
<p>For the curious, the expression: <em>$time:hour\:$time:minute\.&#160; </em>is used to render something like 17:30. The expression has to be split up in 4 parts:</p>
<p>
<table border="0" cellspacing="0" cellpadding="2" width="915">
<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,…&#160; This also includes all the OS function-mappings that were declared in the ‘<em>OS channel</em>’.&#160; 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’.&#160; </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><code>
<p>&#160; &lt;Object Name=&quot;myself&quot;&gt;        <br />&#160;&#160;&#160; &lt;Text Value=&quot;myself&quot; Index=&quot;0&quot; POSGRP=&quot;false&quot; /&gt;         <br />&#160;&#160;&#160; &lt;Bindings&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;ref&gt;I&lt;/ref&gt;         <br />&#160;&#160;&#160;&#160;&#160; &lt;ref&gt;Singular&lt;/ref&gt;         <br />&#160;&#160;&#160; &lt;/Bindings&gt;         <br />&#160; &lt;/Object&gt;</p>
<p>   </code></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.&#160; 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\&#160; 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>,&#160; 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>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=688" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/10/24/the-different-file-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Small update</title>
		<link>http://janbogaerts.name/index.php/2011/10/21/small-update/</link>
		<comments>http://janbogaerts.name/index.php/2011/10/21/small-update/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 16:51:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[releases]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/10/21/small-update/</guid>
		<description><![CDATA[I’ve uploaded an update to the designer. As expected, some last minute changes were apparently not done properly. Well, I guess it’s never a good idea to do some split second changes just before a release.&#160; So,…, here’s the new release with some fresh new changes]]></description>
			<content:encoded><![CDATA[<p>I’ve uploaded an update to the designer. As expected, some last minute changes were apparently not done properly. Well, I guess it’s never a good idea to do some split second changes just before a release.&#160; So,…, <a href="http://janbogaerts.name/index.php/downloads/" target="_blank">here</a>’s the new release with some fresh new changes <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://janbogaerts.name/wp-content/uploads/2011/10/wlEmoticon-winkingsmile1.png" /></p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=686" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/10/21/small-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chatbot designer&#8217;s first beta release</title>
		<link>http://janbogaerts.name/index.php/2011/10/17/chatbot-designers-first-beta-release/</link>
		<comments>http://janbogaerts.name/index.php/2011/10/17/chatbot-designers-first-beta-release/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 15:49:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[chatbot designer]]></category>
		<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/10/17/chatbot-designers-first-beta-release/</guid>
		<description><![CDATA[The fingers are still smoking and the joints are glowing red-hot but I got there. Time for a first beta release! There are still a few things here and there, but hey, it’s a beta, right. So, with no further ado, here’s the basic version and also the pro (the latter will remain active until <a href='http://janbogaerts.name/index.php/2011/10/17/chatbot-designers-first-beta-release/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>The fingers are still smoking and the joints are glowing red-hot but I got there. Time for a first beta release! There are still a few things here and there, but hey, it’s a beta, right.</p>
<p>So, with no further ado, here’s the <a href="http://janbogaerts.name/files/CBDBasic.exe" target="_blank">basic version</a> and also <a href="http://janbogaerts.name/files/CBDPro.exe" target="_blank">the pro</a> (the latter will remain active until the end of the year). I will most likely also release a demo of the designer version &#8211; which allows full debugging and extending/replacing of the network &#8211; in a couple of days, after I’ve cleaned up some more demo projects.     <br />I might also release a 32 and 64 bit specific version in order to support voices that were compiled for a specific platform, other than the one you are running on. The currently released versions will run at 32 or 64 bit, depending on what system you have.</p>
<p>Please, if you experience any ‘hanging’ situations (no reply is coming and in the lower-right corner, the second nr &#8211; with tooltip ‘The total nr of still active processors’ -&#160; never goes back to 0), let me know. Different processors can give different results and I don’t have the resources to spend on different hardware setups, so I’m expecting some ‘issues’ in this area. Your help is much appreciated.</p>
<h4>a word about the included demos</h4>
<ul>
<li>Name &amp; age: contains some patterns that demonstrate how to access the ‘name’ and ‘age’ settings which can be supplied in the ‘chatbot properties’ window. </li>
<li>SysMan: demonstrates how to access external .net functions. It provides access to most of the File, Path and Directory functions. </li>
<li>Thesaurus operations: shows how to manipulate (add, remove,…) thesaurus data&#160; using do-patterns. </li>
<li>Asset operations: shows how you can manipulate the memory. </li>
<li>Complete the sequence: from <a href="http://janbogaerts.name/index.php/2011/08/21/complete-the-sequence/" target="_blank">the previous demo</a>, shows how to perform the ‘complete the list’ trick. </li>
<li>All: this is the start of a common, reusable library of patterns, most of which don’t even have output, but only manipulate the memory. I’m hoping that this can become the basis of a new approach to pattern matching. </li>
</ul>
<p>Also, none of the demos includes thesaurus data. this can be <a href="http://janbogaerts.name/files/full.thesaurus.xml" target="_blank">imported from this thesaurus file</a>. I’ve done this cause this data is still ‘under heavy construction’. The thesaurus currently contains a little more than 2000 words (not much), but can easily be extended using different import methods.</p>
<h4>Thesaurus variables, sub-topics and InvertedWho</h4>
<p>Next week, I’ll probably be spending some time putting together the documentation. In the mean time, there are a few tricks which were used in the common library that I’d like to mention.</p>
<p>Firstly, the whole thing is full of statements like:    <br /><code>^subj:noun.name      <br />^subj:adj.possesive       <br /></code>These are ‘thesaurus’ variables. The first word (in this case ‘subj’) is the name of the variable (so you can access the values in the output or do patterns). The other words describe a path into the thesaurus. Any child of this path will give a match.     <br />Thesaurus variables are very powerful, but also more taxing to the system compared to statics (though, usually less than regular variables). When you have lots of patterns that use thesaurus variables, like the common lib, it’s best not to let the system auto resolve synonyms. More on that later.</p>
<p>A second feature:&#160; sub-topics. This packs a serious punch, in all ways you look at it. In short, it’s possible to reference a single rule or an entire group of rules (a topic) from within another input pattern, like this:   <br /><code>~subject (am|'m|is|'s|are|be) ~object     <br /></code>This single pattern can capture anything from: <em>I’m Jan </em>or<em> my name is Jan</em> over <em>My aunt’s name is Rita </em>to <em>The big tree is a little bigger </em>and anything in between. Even more interesting, this technique allows you to do something that I call ‘topic-inheritance’, which basically means you can extend or overwrite the behavior of patterns. I plan to use this technique to build <a href="http://www-03.ibm.com/innovation/us/watson/what-is-watson/index.html" target="_blank">a ‘Watson’ like</a> chatbot on top of this common lib.</p>
<p>Finally, ‘InvertedWho’ simply refers to how the memory is used in the common lib. The basic topics like ‘subject’, ‘object’, ‘location&#8217;, ‘time’ and ‘numbers’ don’t generate any output, but store the data in 2 memory streams: the first forms the ‘inverted statement. So ‘I’ becomes ‘you’ and ‘mine’ ‘yours’ (guess for what that’s used). The second stream tries to store the actual meaning (which is a collection of references to other memory addresses or words grouped in an organized and structured way). These things are done in the ‘do patterns’. These are hidden by default in the editor, but can be made visible on each pattern (or shft + ctrl + d to expand/collapse them all at the same time). </p>
<p>There are many, many more details and cool features to talk about. Stay tuned.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=659" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/10/17/chatbot-designers-first-beta-release/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>.net integration</title>
		<link>http://janbogaerts.name/index.php/2011/09/18/net-integration/</link>
		<comments>http://janbogaerts.name/index.php/2011/09/18/net-integration/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 19:05:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[chatbot designer]]></category>
		<category><![CDATA[demos]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Screencasts]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[screencasts]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/09/18/net-integration/</guid>
		<description><![CDATA[A final pre-release video on how you can call .net functions from within your chatbot. The idea behind this feature is to allow you to extend your chatbot with custom features. This will only be available in the pro version though. Note: the video is best viewed in max resolution and full screen to see <a href='http://janbogaerts.name/index.php/2011/09/18/net-integration/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>A final pre-release video on how you can call .net functions from within your chatbot. The idea behind this feature is to allow you to extend your chatbot with custom features. This will only be available in the pro version though.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:415e3a0d-8f49-45d3-98b9-42988e60a2fa" class="wlWriterEditableSmartContent">
<div id="3bfffcf4-b369-4e76-bc2b-a699869d4486" style="margin: 0px; padding: 0px; display: inline;">
<div><a href="http://www.youtube.com/watch?v=Hp51R0xJFL4" target="_new"><img src="http://janbogaerts.name/wp-content/uploads/2011/09/videode545cae90f8.jpg" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('3bfffcf4-b369-4e76-bc2b-a699869d4486'); downlevelDiv.innerHTML = &quot;&lt;div&gt;&lt;object width=\&quot;448\&quot; height=\&quot;252\&quot;&gt;&lt;param name=\&quot;movie\&quot; value=\&quot;http://www.youtube.com/v/Hp51R0xJFL4?hl=en&amp;hd=1\&quot;&gt;&lt;\/param&gt;&lt;embed src=\&quot;http://www.youtube.com/v/Hp51R0xJFL4?hl=en&amp;hd=1\&quot; type=\&quot;application/x-shockwave-flash\&quot; width=\&quot;448\&quot; height=\&quot;252\&quot;&gt;&lt;\/embed&gt;&lt;\/object&gt;&lt;\/div&gt;&quot;;" alt=""></a></div>
</div>
</div>
<p>Note: the video is best viewed in max resolution and  full screen to see all the details.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=657" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/09/18/net-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Complete the sequence</title>
		<link>http://janbogaerts.name/index.php/2011/08/21/complete-the-sequence/</link>
		<comments>http://janbogaerts.name/index.php/2011/08/21/complete-the-sequence/#comments</comments>
		<pubDate>Sun, 21 Aug 2011 18:51:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Screencasts]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[code editor]]></category>
		<category><![CDATA[rules]]></category>
		<category><![CDATA[screencasts]]></category>
		<category><![CDATA[sequences]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/08/21/complete-the-sequence/</guid>
		<description><![CDATA[Check out this first ‘AI’ feature that can be done using only 1 rule and, if needed, some thesaurus lookups. I’ve been having a huge smile on my face all day For the interested, here’s a screenshot of the rule that enables this trick (click to enlarge): The important bit is the :complete after the <a href='http://janbogaerts.name/index.php/2011/08/21/complete-the-sequence/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Check out this first ‘AI’ feature that can be done using only 1 rule and, if needed, some thesaurus lookups.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:23fe3611-3a56-4d5f-a4c2-89cfdb3d7461" class="wlWriterEditableSmartContent">
<div id="3a266003-6e95-417d-bc23-e240a45fe015" style="margin: 0px; padding: 0px; display: inline;">
<div><a href="http://www.youtube.com/watch?v=fG9MfdKOhes&amp;hd=1&amp;fs=1" target="_new"><img src="http://janbogaerts.name/wp-content/uploads/2011/08/videoef38c5df47b83.jpg" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('3a266003-6e95-417d-bc23-e240a45fe015'); downlevelDiv.innerHTML = &quot;&lt;div&gt;&lt;object width=\&quot;448\&quot; height=\&quot;252\&quot;&gt;&lt;param name=\&quot;movie\&quot; value=\&quot;http://www.youtube.com/v/fG9MfdKOhes?hl=en&amp;hd=1\&quot;&gt;&lt;\/param&gt;&lt;embed src=\&quot;http://www.youtube.com/v/fG9MfdKOhes?hl=en&amp;hd=1\&quot; type=\&quot;application/x-shockwave-flash\&quot; width=\&quot;448\&quot; height=\&quot;252\&quot;&gt;&lt;\/embed&gt;&lt;\/object&gt;&lt;\/div&gt;&quot;;" alt=""></a></div>
</div>
</div>
<p>I’ve been having a huge smile on my face all day <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-laughingoutloud" alt="Laughing out loud" src="http://janbogaerts.name/wp-content/uploads/2011/08/wlEmoticon-laughingoutloud.png" /></p>
<p>For the interested, here’s a screenshot of the rule that enables this trick (click to enlarge):</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2011/08/Capture.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Capture" border="0" alt="Capture" src="http://janbogaerts.name/wp-content/uploads/2011/08/Capture_thumb.jpg" width="553" height="89" /></a></p>
<p>The important bit is the <em>:complete</em> after the variable $ToComp which performs the calculation.</p>
<p>Here’s another screencast that shows what’s happening behind the scenes (basically, it’s a walkthrough of the neural code in the designer):</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:cc68f9f7-e5e1-4d8c-b663-69cff35ba00d" class="wlWriterEditableSmartContent">
<div id="947237f8-5554-411f-8eb9-c00912acab47" style="margin: 0px; padding: 0px; display: inline;">
<div><a href="http://www.youtube.com/watch?v=JKx3JWLj3S4&amp;hd=1&amp;fs=1" target="_new"><img src="http://janbogaerts.name/wp-content/uploads/2011/08/video49ca0469f5584.jpg" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('947237f8-5554-411f-8eb9-c00912acab47'); downlevelDiv.innerHTML = &quot;&lt;div&gt;&lt;object width=\&quot;448\&quot; height=\&quot;252\&quot;&gt;&lt;param name=\&quot;movie\&quot; value=\&quot;http://www.youtube.com/v/JKx3JWLj3S4?hl=en&amp;hd=1\&quot;&gt;&lt;\/param&gt;&lt;embed src=\&quot;http://www.youtube.com/v/JKx3JWLj3S4?hl=en&amp;hd=1\&quot; type=\&quot;application/x-shockwave-flash\&quot; width=\&quot;448\&quot; height=\&quot;252\&quot;&gt;&lt;\/embed&gt;&lt;\/object&gt;&lt;\/div&gt;&quot;;" alt=""></a></div>
</div>
</div>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=631" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/08/21/complete-the-sequence/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter</title>
		<link>http://janbogaerts.name/index.php/2011/08/15/twitter/</link>
		<comments>http://janbogaerts.name/index.php/2011/08/15/twitter/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 08:13:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/08/15/twitter/</guid>
		<description><![CDATA[Well, I finally set up an account on twitter and linked my blog feed to it, so you can follow me on twitter as well. Here’s the link: http://twitter.com/BogaertsJan or @BogaertsJan for the short version, don’t know yet how that works.]]></description>
			<content:encoded><![CDATA[<p>Well, I finally set up an account on twitter and linked my blog feed to it, so you can follow me on twitter as well. Here’s the link: <a href="http://twitter.com/BogaertsJan">http://twitter.com/BogaertsJan</a> or @BogaertsJan for the short version, don’t know yet how that works.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=620" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/08/15/twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mika</title>
		<link>http://janbogaerts.name/index.php/2011/08/11/mika/</link>
		<comments>http://janbogaerts.name/index.php/2011/08/11/mika/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 16:55:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[characters]]></category>
		<category><![CDATA[chatbot designer]]></category>
		<category><![CDATA[Screencasts]]></category>
		<category><![CDATA[features]]></category>
		<category><![CDATA[screencasts]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/08/11/mika/</guid>
		<description><![CDATA[Check out the new character, called ‘Mika’: Pretty cool He!. I think so as well. The character is another of Laticis Imagery’s creations. Ady provided all the images and I assembled them into a single character. The video demonstrates all the available expressions, which can be activated in the output using ‘mark’ ssml tags. Perhaps <a href='http://janbogaerts.name/index.php/2011/08/11/mika/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Check out the new character, called ‘Mika’:</p>
<div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:1eebc58f-1831-4412-a987-fbc6c84ed7c2" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<div id="a2a093cb-7d2c-40f9-af26-532ddda4a728" style="margin: 0px; padding: 0px; display: inline;">
<div><a href="http://www.youtube.com/watch?v=XtVr7UW99x0&amp;hd=1" target="_new"><img style="border-style: none;" src="http://janbogaerts.name/wp-content/uploads/2011/08/video82a38031e9e1.jpg" alt="" /></a></div>
</div>
</div>
<p>Pretty cool He!. I think so as well. The character is another of <a href="http://www.laticisimagery.com.au/" target="_blank">Laticis Imagery’s creations</a>. Ady provided all the images and I assembled them into a single character. The video demonstrates all the available expressions, which can be activated in the output using <a href="http://msdn.microsoft.com/en-us/library/ff394854.aspx" target="_blank">‘mark’ ssml tags</a>.</p>
<p>Perhaps some more information on the project: The first release, the basic version should be ready in a short while now, when I have created some content (which should also be a perfect opportunity to work out some of the final details). The basic edition will be a free (as in beer) version. After that, the pro will be prepared for release which will contain some more functionality like <a href="http://en.wikipedia.org/wiki/Microsoft_UI_Automation" target="_blank">user interface automation</a>, and/or <a href="http://en.wikipedia.org/wiki/Home_automation" target="_blank">home automation</a> (not certain yet what to do first).</p>
<p>Some of the features that will be available in the first release:</p>
<ul>
<li>Select if the bot starts the conversation or waits for some input on startup. Opening statements can be declared in the bot’s properties page.</li>
<li>You can declare custom memory operations that need to be performed each time the bot starts.</li>
<li>‘Do patterns’ are also executed each time output was generated.</li>
<li>Input repetition is recognized (stored in memory as a counter) and can be handled with custom, conditional output patterns.</li>
<li>When no patterns matched, the system will use one of the custom fallback outputs.</li>
<li>Input patterns are grouped together into a single rule. These patterns share the same set of possible output patterns.</li>
<li>Multiple output patterns can be declared for a single rule. You can select if a random item needs to be selected from the list or if each item needs to be used in sequence (useful for story telling bots).</li>
<li>Each rule can have it’s own do patterns, which are used to manipulate the memory.</li>
<li>Rules are grouped together in <em>topics</em> (the 2 files that are imported in the video, each represent a topic), which are responsible for providing context. This allows you to declare the same pattern in multiple topics (useful for short statements like ‘why, when, yes, no,…’</li>
<li>Additional context can be added through do patterns and can be queried in conditions.</li>
<li>It’s possible to declare conditional questions at the level of a topic, meaning that multiple output patterns can share the same questions. The first one who’s condition matches will be used for outputs that don’t declare their own question.</li>
<li>A single output pattern can link to other output patterns, indicating that It should be used if the rule it belongs too, is the answer to a question declared in one of the linked outputs. This is useful to properly handle responses or when the user doesn’t respond as expected.</li>
<li>Time and date are supported in the output and conditionals through a variable. When used in combination with the thesaurus, some pretty powerful things can be done.</li>
<li>Test-cases for running automated tests on your bot.</li>
<li>Synonyms are automatically resolved in the input. This is a very powerful feature that’s able to recognize and replace compound words in the input. For instance,  if an input pattern contains ‘what is’ and the system knows the synonyms for ‘what is’ are ‘whats, what’s, wats, wat is, wat’s’, then you only need to declare 1 input pattern to recognize all of the possible synonyms.</li>
<li>Synonyms can be managed from the thesaurus editor.</li>
<li>The following operators can be used in the input patterns:
<ul>
<li><strong>()</strong> group input together</li>
<li><strong>[]</strong> option: words between the brackets are optional, not required to be present in the input</li>
<li><strong>{}</strong> loop: words between the brackets can be found 0, 1 or more times (useful for lists)</li>
<li><strong>|</strong> choice: the input needs to contain either the left part or the right part of the choice. This can be combined with an option, group or choice, like: [I | you | he | she | we | they]</li>
<li><strong>$<em>name</em></strong>: variable declaration: collects words that can be used in the output or conditions.</li>
<li><strong>^<em>path</em></strong>: thesaurus variable declaration: the input needs to contain a word (or compound) that is a child of the specified thesaurus path (very powerful). The actual collected word can be used in the output/conditions like a regular variable.</li>
<li><strong>&amp;&amp;</strong> the and operator allows you to declare groups of words that need to be present in the input, but which can have ‘holes’ in between them, ex: (hello) &amp;&amp; (what’s your name)</li>
</ul>
</li>
<li>conditions and outputs can also use:
<ul>
<li><strong>#<em>path</em></strong>: declares a data-path into the memory.</li>
<li><strong>~<em>name</em></strong>: to reference topics.</li>
</ul>
</li>
<li>There is a built in topic-editor or you can edit them directly in xml format.</li>
<li>The built-in topic editor has a spell checker.</li>
<li>Patterns with errors have a red line, making them easy to find. The error text can be seen as a tooltip or in the log.</li>
<li>…</li>
</ul>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=619" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/08/11/mika/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Presenting chatbot designer</title>
		<link>http://janbogaerts.name/index.php/2011/07/02/presenting-chatbot-designer/</link>
		<comments>http://janbogaerts.name/index.php/2011/07/02/presenting-chatbot-designer/#comments</comments>
		<pubDate>Sat, 02 Jul 2011 15:32:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[chatbot designer]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[characters]]></category>
		<category><![CDATA[introduction]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/07/02/presenting-chatbot-designer/</guid>
		<description><![CDATA[For those who  have  been wondering what the bleep I have been up to for the past few months, well check out the video: Watch this video on YouTube Embedded with WP YouTube Lyte. Looks pretty cool he? So, what happened? Well in short, I took the neural network designer, removed everything complicated from view <a href='http://janbogaerts.name/index.php/2011/07/02/presenting-chatbot-designer/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>For those who  have  been wondering what the bleep I have been up to for the past few months, well check out the video:</p>
<div class="lyMe hidef" id="WYL_O_NmvG-24IQ" style="width:640px;height:360px;"><noscript><a href="https://youtu.be/O_NmvG-24IQ"><img src="https://img.youtube.com/vi/O_NmvG-24IQ/0.jpg" alt="" width="640" height="340" /><br />Watch this video on YouTube</a> Embedded with WP YouTube Lyte.</noscript></div>
<div class="lL"></div>
<p>Looks pretty cool he? So, what happened? Well in short, I took the neural network designer, removed everything complicated from view that remotely had anything to do with ‘neurons’ but kept all the memory functionality, added a character engine and a simple but powerful pattern matcher (implemented in neural code, pretty cool I think,… and simple stuff).</p>
<p>The character in this demo (actually called Tara – and still in development) is designed and named by <a href="http://www.laticisimagery.com.au/" target="_blank">Ady Di Pierro from Laticis Imagery</a>.  The drawings were made with DAZ3 and assembled in something very similar to <a href="http://www.verbots.com/wiki/Tools:Conversive_Character_Open_Specification" target="_blank">verbot’s CCS file</a>.  In fact, all verbot characters should work in this character engine as well, cause I only added features to the file format but didn’t change any existing.    The images were manually assembled for this character cause there is no char-editor yet.  That is scheduled.</p>
<p>Also check out what Roger Davie (aka Freddy, Admin of the <a href="http://aidreams.co.uk/forum/index.php" target="_blank">AI  dreams forum</a>) did with the forum’s bot:</p>
<div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:dde3d7ff-449f-4fd7-9a1c-464fa982c9f4" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<div id="aa96a371-f5eb-4791-8393-56cb1a09ff0f" style="margin: 0px; padding: 0px; display: inline;">
<div><a href="http://www.youtube.com/watch?v=z0UJolggyDo&amp;feature=player_embedded" target="_new"><img style="border-style: none;" src="http://janbogaerts.name/wp-content/uploads/2011/07/video75c6d9f065c3.jpg" alt="" /></a></div>
</div>
</div>
<p>The images are also rendered with DAZ. He definitely has the visemes already worked out better than in the first demo.</p>
<p>So, how did all of this come to be, you might wonder. Well, I think you can thank <a href="http://www.chatterboxchallenge.com/" target="_blank">Wendell Cowart from the chatterbox challenge</a> for this. He originally contacted me with a request for a new ‘pattern based’ chatbot project. I took this as a nice challenge to demonstrate exactly just how flexible resonating neural networks are. Soon, <a href="http://www.personalityforge.com/dynachat.php?BotID=24007&amp;MID=23957" target="_blank">Patti Roberts of Bildgesmythe</a> also joined in. Together, they basically told me how they would like to have things, which features they were looking for and such. Thus, this little project was able to come into existence at record speed.<br />
Patti and Wendell also helped out a lot with the initial ‘mid development’ testing, which I’m sure you understand is a pretty frustrating job to do, as things are usually not yet behaving the way they are expected to. So many thanks for cracking out those basic ‘issues’.</p>
<p>Anyway, for those who would like to play with it for themselves, a first public beta release will most likely be coming shortly. Just keep in mind that any first release will be a ‘technology preview’ sort of say.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=617" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/07/02/presenting-chatbot-designer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Off-line</title>
		<link>http://janbogaerts.name/index.php/2011/05/11/off-line/</link>
		<comments>http://janbogaerts.name/index.php/2011/05/11/off-line/#comments</comments>
		<pubDate>Wed, 11 May 2011 12:21:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AICI]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[off-line]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/05/11/off-line/</guid>
		<description><![CDATA[I’m taking everything off line for the time being. Some major changes are on the way. Stay tuned, it’s going to be interesting.]]></description>
			<content:encoded><![CDATA[<p>I’m taking everything off line for the time being. Some major changes are on the way. Stay tuned, it’s going to be interesting.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=612" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/05/11/off-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Screen cast on assets</title>
		<link>http://janbogaerts.name/index.php/2011/03/21/screen-cast-on-assets/</link>
		<comments>http://janbogaerts.name/index.php/2011/03/21/screen-cast-on-assets/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 16:19:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Screencasts]]></category>
		<category><![CDATA[assets]]></category>
		<category><![CDATA[screencasts]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/03/21/screen-cast-on-assets/</guid>
		<description><![CDATA[Note: Deprecated! The next screen cast is ready. It demonstrates some of the features found in the ‘asset’ editor.]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>The next screen cast is ready. It demonstrates some of the features found in the ‘asset’ editor.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:9e4829e0-844b-473b-aced-8bebfadda98f" class="wlWriterEditableSmartContent">
<div id="9089227a-605c-4da1-893c-3b7232b4218f" style="margin: 0px; padding: 0px; display: inline;">
<div><a href="http://www.youtube.com/watch?v=Yi_mbSHoOmk&amp;feature=youtube_gdata_player" target="_new"><img src="http://janbogaerts.name/wp-content/uploads/2011/03/videoc711518e24b91.jpg" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('9089227a-605c-4da1-893c-3b7232b4218f'); downlevelDiv.innerHTML = &quot;&lt;div&gt;&lt;object width=\&quot;724\&quot; height=\&quot;406\&quot;&gt;&lt;param name=\&quot;movie\&quot; value=\&quot;http://www.youtube.com/v/Yi_mbSHoOmk?hl=en&amp;hd=1\&quot;&gt;&lt;\/param&gt;&lt;embed src=\&quot;http://www.youtube.com/v/Yi_mbSHoOmk?hl=en&amp;hd=1\&quot; type=\&quot;application/x-shockwave-flash\&quot; width=\&quot;724\&quot; height=\&quot;406\&quot;&gt;&lt;\/embed&gt;&lt;\/object&gt;&lt;\/div&gt;&quot;;" alt=""></a></div>
</div>
</div>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=609" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/03/21/screen-cast-on-assets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Screencasts</title>
		<link>http://janbogaerts.name/index.php/2011/03/19/screencasts/</link>
		<comments>http://janbogaerts.name/index.php/2011/03/19/screencasts/#comments</comments>
		<pubDate>Sat, 19 Mar 2011 15:44:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Screencasts]]></category>
		<category><![CDATA[Test cases]]></category>
		<category><![CDATA[screencasts]]></category>
		<category><![CDATA[test case]]></category>
		<category><![CDATA[thesaurus]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/03/19/screencasts/</guid>
		<description><![CDATA[Note: Deprecated! I’ve uploaded the first 2 in a set of screencasts on how to use NND. They can be reached from the Quick start page or you can view them directly from here: Hope you liked them.]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>I’ve uploaded the first 2 in a set of screencasts on how to use NND. They can be reached from the <a href="http://janbogaerts.name/index.php/quick-start/" target="_blank">Quick start</a> page or you can view them directly from here:</p>
<p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:8a6f7cea-bb65-49f7-bc99-5e767a78a22a" class="wlWriterEditableSmartContent">
<div id="d4506e79-2986-4556-b7ce-cf52b1443da2" style="margin: 0px; padding: 0px; display: inline;">
<div><a href="http://www.youtube.com/watch?v=ATpIOQDlRIY&amp;feature=youtube_gdata_player" target="_new"><img src="http://janbogaerts.name/wp-content/uploads/2011/03/video66cef4a677e21.jpg" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('d4506e79-2986-4556-b7ce-cf52b1443da2'); downlevelDiv.innerHTML = &quot;&lt;div&gt;&lt;object width=\&quot;448\&quot; height=\&quot;252\&quot;&gt;&lt;param name=\&quot;movie\&quot; value=\&quot;http://www.youtube.com/v/ATpIOQDlRIY?hl=en&amp;hd=1\&quot;&gt;&lt;\/param&gt;&lt;embed src=\&quot;http://www.youtube.com/v/ATpIOQDlRIY?hl=en&amp;hd=1\&quot; type=\&quot;application/x-shockwave-flash\&quot; width=\&quot;448\&quot; height=\&quot;252\&quot;&gt;&lt;\/embed&gt;&lt;\/object&gt;&lt;\/div&gt;&quot;;" alt=""></a></div>
</div>
</div>
<p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:7416eeda-049b-4cde-b166-f8f21ccdfc56" class="wlWriterEditableSmartContent">
<div id="1b898d01-fa2e-407c-9fc5-012cd6e91653" style="margin: 0px; padding: 0px; display: inline;">
<div><a href="http://www.youtube.com/watch?v=Sqr59YAoR_s&amp;feature=youtube_gdata_player" target="_new"><img src="http://janbogaerts.name/wp-content/uploads/2011/03/video3178d676c13a1.jpg" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('1b898d01-fa2e-407c-9fc5-012cd6e91653'); downlevelDiv.innerHTML = &quot;&lt;div&gt;&lt;object width=\&quot;448\&quot; height=\&quot;252\&quot;&gt;&lt;param name=\&quot;movie\&quot; value=\&quot;http://www.youtube.com/v/Sqr59YAoR_s?hl=en&amp;hd=1\&quot;&gt;&lt;\/param&gt;&lt;embed src=\&quot;http://www.youtube.com/v/Sqr59YAoR_s?hl=en&amp;hd=1\&quot; type=\&quot;application/x-shockwave-flash\&quot; width=\&quot;448\&quot; height=\&quot;252\&quot;&gt;&lt;\/embed&gt;&lt;\/object&gt;&lt;\/div&gt;&quot;;" alt=""></a></div>
</div>
</div>
<p>Hope you liked them.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=597" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/03/19/screencasts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>0.6 (CBC11) released</title>
		<link>http://janbogaerts.name/index.php/2011/03/15/0-6-cbc11-released/</link>
		<comments>http://janbogaerts.name/index.php/2011/03/15/0-6-cbc11-released/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 18:46:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/03/15/0-6-cbc11-released/</guid>
		<description><![CDATA[Note: Deprecated! The time for a new release has finally arrived. Lots of new things: The designer and core: lots of speed improvements and deadlock fixes. Added a new asset editor. With this editor, you can declare things like ‘An eye has a color and the color of an eye is usually blue green or <a href='http://janbogaerts.name/index.php/2011/03/15/0-6-cbc11-released/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>The time for a new release has finally arrived. Lots of new things:<a href="http://janbogaerts.name/wp-content/uploads/2011/03/Capture.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Capture" border="0" alt="Capture" align="right" src="http://janbogaerts.name/wp-content/uploads/2011/03/Capture_thumb.jpg" width="286" height="226" /></a></p>
<p>The designer and core:</p>
<ul>
<li>lots of speed improvements and deadlock fixes.</li>
<li>Added a new asset editor. With this editor, you can declare things like ‘An eye has a color and the color of an eye is usually blue green or brown’. This is done with a graphical editor, instead of entering text, so you can directly manipulate the network.&#160; Of course, this can also be used to view recorded ‘asset data’.</li>
<li>Added a new dialog box which allows you to merge 2 neurons into 1. This can be very useful in some situations.</li>
<li>Extended the ‘frames’ editor, so that it can also edit semantic frames (which are new in this version of Aici).</li>
<li>Added a ‘bool filter’ to the frames editor</li>
<li>As I’ve previously mentioned, there’s also a new ‘test case’ debugging tools, which is great for automated testing and validation (using regular expressions) of large input volumes. Running big tests can be useful to pick up unexpected behavior that got introduced because of newly added frames.</li>
<li>I’ve also added support for ‘code search’. You can now search for all occurrences of any neuron within a code cluster in the entire network. To search for a neuron, select it and press ‘Ctrl+F3&#8242;.</li>
<li>There’s a new version available of the ‘echo words’ demo, which uses less code (3 statements).</li>
<li>New instructions: GetCommonParents, GetCommonParentsFiltered, GetCommonParentsWithMeaning </li>
<li>Lots of bug fixes + introduced some new ones <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://janbogaerts.name/wp-content/uploads/2011/03/wlEmoticon-winkingsmile2.png" /></li>
</ul>
<p>Aici:</p>
<ul>
<li>A brand new semantics stage (again), which supports complex sentences and provides more possibilities.</li>
<li>Added a bunch of semantic frames for things like ‘place’, ‘time’, some verbs, nouns and actions.</li>
<li>Added a bunch of new grammar frames, mostly for complex sentences, but also for things like ‘where’, ‘who’,…</li>
<li>Added new actions, mostly for complex sentences, but also for better support of verbs.</li>
<li>cleaned up/improved the ‘be’ and ‘have’ action handlers a bit.</li>
<li>lots of new words</li>
<li>… (I sort of forgot to note everything I did near the end) For a good overview of what’s currently possible, check <a href="http://janbogaerts.name/index.php/category/conversations/" target="_blank">the conversations category</a>.</li>
</ul>
<p>And naturally, he latest version can be retrieved from the <a href="http://janbogaerts.name/index.php/downloads/" target="_blank">downloads page</a>.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=590" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/03/15/0-6-cbc11-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>8393</title>
		<link>http://janbogaerts.name/index.php/2011/02/21/8393/</link>
		<comments>http://janbogaerts.name/index.php/2011/02/21/8393/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 18:05:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Conversations]]></category>
		<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/02/21/8393/</guid>
		<description><![CDATA[Well, it’s an answer]]></description>
			<content:encoded><![CDATA[<p><a href="http://janbogaerts.name/wp-content/uploads/2011/02/Capture.jpg"><img style="background-image: none; border-right-width: 0px; margin: 3px 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Capture" border="0" alt="Capture" src="http://janbogaerts.name/wp-content/uploads/2011/02/Capture_thumb.jpg" width="144" height="35" /></a></p>
<p>Well, it’s an answer <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-laughingoutloud" alt="Laughing out loud" src="http://janbogaerts.name/wp-content/uploads/2011/02/wlEmoticon-laughingoutloud.png" /></p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=571" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/02/21/8393/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging: Attached variables</title>
		<link>http://janbogaerts.name/index.php/2011/01/03/debugging-attached-variables/</link>
		<comments>http://janbogaerts.name/index.php/2011/01/03/debugging-attached-variables/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 18:40:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[attached variables]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[code editor]]></category>
		<category><![CDATA[debugging]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2011/01/03/debugging-attached-variables/</guid>
		<description><![CDATA[Note: Deprecated! Debugging time!!! (when isn’t it.) I sort of forgot about this one, until a couple of days ago, when I ran into a similar problem as for which I originally created this (ahem) simple little trick.  To explain you what attached neurons are for, perhaps first a little explanation on how I have <a href='http://janbogaerts.name/index.php/2011/01/03/debugging-attached-variables/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>Debugging time!!! (when isn’t it.) I sort of forgot about this one, until a couple of days ago, when I ran into a similar problem as for which I originally created this (ahem) simple little trick.  To explain you what attached neurons are for, perhaps first a little explanation on how I have been designing my neural algorithms. (Caution: this is advanced stuff, not for the faint-hearted).</p>
<p>As with all algorithms, I take some input and process it to generate some output. The input with neural algorithms, is always expressed using neurons. The process to execute is defined through the meaning of a link (which also maps to a neuron). The link starts from the input neuron and usually points to some value that needs to be compared against or searched for,…, but this can also be something else.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2011/01/image1.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2011/01/image_thumb1.png" border="0" alt="image" width="323" height="132" /></a><br />
The problem is the ‘split’ instruction. This is a very powerful thing indeed, which allows me to write simple, massively parallel code. It does, exactly as the word says, it ‘splits’ the current process into x nr of similar processes. They are similar, but not exactly the same: ‘the input neurons’ have been duplicated so that they contain the same values, but using new neurons, so that the process will eventually lead to a different result neuron. Also, the ‘variable’ that was supplied with the split instruction, has a unique value in each process (the value items are declared in the split instruction, they  determine the nr of new processes in the split). And finally, globals can be declared  as having to ‘duplicate’ their content when a split occurs. All this means that each process is similar (most variables point to the same neurons), but not exactly the same. (Mount Everest stuff, I know.)<br />
The key thing to keep in mind here are the duplicated input neurons: when a split occurs, the idea is that each process will work on it’s own input and result data. But, sometimes, for various reasons, one or more of these neurons can spill over to other processes. And that’s when ‘contamination’ can occur, or when one process modifies the input/result of an other process, which is very bad indeed and excruciatingly difficult to trace using traditional debugging methods like breakpoints.</p>
<p>Thus come attached variables to the rescue. The idea is very simple: Whenever a ‘variable’ that has been signaled in the designer as ‘attach required’, gets it’s first value assigned, it attaches this ‘value’ to the  process in which this assignment occurred. If, from that point on, another  process tries to change  this value-neuron, all alarms go off as if it were WOIII. And that’s basically it. From there on, it’s up to you to use the <a href="http://janbogaerts.name/wp-content/uploads/2011/01/image2.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2011/01/image_thumb2.png" border="0" alt="image" width="279" height="141" align="right" /></a>presented information (where and who), to figure out the why.</p>
<p>For practical use, I have found that the ‘CurrentFrom’ system variable, really is the most useful variable for this trick, though it is possible to put it on any other. You can even attach neurons manually to a process, if you’ve paused and selected one. This is done on a code editor, using the context menu item ‘attach to  processor’. To activate the monitoring of a variable, make certain that it is added to the left most pane in the debugger view and select checkbox  in the ‘attach’ column before you provide the network with some input.</p>
<p>Like I’ve already mentioned, it doesn’t take much to use and activate it. This little trick’s usage field isn’t very broad, it only traces down 1 specific type of bug, but one that is very hard to find otherwise. Also, if not used correctly, you can get a lot of false errors, since it’s very common for multiple processes to modify the same neurons. So use with caution!</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=532" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2011/01/03/debugging-attached-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Structured editors: a first impression</title>
		<link>http://janbogaerts.name/index.php/2010/12/20/structured-editors-a-first-impression/</link>
		<comments>http://janbogaerts.name/index.php/2010/12/20/structured-editors-a-first-impression/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 15:58:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[code editor]]></category>
		<category><![CDATA[code images]]></category>
		<category><![CDATA[designers]]></category>
		<category><![CDATA[editing]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[structured editor]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/12/20/structured-editors-a-first-impression/</guid>
		<description><![CDATA[For a while now, I’ve been working fairly intensely with the designer and it’s many structured editors. Long enough for me to get a feeling for them and find a good rhythm in working with them. So I thought it perhaps time to put down my experiences and ideas for future improvements. To tell you <a href='http://janbogaerts.name/index.php/2010/12/20/structured-editors-a-first-impression/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>For a while now, I’ve been working fairly intensely with the designer and it’s many structured editors. Long enough for me to get a feeling for them and find a good rhythm in working with them. So I thought it perhaps time to put down my experiences and ideas for future improvements.<br />
To tell you the  truth, I took a big risk when I decided to make all the editors, including the one for code, as <a href="http://en.wikipedia.org/wiki/Structure_editor" target="_blank">structured editors</a> (aka not text-based). The reasons are simple:</p>
<ul>
<li>I had never made something like that, while I had plenty of experience <a href="http://users.telenet.be/GeneCompiler/" target="_blank">designing languages</a>,</li>
<li>I didn’t really know what the end product would look like or how it would behave,</li>
<li>and apart from some ‘UML designers’ that render classes, I had never used such a thing for editing code myself.</li>
</ul>
<p>So then, what made me decide to use this approach instead of the more conventional and traditional way of using text?  First of, a major part of the answer lies in the previous statement <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-style: none;" src="http://janbogaerts.name/wp-content/uploads/2010/12/wlEmoticon-winkingsmile.png" alt="Winking smile" /> . Other reasons were:</p>
<ul>
<li>Guided editors (can) lower the entrance level, when done properly (something I needed,… seriously).</li>
<li>I new I would be needing some good debuggers (lessons learned!!). I could try and incorporate these into some existing editors, or turn out one of my own. At the time, it seemed a better idea to have full control from top to bottom, if I wanted to do this properly.</li>
<li>I had a bit of experience working in WPF, which gave me some confidence that it was possible.</li>
<li>Also, I came across this, <a href="http://blogs.msdn.com/b/kirillosenkov/archive/2009/09/08/first-videos-of-the-structured-editor-prototype.aspx" target="_blank">rather serious attempt at structured editors </a>(originally for C#), which raised my hopes as well.</li>
<li>Did I already mention you that I was hoping this would make things a bit simpler for other people to understand?</li>
</ul>
<p>In the end, it turns out I am glad I decided to use this approach, though not exactly for the reasons as previously stated.<a href="http://janbogaerts.name/wp-content/uploads/2010/12/image.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/12/image_thumb.png" border="0" alt="image" width="111" height="142" align="right" /></a> Except perhaps for the debugging, which really was fairly easy to implement this way. No, the thing that convinced me was the way that it changes how you program. This didn’t happen over night, I only began noticing this the last couple of months, after some 1,5 years of (trying to) program this way.<br />
So what changed: well, over time, when I needed a ‘variable’, instead of thinking ‘variable’ I began to think ‘purple’. This is a shift from thinking in words to thinking in color. The best evidence for this, came in the form of me, continually trying to put a conditional in an assignment as if it were a global (cause I thought I had picked up a global). If you look at the picture to the right, you can probably understand why I erred: the blue colors are just to close to each other.<br />
What’s more, over time I also began to think more and more in visual structures instead of ‘if-else’ or ‘while-do’. When I think about an ‘if’, I think:</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/12/image1.png"><img style="background-image: none; margin: 0px auto 10px; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/12/image_thumb1.png" border="0" alt="image" width="461" height="155" /></a> In short, when programming, I am thinking more and more in terms of: blue square, red hexagon, white circle with line below (the conditional part),… Or in other words, it feels as if I am programming like building with <a href="http://www.lego.com/en-gb/default.aspx" target="_blank">Lego</a> blocks!!! <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://janbogaerts.name/wp-content/uploads/2010/12/wlEmoticon-smile.png" alt="Smile" /><br />
I can’t explain exactly how or why this is, but it appears to free the mind for thinking about other stuff. At times, I find myself, just mindlessly putting blocks together to build up the picture that I had previously constructed in my head.  Very pleasing.</p>
<p>So, as a first try, I am very happy with the result, well enough for me to continue this path, and with some minor corrections here and there, keep the design. That is not to say there isn’t room for improvement, I have bucket-loads already of those, just not the time, so most of these will not be for the near future.  Others might be implemented sooner, depending on needs.</p>
<p>Basically, most of the concerns are centered round work speed (the number of movements and clicks required for an operation), maintainability and overview:</p>
<h4>Speed</h4>
<ul>
<li>To start with, the toolbox needs some redesign. I currently have 2 pages: one for general items, and a separate tab for all the instructions. I find myself continually switching between the 2, which is time consuming and unnecessary. The solution is simple: split them up in separate toolboxes.</li>
<li>The toolbox currently only supports drag-drop operations. So to get 5 objects of the same type, you need to perform 5 drags. Better would be to have a ‘paint’ tool, like graphical apps, and many (UML) designers have.</li>
<li>The code designer really could use some more keyboard support, so it can be used like a regular text editor (sort of). This seems a logical next step to do, just haven’t gotten there yet.</li>
<li>I have been thinking a lot about using WPF’s new <a href="http://www.davidezordan.net/blog/?p=1136" target="_blank">multi-touch libraries</a> to add support for using 2 mice while coding. I don’t really make use of the left hand during the GUI coding, apart from the occasional copy/paste or editing a label. At times, I could definitely work with 2 hands at the same time. It’s a bit like using both hands for searching and placing blocks.<br />
I had also thought about using this new <a href="http://www.xbox.com/en-GB/kinect" target="_blank">kinect</a> toy, which appears to have been <a href="http://www.engadget.com/2010/11/16/kinect-hack-explained-follow-along-at-home-guide-lets-you-rever/" target="_blank">hacked</a> already for PC usage. This would even resemble more like building with Lego (or like <a href="http://singularityhub.com/2010/12/10/mit-uses-xbox-kinect-to-create-cheap-minority-report-interface-video/" target="_blank">Tom cruise is doing in Minority report</a>) . But then I figured: ok how would you feel after 2 weeks of keeping  your arms up in the air? Ok, I don’t know how I’d feel after 2 weeks like that, but my shoulders and neck definitely do!!!<br />
So that plan was canceled.</li>
</ul>
<h4>Overview</h4>
<ul>
<li>As I’ve previously mentioned, I often simply recreate the picture that’s already in my head. The annoying thing is that the designer only shows a small part of the object (algorithm) that I’m working on, while at times I have more a need for a birds view approach. That’s why I added the zoom support, but more can be done such as:
<ul>
<li>make the code templates (the drawings) a bit smaller. I’m no good at designing, which shows.</li>
<li>provide a bread-crumb like ability (for drilling down and going back up again), much like the windows file explorer provides using it’s breadcrumb approach for directories.  I could use this for sub blocks.</li>
<li>See what I can do about providing support for multiple screens.</li>
<li>Buy a new big sized monitor, but given the massive resources at my disposal, that’s not an option <img class="wlEmoticon wlEmoticon-sadsmile" style="border-style: none;" src="http://janbogaerts.name/wp-content/uploads/2010/12/wlEmoticon-sadsmile.png" alt="Sad smile" /></li>
</ul>
</li>
<li>Also previously stated: some of the colors can use a little tuning, the same perhaps for some shapes, to make them more distinguishable from each other.</li>
<li>Currently, the drop area for the arguments is displayed as a simple, single square. The thing is: the argument requirements are known for each instruction, so it’s perfectly possible to display a custom set of boxes, with correct labels, for each instruction. This, by the way, would also free some space, since no drop area needs to be shown when all arguments are provided.</li>
<li>I could also try to implement some sort of 3D-view on the network model, but I think I’ll need to extend my skill-set for that one.</li>
</ul>
<h4>Maintainability</h4>
<p>The single major issue I have with code maintainability is concerning documentation. I added support for this by allowing to add some ‘rich-text’ string to each neuron. The idea being that you’d put all the comments concerning what’s going on, in there. Unfortunately, it doesn’t really work very well for code documentation because:</p>
<ul>
<li>neurons can be reused. This is different compared to regular text code: when this is compiled, each line of code will get it’s own output (or better, each compiled instruction corresponds with exactly 1 location within the text). With this neural network however, things are a bit different: it’s perfectly possible to use the same assignment in 2 (or more) different places. This is something I do extensively, by the way, to speed up coding and to keep the nr of links down.  What I noticed is this: though the code is shareable, the reason usually isn’t. I am currently solving this by stacking the different comments in the same text-blob, when needed. But better solutions are possible.</li>
<li>I also find it annoying having to select an object in order to see it’s comments within the code view. It appears to be easier/better when you can quickly scan a document for all comments and read the one you need, without thinking about selection.</li>
</ul>
<p>To solve this, I have been thinking about adding support for comments within the ‘project’ documents. These would maintain and display (as call-out balloons) all the comments for the neurons that they contain. The location of the comments would be determined by the comments themselves, so they can be floating, closest to the neuron that they are attached to. This would also allow me to display the comments, even if the actual neurons aren’t visible, but collapsed.</p>
<h4>Final note</h4>
<p>As a final note, for those who would like to build their own structured editor in WPF, perhaps a word of advice: <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.aspx" target="_blank">stay away from</a> ItemsControl or any of it’s descendants. The paradigm sounds grate: manage a list of items and display them any way you want through styling and templates. What’s not mentioned is that this only works for 10 objects or so. Any more, and your app slows down to a crawl or worse: crashes just as bad as the good old win32 apps would, perhaps even worse at times. Instead, go lower level: inherit from panel and roll out your own Measure/Arrange or go even further down and overwrite the rendering routines.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=513" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/12/20/structured-editors-a-first-impression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The To-many-globals bug</title>
		<link>http://janbogaerts.name/index.php/2010/11/10/the-to-many-globals-bug/</link>
		<comments>http://janbogaerts.name/index.php/2010/11/10/the-to-many-globals-bug/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 14:52:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[globals]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/11/10/the-to-many-globals-bug/</guid>
		<description><![CDATA[Man, I was almost ready to give up on this one. I had been trying to find the cause of a very peculiar bug for months now without getting anywhere.&#160; It occasionally caused all results to be dropped without any error, deadlock or exception to trace down. Because it only happened occasionally, under varying conditions, <a href='http://janbogaerts.name/index.php/2010/11/10/the-to-many-globals-bug/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Man, I was almost ready to give up on this one. I had been trying to find the cause of a very peculiar bug for months now without getting anywhere.&#160; It occasionally caused all results to be dropped without any error, deadlock or exception to trace down. Because it only happened occasionally, under varying conditions, I strongly suspected something at the threading level was going wrong. So I have been staring at the same 30 (or so) lines of C# code for months now, trying to figure out where it could drop something or do anything wrong. (strong feelings of resentment swell as I think about those lines). Of course, the latest speed improvements made it impossible to continue without figuring out what was going on. </p>
<p>Don’t ask me how I figured it out, but yesterday, I decided&#160; nothing could be wrong with those lines of code and instead, something in the neural code has to be wrong, more specifically, with the variables. So I built myself a better view on the memory content of the processors, and lo and behold, there they are: 3 innocent globals that get carried over from one algorithm to the next, causing all sorts of mayhem. In total, the fix took about 20 seconds. Which leaves me with mixed feelings: I’m soooo glad I finally found it. If only I had looked in the right place 3 months ago.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=493" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/11/10/the-to-many-globals-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On flows</title>
		<link>http://janbogaerts.name/index.php/2010/11/02/on-flows/</link>
		<comments>http://janbogaerts.name/index.php/2010/11/02/on-flows/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 14:03:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[AICI]]></category>
		<category><![CDATA[N²D]]></category>
		<category><![CDATA[Structures]]></category>
		<category><![CDATA[flow recoginition]]></category>
		<category><![CDATA[flows]]></category>
		<category><![CDATA[parsing]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/11/02/on-flows/</guid>
		<description><![CDATA[Note: Deprecated! An introduction In short, a flow is a template definition of recognizable data. It is used to transform a stream of neurons into another stream of neurons (doesn’t sound very useful, but trust me, it is).  To get a visual image on how a flow works, you can perhaps think of those toddler <a href='http://janbogaerts.name/index.php/2010/11/02/on-flows/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<h3>An introduction</h3>
<p>In short, a flow is a template definition of recognizable data. It is used to transform a stream of neurons into another stream of neurons (doesn’t sound very useful, but trust me, it is).  To get a visual image on how a flow works, you can perhaps think of those toddler toys where the child needs to fit different types of blocks into different types of wholes (see image).</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/11/babys-first-blocks.jpg"><img style="margin: 0px auto; display: block; float: none; border-width: 0px;" title="babys first blocks" src="http://janbogaerts.name/wp-content/uploads/2010/11/babys-first-blocks_thumb.jpg" border="0" alt="babys first blocks" width="275" height="275" /></a></p>
<p>Well, a Flow is the yellow filter at the top of the box. As the blocks pass along, a flow tries to find a set that fits it’s filter. When it finds one, it collects this set, tags it, and stores it for further use. This process is done by the <em>flow recognition algorithm</em>.</p>
<blockquote><p>A flow is a template definition, used to recognize sequences of data in a stream.</p></blockquote>
<h3>flow items</h3>
<p>So, what is this filter that’s supposed to recognize the data, actually constructed of? Well, flow definitions are very (mmm, perhaps not so very) similar to <a href="http://en.wikipedia.org/wiki/Coco/R" target="_blank">Coco/R</a> definitions. In short, you use constants, other (nested) flows, loops and options to build up a definition. Here’s a short example:<br />
<a href="http://janbogaerts.name/wp-content/uploads/2010/11/image.png"><img style="margin: 5px auto; display: block; float: none; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/11/image_thumb.png" border="0" alt="image" width="121" height="34" /></a> This flow can recognize the sequence: <em>Agent verb</em> possibly followed by a <em>not</em>. It’s actually the definition for the <em>simple past tense</em> (there’s an extra hidden filter on ‘verb’ which I’m not showing yet for this example). ‘Agent’ is underscored, indicating that it is another flow, <em>verb</em> is not, so it’s a static, like <em>not</em>. Which is surrounded by strait brackets, indicating that it’s optional. So basically, this flow can recognize statements like: <em>I swam, you dug, the brown men found not</em>,… Without the filter (like here), sentences like: <em>I fish, they eat not,…</em> would also be recognized.</p>
<h4>Statics and nested flows</h4>
<p>Most of the items in a flow definition tend to be statics and other, nested flows. This forms the meat, the data that can be found in the input stream itself. When 2 statics are declared in sequence, the same sequence needs to be found in the input, without anything in between.</p>
<p>Nested flows can easily be recognized. They are underlined. If you double-click on them, you will jump automatically to the flow (you can navigate back and forward between the selected flows using the navigation commands). Behavior-wise, nested flows are the same as statics. If you declare 2 nested flows in sequence, the input stream should contain the data for the 2 flows in the same sequence.</p>
<h4>Floating flows</h4>
<p>A floating flow is a special type of flow that can be recognized anywhere in the stream without having to be specifically declared in any other flows. They are mostly used for things like spaces and newlines. You usually don’t integrate them into other flows, as nested.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/11/image1.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/11/image_thumb1.png" border="0" alt="image" width="186" height="86" /></a></p>
<p>Floating flows can be destructive or not. When a destructive flow is found, it will break up the recognition of other data in the stream. So this type of flow can not be found between 2 statics, but can be between 2 nested flows or between options, loops or conditional parts (see further). If you need to have a floating flow between 2 statics, it needs to be non destructive. The type of flow can be assigned from a context menu on the flows: you can select for normal flows (not floating), floating (visualized by a green bar in front of the flow) and non destructive floating (displayed using a blue bar).</p>
<p>You can also specify if the data that a floating flow finds is discarded or not. Discarding the data can be useful in cases where you are really not interested in it, like for empty space. This is also selected from the context menu on the flows and is visualized by using an extra bar at the end of the flow.</p>
<h4>Options</h4>
<p>With an option you can define a number of different paths, from which 1 can or has to be selected. The following example of options defines the ‘can’ verb:<a href="http://janbogaerts.name/wp-content/uploads/2010/11/Capturecan.jpg"><img style="margin: 5px auto; display: block; float: none; border-width: 0px;" title="Capturecan" src="http://janbogaerts.name/wp-content/uploads/2010/11/Capturecan_thumb.jpg" border="0" alt="Capturecan" width="211" height="126" /></a>A blue block (also called ‘conditional part’) represents a single path. If the frontal bracket of the options contains a vertical line, 1 path has to be selected, if there is no line, no path has to be selected but 1 can be. The content of a conditional has to be recognized in the same sequence as the way that it is defined and can consist of statics, flows, loops and other options, but no conditional parts. The option itself can only contain conditional parts.</p>
<p>Just like statics and nested flows, you can also reuse the same option in different places. In fact, the more you can do this, the more processing power can be saved. The same goes for the conditional parts (the blue blocks). These can also be shared by different options (and loops). This can be done by drag and drop from within the editor.</p>
<h4>Loops</h4>
<p>Loops are very similar to options, they also consist of conditional parts and they can also be defined with a vertical line in front, indicating that 1 path has to be selected or not. The main difference with options is that a loop can recognize 0, 1 or more of it’s conditional parts in sequence. They are declared using curly brackets, like in the following example:<a href="http://janbogaerts.name/wp-content/uploads/2010/11/CaptureIntDef.jpg"><img style="margin: 0px auto; display: block; float: none; border-width: 0px;" title="CaptureIntDef" src="http://janbogaerts.name/wp-content/uploads/2010/11/CaptureIntDef_thumb.jpg" border="0" alt="CaptureIntDef" width="75" height="32" /></a> This loop simply declares a sequence of digits, with at least 1 required digit. In other words, it’s the definition for an integer.</p>
<p>Loops can have some more lines in the front to declare extra info. If there is a green line present, to the right of the black one, it means there can’t be a floating flow in between 2 conditional parts, otherwise this is allowed (see floating flows). A red line to the left of the black one, indicates exactly the opposite: 2 conditionals need to have a floating flow in between them for a valid parse (not often used).</p>
<p>As a final example, here’s the entire scanner definition which is used to recognize words, numbers (integer and doubles), signs and spaces:</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/11/image2.png"><img style="margin: 0px auto; display: block; float: none; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/11/image_thumb2.png" border="0" alt="image" width="479" height="348" /></a></p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=489" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/11/02/on-flows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NND 0.5.1</title>
		<link>http://janbogaerts.name/index.php/2010/11/01/nnd-0-5-1/</link>
		<comments>http://janbogaerts.name/index.php/2010/11/01/nnd-0-5-1/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 14:43:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[releases]]></category>
		<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/11/01/nnd-0-5-1/</guid>
		<description><![CDATA[Note: Deprecated! It’s time again to do a new release, which was long overdue to tell you the truth. Lots of things have been changed, though mostly in the background, both for the designer and Aici. Here’s a non exhaustive list of the changes: The designer + core: Basically, I began the process of improving <a href='http://janbogaerts.name/index.php/2010/11/01/nnd-0-5-1/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>It’s time again to do a new release, which was long overdue to tell you the truth. Lots of things have been changed, though mostly in the background, both for the designer and Aici. Here’s a non exhaustive list of the changes:</p>
<h4>The designer + core:</h4>
<p>Basically, I began the process of improving the feel of the application, to get the prototype taste out of it. It’s not done yet, but things are improving considerably. I am now able to work with the designer for a full day, while keeping memory reasonably under control and with the same speed at the end as at the start. here’s what else got changed:</p>
<ul>
<li>Lots of speed improvements (more to go) </li>
<li>fixed some memory leaks, there are still some more left to plug. </li>
<li>New instructions: IsClusteredByAny, ChangeChild, ChangeInfo, ChangeParent, Avg (average), Max, Min, StDev </li>
<li>Added system events OnStarted, OnShutDown, OnSinActivity. </li>
<li>Added a new system variable: Time (to get the current system time). </li>
<li>Added back/forward commands to the flow editor. </li>
<li>Added the ability to manage 1 to 1 thesaurus relationships (from within the thesaurus tool window).</li>
<li>Added ‘go to unfreeze location’ functionality in the memory profiler. </li>
<li>Created a custom treeview, currently only used by the thesaurus. There are still a few issues left with the new view, but it fixes some unresolvable issues found in the default (wpf) treeview, so all trees will be replace with this new one in the next releases. </li>
<li>lots of bug fixes </li>
</ul>
<h4>Aici</h4>
<p>Aici has undergone a major upgrade, though mostly in the background, that is to say, to improve already existing functionality or extend it. Here’s what’s new/updated:</p>
<ul>
<li>There’s a new stage, just after scanning and before parsing, used to retrieve the different sentences and groupings from the input. This allows the system to process multiple sentences in the input (at the same time). 1 small note: the final stage hasn’t been tested yet, so even though the sentences are recognized, only input with 1 sentence is processed correctly at the moment. </li>
<li>I’ve changed the semantics processing from a simple transition/translation to a full stage, so the semantic information can be used to do more filtering. </li>
<li>Yet another new stage has been added to do grammatical analysis (things like figuring out whether an ‘a’ is most likely used as a noun or article. </li>
<li>The output stage has been adjusted so that the output isn’t directly sent out, but instead stored as neurons that can be used for further analysis while being sent out at a later stage. The analysis itself however isn’t done yet. </li>
<li>Some new frames have been added, mostly to handle invalid grammar and present/past articles.</li>
<li>The flow definition has been simplified a bit.</li>
<li>Lots of bug fixes </li>
</ul>
<h4>Aici-Web</h4>
<p>And finally, the newcomer: Aici-web which is a web-based interface of Aici (go figure!). It’s currently implemented in Silverlight (other web technologies should follow). The basic purpose of this website version is 2 folded: as a technology showcase and as a way for me to easily get conversation logs that I can use to improve the network. So go ahead and test the limits, see how fast you can break the thing (shouldn’t be to hard <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://janbogaerts.name/wp-content/uploads/2010/11/wlEmoticon-winkingsmile.png" /> ). You can find it <a href="http://bragisoft.com/AiciClient/AiciWebTestPage.aspx" target="_blank">here</a>. (Note: I plan to reset the backing database on a regular basis, to keep the thing fresh and with the latest Aici version.)</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=475" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/11/01/nnd-0-5-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WPF: a fast TreeView</title>
		<link>http://janbogaerts.name/index.php/2010/09/09/wpf-a-fast-treeview/</link>
		<comments>http://janbogaerts.name/index.php/2010/09/09/wpf-a-fast-treeview/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 12:29:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[treeview]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/09/09/wpf-a-fast-treeview/</guid>
		<description><![CDATA[An introduction on creating proper UI virtualization in WPF. It describes a technique to create treeviews in WPF that are able to display any amount of data while maintaining scroll speed and using a minimum of memory.]]></description>
			<content:encoded><![CDATA[<p>Are you getting sick already of WPF’s inability to handle large amounts of data? Well, I am,… definitely. After some final trials with the thesaurus (displayed in a tree), I gave up and decided to write my own virtualizing Treeview. Why? Here’s why:</p>
<ul>
<li>Scroll &amp; load speed: Even with full virtualization turned on, scrolling crawls almost to a halt when you have 60 000+ root items and a few of them are expanded some levels down the tree. The same for loading large lists.</li>
<li>Memory usage: probably related with the previous item, in short: kaboem!!!</li>
<li>BringIntoView: Here’s the killer, when virtualization is turned on, and the UI TreeViewIem hasn’t been rendered yet, you can’t bring it into view. Translated: you can’t do a search and show the found items in large trees, only in small trees (go figure).</li>
</ul>
<p>Note about my test data:  The thesaurus demo contains about 100 000 words (syn-sets actually), almost all of which have multiple relationships, so  in total, there are +500 000 nodes in the tree.</p>
<p>Ok,… and how do you fix this? Well here’s how I did it:</p>
<h4>Container rendering</h4>
<p>Virtualization means that you only render the UI elements that are currently visible, and not the whole tree (or a large part like microsoft does). This means that, for each UI object that got rendered, you somehow need to keep track of the data position in the tree. I do this by using 2 cursors: one for the first and another for the last visible element. This cursor is nothing more than a list of indexes into the tree.</p>
<p>All items in between those 2 cursors are flattened out (by rendering UI elements for them). The nr of indexes (or nr of parents) for each item, is used as the level for the UI element. This determines the amount of indentation to the right that is applied to the UI element.</p>
<p>When the user scrolls down, the bottom cursor is updated (advanced by the amount that the user scrolled). This is a basic tree walking algorithm. From this bottom index, we render objects while going up the tree until the panel is full (again, the same tree walking algorithm). The index path of the new top item becomes the new top cursor. The same technique is used to scroll up, but instead, you start from the top cursor and fill downwards.</p>
<p><em>Remark: Watch out while calculating the scroll difference: The scrollbar value is usually a double while we only consume integer values, so there might be some left over in the scroll difference which has to be consumed the next time you calculate the dif.</em></p>
<p>Of course, this technique only works if the TreeView has some knowledge of the data structure, how else can it find the children of the root items and see if they are expanded or not? This requires an interface. Here’s how mine looks like:</p>
<pre class="code"><span style="color: blue;">   public interface </span><span style="color: #2b91af;">ITreeViewItem
   </span>{<span style="color: gray;">
      </span><span style="color: blue;">bool </span>IsExpanded { <span style="color: blue;">get</span>; <span style="color: blue;">set</span>; }<span style="color: gray;">
      </span><span style="color: blue;">bool </span>IsSelected { <span style="color: blue;">get</span>; <span style="color: blue;">set</span>; }<span style="color: gray;">
      </span><span style="color: blue;">bool </span>HasChildren { <span style="color: blue;">get</span>; }<span style="color: gray;">
      </span><span style="color: #2b91af;">IList </span>TreeItems { <span style="color: blue;">get</span>; }<span style="color: gray;">
      </span><span style="color: #2b91af;">ITreeViewPanelItem </span>ParentTreeItem { <span style="color: blue;">get</span>; }
<span style="color: gray;">      </span><span style="color: blue;">bool </span>NeedsBringIntoView { <span style="color: blue;">get</span>; <span style="color: blue;">set</span>; }
   }</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Each tree node should implement this interface so that the TreeView can properly traverse the tree. A few properties are mostly for the visual parts, like ‘IsSelected’ or ’HasChildren’ (to display the toggle button). The last property is perhaps a bit of an odd one: ‘NeedsBringIntoView’. It’s a quick method to let the Tree know that an element needs to be brought into the viewable area. You could also use a function on the TreeView (like microsoft does), but then you are forced to go find the UI element from your search code to bring the item into view, which I wanted to avoid.</p>
<p>Using this technique, you do create and destroy a lot of containers since each time the user scrolls, the entire visible area is re-rendered. To minimize the impact of this on the garbage collector, it’s probably best to use some recycling scheme. This doesn’t have to be fancy: a simple queue to put the items in when clearing the list which can be consumed again when rendering the containers. I chose a queue since it gives best chances to reassign the same container to the same data object when possible, which minimizes the impact of re-rendering on the binding system.</p>
<h4>Events</h4>
<p>The second important thing for virtualized TreeViews, is the event system. You can not simply go and hook up event handlers to every data element. This would blow up the memory. Also, you’d have to write a lot of code to keep track of those events as data objects are being created and destroyed (trees of such a size can only work if you combine UI virtualization with data virtualization, but that’s an entire subject all together). On the other hand, events are VERY important to get UI virtualization working for keeping track of the maximum scroll count, tree nodes that get expanded/collapsed, objects that need to be brought into view, and UI elements that need to be updated.</p>
<p>Are you seeing the bubbles already? Yep: use bubbling events, like WPF does. The only problem: that doesn’t exist for regular objects, it’s only available in the WPF world. You could inherit all your objects from <em>DependencyObject</em>, but with 200 0000 objects in memory, that somehow becomes bloated. Better to roll out your own sleek, mean and fast event mechanism, which isn’t hard at all to do. Here’s a little sample code to bubble events up a tree:</p>
<pre class="code"><span style="color: blue;">public static void </span>OnPropertyChanged(<span style="color: #2b91af;">IOnBubblingChanged </span>sender, <span style="color: #2b91af;">BubblingPropertyChangedEventArgs </span>e)
{
   <span style="color: blue;">while </span>(sender != <span style="color: blue;">null</span>)                                  <span style="color: green;">//use a while loop to avoid recursive calls.
   </span>{
      sender.OnBubblingPropertyChanged(e);
      <span style="color: #2b91af;">IOwnedObject </span>iOwned = sender <span style="color: blue;">as </span><span style="color: #2b91af;">IOwnedObject</span>;
      <span style="color: blue;">if </span>(iOwned != <span style="color: blue;">null</span>)
         sender = iOwned.Owner <span style="color: blue;">as </span><span style="color: #2b91af;">IOnBubblingChanged</span>;
      <span style="color: blue;">else
         </span>sender = <span style="color: blue;">null</span>;                                    <span style="color: green;">//need to make the loop stop
   </span>}
}</pre>
<p>This function is called whenever a property on a tree item is changed. As you can see, a lot of interfaces are at work here. <em>IOnBubblingChanged</em> defines a function that can be called which will raise the event. IOwnedObject is one of my core interfaces for all objects that can be ‘owned’ by another object. This maps to the ‘<em>ParentTreeItem</em>’ property of the first <em>ITreeViewItem</em> interface.</p>
<p>A similar thing needs to be done for the <em>CollectionChanged</em> events. A remark on the ‘reset collection’ event: make certain that you can pass along the list of items that got cleared, otherwise the TreeView will have a hard time figuring out exactly how much the count needs to be decreased (were any of the removed items expanded?). The default WPF <em>NotifyCollectionChanged</em> event doesn’t do that, so you can’t simply use it’s event arguments.</p>
<p>With this type of bubbling event system, it’s probably best to work with some kind of ‘root’ object that defines the events for the property and collection changes in the entire tree. Again a nice job for an interface, I suppose. This root interface can be used as the <em>ItemsSource</em> for the treeview instead of a list, like WPF does. This way, you can have lots of root objects without overtaxing the .net event management system.</p>
<p>Using this technique, you can make Treeviews that aren’t only fast to load and scroll, but also use very little memory. I am silently hoping that microsoft will eventually pick up on this and begin implementing proper UI virtualization in the coming versions of WPF (thus relieving me from the burden). In the mean time, I guess we are left to roll out our own stuff.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=449" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/09/09/wpf-a-fast-treeview/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Images lost and found</title>
		<link>http://janbogaerts.name/index.php/2010/08/05/images-lost-and-found/</link>
		<comments>http://janbogaerts.name/index.php/2010/08/05/images-lost-and-found/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 12:04:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[stupid]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/08/05/images-lost-and-found/</guid>
		<description><![CDATA[I accidently lost all my images on the first few posts. Apparently they were still stored on the old site, which I had just shut down (domain name forward actually). Oeps… At first there was a bit of a panic, since the post I was looking at was exactly a year old, which could mean <a href='http://janbogaerts.name/index.php/2010/08/05/images-lost-and-found/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I accidently lost all my images on the first few posts. Apparently they were still stored on the old site, which I had just shut down (domain name forward actually). <em>Oeps</em>… At first there was a bit of a panic, since the post I was looking at was exactly a year old, which could mean my blog was dropping old images. Luckily it isn’t that smart so, quickly disable the forwarding, and voila, images are back.&#160; Better move them to the new site now.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=404" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/08/05/images-lost-and-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running AICI from the designer</title>
		<link>http://janbogaerts.name/index.php/2010/07/30/running-aici-from-the-designer/</link>
		<comments>http://janbogaerts.name/index.php/2010/07/30/running-aici-from-the-designer/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 15:25:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[AICI]]></category>
		<category><![CDATA[debugging]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/07/30/running-aici-from-the-designer/</guid>
		<description><![CDATA[How to best run AICI from within the neural network designer.]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>The designer is a strange beast: the project that is opened for editing, is also running in the background as a neural network. This means that you can use the input/output channels just like in a regular (neural network enabled) application, like the AICI client app. Grate for debugging and trying out stuff, but you don’t want to get your test data mixed into the actual network, enter <a href="http://janbogaerts.name/index.php/2009/03/17/about-sandboxes/" target="_blank">sandboxes</a>:</p>
<blockquote><p>A sandbox is a complete copy of your project, running in a new, separate designer.</p></blockquote>
<p>So, after you have opened the Aici project in the designer (installed at {Documents}\NND\Demos\AICI_1, note that you need to select the directory, not the file), you can run your project in a sandbox. Simply click on the <a href="http://janbogaerts.name/wp-content/uploads/2010/07/image15.png"><img style="margin: 0px; display: inline; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb15.png" border="0" alt="image" width="16" height="16" /></a> button in the toolbar, or select ‘debug/sandbox’ from the menu. This will start a new designer with you sandbox project loaded. Once the sandbox is open, you can use the already declared text-channel to communicate with the network. if not yet opened, switch it on by selecting ‘view/communication channels/Text channel’ from the menu. The <a href="http://janbogaerts.name/index.php/2009/03/12/demos-explained-echo/" target="_blank">Echo words demo</a> has more info on this type of channels (though the view has been updated a bit). here’s the short version:</p>
<p><strong><a href="http://janbogaerts.name/wp-content/uploads/2010/07/image16.png"><img style="margin: 0px 5px 0px 0px; display: inline; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb16.png" border="0" alt="image" width="254" height="216" align="left" /></a>The toolbar:</strong><br />
1: Send the input text to the network.<br />
2: a combo for selecting the method to send text to the network.<br />
3: copy the conversation log to the clipboard.<br />
4: save the conversation log to file.<br />
5: clean the conversation log.<br />
6: toggle audio on/off.<br />
<strong>The edit area:<br />
</strong>1: All the neurons that were sent to the network as input.<br />
2: All the neurons that were sent back from the network as output.<br />
3: The conversation log.<br />
4: The input box</p>
<p>In short, simply type some text in the textbox at the bottom, press enter and watch what happens.</p>
<p>When you are done testing, simply close the sandbox app and you are done (it wont ask to save any changes). If you would want to do some more testing later on with the same data, you can first save it to a different location (otherwise the sandbox data will be deleted when you start a new sandbox).</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=366" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/07/30/running-aici-from-the-designer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NND 0.5</title>
		<link>http://janbogaerts.name/index.php/2010/07/29/nnd-0-5/</link>
		<comments>http://janbogaerts.name/index.php/2010/07/29/nnd-0-5/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 17:56:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/07/29/nnd-0-5/</guid>
		<description><![CDATA[Note: Deprecated! It’s been a while, a bit longer then planned actually. As usual, there was a little unexpected detour required. This time, it was called the ‘neuron profiler’. Don’t ask, in short: I couldn’t find a bug, which would be traceable with a profiler thingy. The good news: found the bug, the bad: found <a href='http://janbogaerts.name/index.php/2010/07/29/nnd-0-5/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>It’s been a while, a bit longer then planned actually. As usual, there was a little unexpected detour required. This time, it was called the ‘neuron profiler’. Don’t ask, in short: I couldn’t find a bug, which would be traceable with a profiler thingy. The good news: found the bug, the bad: found some new. Anyway, here’s what’s added, updated or fixed (sort of):</p>
<h4>The Designer:</h4>
<ul>
<li><a href="http://janbogaerts.name/wp-content/uploads/2010/07/image14.png"><img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="right" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb14.png" width="179" height="111" /></a>A new neuron profiler, very similar to a memory profiler: it tracks down leaked neurons (which were created but not destroyed). This is a powerful little debug tool indeed. </li>
<li>the new flow editor is working. This is a lot faster now. Some bugs should also be fixed (maybe some new were added as well). </li>
<li>Search on all editors and tool windows has been made into an asynchronous process. </li>
<li>I’ve added a new clean up dialog box (can be found under ‘tools’), called ‘clean orphan flow data’. Which can be used to trace down and remove flow data that should have been deleted, but wasn’t and is now simply causing the parse to fail. </li>
<li>cleaned up the module import and export a bit, but not yet completely ready. </li>
<li>The Window manager has been updated. </li>
<li>The UI has been cleaned up a bit. I’ve tried to make it esthetically a little more appealing, hope you like it. </li>
<li>Some speed improvements in the core, more to come though. </li>
<li>I’ve reloaded the thesaurus demo, for 2 reasons: 1, the first demo wasn’t loaded correctly (had forgotten to turn on to include items with multiple words) and secondly, I mixed up the meaning of hyponym and hypernym in the thesaurus view (not in the Wordnet-channel view). A typical mix-up for me, a consequence of flying solo, I guess. Anyway, this project should be very useful for stress testing. </li>
</ul>
<h4>AICI:</h4>
<ul>
<li>You can now call .net functions from within the network. As a <a href="http://janbogaerts.name/index.php/2010/07/11/aici-calling-net/" target="_blank">test-case</a>, I’ve implemented the ‘file copy’ function (System.IO.File.Copy). At the moment, Aici requires some code for each known&#160; .net function to extract the arguments from the network’s input data. I plan to change this into something more generic, so that Aici knows that a function requires arguments ‘x’ and ‘y’ without having to lay out custom code for each function. </li>
<li>There’s a lot less neuron leakage going on. The flow recognition algorithm is almost completely clean (except for 1 remaining issue). The latter part of the process still needs some work. </li>
<li>I’ve cleaned up a lot of the code, removed bugs all over the place so that it becomes more responsive. </li>
<li>The flow recognition algorithm has also been updated to remove some more bugs that were causing the parse to fail. </li>
<li>The flow definition itself has also been updated considerably. In part so that it would be able to parse complex sentences, but mostly to get the speed up (dramatic results can be achieved with a correct filter, early on in the parse). </li>
</ul>
<p>All in all, I think I’m starting to see some light in the distance, finally. Perhaps it’s almost time to move to beta stage. <img src='http://janbogaerts.name/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> )</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=353" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/07/29/nnd-0-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objects and assets: abstract and concrete</title>
		<link>http://janbogaerts.name/index.php/2010/07/12/objects-and-assets-abstract-and-concrete/</link>
		<comments>http://janbogaerts.name/index.php/2010/07/12/objects-and-assets-abstract-and-concrete/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 16:54:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[AICI]]></category>
		<category><![CDATA[Structures]]></category>
		<category><![CDATA[assets]]></category>
		<category><![CDATA[objects]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/07/12/objects-and-assets-abstract-and-concrete/</guid>
		<description><![CDATA[Today, I’d like to write a little bit about some of the internal data structures used by aici. More specifically, how it stores abstract and concrete knowledge or in other words, the structures used to make a difference between general understanding and concrete, recorded data. For instance, the abstract can be ‘a house’ while the <a href='http://janbogaerts.name/index.php/2010/07/12/objects-and-assets-abstract-and-concrete/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Today, I’d like to write a little bit about some of the internal data structures used by aici. More specifically, how it stores <em>abstract</em> and <em>concrete</em> knowledge or in other words, the structures used to make a difference between general understanding and concrete, recorded data.</p>
<p>For instance, the abstract can be ‘a house’ while the concrete is ‘The house that I live in,… my house. Aici needs a way to distinguish the 2 and be able to find relationships between both. This is done through the use of different data structures.</p>
<h4>Objects</h4>
<p>Lets start with the objects, these are the simplest. They represent abstract knowledge. Every interpretation of every word is represented by an object. For instance, ‘house’ can mean the house that you live in, but could also refer to a musical style. So there is an object for each interpretations of the word. Furthermore some words can have synonyms, words that have the same meaning. For instance, ‘house’ and ‘home’ could be considered as synonyms, or house and ‘house music’. With ‘house music’ being a compound word: 2 words joined together to form a new meaning. Other examples of compound words are: car factory, fire hose, film studio,…</p>
<p>Another bit of information that can be useful to know about a word, is how it should be interpreted in the context of a sentence: can it be a noun, verb, adjective,…. Sometimes, a word can have multiple interpretations, while being used as the same sentence type (like house), sometimes multiple sentence types are allowed for a single meaning (colors for instance can be used as adjectives or nouns: ‘my eyes are blue’, ‘that blue is pretty’ ). As a speed optimization, we group all the objects together that have the same part of speech, but with different meanings in ‘Pos-groups’, though this is not required.</p>
<p>As a visual example, let’s take the objects ‘hello’ and ‘goodbye’ (as in a greeting). Both are nouns (it’s <em>an</em> hello and <em>a</em> goodbye). Both have multiple synonyms: hi, howdy, bye,..&#160; So here’s how this would look like:</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/07/image3.png"><img style="border-right-width: 0px; margin: 0px auto; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb3.png" width="672" height="235" /></a></p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/07/image4.png"><img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb4.png" width="332" height="265" /></a> <a href="http://janbogaerts.name/wp-content/uploads/2010/07/image5.png"><img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="right" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb5.png" width="332" height="240" /></a></p>
<h5></h5>
<h5>&#160;</h5>
<h5>&#160;</h5>
<h5>&#160;</h5>
<h5>&#160;</h5>
<h5>&#160;</h5>
<h5>&#160;</h5>
<h5>&#160;</h5>
<h5>&#160;</h5>
<h5>&#160;</h5>
<h5>Relationships between objects: the Thesaurus</h5>
<p>Objects are stored in a thesaurus like structure to indicate relationships between them. For instance, both ‘aici’ and ‘jan’ are names, so&#160; this could be expressed in a thesaurus relationship like in the 2 images below:</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/07/image6.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb6.png" width="136" height="145" /></a></p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/07/image7.png"><img style="border-right-width: 0px; margin: 0px 0px 0px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="right" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb7.png" width="428" height="285" /></a></p>
<p>Notice (to the left) that the ‘noun’ filter was selected in the thesaurus together with the ‘is a’ relationship. To the right, you can see how this is represented internally: <em>Name</em> points to an ‘is a’ cluster, which contains all the related objects. So the ‘Noun filter works by only displaying objects that point to ‘noun’ or are clustered by a ‘noun’ pos-group while the ‘is a’ relationship will filter out all but the clusters attached to the roots using this ‘is a’ neuron.</p>
<p>Sometimes a root object doesn’t have any children (as in cluster-children, not in the thesaurus). This makes the object a dummy, a placeholder that shouldn’t be used for input or output directly, but only for filtering. Some examples of these dummies can be seen when the ‘pronouns’ are selected.</p>
<p>The thesaurus relationships can be used in frames to filter the input in a general way and to perform lookups by the actions. For instance, the ‘be name’ frame (in the ‘names’ editor) has an ‘object flow’ element that filters on ‘name’ through the ‘is a’ relationship, as seen in the image below.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/07/image8.png"><img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb8.png" width="781" height="259" /></a></p>
<p>This means that the frame is only selected when the input contains the result of an object flow that is the child of an ‘is a’ cluster, attached to &#8216;name’ or one of it’s thesaurus children (so multiple levels are allowed).</p>
<blockquote><p>To create this type of filter by the way, you simply drag ‘name’ from the thesaurus to the filter area.</p>
</blockquote>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/07/image9.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb9.png" width="238" height="488" /></a>Actions also make use of these thesaurus relationships in a very similar way. For instance, an action could check if an object&#160; is allowed to/can be the name of something (‘my name is Jan’). Or, in sentences like: ‘<em>this is blue</em>’, the thesaurus is used to find out what ‘blue’ actually is: a color (I’m jumping here, keep with me, It will become clear very soon).</p>
<p>An object can also be the child of multiple items in a thesaurus. For instance, ‘blue’ is both the child of ‘colorful’ and ‘sad’ (child of ‘emotional’). Note that these are all adjectives, hence we say ‘colorful’ instead of ‘color’. To find out which relationship to take, we can make use of a log of previously made statements or a list of focused objects. The most important usage of either color(ful) or emotion(al) in this log, triggers it for the new input. <em>Most important</em> can be interpreted very <a href="http://janbogaerts.name/wp-content/uploads/2010/07/image10.png"><img style="border-right-width: 0px; margin: 0px 0px 0px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="right" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb10.png" width="233" height="352" /></a>broadly: it could be ‘newest log item’, or ‘most talked about’,… If it is impossible to solve this, a question needs to be asked.</p>
<p>Anyway, once you have figured out which path to take in the thesaurus: colorful, we still have an adjective. If the same logical concept/idea can be expressed in multiple parts of speech, using different words (like color-colorful) and you want to be able to jump between the 2, you need to have a relationship between them. As I already stated, we interpret ‘blue’ as a ‘color’, not ‘colorful’. Why, will become more clear when we talk about the assets, for now lets just take it that we need to change from adjective or verb to noun. As you can see in the image, the thesaurus has a special section to define this type of relationship: the left part of the table contains the link meaning, the right section is the ‘from’ part of the link.</p>
<p>The same can be done for verb conjugations. In English, a verb usually has 3 different conjugational forms, other languages have others, so the thesaurus allows you to define this type of relationship free form, much like the part of speech relationships. When you create a new verb though, the designer will try to fill in all the conjugations (if it finds neurons titled ‘present particle’, ‘past particle’ and ‘third person present’. It’s always best to check them before storing the default though, since it doesn’t know about irregular verbs and sometimes it/I may simply goof up.</p>
<p>The verb conjugations, compared to the part-of-speech relationships, are used a bit differently. These serve their purpose while parsing the input and generating output. Some flow elements try to search for conjugation relationships while filtering (in the ‘FilterCode’ tab) in order to get the correct parse. For instance, in the ‘model verbs flow’, this is used to make certain that a verb is the present particle. The same goes for generating output: when a verb is used in certain situations (ex: ‘what’ contains a verb instead of a noun), we need to generate it’s present particle form (or another, depending on the exact situation).</p>
<h4>Assets</h4>
<p>Up until now, all relationships were between objects, so between abstract knowledge only. To record a network’s experiences (the data that it records), we use <em>assets</em> and <em>asset relationships</em>.</p>
<p>At it’s core, an asset is a cluster with meaning ‘<em>asset</em>’ (we’re very original here), which contains a number of child neurons that represent property-value pairs for that asset. This is done through links to objects and/or other assets, using the meanings: <a href="http://janbogaerts.name/wp-content/uploads/2010/07/image11.png"><img style="border-right-width: 0px; margin: 5px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb11.png" width="477" height="532" /></a> attribute, value, amount,… From this basic structure, we can start to play and create meaningful relationships.</p>
<p>As usual, a picture says a thousand words, so to the left, I’ve displayed a debug view of the ‘text channel’ neuron (the text input channel of AICI). Why this neuron? If you look closely, it has a link that points to an ‘asset’ cluster, using the meaning ‘Pr:You’. So with this image, I’ve got 2 birds with 1 stone: the asset and how to find the asset that AICI is using for the person on the other side of the channel <img src='http://janbogaerts.name/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
<p><em><em class="callout">A text channel stores a reference to the asset that represents the entity it is communicating with using a link with meaning ‘Pr:you.</em></em></p>
<p>As a side note, linking ‘you’ to the text channel, allows the system to talk to multiple users at the same time: each on their own channel.</p>
<p>So what’s stored in this asset anyway? As you can see, there are 2 child neurons in the asset, so 2 data items: the first has an attribute (property) of ‘entity’ and a (property) value of ‘animate entity’. The second asset-child&#160; points to ‘eye’ for the attribute, the value is another asset and it has a general <em>amount</em> of ‘plural’.</p>
<p>Note that the attribute should always be a noun. Having a fixed transformation point facilitates the search.&#160; Why a noun: well, all adjectives and action-verbs can be converted to a noun, but not the other way round. This conversion can be done using the part of speech relationships that were previously described.</p>
<p>The ‘entity’ property is how AICI tries to classify assets: is it an object, animate, animal, human,… If you look at the thesaurus (in the designer), ‘entity’ is a noun-root and the asset-child’s value is one of it’s children. This is a rule: when the value is an object, it must have a thesaurus relationship with the attribute. This type of child asset represents the ‘x is an y’ type of relationship. Here, it is ‘I am an animate entity’, an other example could be:&#160; ‘I am a human’, which would/should map to the same asset-child.</p>
<blockquote><p>- An asset-child with an object as value represents an ‘x is an y’ sentence structure.     <br />- In this case, the value must have a thesaurus relationship with the attribute. This relationship can span multiple levels.</p>
</blockquote>
<p>AICI at the moment,&#160; presumes that an ‘entity’ that is able to communicate through a text channel, must be animate (mammal, AI,…). So, even if this information is not yet provided, it is presumed to be the case. This is done cause the property and value play a role in other parts of the network.</p>
<p>The second asset-child has another asset as value. This type of relationships represents the ‘x has an y’ sentence structure. More specifically, in this example we said: ‘I have blue eyes’. This also explains the undefined ‘plural’ amount: eyes is plural and was converted into a single value, but since we don’t know exactly how many, we keep a ref to the multiple. The sub asset also has it’s own child-asset, which defines the ‘color-blue’ part of the example sentence. Through this nesting, it is possible to describe complex entities that consist out of multiple parts of knowledge.</p>
<blockquote><p>An asset-child that references another asset as value, represents an ‘x has an y’ sentence structure.<a href="http://janbogaerts.name/wp-content/uploads/2010/07/image12.png"><img style="border-right-width: 0px; margin: 10px 0px 0px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="right" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb12.png" width="434" height="413" /></a></p>
</blockquote>
<h5>Objects referencing assets</h5>
<p>Assets aren’t exactly islands, independent of everything else. No, they too are referenced in many different ways. We already saw 2: assets attached to child-assets, and to the text-channels.&#160; There’s one more reference worth mentioning at this moment: objects that reference assets. Yes, assets don’t just reference objects, it can also go the other way round. This is used to represent general knowledge about general things, like: ‘a human has hands’, as depicted in the image to the right. The same thing is also valid for statements like ‘an x is a y’: they are represented as assets, linked from objects.</p>
<p>Note: I did a bit of recycling with regards to the meaning of the link from the object: it also uses ‘asset’, which is the same as the meaning for the cluster.</p>
<blockquote><p>An object that references an asset cluster, using ‘asset’ as meaning for the link, is used to represent statements of the form: ‘an x is/has a y’</p>
</blockquote>
<p>The important difference between stand alone assets and assets that are linked to objects, are the information that they represent about the agent of a sentence: stand alone assets represent concrete agents: I, you, the book,… while object referenced assets represent abstract agents: a book, a human,…</p>
<p>These 2 data structures: objects and assets, are simple, but, I believe, flexible enough to represent a whole world of information. It is not as much the the querying and reshaping of the data as it will, in the end, be the automatic creation of these structures which I believe will ultimately be the truly interesting thing. With a query, we can retrieve data, reshaping it allows us to find truths, fallacies and falsities in the data, but a correct automatic creation of a new, complex asset, is in fact, a new entity.</p>
<blockquote><p>In the end, all is just structure.</p>
</blockquote>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=331" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/07/12/objects-and-assets-abstract-and-concrete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AICI calling .Net</title>
		<link>http://janbogaerts.name/index.php/2010/07/11/aici-calling-net/</link>
		<comments>http://janbogaerts.name/index.php/2010/07/11/aici-calling-net/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 14:33:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AICI]]></category>
		<category><![CDATA[Conversations]]></category>
		<category><![CDATA[N²D]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/07/11/aici-calling-net/</guid>
		<description><![CDATA[Note: Deprecated! The thunk to .Net is finally working: So it’s now possible to call static functions that take value types as argument and/or as return type.  In this example, I am calling the standard System.IO.File.Copy function to copy a file on my disk. Exceptions are also supported, as you can see from the first <a href='http://janbogaerts.name/index.php/2010/07/11/aici-calling-net/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>The thunk to .Net is finally working:</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/07/image1.png"><img style="margin: 0px auto; display: block; float: none; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb1.png" border="0" alt="image" width="409" height="76" /></a></p>
<p>So it’s now possible to call static functions that take value types as argument and/or as return type.  In this example, I am calling the standard <em>System.IO.File.Copy</em> function to copy a file on my disk. Exceptions are also supported, as you can see from the first line, when I am trying to copy a non existing file. The output comes from the exception generated by the copy. Note that you can specify the arguments in different ways. In this example, I am using the ‘to’ word. ‘From’ would also be recognized. Both determine the extraction order of the arguments.</p>
<p>At the moment, I have hardcoded this extraction of the function arguments for the ‘copy-verb’ manually. The idea is to change it to something more general that can work for any .net function using some meta data of the function (like which neuron to send to which output, how to recognize the arguments, how many arguments,…). I’m not there yet though. First some finishing touches to the designer, so I can trace some neuron/memory leaks. After that I’ll probably do a new release, so you can play a bit.</p>
<p>Oh, and it’s still way to hot outside <img src='http://janbogaerts.name/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=306" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/07/11/aici-calling-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Neural network designer 0.4.6</title>
		<link>http://janbogaerts.name/index.php/2010/06/09/neural-network-designer-0-4-6/</link>
		<comments>http://janbogaerts.name/index.php/2010/06/09/neural-network-designer-0-4-6/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 12:56:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/06/09/neural-network-designer-0-4-6/</guid>
		<description><![CDATA[Note: Deprecated! Perhaps a mid-dev cycle release would be appropriate this time round, since some changes were done to the core and some people might be interested in taking a peek under the hood. Here’s roughly what’s changed: There’s a new expression: the LockExpression, which does what you would expect: lock 1 or more neurons <a href='http://janbogaerts.name/index.php/2010/06/09/neural-network-designer-0-4-6/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>Perhaps a mid-dev cycle release would be appropriate this time round, since some changes were done to the core and some people might be interested in taking a peek under the hood. Here’s roughly what’s changed:</p>
<ul>
<li>There’s a new expression: the LockExpression, which does what you would expect: lock 1 or more neurons and/or 1 or more links for a short period of time so that other threads can’t get to them during the lock. Watch out with this one, try avoiding to use this with split or duplicate instructions since that combination can easily create deadlock situations.</li>
<li>A new instruction: SplitWeighted, which is the same as the normal split, but gives each processor a weight, based on the position of the split variable that the processor received and the accumulator value. Example, if you were to split over 3 vars, which an accumulator of 1, the first processor would get a weight of 0, the next 1, an the last would get 2. This is an easy shortcut for search routines.</li>
<li>I have began work on the new flow editor, but this is still a work in progress.</li>
<li>Lots of bugfixes.</li>
<li>Cleaned up the interface a bit.</li>
</ul>
<p>As usual, you can get the download from <a href="http://janbogaerts.name/index.php/downloads/" target="_blank">here</a>.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=297" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/06/09/neural-network-designer-0-4-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deadlocks, again</title>
		<link>http://janbogaerts.name/index.php/2010/05/31/deadlocks-again/</link>
		<comments>http://janbogaerts.name/index.php/2010/05/31/deadlocks-again/#comments</comments>
		<pubDate>Mon, 31 May 2010 13:11:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[deadlocks]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/05/31/deadlocks-again/</guid>
		<description><![CDATA[I just spent the last 3 days chasing down 3 deadlocks that were teaming up against me. Man, I hate deadlocks. They were definitely the biggest obstacles so far in the development process. Simply because their origins are so hard to locate. And that, even though they are always caused by the same type of <a href='http://janbogaerts.name/index.php/2010/05/31/deadlocks-again/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I just spent the last 3 days chasing down 3 deadlocks that were teaming up against me. Man, I hate deadlocks. They were definitely the biggest obstacles so far in the development process. Simply because their origins are so hard to locate. And that, even though they are always caused by the same type of situation: 2 threads intertwining with their locking scheme.</p>
<p>Put into sequence:</p>
<ol>
<li>Thread 1 locks x and continues execution (no waiting) </li>
<li>Thread 2 locks y and continues execution (no waiting) </li>
<li>Thread 1 requests y and waits </li>
<li>Thread 2 requests x and waits,… oeps </li>
</ol>
<p>The most often way to locate this situation is by examining the execution stack of the CPU. But what if you do out of sync locking: the request in function 1 and the release in function 2, without any relationship between the 2 functions. As an example, take the network-core’s lock expression, which is new. This locks the items when the statement is called, but releases them only after all the child statements were called. The interpreter obviously can’t do this in the same function call. </p>
<p> So how do you trace this type of bug? Well, slowly, painfully and with lots of debug code to generate application dumps. here’s the smallest dump that I generated for the core (usually it was several 100 lines longer):</p>
<p> <code>Links in    <br />ID: 7461 ReadCount: 2&#160; WriteCount: 0, Waiting: 0     <br />Links out     <br />ID: 7461 ReadCount: 2&#160; WriteCount: 0, Waiting: 0     <br />Values     <br />ID: 7461 ReadCount: 2&#160; WriteCount: 0, Waiting: 0     <br />Processors     <br />Parents     <br />ID: 7461 ReadCount: 0&#160; WriteCount: 0, Waiting: 2     <br />Children     <br />ID: 7432 ReadCount: 0&#160; WriteCount: 1, Waiting: 0     <br />ID: 7461 ReadCount: 2&#160; WriteCount: 0, Waiting: 0     <br />ID: 7288 ReadCount: 0&#160; WriteCount: 1, Waiting: 0     <br />LockExpressionCounter: 2     <br />Single lock count: 0</code>
<p>Basically, it allows me to check all the locks that are still active (in order of age) when the deadlock occurred. From then it’s simply a matter of figuring out who has the oldest lock and why it wasn’t released. To do this, it’s best to keep track somehow of the threads that do the locking and make certain that they are named, so you can find them again in the execution stack of the debugger.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=282" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/05/31/deadlocks-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AICI: Respond to what</title>
		<link>http://janbogaerts.name/index.php/2010/05/17/aici-what/</link>
		<comments>http://janbogaerts.name/index.php/2010/05/17/aici-what/#comments</comments>
		<pubDate>Mon, 17 May 2010 14:13:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AICI]]></category>
		<category><![CDATA[N²D]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/05/17/aici-what/</guid>
		<description><![CDATA[A complete overview on how the word 'what' is processed by the Aici neural network.]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p><span class="callout"> </span>No, this post doesn’t explain what AICI is, check <a href="http://janbogaerts.name/index.php/2010/02/22/the-aici-demo/" target="_blank">here</a> to read more about that topic. Today, I’m attempting to explain how to add the functionality to AICI so that it can respond to the statement ‘What’.</p>
<p>As previously mentioned, there are a number of stages<a href="http://janbogaerts.name/wp-content/uploads/2010/05/image4.png"><img style="margin: 0px; display: inline; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb4.png" border="0" alt="image" width="500" height="196" align="right" /></a> that we need to get through to go from input to output. The first is the scan phase, which translates the letters into words, numbers and signs. When this is done, we try to find sentence constructs, like the subject, verb,…. This is matched to a frame, which determines the action that needs to be triggered. Finally, the action might also activate an attribute, but this is out of this post’s scope. So let’s make our network respond to ‘what’.</p>
<p><span class="callout">Recap:</span><br />
<span class="callout">First check if the flows can parse the statement: both scanner and grammar. Next comes the frame and finally the action and attribute.</span></p>
<h4>Scanner</h4>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/05/image5.png"><img style="margin: 0px 10px 0px 0px; display: inline; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb5.png" border="0" alt="image" width="419" height="87" align="left" /></a> This stage will transform the letters into a single word ‘what’, when it reaches the ‘Sentence’ flow. The result of this stage is a cluster, with the meaning ‘Sentence’ (the same as the name of the flow that produced the result). The child will be a textneuron, representing ‘what’</p>
<p>‘What’ is a simple word, which is already handled by the scanner, so no worries there. If you are wondering how words are parsed, take a look at the preceding image, which is the flow for a word. Underlined words are references to other flows,  words that aren’t underlined represent static values. Curley brackets mean a repetition, strait ones define an option. If a conditional has a vertical line after it’s first bracket, a selection is required, this is valid for both repetitions and loops. This basic syntax was inspired by parser generator languages like <a href="http://www.ssw.uni-linz.ac.at/Coco/" target="_blank">Coco/R</a>, Lex and Yacc.</p>
<p>So in the above example, a word can start with number (a sub flow), letters or capital letters. A word must always have at least 1 letter or capital, may have middle numbers and can end with a number or an alpha numeric.</p>
<p>Note: at the time of writing, there is still a little optimization required to get words with many mixed digits and letters working properly.</p>
<h4>Grammar</h4>
<p>Moving on to the grammar section. This is also defined in a flow editor, called ‘<em>English grammar</em>’. So open this (in the ‘<em>Flows</em>’ folder) and immediately select the ‘Interrogative pronouns’ (if you are, like me, not that very fluent in English grammar, and could use a mental aid now and then, there are plenty of resources on the net, check out <a href="http://www.google.com/dictionary" target="_blank">Google dictionary</a>, <a href="http://www.englishclub.com/grammar/index.htm" target="_blank">the English club</a>, <a href="http://en.wikipedia.org/wiki/English_grammar" target="_blank">Wikipedia</a>,…). As you can see, our ‘what’ is already in the ‘Interrogative pronouns’ flow.  So perhaps no extra work for the grammar stage as well? As it turns out, this will be the case. For those who want some more details though, here goes:</p>
<p>If we  look more closely to the flow name itself (on the first picture), we can see there is an overlay ‘<span style="color: #ff0000;">FL</span>’, which is short for flow-code. If you hover over the ‘FL’, you get a tooltip with more info. This says ‘<em>References code that is executed when the item is recognized in a data flow</em>’. This means that the flow does something when it is recognized in an input stream. Usually, it formats the recognized data in such a way that the next stage knows what type of sentence part it was. If there is no ‘FL’ overlay, it means that the data will be recognized in the input stream, but no extra actions are taken, when found. <a href="http://janbogaerts.name/wp-content/uploads/2010/05/image6.png"><img style="margin: 5px 5px 0px 0px; display: inline; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb6.png" border="0" alt="image" width="387" height="310" align="left" /></a> So the input is simply copied over to the result which leaves it unrecognizable. The ‘<em><em>Reflective </em>pronouns’</em> are a good example of a flow without overlays.</p>
<p>But what to do in such a case? Before you start to code, first see who uses the flow anyway, maybe they do something with it.</p>
<p><em><span style="color: #808080;">Tip:<br />
Use F8 to browse all relationships of a neuron.</span></em></p>
<p>If you select the ‘<em>Reflective pronouns’</em> Flow (click 2 times, the first time we automatically focus on the editor) and press F8, you can see which clusters it belongs to (and some other stuff too, not important for now). In this case it’s only 1 cluster: a conditional part (we need flows), so if we drill down a bit further, until we eventually get to the ‘Object flow’. This is used to find the object of a sentence. These flows do have an overlay (in the editor), and tag the recognized data. Usually, this is enough. Only when you need to tag this sub result as well, do you need to add some code, which is generally not the case.</p>
<p>Anyway, to get back to our ‘Interrogative pronouns’, lets see what the attached code does, and open the code editor (right-mouse button on the flow, and select ‘<em>View code</em>’).<a href="http://janbogaerts.name/wp-content/uploads/2010/05/image7.png"><img style="margin: 5px 0px 10px 10px; display: inline; border-width: 0px;" title="image 3" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb7.png" border="0" alt="image 3" width="346" height="186" align="right" /></a> Most often, as with this flow, it simply duplicates the content of the ‘<em>Result</em>’ variable (which always references a cluster at this stage), and removes all outgoing links on this duplicate (sometimes, result clusters can link to some extra data which we don’t want,  but is used by the algorithm) and stores this duplicate back into the result cluster.</p>
<p>To better explain what this actually means, lets take the following input stream: ‘<em>you are here</em>’. After the scan stage, we have a result that looks like image 5: a cluster with meaning ‘sentence’ and 3 text neurons as children. Once the grammar stage is done transforming this dataset, it looks more like image 6: a cluster with meaning ‘statement’  and 3 children again, but with some more info. The first 2 represent the agent (sentence subject) and the verb, both flows use the previously described transformation code. The last child is the object representation of the textneuron ‘here’. It is the result of an adverb that was recognized somewhere in a flow, which didn’t transform the data, so content simply got copied to the final result.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/05/image8.png"><img style="margin: 0px; display: inline; border-width: 0px;" title="image 4" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb8.png" border="0" alt="image 4" width="319" height="151" align="left" /></a></p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/05/image9.png"><img style="margin: 0px 0px 0px 5px; display: inline; border-width: 0px;" title="image 5" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb9.png" border="0" alt="image 5" width="369" height="297" align="right" /></a></p>
<p><em><span style="color: #808080;"><br />
</span></em></p>
<p><span style="color: #808080;"> </span></p>
<p><span style="color: #808080;"><em> </em></span></p>
<p><span style="color: #808080;"><em> </em></span></p>
<p><span style="color: #808080;"><em> </em></span></p>
<p><span style="color: #808080;"><em> </em></span></p>
<p><span style="color: #808080;"><em> </em></span></p>
<p><span style="color: #808080;"> <em><span style="color: #808080;"> </span></em></span></p>
<p><em><span style="color: #808080;">AICI:<br />
</span><span style="color: #808080;">When a flow has been recognized, the ‘flow-code’ callback of the flow is executed. The ‘Result’ variable will contain a cluster</span><span style="color: #808080;"> with the flow as it’s meaning and the recognized data as it’s children.</span> </em></p>
<p><span class="callout">AICI:</span><br />
<span class="callout">Use the ‘TransformFlowResultCallback’ cluster as a default callback for flows so the result can be recognized by the frames.</span></p>
<h4>Frames</h4>
<p>Up until now, not much had to be done, with the frames though, this will change, here we actually need to do something to get it working. Frames can be seen as the conduit between the front (scanner/grammar) and back (actions/attributes). A frame defines which sentence parts it can contain and their order. Multiple orders can be defined, so that you can have the same sentence parts to form a statement or a question. You can also have optional parts, to make frames even more flexible. Each order is defined in a frame sequence. This is also able to render itself back as output, completing the circle.</p>
<p>Just like for the scanner and grammar, the network is already capable to extract the correct frame sequence, based on the set of already defined frames and their sequences (so if it’s not yet defined, the network can’t recognize it). Once, the sequence is found, the framework performs some calls to attached code that you have to provide so that the network also knows what to do with the input statement. The following code blocks can/should be attached to a frame sequence:</p>
<ul>
<li>ExtractAction: this code block is called to determine which action(s) the frame should trigger. Multiple actions are allowed, in which case each will be triggered in the order as they were returned. This is done through the variable ‘<em>ExtractedActions</em>’.  The attachment is required.</li>
<li>ConvToKnowledge: this code block should transform the result data of the grammar parse, into the input data for the actions and return this cluster through the variable ‘KnowledgeConv’. <em>(edit 11/July/2010)</em> <del>The attachment is required.</del> This attachment is optional. If you define a value for the new column ‘ResultType’ in the frame editor and the ‘role’ neuron has a ‘ConvToKnowledge’ code cluster, the network can automatically generate the result cluster for an entire frame sequence, and so this code is no longer required. You can override the auto rendering by defining this code cluster.</li>
<li>RenderCode: This code block is called by an action to render output according to the structure of the frame. The output to render is found in the ‘CurrentFrom’ system variable. The format of the data is the same as that of ‘ConvToKnowledge’. The attachment should only be defined if there is an action able to call it is output. This is not always the case, for instance, frames that deal with ‘unknown’ word types, don’t need to be generated.</li>
</ul>
<p><span class="callout">Recap:<br />
A frame determines the action to execute, provides the data for the action and is able to render data provided by an action.</span></p>
<p>As previously mentioned, a frame needs to prepare the data for the action. This should be a cluster without meaning (it will automatically be assigned, once the correct frame sequence is found, and will eventually indicate that the cluster is an input statement). The content of this cluster needs to be well defined, so that the action can handle it correctly. In theory, you can use any type of structure that you want, as long as the action uses the same. In practice, it’s best to use a predetermined structure, shared by all the actions and frames, for easy sharing of default actions. So here’s a small overview of the possible content:</p>
<ul>
<li>The first child neuron should indicate the time value: current, passed or future. Though most actions don’t specifically expect it on the first pos, all current frames use this.</li>
<li>The child list can also contain a ‘not’ neuron, to indicate that the statement should be interpreted as a negation.</li>
<li>The sentence agent should be stored in a cluster with meaning ‘who’</li>
<li>You can store the sentence object in a cluster with meaning ‘what’ or ‘value’, depending on the situation. Sometimes, ‘what’ can be extracted, from ‘who’, a previous statement or the ‘value’.</li>
<li>a cluster with meaning ‘verb’ can be used for sentences that a verb. Originally, this wasn’t done for the basic verbs like ‘to be, ‘to have’, since it can be inferred from the action that is triggered. However, it can always be useful to take the actual verb that was used to the action, in case it needs to do some analysis on the ‘subject’ indicator of the word. For instance, ‘am’ is usually for ‘I’.</li>
</ul>
<p>Frames can play a little bit with these structures: fill in missing data, switch who, what and value,… Though most of the code in the current frame sequences is shared: if there is an agent in the sentence, 9 out of 10 times it is transformed in the same way, so lots of copy paste (or drag drop) possibilities here. Also perhaps for future automatic learning.<br />
<em>(Update 11/July/2010)</em> In the new version, it is no longer required to provide this code for each frame. It is moved to the level of the ‘role’ (as defined in the frame element), usually these are the flows like ‘agent’ or ‘be verb’,…</p>
<p><em>The translation results for the input ‘i am jan’. In the final stage, ‘what’ is filled in by the frame.</em><a href="http://janbogaerts.name/wp-content/uploads/2010/05/image10.png"><img style="margin: 0px auto; display: block; float: none; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb10.png" border="0" alt="image" width="780" height="160" /></a></p>
<p>For our example, we will have to create a new frame to handle the input ‘what’. Since this is a sentence that only contains an interrogative pronoun, we should probably best put it in the ‘Pronouns’ frame editor together with all the other pronouns (for easy lookup later on). So open up this editor (double click on the editor’s name in the project view), or create a new one if it doesn’t yet exist (the button that looks like a rectangle, you know ‘<em>frame</em>’).</p>
<p>To create a new frame, click on the button with the square, on the editor (tooltip: Create a new frame) or press Ctrl+Shift+F and provide a name for the new frame. Lets call it ‘what frame’. To quickly build the frame, you can drag neurons from the toolbox, thesaurus, flow,… and drop them on the frame editor. To start with, find an ‘Interrogative pronoun (to get it in the explorer, press ‘F4’),  and drop it somewhere in the top part to create a new frame element. This indicates that the sentence should contain an ‘<em>interrogative pronoun</em>’ sentence part.</p>
<p><span class="callout">Tip:<br />
To quickly sync the explorer with the currently selected item, press F4 from anywhere in the application.</span></p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/05/image11.png"><img style="margin: 0px auto; display: block; float: none; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb11.png" border="0" alt="image" width="750" height="319" /></a></p>
<p>Make this element an evoker. Only evoker elements are used to find all possible frame candidates. This is a small optimization for the search algorithm. Each frame should have 1 evoker element. Usually, this is the verb, but in this case there isn’t one so we use what’s available.</p>
<p>At this point, we have a frame that will be activated for all sentences that contain an interrogative pronoun, like: what, who, where, when,… We need to further specify that we only want to respond to ‘what’. This is done by adding a filter to the frame element. So make certain that the element is selected, and from the thesaurus, drag ‘what’ to the bottom part of the frame editor and drop it there. this will automatically create a thesaurus filter for the currently selected relationship. So if ‘what’ had one or more children in the thesaurus, these would also be valid for the filter. In this case we don’t have that, so the relationship field could have been left empty.</p>
<p>Also notice the ‘RestrictionMofidierInclude’ in front of the filter. This is to indicate that input values that <em>contain </em>the filter value are allowed. If this was set to ‘RestrictionModifierExclude’, only sentences that wouldn’t contain ‘what’ would be allowed (so, where, who, when,..).</p>
<p>Finally, there is also the small button. When this is checked, the content of the sentence part should only contain what is defined in the filter, and no other words. If not checked, other words may still be present. This is an important little property which I almost got wrong starting out this post. Do we want to handle sentences like ‘what color’, ‘what time’, what the hell’,  ‘what in the name of sweet Jesus&#8217;, or only ‘what’. If you go back to the very first image, you can see that it’s allowed to put some words after the pronoun. This is to allow correct recognition of sentences like ‘what size are you’ where ‘<em>you</em>’  is the subject. This means that the grammar will also recognize ‘what color’ as an interrogative pronoun. It turns out this is actually ok for us (see frame sequence code). So we leave this not checked to allow other words in the flow result.</p>
<h5>The Frame sequence</h5>
<p>Now that the frame has been defined, lets move on to the sequence. To create this, press the ‘Add frame sequence button’, or ‘Shift+Ctrl+S’ and provide a name for the sequence (make certain that the frame editor is active when pressing the button, otherwise it won’t be active). Lets call it ‘What statement’. You create the sequence by moving the frame elements from the left part to the right part of the editor. You can use the arrow buttons for this. Multiple elements can be moved at the same time. The up and down can be used to change the order.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/05/image12.png"><img style="margin: 0px auto; display: block; float: none; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb12.png" border="0" alt="image" width="690" height="377" /></a></p>
<p>All pretty strait forward. The cool part comes in <a href="http://janbogaerts.name/index.php/2009/06/05/designing-code-editing-techniques/">the code editor</a>. To open this, select the frame sequence in the editor (or somewhere else, like in the explorer), open the context menu and select ‘view code’. First, lets make certain that this new code editor is also available from the project. All you have to do is open the context menu on the bottom tab items of the code editor, and press the ‘Show in project’ menu item. This will add the neuron to the currently selected project folder (or root if there is non selected). So, when you do this, it’s best that the correct folder is selected first. If you forgot to select the one you wanted, you can always still move it later on.</p>
<p class="callout">Tip:<br />
To add a code editor to the project view, right click on the bottom tab items and select ‘Show in project’. The item will be added to the currently selected project folder.</p>
<p>By default, there are only a limited number of pages available in the code editor. The rules and actions pages are always available (though the code clusters are only created when you actually drop something on them). But not the ones that we need. Those will have to be added manually. So open the context menu, again on the bottom tab items, and select the required pages listed under ‘add new code page’. We need ‘ExractAction’, ‘ConvToKnowledge’ and ‘RenderCode’.</p>
<p class="callout">Tip:<br />
You can add any type of code page to a code editor, make certain that the required neuron is tagged as ‘<em>a default meaning neuron</em>’ in the explorer. Open the context menu on the bottom tab items of the code editor and select the new page from the ‘Add new page’ menu item.</p>
<h5>Frame sequence code</h5>
<p><strong>RenderCode:</strong> The render code for the ‘what’ statement as displayed in the above picture is very simple, but not completely correct (see below), we basically write “what?”. I added the question mark, just to show a little trick of the text sins: When you send them multiple neurons, by default, each one will be rendered on it’s own line. To group neurons together, use the ‘BeginTextBlock’ and ‘EndTextBlock’ neurons.  These are recognized by the text sin as special formatting tokens.</p>
<p>We use the ‘output’ statement to send data to a sensory interface. The fastest way to declare this expression, is by dragging it from the toolbox. This has 2 pages: one for common expressions like clusters, assignments and commonly used neurons, and a second page, exclusively for all the instructions.</p>
<p class="callout">Tip:<br />
You can quickly expand or collapse all toolbox items from their context menu. All instructions display a tooltip with a short description, the expected parameters and output.</p>
<p>The first argument to all the output statements is always the same: ‘OutputSin’. This is a global that is filled in by the framework and points to the sensory interface to which the output should be sent. You can also hardcode which sensory interface it needs to be sent to, but that is less flexible. This way, you can actually have multiple text-sins in 1 network and have multiple users chat at the same time. As a small side note: because the output statement can take any number of arguments, we could have written it shorter: in 1 statement. This wasn’t done because I forgot, before taking the screenshot <img src='http://janbogaerts.name/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Also, if you look closely, some of the statements appear to have a double border, while others don’t. This is to indicate that it is used multiple times. This is important to keep in mind, if you modify these statements, you are also changing them in some other part of the code. When dragging code around, it is not like text that you duplicate. When you drag and drop, there is no deep copy, only a new reference made. This can keep the code size pretty compact, allows for some deep future analysis and most importantly should allow for easy auto generation later on. But it is something to keep in mind while changing code.</p>
<p class="callout">Caution:<br />
Statements with a double border are used multiple times, be careful while modifying these.</p>
<p>The complete render code looks something more like the following image. This is able to handle not only ‘what’, but also ‘what color’, ‘what on earth’,… Looks scary? Don’t worry, it’s actually very simple, and most of the code is copied over from other parts anyway.<img style="margin: 0px auto; display: block; float: none; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb13.png" border="0" alt="image" width="650" height="303" /></p>
<p>The second statement, the big yellow monster, is actually a query, who’s result is stored in the ‘what’ variable. ‘Get children filtered’ returns all the child neurons of a cluster that meet a specified filter. In this case, we only want neuron clusters that have a cluster-meaning equal to ‘sg:What’, in other words, we want to retrieve the ‘what’ part from the input. (no surprise there).<br />
The next statement is an ‘if’ construct: if we found something (count(what) &gt; 0), render the contents of the ‘what’ variable, using the ‘Render object’ code block. If there is no cluster found, simply render ‘what?’. The ‘what’ variable isn’t passed over to the ‘Render object’. This is not possible and not required: a code block doesn’t have it’s own variable space, so all the variables maintain their value, hence, the ‘what’ variable is passed along implicitly.</p>
<p>And thus, you have mastered your third little peace of code already <img src='http://janbogaerts.name/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><strong>ConvToKnowledge</strong>: (update 11/July/2010: this code cluster is no longer required, but is still allowed) The transformation for ‘what’ is also fairly strait forward. This  type of attached code tends to have a <a href="http://janbogaerts.name/wp-content/uploads/2010/05/image13.png"><img style="margin: 5px 5px 0px 0px; display: inline; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb14.png" border="0" alt="image" width="331" height="372" align="left" /></a>fairly similar structure across frame sequences. In this one, we check if the <em>interrogative pronoun</em> contained anything other than ‘what’. We do this by checking if it has more than 1 child. When this is the case, we create a new cluster, assign it the meaning ‘sg:what’ (this is a tag operation) and we copy all the children, except the first, from the cluster that we found to the newly created one. Finally, we add this new cluster to our result. We don’t copy the first child, since that is the the ‘what’. We presume this, if you know any situation in which it is not the case, the code needs to be updated to something more secure (remove the actual ‘what’ neuron).</p>
<p><strong>ExtractAction:</strong> Lastly, we also need to provide some code that returns the action we want to execute. Before we can do this, we actually need to know which are the possible actions that can be performed.</p>
<p>So lets try and come up with a few possible dialogs, so we can analyze the different possibilities. Here’s what I came up with on short notice:</p>
<p>PC: I have hair<br />
You: what<br />
PC: I have hair –&gt; this is a simple repetition of what was last said.</p>
<p>PC: I am in the black room<br />
You: what color<br />
PC: black-&gt; return the first value that was found through an ‘is a’ relationship (black is a color), from any of the words of the prev statement.<br />
You what room<br />
PC: the room of your house –&gt; return more relationship info on the actual result of ‘the black room’, if there is any. In this case, we know the owner of the house.</p>
<p>You: what the fuck<br />
PC: No swearing please –&gt; catch a special case.</p>
<p>So Basically, I have 3 different groups of the conversations (if you can think of more, le me know). In the first case, when the user simply asks ‘what’, we return the last output statement. The 3th conversation, when the user wants to express surprise/disagreement through an insult, we return a standard message to keep it clean. Finally, in the middle example, some analysis is done on the previous statements, to find a proper match. We can check the actual words, see if there is an ‘is a’ relationship to be found. In this  case, the user might have forgotten the actual value, but still remembered the attribute. The user could also be requesting more info about something, in which case we need to return some more links if there are any.</p>
<p>Exactly how you pour this information into actions, is a bit up to you. Me, I would go for 3 different actions. In fact, I would <a href="http://janbogaerts.name/wp-content/uploads/2010/05/image14.png"><img style="margin: 5px 0px 0px 5px; display: inline; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb15.png" border="0" alt="image" width="417" height="136" align="right" /></a>handle the last conversation type (aka: ‘<em>what the xxx</em>’) as a special case in a different frame, so we can filter on these specific word groups. I guess that would be a good exercise for you. The first and second should be handled by this frame, so these are 2 new actions that should be returned by our frame sequence. To determine the exact action that needs to be returned, we can use a similar ‘if’ construct as in the ‘ConvToKnowledge’ code cluster: when there is more than a ‘what’ in the input data, use ‘Find Prev out statement’, which does the heavy searching. If there is only ‘what’ in the input data, use the light weight ‘Return last out statement’. To return the action we want to execute, simply assign it to the ‘ExtractActions’ variable, like in the statements to the right.</p>
<p><span class="callout">Recap:<br />
Return your actions in the ‘ExtractedActions’ variable.</span></p>
<h4>Actions</h4>
<p>Rejoice, the end of this post is almost in sight: Actions, the final step. As already mentioned, we are going to need 2 actions, though to keep the post a bit within the limits of sanity, I am going to restrict the explanations to the simplest action. The more complex search algorithm needs another one of these posts to explain it all. In fact, I still have to finish it myself. Perhaps, I’ll leave it like it is, as an exercise for you <img src='http://janbogaerts.name/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Before we start to create our action though, perhaps a small word about actions in general. These are actually nothing more then regular neurons with 2 different types of code clusters attached. The first type contains code that is called when the action is executed. You can specify a different code cluster for all the different states that the action needs specific responses for. The <a href="http://janbogaerts.name/wp-content/uploads/2010/05/image15.png"><img style="margin: 0px 5px 0px 0px; display: inline; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb16.png" border="0" alt="image" width="250" height="57" align="left" /></a> default state is ‘Normal state’, which is currently the only one defined, but you can create and set as many of your own states as you want. The current state of the network is defined as a link between the text sin using the meaning ‘state’ to the current value (see image). This means that you can have as many concurrent network states as communication channels. Also, when an action doesn’t have an implementation for the current state, or when the text-sin doesn’t define a state, the fallback ‘Normal state’ is used.</p>
<p>The second type of code clusters that are attached to actions, are used during the conversation, to check for and handle possible responses to questions. That is, some actions require some sort of response. These types of actions need to check if a response is valid, determine if an action is a valid response action and can also specify extra ‘response’ code. This though is again far outside the scope of this post, so lets leave  it at that.</p>
<p>Back to our example, we still need to create the action. Since this is just a neuron, there are many different ways of doing this. If you are already in the correct project folder, a quick way is to use the toolbar button above the project overview, called ‘Create a new neuron with attached code’. This will create a neuron, open it’s code editor and add it to the project. If you press F2, you can change the name (make certain the project node has keyboard focus). To add the ‘Normal state’ code page, just do the same as with the frame sequences: open the context menu on the bottom tab items, select ‘add new code page’ and click on ‘Normal state’.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/05/image16.png"><img style="margin: 0px auto; display: block; float: none; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb17.png" border="0" alt="image" width="650" height="356" /></a>And that’s how the action should eventually look like. It’s a nice bit of code to end with, with just a little bit more meat to look at. Though in the end, it’s still very strait forward. Before we delve into the specifics of the code, perhaps first a small word about the conversation log, since that’s our primary data source in this action.</p>
<p>The conversation log is a cluster, attached to the text sin for which it is keeping track of the previous statements made by the network and the user of the text sin. This means that the network has a log cluster for each active user. It keeps track of a 1 to 1 conversation. A Part of the content of the log consists out of the clusters that we created in the frame sequence, in the ‘ConvToKnowledge’ code. These have a cluster-meaning of ‘in’. The other part consists out of the clusters that were generated in the actions, as output.  These are labeled ‘out’. Both ‘in’ and ‘out’ children still have a link to the action(s) that was/were executed so we know what they triggered.</p>
<p>When we translate this information to our action, we get something like the previous picture. Basically, we try to retrieve the log from the ‘OutputSin’ global. We have already encountered this global.  It is the one that is always pointing to the Text-sin for whom we are currently processing, remember. If this doesn’t have a log, something is wrong, so we show a message to the user, log it as an error (this is useful for the debugger) and exit the link. We exit the link and not the neuron or the entire processor, since there might still be other actions that need to be executed.<br />
If there is a log file, we walk through each log entry, from back to front, using a counter and the ‘GetChildAt’ instructions. You can do this in different ways (using the reverse instruction combined with 1 or more selects, for instance). I choose this way, since I think it’s the fastest solution for this situation.<br />
If we find an item, with a cluster meaning of ‘out’, we simply push it back on the stack and exit the loop. By putting the cluster back on the stack, we actually let the network execute the action again, since it is still linked to the data. Note that we decrease the counter each time that we don’t have an item with meaning ‘out’. The ‘-‘ instruction might be written a bit strange at first. You can probably best think of it as a <a href="http://en.wikipedia.org/wiki/Polish_notation" target="_blank">polish notation</a>. This is actually a result of the fact that ‘-‘ is just an instruction and at present, all instructions have the same UI input format. And that’s it.</p>
<p>Ok, slowly breed in, and out. You’ve just reached the top of the Himalayas (or something comparable). It’s done, you’ve absorbed all the info, and your still alive. Time now to let it all breed a little, let it digest, and sleep on it a bit. Don’t worry about it, it will come to you too.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=275" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/05/17/aici-what/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Neural network designer 0.4.5</title>
		<link>http://janbogaerts.name/index.php/2010/05/13/neural-network-designer-0-4-5/</link>
		<comments>http://janbogaerts.name/index.php/2010/05/13/neural-network-designer-0-4-5/#comments</comments>
		<pubDate>Thu, 13 May 2010 17:11:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/05/13/neural-network-designer-0-4-5/</guid>
		<description><![CDATA[Note: Deprecated! The tail side is still red hot from the afterburners. At full throttle, 2 editors were completely rewritten, the drag drop system cleaned up and a rare deadlock removed. Both the mindmap and code editors now support all the mouse functions: horizontal/vertical scrolling and zooming. Oh, and I’ve also cleaned up the AICI <a href='http://janbogaerts.name/index.php/2010/05/13/neural-network-designer-0-4-5/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>The tail side is still red hot from the afterburners. At full throttle, 2 editors were completely rewritten, the drag drop system cleaned up and a rare deadlock removed. Both the mindmap and code editors now support all the mouse functions: horizontal/vertical scrolling and zooming. Oh, and I’ve also cleaned up the AICI code a little, though that needs more work.</p>
<p>Get the latest installation from the <a href="http://janbogaerts.name/index.php/downloads/">download section</a>.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=246" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/05/13/neural-network-designer-0-4-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The new code editor</title>
		<link>http://janbogaerts.name/index.php/2010/05/08/the-new-code-editor/</link>
		<comments>http://janbogaerts.name/index.php/2010/05/08/the-new-code-editor/#comments</comments>
		<pubDate>Sat, 08 May 2010 16:59:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[code editor]]></category>
		<category><![CDATA[code images]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/05/08/the-new-code-editor/</guid>
		<description><![CDATA[Note: Deprecated! The new code editor is beginning to work:]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>The new code editor is beginning to work:</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/05/image2.png"><img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb2.png" width="870" height="258" /></a></p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/05/image3.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://janbogaerts.name/wp-content/uploads/2010/05/image_thumb3.png" width="688" height="519" /></a></p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=232" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/05/08/the-new-code-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AICI &#8211; desktop</title>
		<link>http://janbogaerts.name/index.php/2010/04/27/aici-desktop/</link>
		<comments>http://janbogaerts.name/index.php/2010/04/27/aici-desktop/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 14:17:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AICI]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/04/27/aici-desktop/</guid>
		<description><![CDATA[Note: Deprecated! I have created a new small network host demo application which you can use instead of the full designer to run AICI. You can get it from here, or from the new download section. It’s basically a general purpose network host that only supports the text sensory interfaces for input/output. You specify the <a href='http://janbogaerts.name/index.php/2010/04/27/aici-desktop/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>I have created a new small network host demo application which you can use instead of the full designer to run AICI. You can get it from <a href="http://www.janbogaerts.name/files/AiciDesktop.exe">here</a>, or from the new <a href="http://janbogaerts.name/index.php/downloads/">download section</a>.</p>
<p>It’s basically a general purpose network host that only supports the text sensory interfaces for input/output. You specify the network that needs to be run at the command prompt. The installation program will do a default setup to work with the AICI demo, but you can change the shortcut to use your own if you want.</p>
<p><img style="margin: 0px auto; display: block; float: none; border: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/04/image_thumb1.png" border="0" alt="image" width="195" height="291" /></p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=226" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/04/27/aici-desktop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Neural network designer 0.4</title>
		<link>http://janbogaerts.name/index.php/2010/04/27/neural-network-designer-0-4/</link>
		<comments>http://janbogaerts.name/index.php/2010/04/27/neural-network-designer-0-4/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 13:40:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[releases]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/04/27/neural-network-designer-0-4/</guid>
		<description><![CDATA[Note: Deprecated! Finally, it’s time for a new release. Most of the changes are in the backend this time, though there are a few visual changes. So here goes: What’s new Designer and core The storage system has been updated to a binary, flat file structure, which improves the operation speed considerably in all areas. <a href='http://janbogaerts.name/index.php/2010/04/27/neural-network-designer-0-4/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>Finally, it’s time for a new release. Most of the changes are in the backend this time, though there are a few visual changes. So here goes:</p>
<h4>What’s new</h4>
<h5>Designer and core</h5>
<ul>
<li>The storage system has been updated to a binary, flat file structure, which improves the operation speed <a href="http://janbogaerts.name/wp-content/uploads/2010/04/image.png"><img style="margin: 0px; display: inline; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/04/image_thumb.png" alt="image" width="199" height="299" align="right" border="0" /></a> considerably in all areas. This essentially makes the core a true database system, which should be fairly easily scaled (see thesaurus demo project), even over multiple hardware systems (eventually).</li>
<li>I  have finally implemented the namespaces. These are currently maintained in the background, so you don&#8217;t need to worry about them. The only change you’ll notice, is an improved browser popup in the frame and flow editors (see image). Basically, the thesaurus, timers and all the project editors (with their entry points) are included and automatically updated.</li>
<li>The frame editor has been updated a bit cause the previous datagrid didn’t handle the custom namespace selection object. So back to listview for the frame elements (will be updated when the datagrid is fixed).</li>
<li>I have also added a new restriction type for frame elements: a custom filter, which allows you to do determine the filter result through code.</li>
<li>Support for modules has also been included, though not yet properly tested, so the imports will definitely not yet work.</li>
<li>The speed increase brought some more threading issues to light, I hope they are now solved, but one or two things can still pop up here or there.</li>
<li>Somehow, I managed to show the thesaurus in reversed order (so the view for the hypernyms was showing that of the hyponyms). While fixing that, I also tried to get it to work with an arbitrary number of elements (so you can also browse a huge thesaurus, the search hasn’t yet been updated though).</li>
<li>The thesaurus can now also be built automatically, based on the content of the database.</li>
<li>I have added a dialog to remove clusters that have no children, based on the ‘remove orphans’ dialog. This will probably grow out to a general purpose query window, but that’s for the next version.</li>
<li>New instructions (some were long overdue):
<ul>
<li>Substract: remove 1 or more neurons from a set, contained by a variable or global</li>
<li>Select: perform a filter on the content of a variable or global.</li>
<li>Remove Links In: removes all the incoming links of a neuron that have a specified meaning.</li>
<li>Remove links out: same as ‘Remove Links In’, but for the outgoing links. These 2 instructions allow you to do without an extra loop, which makes it all more thread save and faster.</li>
<li>GetAt: retrieves the neuron at a specified index in the content of a variable/global.</li>
</ul>
</li>
<li>I have changed the parameters of the split instruction a little bit: I have removed the ‘result cluster’ which was originally used to retrieve the results of a split. This worked ok, but could cause problems when multiple users would be performing the exact same algorithm. The solution was to simply use the already existing ‘GetSplitResults’ function, which now also works after the split (and not just when the split is still running). This means that you manually need to clear the split result cache once you are done with it, otherwise the next split will give some bogus results.</li>
<li>I have also removed the possibility to assign a weight value to a single neuron. Instead you now assign it to the entire processor. This will assign it’s weight to all of it’s result values when it is done. This way, you can change the weight before you know the actual result.</li>
<li>Attached neurons are working.</li>
<li>some cosmetical touch-ups here and there.</li>
<li>Lots of other bug fixes.</li>
</ul>
<h5>AICI</h5>
<p>The aici network demo is slowly starting to function. That is, it is beginning to record data into understandable structures. Though it’s still very early, so lots of stuff still goes wrong or hasn’t yet been implemented. Some fun responses guaranteed. Here are the major changes:</p>
<ul>
<li>I’ve managed to simplify the flow recognition algorithm (while fixing some tough bugs), so no more synchronization points for the loops. The designer still allows to change this prop at the moment, but this will be removed soon.  Don’t worry about existing values, they are simply skipped, no longer used.</li>
<li>Some bugs in the frame recognition section have also been solved.</li>
<li>I have implemented a first version of the noun path resolver algorithm. This is used to understand statements like ‘my brother’s sister’, ‘I’, ‘my favorite car’, ‘sister in law’. This algorithm is also responsible for generating new ‘<em>compound words</em>’, like ‘brother in law’.</li>
<li>Compound words are recognized again, at different stages. Some compounds can’t be recognized yet (if they have verbs).</li>
<li>New frames:
<ul>
<li>Be-unknown noun: sentences with an agent, be verb and a possible noun. Example sentences: I am Jan. It is a cat. My name is Jan. I was Jan. It will be a cat. (preconditions: Jan and cat are not yet  in the network). The frame is triggered when it receives a sentence that might contain a noun, and there is an open question that can consume this value.</li>
<li>some more, to much to write all down.</li>
</ul>
</li>
<li>If AICI knows several different synonyms for the same word, it will now mimic your preferred one. So if you just said ‘bye’, it will also say ‘bye’ next time. If you say ‘goodbye’ next, it will switch to this.</li>
<li>I have introduced the concept of ‘attributes’. These provide an extra step in the semantics stage. For instance, ‘<em>color</em>’ is an attribute. It’s possible values are: blue, red, black, white, green,… Color is a special attribute, since it changes meaning when applied to different types of subjects. For instance, the sentence: ‘I am blue’ usually means: ‘I am a bit down’. So that’s the semantic part: an attribute can inspect to who it is applied and, when needed, can change the attribute, the owner or the value.</li>
</ul>
<p>The latest release can be downloaded from <a href="http://www.janbogaerts.name/files/setup.exe" target="_blank">here</a>, or from the main menu.</p>
<h4>Coming up</h4>
<p>Next in line will be the editor views (finally). These are currently built using standard WPF controls (listboxes, treeviews,…), which are, well, not performing as desired: they generally can’t handle more than 2-300 items (if you can’t use virtualization) and, more importantly, have a hardcoded recursion limit that causes serious problems, primarily in the code editor. So I need some custom controls to get the speed and reliability up.</p>
<p>Before this though, I will be spending a little more time with AICI. The algorithms are beginning to work the way I want them to, so it’s time to complete the flows, in order to get a larger part of the English language parsed. And off course, I will be adding a bunch of new frames, actions and attributes.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=223" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/04/27/neural-network-designer-0-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging networks: split paths</title>
		<link>http://janbogaerts.name/index.php/2010/03/04/debugging-networks-split-paths/</link>
		<comments>http://janbogaerts.name/index.php/2010/03/04/debugging-networks-split-paths/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 16:54:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[debugging]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/03/04/debugging-networks-split-paths/</guid>
		<description><![CDATA[Note: Deprecated! An annoying side effect of this type of resonating network, is, when you have a bug in the code, you generally don’t get 0 answers, but a whole lot. This can sometimes be very confusing to debug. Why does a certain path give a positive result, when it shouldn’t? And more importantly (from <a href='http://janbogaerts.name/index.php/2010/03/04/debugging-networks-split-paths/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/03/image4.png"><img style="margin: 0px 0px 0px 5px; display: inline; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/03/image_thumb4.png" alt="image" width="362" height="323" align="right" border="0" /></a> An annoying side effect of this type of resonating network, is, when you have a bug in the code, you generally don’t get 0 answers, but a whole lot. This can sometimes be very confusing to debug. Why does a certain path give a positive result, when it shouldn’t? And more importantly (from NND’s point of view at least), how can you follow the construction of that specific result, without the clutter of all the other processors? Enter ‘<em>split paths</em>’.</p>
<p><em><span style="color: #808080;">A split path represent the route that a result took, from start to now, expressed in the neurons that the path chose during all the splits. </span></em></p>
<p>As example, if only 1 split was executed to get to a result, and there were 2 neurons in that split, the path of the result only has 1 node and can have 2 possible values, those that were used in the split. In the real world though, a path usually has many, many nodes.</p>
<p>To record a split path, you first need to put a break point at a position where you know you will get many invalid results. That’s because a split path can only be recorded when the processors are still running, not when the result has already been calculated.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/03/image6.png"><img style="margin: 0px 10px 0px 0px; display: inline; border: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/03/image_thumb6.png" alt="image" width="400" height="246" align="left" border="0" /></a>In the aici demo, it’s best to put a breakpoint in the ‘<em>Stage 1.1</em>’ code, in the if, second part (GetClusterMeaning(CurrentTo) == flow), if you drill down a bit further, you get the ‘Add split result’ instruction, which is basically the end point of the flow recognition  algorithm. (see picture below).</p>
<p><em><span style="color: #808080;">Put breakpoints on ‘Add split result’ instructions to find </span></em><em><span style="color: #808080;">invalid split paths.</span></em></p>
<p>Once you have a processor that is producing an invalid result at your breakpoint, you can store the split path. Select the processor, open the context menu (right mouse button on a processor in the debugger overview) and select ‘<em>Store split path</em>’.  This will produce a new entry in the tree on the ‘<em>Debugger</em>’ page (see 3th image). The root item will be ‘path for x’ where x is the name of the processor. The children are all the neurons that were selected for the path during a split instruction.</p>
<p>I usually kill everything after I have the path, the other processors will produce invalid results anyway, and you need to start a new run before it’s  possible to actually use the path anyway. <a href="http://janbogaerts.name/wp-content/uploads/2010/03/image2.png"><img style="margin: 0px 0px 5px 10px; display: inline; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/03/image_thumb2.png" alt="image" width="383" height="91" align="right" border="0" /></a></p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/03/image5.png"><img style="margin: 5px 0px 0px; display: inline; border: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/03/image_thumb5.png" alt="image" width="294" height="310" align="left" border="0" /></a>So, finally we can start using the data to debug our network. The basic idea is to  use the path for finding the processors that are following the specified path, so we can take a closer look at the code. In short, a split path provide a shortcut: instead of manually stepping through all the code and individually deciding which processors to follow, we can jump to the ones we are interested in. These will be highlighted in green and will pause when they have reached a split that is selected in the path. Off course, we first need to select the path in the debugger, and at least 1 child node, otherwise there wont be anything to see.</p>
<p><em><span style="color: #808080;">Processors that follow a selected split path will show up in green and pause whenever they reach a split that produces a neuron which is selected in the path.</span></em></p>
<p>&nbsp;</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/03/image2.png"> </a>One last note perhaps, once you have the processor you want, you can use the ‘Kill all but this’ command to stop all the other processors. This way there is less distraction in the debugger.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=205" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/03/04/debugging-networks-split-paths/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WPF is getting under my skin</title>
		<link>http://janbogaerts.name/index.php/2010/02/24/wpf-is-getting-under-my-skin/</link>
		<comments>http://janbogaerts.name/index.php/2010/02/24/wpf-is-getting-under-my-skin/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 12:58:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/02/24/wpf-is-getting-under-my-skin/</guid>
		<description><![CDATA[I have been fighting the WPF model all the way during the development of NND. And it is wearing me down. Latest problem: the updated selection box for frame element filters doesn’t want to get focus, making it impossible to use the keyboard. I guess the new release will have to wait until I can <a href='http://janbogaerts.name/index.php/2010/02/24/wpf-is-getting-under-my-skin/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I have been fighting the WPF model all the way during the development of NND. And it is wearing me down. Latest problem: the updated selection box for frame element filters doesn’t want to get focus, making it impossible to use the keyboard. I guess the new release will have to wait until I can get this fixed. Bummer.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/02/image1.png"><img style="margin: 0px; display: inline; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/02/image_thumb1.png" alt="image" width="758" height="728" border="0" /></a></p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=191" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/02/24/wpf-is-getting-under-my-skin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On resonance</title>
		<link>http://janbogaerts.name/index.php/2010/02/22/on-resonance/</link>
		<comments>http://janbogaerts.name/index.php/2010/02/22/on-resonance/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 18:10:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[N²D]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[resonance]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/02/22/on-resonance/</guid>
		<description><![CDATA[Just a small mental burp, while this thesaurus is (still) loading. In case you are looking for a mental image to visualize this whole concept, try this: Resonance. When a link gets activated (for instance, the one to the very first neuron), it creates a resonance that triggers one or more other neurons. This excitation <a href='http://janbogaerts.name/index.php/2010/02/22/on-resonance/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><em>Just a small mental burp, while this thesaurus is (still) loading.</em></p>
<p>In case you are looking for a mental image to visualize this whole concept, try this: <strong>Resonance. </strong>When a link gets activated (for instance, the one to the very first neuron), it creates a resonance that triggers one or more other neurons. This excitation in turn can cause another link between 2 neurons to be activated, causing more resonance and so and and on until the whole thing settles down.</p>
<p>I have absolutely no prove or idea that this is how it works in the real world, that’s just how my model can be interpreted. Truth be told, this is not how I conceived the thing (aka lets try to create a model that uses resonance), it was rather more like: I have 2 neurons, they are linked, how can I make something happen? Well, I can attach some other neurons (that behave like code) to the link and execute that. Cool. But, wait a moment, that looks like resonance…</p>
<p><em>and we just passed ‘culminate’, pfff</em></p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=186" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/02/22/on-resonance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NND 0.3</title>
		<link>http://janbogaerts.name/index.php/2010/01/20/nnd-0-3/</link>
		<comments>http://janbogaerts.name/index.php/2010/01/20/nnd-0-3/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 19:16:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[AICI]]></category>
		<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/01/20/nnd-0-3/</guid>
		<description><![CDATA[Note: Deprecated! The new release is finally ready.&#160; The Aici demo took a bit longer than planned. Also, lots of things have been fixed and updated. Here’s a non exhaustive list: There’s a complete new lockmanager running in the background. This is much more secure (thread-wise, that is) and a lot faster. It’s still a <a href='http://janbogaerts.name/index.php/2010/01/20/nnd-0-3/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p> The new release is finally ready.&#160; The Aici demo took a bit longer than planned. Also, lots of things have been fixed and updated. Here’s a non exhaustive list:</p>
<ul>
<li><a href="http://janbogaerts.name/wp-content/uploads/2010/01/image1.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px 20px 0px 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2010/01/image_thumb1.png" width="207" height="296" /></a>There’s a complete new lockmanager running in the background. This is much more secure (thread-wise, that is) and a lot faster. It’s still a bit of a diesel though, it takes some time for it to get going, but once running, it should be pretty fast. The slow start is due to the storage mechanism (all xml files currently). This is the major drag on the entire system at the moment, and will be fixed next.</li>
<li><a href="http://www.ebswift.com/OpenSource/WordNetSQLServer/" target="_blank">Wordnet</a> import has been seriously updated, a lot more info is retrieved, and it’s now also possible to import the entire db in one go (although not yet advisable, due to a memory bug in the designer, it still takes a major byte out of the hard disk and it simply takes ridiculously long).</li>
<li>The thesaurus has been given a make over to allow for editing and filtering. He can now also display / edit non recursive relationships. Drag drop is also supported.</li>
<li> The frame editor has been updated considerably: drag drop support has been added and frame element filters/restrictions have also been introduced (will probably be extended in the future).</li>
<li>I changed the function of the ‘contains’ operator a bit. It now only checks the contents of a variable. For clusters/children, there are the new instructions (IsClustesteredBy, LinkExists, ContainsChildren, GetInFiltered,…).</li>
<li>I have added the ‘not contains’ operator.</li>
<li>New instructions:</li>
<ul>
<li>Arithmetic group (+-/*%): I finally caved on those. My <a href="http://janbogaerts.name/wp-content/uploads/2010/01/image2.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 0px 20px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="http://janbogaerts.name/wp-content/uploads/2010/01/image_thumb2.png" width="559" height="223" /></a>original plan was to see how far I got without using any arithmetic in the neural code. I guess, this is as far as I got with that.</li>
<li>Get-at group: get child at, get cluster at, get out at, get in at, get info at.</li>
<li>Distinct</li>
<li>get Incoming, get outgoing, get info, Get in filtered, get out filtered, Get info filtered</li>
<li>Is clustered by, Link exists, Contains children</li>
<li>Remove-at group: Remove child at, remove info at, remove link in at, remove link out at</li>
</ul>
<li>many, many bug fixes, updates and little improvements.</li>
</ul>
<h4>Aici 1</h4>
<p>This demo is a small chat interface. Though, in it’s current state, it’s not much more than a framework. It can initiate a conversation, close it, ask for the name of the user and store the data. It’s not yet able to fully recognize a recurring user since I haven’t defined the neural code for this yet. </p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/01/image3.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 0px 20px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="http://janbogaerts.name/wp-content/uploads/2010/01/image_thumb3.png" width="204" height="315" /></a> I will be explaining how it works and how you can expand on this functionality, shortly. For those who can’t wait and want to get a peek under the hood, here are some pointers to get started:</p>
<ul>
<li>There are 3 main stages:</li>
<ul>
<li>Flow recognition, which is basically the syntactical stage: check the word types and order. Project pages are: </li>
<ul>
<li>the flows (aici/flows), </li>
<li>the code that is attached to these flows (aici/code/flow code)</li>
<li>the code that recognizes the flows in the input (aici/code/flow recognition)</li>
</ul>
<li>Frame recognition, or the semantics stage. This is where we try to find meaning in the words. Project pages are:</li>
<ul>
<li>the frames (aici/frames)</li>
<li>the code that is attached to the frame sequences (aici/code/frame seq code). The frames don’t have code (yet).</li>
<li>the code that recognizes the frames in the flow results (aici/code/frame recognition).</li>
</ul>
<li>action execution, or the response of the network to the input. Project pages are:</li>
<ul>
<li>Actions: all the different actions that the system knows (not yet a lot, should be extended).</li>
<li>Output: some common code blocks for rendering output. This is also used by the frame sequences, since they are also used to render data in a predefined format.</li>
<li>Action helpers: code that the action neurons can use to perform common tasks, like stopping a conversation or controlling the timers. Timer callbacks are also stored here.</li>
</ul>
</ul>
<li>The transition between the different stages can be located in aici/code/transition. </li>
<ul>
<li>More specifically, the ‘Transition’ neuron is used to go from the flows to the frames and finally to the actions.&#160; </li>
<li>An action is started using the ‘Execute action’ neuron as meaning for a link from a data cluster to the action that needs to be started.</li>
</ul>
<li>The project also contains some mindmaps that describe the inner data structures and functionality.</li>
</ul>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=180" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/01/20/nnd-0-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aici&#8217;s first words</title>
		<link>http://janbogaerts.name/index.php/2010/01/19/aicis-first-words/</link>
		<comments>http://janbogaerts.name/index.php/2010/01/19/aicis-first-words/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 19:08:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2010/01/19/aicis-first-words/</guid>
		<description><![CDATA[New release coming shortly.]]></description>
			<content:encoded><![CDATA[<p><a href="http://janbogaerts.name/wp-content/uploads/2010/01/image.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://janbogaerts.name/wp-content/uploads/2010/01/image_thumb.png" width="842" height="509" /></a> </p>
<p><img alt="" src="http://www.zu14.cn/coolemotion/emotions/round_2.gif" /> <img alt="" src="http://www.zu14.cn/coolemotion/emotions/round_6.gif" /> <img alt="" src="http://www.zu14.cn/coolemotion/emotions/round_2.gif" /> </p>
<p>New release coming shortly.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=173" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2010/01/19/aicis-first-words/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Lightning fast</title>
		<link>http://janbogaerts.name/index.php/2009/10/03/lightning-fast/</link>
		<comments>http://janbogaerts.name/index.php/2009/10/03/lightning-fast/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 18:53:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2009/10/03/lightning-fast/</guid>
		<description><![CDATA[The new thread locking algorithm is beginning to work and it looks fast, real fast. Yes]]></description>
			<content:encoded><![CDATA[<p>The new thread locking algorithm is beginning to work and it looks fast, real fast. Yes <img alt="" src="http://www.zu14.cn/coolemotion/emotions/round_2.gif" /></p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=170" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/10/03/lightning-fast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Demos explained: Scanner</title>
		<link>http://janbogaerts.name/index.php/2009/10/01/demos-explained-scanner/</link>
		<comments>http://janbogaerts.name/index.php/2009/10/01/demos-explained-scanner/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 13:19:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[AICI]]></category>
		<category><![CDATA[flow recoginition]]></category>
		<category><![CDATA[flows]]></category>
		<category><![CDATA[scanner]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2009/10/01/demos-explained-scanner/</guid>
		<description><![CDATA[Note: Deprecated! Intro Time for the second demo overview: the Scanner.  It builds on most of the ideas found in the first demo but it goes way further, and actually does something very useful (although you wouldn’t say it at first).  It’s probably going to be a lengthy piece so I’m thinking of cutting it <a href='http://janbogaerts.name/index.php/2009/10/01/demos-explained-scanner/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<h4>Intro</h4>
<p>Time for the second demo overview: the Scanner.  It builds on most of the ideas found in the <a href="http://janbogaerts.name/index.php/2009/03/12/demos-explained-echo/" target="_blank">first demo</a> but it goes way further, and actually does something very useful (although you wouldn’t say it at first).  It’s probably going to be a lengthy piece so I’m thinking of cutting it in 2 or maybe even 3 parts. Anyway, lets first start it up, either through the start menu shortcut (in the <em>Demo’s</em> sub folder, conveniently called <em>Scanner demo</em>), or by opening it in NND (<em>File/Open</em>, select the ‘<em>My documents/NND/Demos/Scanner</em>’ folder). Once the project is loaded, you should see a single text communication channel open (called Text sin), if this is not the case, go to <em>View/Communication channels/Text</em> sin and make certain that it is is selected.</p>
<h4>Overview</h4>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/10/image.png"><img style="display: inline; margin: 0px 0px 5px 10px; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2009/10/image_thumb.png" border="0" alt="image" width="606" height="419" align="right" /></a></p>
<p>Lets get a taste of what it does, so enter some text (or leave the one that’s already there) and press the ‘send’ button (or enter).</p>
<p>You’ll notice that it basically does the same thing as the <a href="http://janbogaerts.name/index.php/2009/03/12/demos-explained-echo/" target="_blank">echo demo</a>: the input text is echoed back, except that it’s a bit slower. If you had the debugger tab open, you probably also noticed a lot more activity, so something more must be going on.</p>
<p>And indeed, if you take a closer look to the text sin channel, in the upper section, you can see the neurons that were send to the network (on the left) and those that were returned (on the right), which are different. This was not the case with the echo demo, it simply sent all the incoming neurons back out, as they were. In this demo though, we get back something completely different: TextNeurons, that represent the same thing as the int neurons that were sent as input (if you regard them as ASCII characters). Hence the name of the demo, it’s a scanner.</p>
<p>Converting a stream of ASCII chars into words, integers, doubles and signs is a pretty useful feature and that’s all this demo is capable of doing, but that’s only because <em>I</em> stopped there. You see, in the background, is a general purpose algorithm that converts an input stream of neurons into a single result cluster, using any and all of the flows that are defined in the network. This means that you can use the same algorithm with many different flow definitions. I have simply defined some to recognize words, integers and doubles. You could go further and add flows to find verbs, sentence subjects,.. (in fact, that’s what the <em>AICI 1</em> demo does). You could even go further still and create flows for visual objects or audio fragments, the same algorithm can be used. Unfortunately though, the editor doesn’t yet support such types of displays for flows (will probably be added somewhere in the future though).</p>
<h4>Details</h4>
<p>So how is the translation actually performed? To explain this, let me first recap some of the basic concepts of neurons and flows:</p>
<ul>
<li><a href="http://janbogaerts.name/wp-content/uploads/2009/10/image1.png"><img style="display: inline; margin: 0px 0px 0px 10px; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2009/10/image_thumb1.png" border="0" alt="image" width="105" height="98" align="right" /></a>The different types of  data available to a neuron are: incoming and outgoing links, possibly one or more <em>parent</em> clusters, for clusters possibly 1 or more children and a <em>meaning</em>. And finally value neurons also have their value of course. This is important, cause when the translation process starts, this is all the available information.</li>
<li>Flows are nothing more than <em>clusters</em> that contain flow items, which can be statics or conditionals (loops and options). These in turn can only contain conditional parts. They represent a single branch of the decision tree. Parts can again have the same data as flows: statics or conditionals. So if you are a neuron (a static, part, conditional or flow), you can always look up into your list of parents to see in which flows and parts it is used.</li>
</ul>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/10/image2.png"><img style="display: inline; margin: 0px 0px 0px 10px; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2009/10/image_thumb2.png" border="0" alt="image" width="114" height="108" align="left" /></a>Now, if you recall from the first demo, an input starts by creating an IntNeuron for each ASCII value, which is linked to another neuron using the ‘<em>Letter</em>’ neuron (ID 109). These are all put on the execution stack and the processor starts (the <em>Rules</em> code on the <em>Letter</em> neuron is executed).</p>
<p>So both neurons are new and only have each other as links. This means that <a href="http://janbogaerts.name/wp-content/uploads/2009/10/image3.png"><img style="display: inline; margin: 0px 0px 0px 10px; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2009/10/image_thumb3.png" border="0" alt="image" width="145" height="110" align="right" /></a> we can’t use links or parent/child relationships to resolve the first step, but instead must use something different. The only other thing that remains is the value of the int neurons, so this is compared against some constants to see if they are digits (0..9) alpha numeric (a..z+A..Z), spaces | returns, or something else.  This comparison results in the creation of 1 new neuron per input neuron: the result cluster, in which we store the integer. One of these clusters (or it’s duplicate, due to a split) will eventually store the end result.  This cluster is linked to one of 3 static neurons: <em>Digit</em>, <em>Alpha or</em> <em>Space </em>(signs like . or , are handled a bit differently, this will be explained later). Naturally, if the integers would represent color values, we would use other starting points than <em>digit</em> or <em>alpha</em>. In other words, this first part is variable according to the type of input and the required accuracy of the algorithm. As meaning, we use  the start of the ‘flow recognition’ algorithm, called ‘<em>Stage 1.1</em>’ and put the result cluster back on the stack.  It’s important to put this one back on the stack, and not the item we are looking for. That’s because the algorithm can perform numerous splits and we want the result to be duplicated not the searchable, cause the contents of the list are continuously modified and we don’t want the result of one processor to be modified by  another one (I had to learn this the hard way).</p>
<p>After this initial step, the actual recognition algorithm kicks in. This consists out of 4 stages, grouped by 2. Meaning that  stage 1.2 is executed immediately after stage 1.1 for each neuron (this is the same for stage 2,1 and 2.2), but at the end of stage 1.2 and 2.2 all the result neurons are collected into a single global. Only after the last link of the last item on the stack has  been processed, are all the result clusters put back on the stack, with links for the next stage.  This is done for allowing to group items together.</p>
<p>The different stages are:</p>
<ul>
<li><em><strong>Stage 1.1 (search parts/flows)</strong></em>: Find conditional parts or flows in the list of parents of the searchable. If there are multiple results, perform a split for each, after the result list has been filtered (these are the shortcuts). If there are no results and this is the only and last item still on the stack, the end result has been found.</li>
<li><em><strong>Stage 1.2 (sequence-combine and filter): </strong></em>Check if items are sequential (2 flow items declared after each other in the same parent list, which is a part or flow)<strong><em> </em></strong>and handle floating flows, which are allowed to appear anywhere in the input stream, but which break up the sequence of other items.  Different actions can be performed if the order of the items is not ok: try to solve further or exit without result. Results of sequential items are grouped together.</li>
<li><em><strong>Stage 2.1 (search conditionals): </strong></em>Find conditionals in the list of parents of the searchable if this is a conditional part, otherwise the stage is simply skipped. If there are multiple results, perform a split for each after the result list has been filtered (not yet completely implemented at this stage). If there are no results, there is an error in the flow definition.</li>
<li><strong><em>Stage 2.2 (process loops and sync-points):</em></strong> If there was a conditional found in the previous stage, check if this is a loop. If so, and the previous item is of the same loop, combine the results. Also start a sync-point (will be explained later) if this was defined on the conditional.</li>
</ul>
<p>These 4 stages are repeated until there is only 1 result cluster on the stack that represents the end result of a flow which is no longer used in any other flows. This cluster is made the result of the  split for the processor it ran on.  Off course, because there were possibly many splits, there could be many results. These will all be presented in the split-callback cluster (you need to provide a code cluster to the Split instruction, which will be called when all sub processors are done). In this demo, the result is sent back to the sin that caused the input, in a normal situation thought, this will simply start another process, as is done in the AICI 1 demo.</p>
<p>During this whole process, the algorithm is capable of executing callback code (attached to the statics, conditionals, parts and flows) at certain specific moments in the code. This is where the magic happens. The following types of callbacks are possible (together with  their execution time):</p>
<ul>
<li>Flow code: this code cluster is executed when a flow has been recognized in the stream. The ‘Result’ variable (ID 1822) contains all the neurons that match the flow. It’s here for instance that the int neurons are converted to a single word using the CiToS (Cluster with ints to string) instruction.</li>
<li>Filter flow code: this code cluster is called from stage 1.1  (or 2.1, but this is not yet completely implemented) just after all the next items were retrieved from the list of parents of the searchable (stored in the CurrentTo variable). It allows the flow item to determine if it is a valid result, given the current state of the network. This is done by checking the contents of a number of globals, like ‘<em>Prev stage item</em>’ (ID 1956), which contains the previously processed neuron.</li>
</ul>
<p>In the next post, I’ll go deeper into the specifics of the algorithm itself, for as you’ve guessed by know, it’s a bit funky, and I don’t want to forget all the subtleties, since it’s definitely still a work in progress (there are many improvements still possible).</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=168" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/10/01/demos-explained-scanner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deadlocks and DotNet</title>
		<link>http://janbogaerts.name/index.php/2009/06/28/deadlocks-and-dotnet/</link>
		<comments>http://janbogaerts.name/index.php/2009/06/28/deadlocks-and-dotnet/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 18:56:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[deadlocks]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2009/06/28/deadlocks-and-dotnet/</guid>
		<description><![CDATA[Well, that bear (you know, the deadlocks) turned out to be a formidable grizzly. Now, I don’t know about you, but me, when I see a monster like that, I turn around and run… I can assure you, there’s nothing better than a fierce predator on your tail to streamline things.&#160; First to go was <a href='http://janbogaerts.name/index.php/2009/06/28/deadlocks-and-dotnet/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Well, that bear (you know, <a href="http://janbogaerts.name/index.php/2009/06/03/nnd-011-released/" target="_blank">the deadlocks</a>) turned out to be a formidable grizzly. Now, I don’t know about you, but me, when I see a monster like that, I turn around and run… I can assure you, there’s nothing better than a fierce predator on your tail to streamline things.&#160; First to go was .net’s WeakReference pattern.&#160; This simply couldn’t keep up with the engine (a change that touched every part of the designer: all editors, toolbox, explorer, thesaurus, timers,…). Next was the ReaderWriterLockSlim thingy (used to protect data blocks from corruption), which has a very peculiar definition of slim: you have no idea how many times I have seen my RAM blown up because of a simple integer scan. Lots of other stuff got tuned up or hacked out as well, so the expected update has arrived.</p>
<p>The engine appears to be stabling out, although it is still acting fishy on single core machines, where there are errors I don’t have on my multi core dev system, so I need to move to a different machine to test this out. The designer is also still very much lingering behind the engine when this is processing at full speed, but the UI should remain responsive now.</p>
<p>I have also included an extra demo project called ‘<em>Scanner</em>’. It is able to transform an input stream containing integers, representing characters, into words and numbers (ints and doubles).&#160; This doesn’t seem much, and it isn’t, except that it is doing this using a couple of flows and a general purpose algorithm (processing is still slow, mostly because the UI is trying to catch up).&#160; This was the guts of the older ‘<em>English language definition</em>’ demo, which I have split into 2: the scanner and the language definition, which is no longer able to do any processing (all code removed). It’s an example of a more complex flow.</p>
<p>The scanner demo also has the <em>number scanning problem</em> fixed (numbers longer than 2 came out with multiple results). This appeared to be caused by deleting a couple of neurons to many (in the scanning algorithm).&#160; I had already experienced the dangers of deleting neurons I thought were no longer used, but which were because of the splits. I will probably have to implement some sort of a garbage collection system to clean up unused neurons (but that’s for later).</p>
<p>Anyway, here’s the latest <a href="http://www.janbogaerts.name/files/setup.exe" target="_blank">download</a> (best to remove previous installation before installing this one).</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=139" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/06/28/deadlocks-and-dotnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The debugger</title>
		<link>http://janbogaerts.name/index.php/2009/06/09/the-debugger/</link>
		<comments>http://janbogaerts.name/index.php/2009/06/09/the-debugger/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 18:36:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[code editor]]></category>
		<category><![CDATA[debugging]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2009/06/09/the-debugger/</guid>
		<description><![CDATA[Note: Deprecated! This is the very first debugger I have written, and I am pretty proud about it! It’s not a masterpiece, but functional.&#160; The code definitely could use some tidying up and some speed tuning wouldn’t hurt at all, but you can trace bugs, inspect values and follow the program flow, and that’s already <a href='http://janbogaerts.name/index.php/2009/06/09/the-debugger/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>This is the very first debugger I have written, and I am pretty proud about it! It’s not a masterpiece, but functional.&#160; The code definitely could use some tidying up and some speed tuning wouldn’t hurt at all, but you can trace bugs, inspect values and follow the program flow, and that’s already something I guess. To explain the debugger to you, I thought it perhaps best to do it using some of the demo’s.&#160; Simply open the ‘<em>Echo words</em>’ project to get started.</p>
<h4>Set up</h4>
<p>Before we send some input to the network, we need to set up the designer so that it is ready to debug:</p>
<ol>
<li>We need to&#160; put a breakpoint&#160; on a statement. You can do this in a code editor. The very first code block that gets called in this network is the <em>rules</em> code on the ‘<em>Contains Word</em>’ neuron, so simply double click on the ‘<em>Code: Contains Word</em>’ node in the <em>Projects</em> tab.       <br />To set the breakpoint on the first statement, expand the ‘<em>CheckStartTextBlock – space insertion</em>’ code block and click in the little circle on the ‘<em>if</em>’ statement. This should make it turn red. </li>
<li>The designer also needs to be set in design mode.&#160; You can do this by the drop down box on the main toolbar or on the debugger tab’s toolbar. There are 3 possible modes:
<ul>
<li>Off: no debugging is possible.&#160; This mode runs faster. </li>
<li>Normal: The debugger stops whenever a breakpoint is encountered. When a breakpoint is encountered or a processor was paused, it is possible to inspect values.&#160; This is how most other debuggers provide debug capabilities. </li>
<li>Slow motion: In this mode, the debugger automatically pauses and continues on every statement, creating a <em>movie</em> of the execution process. You can use the throttle bar on the left of the combo box to select the speed, which is updated real time. It’s possible to pause and continue this movie using the pause and play buttons on the debugger tab’s menu.&#160; I have included this type of debugging mode because I believe it is sometimes useful to see the path that is taken to a specific point of interest. With this feature, you don’t have to keep pressing <em>F6</em> to advance. </li>
</ul>
</li>
<li>It’s also possible, but not required, to let a processor stop when an error was encountered. This is done by activating the ‘<em>Break on error</em>’ button. This only works when the error happened on a processor in debug mode. </li>
</ol>
<p></p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image15.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 0px; border-right-width: 0px" height="615" alt="image" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb15.png" width="768" border="0" /></a> </p>
</p>
<p>Note that it is not possible to switch between different modes while a processor is running. You can only specify the debug mode for newly created processors. </p>
<p>An overview of all the breakpoints in the project can be found on the right side of the debugger tab. Currently it simply lists all the breakpoints, but new features should be added to this list shortly.</p>
<h4>Start a processor</h4>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image16.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 0px 0px 10px; border-right-width: 0px" height="473" alt="image" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb16.png" width="378" align="right" border="0" /></a> To get started, we need to send&#160; some data to the network through it’s text-sin (sensory interface), so make certain that the ‘<em>Echo channel</em>’ is opened (a communication&#160; channel is the visual interface for a sin). Go to <em>View/Communication Channels/Echo channel</em>, and make certain it is checked (and that the tab is selected).</p>
<p>Once the channel is open, type some text in the input section and send it to the network by pressing enter (or the <em>send</em> button). You should see a neuron appear in the left upper screen, which represents the input event (the neuron that will be solved by the processor). Your text will also appear as a string in the centre dialog screen. There will also appear an object in the centre screen of the debugger tab. This represents the processor that was started and which is handling the input event. </p>
</p>
<p>The processor overview contains 2 numbers. The first number represents the name of the processor. This value can be changed and is used to identify it between multiple processors. The second number represents the number of neurons that are left on the stack + the current neuron that&#160; is being solved. </p>
<p>The buttons represent, from left to right:</p>
<ul>
<li>a toggle button that can be used to open and close the detailed view for the processor.&#160; </li>
<li>An indicator that is selected when the processor is paused. This is used to inform you on the run state, it’s not an interactive button. </li>
<li>An indicator that lets you know that the processor is still running or not. When this is no longer selected, an irrecoverable error occurred in the processor and it is actually dead (in other words, you’ve got a problem when this is no longer selected). </li>
</ul>
<p>Once a processor is started, the middle square in the right side group on the status bar will be blue.&#160; This will remain so for as long as the network has still a processor running. </p>
<h4>Detailed view</h4>
<p>If you press the first toggle button, a detailed view of the processor should open in a new tab (using the same name as that of the processor). </p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image17.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 0px; border-right-width: 0px" height="484" alt="image" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb17.png" width="637" border="0" /></a>&#160;</p>
<p>This tab is divided into 3 sections (from left to right):</p>
<ul>
<li>The content of the execution stack.&#160; This stack contains the neurons that have to be solved by the processor.&#160; You can add and remove neurons from/to this stack using the Pop and Push instructions (The first neuron is automatically added). In our demo, there is only 1 item currently on the stack, that’s the one being solved. This item displays&#160; a square in the stack UI element. </li>
<li>All the neurons that were assigned as meaning to the links starting from the solvable neuron. The top one will be executed first.&#160; A special case is the ‘Actions’ neuron, which will only be solved when all the others have been, no matter where it is found in the list. </li>
<li>A stack containing all the processor frames.&#160; A frame represents a single cluster’s code that is being executed by the processor. Since some statements call other clusters, like conditional statements, code blocks,… a processor will usually have a number of frames active. This provides an exact view of the processor’s current execution location.      <br />The following info is provided for each frame, from top to bottom
<ul>
<li>The code, in textual form. Each code unit can easily be selected separately for debugging purposes (check out the context menu on each item to see what you can do with it).&#160; It’s not possible to edit in this window though (you have to open the editor for this). </li>
<li>The name (or id when no name is defined) of the neuron that defines all the code. </li>
<li>The relationship between the neuron that defines the code and the actual cluster containing the code.&#160; This can be:
<ul>
<li>Children: in this case, the neuron that defines the code, is the cluster that contains the code. </li>
<li>Rules: the neuron that defines the code has a link with meaning ‘Actions’ to a code cluster. </li>
<li>Actions: the neuron that defines the code has a link with meaning ‘Actions’ to a code cluster. </li>
</ul>
</li>
</ul>
</li>
</ul>
<p>The detailed view is great to have an overview of where we are in the processing stage, but it isn’t very useful to&#160; debug a program flow. It’s better to use the code editor for this because it provides a better overview of the connection between the statements.&#160; To do this, open the editor containing the code and make certain the the processor in the debugger tab’s center screen is selected.&#160; This last action is very important for the following reason: a detailed view is opened for a specific processor, so a single tab always links to a single processor.&#160; Code however is not specific to a processor, it can be called by many processors. So it needs to know the processor context for displaying debug information.&#160; It uses the processor that is selected in the&#160; debugger overview for this purpose.&#160; This has a nice&#160; side effect: when you have multiple processors running, you can quickly switch between active processor and view where each one is in the code. Note that the code editor will put a red square around the statement that will be executed next, to indicate execution location.</p>
<h4>Do the debug</h4>
</p>
</p>
<p> <a href="http://janbogaerts.name/wp-content/uploads/2009/06/image18.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 0px; border-right-width: 0px" height="669" alt="image" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb18.png" width="801" border="0" /></a><br />
<h5>Code flow</h5>
<p>We are ready now to start debugging the network. The first thing you can do is walk through the code using the following commands:</p>
<ul>
<li><strong>Run (F5)</strong>: continue execution until the next breakpoint or until the processor is finished (only active when paused). </li>
<li><strong>Next step (F6)</strong>: execute the next step only and&#160; pause again (only active when paused). Note, when&#160; you do a <em>step next</em> on a split instruction that creates multiple sub processors, all sub processors will also wait on the next statement, they wont run wild, but wait until you tell them what to do, which is very useful for inspecting stuff. </li>
<li><strong>Pause</strong>: stop execution and wait until the <em>Run</em> or <em>Next step</em> command have been given (only active when running). </li>
<li><strong>Stop</strong>: Ok, this sounds silly, I know, but I haven’t yet implemented the stop.&#160; I’ve always been able to stop in other ways (I’m running the debugger inside another debugger which is great for creating a schizoid coding mind). If you feel an urgent need for this command, let me know, otherwise, it’ll get in there,&#160; I just have absolutely no time frame for this. </li>
</ul>
<h5>Inspecting values</h5>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image19.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 0px 0px 10px; border-right-width: 0px" height="186" alt="image" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb19.png" width="275" align="right" border="0" /></a> When a processor is paused, it is possible to inspect the value of any item that returns a result, this includes: variables, globals, result statements, bool expressions and ByRefs. You can do this by selecting the item you want to inspect with the mouse, and pressing <strong>F7</strong> or through it’s context menu (Inspect value). This opens a dialog with the debug info of the result.&#160; This can be empty, 1 or multiple neurons.</p>
<p>Debug info for a neuron contains the following info:</p>
<ul>
<li>All the incoming links, where they point to and the meaning of the link (note that the meaning UI element still has to be changed into a debug neuron). </li>
<li>All the outgoing links, where they point to and the meaning of&#160; the link. </li>
<li>All the clusters that contain the parent node. </li>
<li>When the parent node is a cluster, all it’s children. </li>
<li>When the parent is a cluster, the meaning of the cluster is depicted, in brackets, after it’s name.&#160; This is also a debug UI element. </li>
</ul>
<p>The debug info is depicted recursively for all neurons. This type of debug visualization is used in multiple places throughout the designer.&#160; You might have noticed that the <em>echo channel</em> uses this UI element to depict the incoming and outgoing neurons. The detailed view of a processor also uses it to depict most of the neurons. </p>
<h5>Watches</h5>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image20.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 0px 0px; border-right-width: 0px" height="162" alt="image" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb20.png" width="451" align="left" border="0" /></a> A final feature of the debugger is watches.&#160; These allow you to observe the content of variables and globals in a list for a single processor or across all processors for those that are paused.&#160; </p>
<p>This feature is best experienced using the ‘<em>English language definition</em>’ demo since this performs some splits while processing text input. I have put a breakpoint in the ‘<em>Code: Stage 1.1</em>’ page on the second <em>if</em> statement&#160; (first child <em>if</em> in the left-side path of the only root <em>if</em>) and ran it until ‘<em>Found == Sentence(flow</em>)’ to get the screenshot on the left.</p>
<p>To add watches, drag a variable or global and drop it in the left part of the debugger tab.&#160; This will add it at the bottom of the list. If you are dragging it from a code editor, it is best to hold the <em>ctrl</em> key pressed, so that the item stays at it’s original position.&#160; Note that it’s currently not yet possible to drag from the toolbox.&#160; This is a small bug that still needs fixing. Also note that it’s not yet&#160; possible to remove variables (except by editing the designer file).&#160; This command will be added very soon (just goes to show how fresh the debugger still is).</p>
<p>By default, a list of watches with their values for the selected processor is depicted.&#160; The left side is the name of the variable (or it’s id if no name has yet been assigned). To the right of the name, the content of the variable is displayed. This can be empty, 1 or more neurons, all of which are depicted using the debug UI element for neurons.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image21.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 0px 0px 10px; border-right-width: 0px" height="207" alt="image" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb21.png" width="521" align="right" border="0" /></a> </p>
</p>
</p>
<p>If you switch to variable view, the left section of the debugger tab will only display a radio button for each watch. The middle section, which contains processor info, will now display the contents of the selected watch for each processor.&#160; </p>
<p>Also note that, when a processor gets split up into multiple sub procs, the view will switch to a tree.&#160; The root node shows the number of processors contained by the node. If a new input event is sent to the network before the previous has been processed, it is added as a list item, at end of the list. If sub processors split up, more sub nodes are created as children of the nodes that triggered the split (tree structure). This allows you to see how processors are related to each other.&#160; At the moment you can only see the current state, through the tree/list structure.&#160; In the future, an extra view might be added that shows a line view over time to show when and how may processors did a split and when they died out, although that’s just an idea at the moment, so don’t put your hopes up to see it any time soon, there are still far more important things to do.</p>
<h5>Errors and warnings</h5>
<p>If there are any errors generated by the code, either through the <em>Error</em> or <em>Warning</em> instruction or because of an error in the code, you can view exactly where it occurred. All messages are stored in the log tab. When they are blue, you can double click on them. This will open a code editor with the statement selected&#160; that caused the log item (note: if it is somewhere in a sub section, this is not expanded automatically) Because you can use the same statement in multiple locations, only the first few will be selected, this is to take care of some problems with WPF’s standard controls (will be fixed in the future).</p>
<p>As you can see, it’s all still fresh,&#160; but functional. The debugger has already become a central point of usage for me and I suspect this will only increase, so this will get some extensive testing early on. There are plenty of things that still need adding like conditional breakpoints, counts on breakpoints, enabling-disabling of breakpoints, more commands on the breakpoints-list (like clear, enable/disable all,…),… These things will probably be added as needed.</p>
<p>I am certain there is plenty more to say about NND’s debugger, I just can’t think of anything&#160; anymore, so I guess I’ll leave it by this for today. It’s already turned out a long enough post.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=134" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/06/09/the-debugger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Designing code: Tips and tricks</title>
		<link>http://janbogaerts.name/index.php/2009/06/05/designing-code-tips-and-tricks/</link>
		<comments>http://janbogaerts.name/index.php/2009/06/05/designing-code-tips-and-tricks/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 15:13:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[code editor]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2009/06/05/designing-code-tips-and-tricks/</guid>
		<description><![CDATA[Coding tips and tricks.]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>Note: this is the second part of in a<a href="http://janbogaerts.name/index.php/2009/06/05/designing-code-editing-techniques/" target="_blank"> group of 3</a>.</p>
<p>N2D is still in proto type stage, so there are plenty of idiosyncrasies to work around. Here are some tips and tricks that might make things a bit easier.</p>
<ul>
<li><span style="text-decoration: line-through;">When there is lots of code visible, things can slow down fast.</span> (fixed)  To avoid this, use the drill down/up arrows on some statements like conditional statements to close as much as possible.  If you are drilling down and need to see more code, you can always open sub items into a new code editor.  This will speed up things dramatically. You can do this on conditionals, their parts and code blocks</li>
<li><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image11.png"><img style="display: inline; margin: 0px 0px 0px 10px; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb11.png" border="0" alt="image" width="217" height="255" align="right" /></a> Be careful with copying items around (or using shift drag). The editor displays items that are used in multiple places, but you can still be surprised when you change something to an argument only to see it changed it multiple places. The same goes for breakpoints: if an item is used in multiple places and it has a breakpoint defined, it will break everywhere the statement is used.  Keep this in mind while using copy or shift-drag.</li>
<li>I use the <em>sync with explorer</em> command (F4) a lot. This was mainly because the copy paste system wasn’t working yet.  But it’s still useful I think: it’s a quick route into the explorer.</li>
<li>The Toolbox is really useful to build code.  If you select the ‘Instructions’ section, you get a good overview of all the available instructions, grouped by functionality.  To quickly collapse and expand the groups, you can use the context menu of the toolbar.</li>
<li>It’s possible to add items to the toolbox, although this currently has to be done by hacking the “XXXdesigner.xml” file.</li>
</ul>
<h4>Final note</h4>
<p>There are still a number of shortcomings in the editor that need to be worked out, more specifically:</p>
<ul>
<li><span style="text-decoration: line-through;">CPU and memory usage are a problem resulting in a very slow view when there is lot&#8217;s of visible data. This needs be solved by a custom control.</span> (Done<span style="text-decoration: line-through;">)<br />
</span></li>
<li>Keyboard entry functionality, similar to the flow editor must still be implemented, this should speed up code editing significantly, compared to the all drag-drop or copy-paste solution.</li>
<li>Clean up the views some so that they are clearer, compacter,…</li>
</ul>
<p>Next up will be the debugger, I guess.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=106" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/06/05/designing-code-tips-and-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Designing code: Statements</title>
		<link>http://janbogaerts.name/index.php/2009/06/05/designing-code-statements/</link>
		<comments>http://janbogaerts.name/index.php/2009/06/05/designing-code-statements/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 15:12:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[code editor]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2009/06/05/designing-code-statements/</guid>
		<description><![CDATA[Note: Deprecated! Note: this is the second part of in a group of 3. All the different statement types, the general neuron types, some common static neurons, all the operators and the instructions can be accessed from the toolbox. You can easily drag and drop them on the editor. Assignment An assignment is used to <a href='http://janbogaerts.name/index.php/2009/06/05/designing-code-statements/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>Note: this is the second part of in a<a href="http://janbogaerts.name/index.php/2009/06/05/designing-code-editing-techniques/" target="_blank"> group of 3</a>.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image1.png"><img style="border-right-width: 0px; margin: 0px 0px 0px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="right" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb1.png" width="187" height="695" /></a>All the different statement types, the general neuron types, some common static neurons, all the operators and the instructions can be accessed from the toolbox. You can easily drag and drop them on the editor.</p>
<h4>Assignment</h4>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image2.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb2.png" width="331" height="43" /></a></p>
<p>An assignment is used to assign one or more neurons to a variable. After the operation, the variable will reference the result of the right part of the assignment. The left part must always be a variable: regular or global, but no system variables are allowed.&#160; What exactly is assigned to the left part, depends on the type of the right part.</p>
<ul>
<li>If it is another variable, the contents of the right part are assigned to the left part. </li>
<li>It can also be a result statement, in which case the statement is executed and it&#8217;s result is assigned to the variable. </li>
<li>ByRef statements are also resolved: the content of the ByRef statement will be assigned to the variable. This is useful if you want to assign a variable or a result statement to a variable and not it&#8217;s contents or results. </li>
<li>In all other cases, the right part is assigned to the left part, so if you put a code block in the right section, it will not executed, instead, the variable will point to the code block. </li>
</ul>
<h4>(Result) Statement</h4>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image3.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb3.png" width="199" height="46" /></a></p>
<p>A statement is used to call an instruction and provide all the parameter values for this instruction. You can call any type of instruction with a statement, even those that return values, although that&#8217;s not very useful cause any result values are lost when used in a statement.</p>
<p>You select the instruction using the drop down box.&#160; The instruction itself is also just another neuron, that the statement links to.&#160; This has some consequences.&#160; For instance, if you want to find all the statements that use a specific instruction, just check the incoming links on the instruction.</p>
<p>Most instructions require 1 or more arguments. The values for these arguments are displayed in a list that comes after the instruction. This is a regular drop list, like a code list. Each&#160; instruction should have a little description (you can see/edit this in the description tool-frame if you select the instruction in the toolbox).&#160; This description should say all the required arguments and any possible result values.</p>
<p>A result statement works similar to a normal statement, except that it return a value and tend to be used as part of another statement, like an assignment, a Boolean expression or as an argument value.&#160; Result statements are depicted using the same template, but with a slightly different color to make a distinction.</p>
<h4>Code block</h4>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image4.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb4.png" width="108" height="46" /></a></p>
<p>A code block is used to group other statements together. This allows you to reuse common functionality.&#160; It is a bit similar to a <em>function</em> in traditional programming languages (like C, Pascal,..), except that there are no arguments allowed and it doesn&#8217;t allow for local variable values (scope locality), see Variables for more info on this one. Internally, a code block stores all the statements in a cluster that is linked to the statement.</p>
<p>It is possible to see the statements of a code block inline, by using the expand button in front of the name.&#160; Note that this can slow the editor down dramatically.&#160; Better is to open the code block in a new editor frame (make certain that ‘<em>Statements</em>&#8216; tab is selected).&#160; You can do this through the context menu’s ‘<em>View code</em>’ command (can also be triggered from the main toolbar). If you want to reuse a code block, you can simply drag it from the explorer frame to the editor.</p>
<p>Even though you define parameters on code blocks, it’s still possible to pass along argument values.&#160; Because the content of a variable isn’t reset when a code block is called, you can create some Variables that function as parameters, fill them before you call the block and access them inside the subroutine.&#160; The same can be done for result values, you can return as many as you want, simply&#160; define some variables and assign a value to them in your code block.</p>
<h4>Conditional statement and it’s parts</h4>
<p>A conditional statement is used by the processor to perform execution jumps (if, case, while, foreach,…).&#160; Each conditional should contain at least 1 conditional part, but can have more. This depends on how it is set up. You add parts by dropping them in the ‘<em>Children</em>’ section of the UI element (which moves to the right).&#160; You can also move them around, just make certain that the entire part is selected, and not just the ‘<em>conditional</em>’ section. When correctly selected, the part will have a selection border.</p>
<p>Visually, a conditional statement is always represented as a horizontal split in the vertical code branch.&#160; When there is a repetition in the statement (for-each, looped, until, case-looped), 2 vertical lines are also visible, making the conditional statement boxed in. This is an easy visual queue to identify repetitions (so you can have a bit of a birds eye on the code to see the structure, without the details).</p>
<p>There are currently 5 different types of conditional statements (which can be selected from the drop down box): these are:</p>
<h5>If statement</h5>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image12.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb12.png" width="452" height="189" /></a></p>
<p>An ‘<em>If</em>’ statement can be compared with a <em>structural language’s </em>if statement. It can contain multiple parts, with only the last one allowed to have no condition. The first part who’s condition evaluates to true will have it’s code executed, all other parts are skipped from then on (so there is no fall through possible like in C’s case statement). After all the code in the part has been executed, the next statement after the if is performed, so there is no repetition in this type of conditional.</p>
<p>Adding statements to a part is done by dropping them in the ‘<em>children</em>’ section of the UI element. Because a condition must evaluate to either true or false, a Bool expression tends to be used, but a result statement can also be used. Simply drop an item in the ‘<em>condition</em>’ section.</p>
<h5>Case statement</h5>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image5.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb5.png" width="550" height="112" /></a></p>
<p>The case statement is, like the ‘if’ statement, very similar to it’s structural equivalent: the content of a value is compared against a number of different possibilities.&#160; Each possibility is provided through the ‘<em>condition</em>’ of the part, which can be a static or another statement that returns a result. Only the last part can be empty, which will be executed if none of the previous values matched the variable.&#160; An empty part is not required though. There is no fall through possible (unlike the <em>switch</em> in C).</p>
<p>When you select this type of conditional statement, the UI element will display an extra drop target for you to specify the variable&#160; who’s content needs to be checked.&#160; This has to be a variable (or global).</p>
<h5>Looped statement</h5>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image13.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb13.png" width="633" height="112" /></a></p>
<p>A looped conditional is comparable with&#160; the ‘while’ statement, but with a twist: it is possible to define multiple parts.&#160; It’s actually a bit like C’s <em>while</em> and <em>if</em> combined. The loop will run for as long as the condition in one of the parts evaluates to true.&#160; Like the if statement, this part’s sub-statements will be executed.&#160; The last part doesn’t require a condition, in that case, the loop will run for ever and will only stop when a break or one of the exit instructions is called. These instructions will always terminate a loop. If there&#160; is no ‘<em>empty</em> part, the loop will stop when none of the conditions evaluates to true.</p>
<h5>Until statement</h5>
<p>The <em>until</em> conditional is similar to the <em>looped</em> variant in that it is repetitive, but it only allows 1 part that must always have a condition which is evaluated after all the sub statements have been executed.&#160; When the condition evaluates to <em>true</em>, the repetition is stopped. This type of conditional is very similar with C’s <em>do until</em> loops.</p>
<h5>Case looped statement</h5>
<p>This conditional is a looped statement, but instead of using an ‘<em>if</em>’ kind of testing style, a <em>case</em> is used. This means that you need to provide an extra <em>case item </em>variable, like the case statement. The statement will loop for as long as a condition in one of the parts equals to the content of the case variable. The conditions in the parts should be static values, result statements, ByRefs, bool expression, variables or globals (so anything that can return a result). You can also specify an empty condition in the last part which will be activated if all of the other parts were different than the case variable.&#160; This results in a never ending loop, which will only stop when the <em>break</em> or one of the <em>exit instructions </em>is called.</p>
<p>The case looped statement is a bit of a strange beast.&#160; It’s origins can be traced back to <a href="http://genelib.tigris.org/" target="_blank">Gene</a>, where it made a lot of sense for parsing or generating stream.&#160; Id don’t know if it’s useful in this context, so I simply left it in, you never know where this might end up: could be the dumpster, could be some cool trick.</p>
<h5>For each statement</h5>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image14.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb14.png" width="310" height="140" /></a></p>
<p>This type of conditional statement can probably best be compared to C#’s ForEach loop: it executes a peace of code for each neuron&#160; in a list. Only 1 part is allowed. It’s condition should be a statement that returns some neurons.&#160; This can be a variable or global that contains multiple items, or a result-statement that returns a number of items, like the one that returns all the children of a cluster.</p>
<p>When this type of conditional is selected, an extra drop target is visualized, which should reference a variable (or global) that will receive the current item from the list, as it’s content. This allows you to reference the loop item from within&#160; the subroutine.&#160; After the loop is done, this will still reference the last item in the list.</p>
<h4>Bool expression</h4>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image6.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb6.png" width="429" height="47" /></a></p>
<p>A Boolean expression is evaluated to the ‘<em>True</em>’ or ‘<em>False</em>’ neurons. It can be used as a conditional part’s condition. The left part is compared with the right part, using the specified operator. This statement type is probably recognizable from more classical programming languages.&#160; There are a couple of important twists to this type of statement though:</p>
<p>First of all, because the operator is also a neuron, it can just as well be another result statement, or variable.&#160;&#160; As long as you have something that can be evaluated to 1 or more operators, it’s ok. And this brings us to the second wrinkle:</p>
<p>Because variables, globals and result statements can return a list of neurons, so that the left, operator and/or right sides can have multiple items, the expression evaluates the lists using the following algorithm:</p>
<ul>
<li>If the left part has no result (no neurons) and all the operators are all ‘!=’ and the right side is not empty, true is returned, otherwise false. </li>
<li>Otherwise: for all items in the left part, compare each item in the right using every operator. </li>
</ul>
<p>Note, when there are multiple operators, it is like having an ‘and’ operator for conditions that work with the same left and right side, but different operators.&#160; This will probably not be used a lot (I haven’t yet).&#160; It’s just a result of the structure, so I let it be available.</p>
<p>All the operators are represented by statically declared neurons (so you can’t add your own). Most are recognizable from classical programming languages like C(++). You have:</p>
<table border="0" cellspacing="0" cellpadding="2" width="347">
<tbody>
<tr>
<td width="63" align="right">==</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="272">equal</td>
</tr>
<tr>
<td width="63" align="right">&lt;</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="272">less than</td>
</tr>
<tr>
<td width="63" align="right">&lt;=</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="272">less or equal than</td>
</tr>
<tr>
<td width="63" align="right">&gt;</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="272">more than</td>
</tr>
<tr>
<td width="63" align="right">&gt;=</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="272">more or equal than</td>
</tr>
<tr>
<td width="63" align="right">!=</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="272">different</td>
</tr>
<tr>
<td width="63" align="right">||</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="272">logical or</td>
</tr>
<tr>
<td width="63" align="right">&amp;&amp;</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="272">logical and</td>
</tr>
<tr>
<td width="63" align="right">contains</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="272">contained in the child or clustered-by list</td>
</tr>
</tbody>
</table>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image7.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb7.png" width="275" height="44" /></a></p>
<p>The ‘Contains’ operator is a bit different. First of, there is no equivalent in traditional programming languages and it&#160; requires a little more information to work properly: it needs to know which list to search: in the child list (in which case the left part should be a cluster),&#160; or in the clustered-by list, which contains all the clusters that contain the neuron (this list is available in every neuron type, so the left part can be any type).</p>
<p>There is no operator precedence defined as in most traditional languages, since it is the structure of the neurons that defines the order.&#160; This is visually verifiable by the statement’s container: first the left part is evaluated, next the operator and finally the right part.&#160; If left or right has a sub bool expression, this is recursively repeated.</p>
<h4>Search expression</h4>
<p>This type of statement has already become deprecated. It’s been surpassed by the instructions, which provide more functionality and flexibility.&#160; Nothing more to say about this, I guess.</p>
<h4>Variable</h4>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image8.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb8.png" width="112" height="30" /></a>A variable is a neuron that is able to store a reference to other neurons in the context of a processor. That is to&#160; say, the content of a variable is only valid for as long as the processor running the code is still alive.&#160; The contents of a variable can also be different for each processor. It will also be reset after the processor has completed evaluating all the links on a neuron and when a split callback function is called (scope locality).</p>
<p>A variable doesn’t have an initial value by default. It is possible to provide one though.&#160; You need to unfold the drop location to make it accessible. This value can be another result statement, variable, global byref, or bool expression, in which case it is first resolved. In all other cases, the value is treated as a static.</p>
<h4>Global</h4>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image9.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb9.png" width="381" height="28" /></a></p>
<p>A global is similar to a variable, except that it has a different scope.&#160; Globals are able to retain the same value for as long as the processor is alive while normal variables are reset at different times during the execution process of a processor. This is useful to pass along data generated during the execution of one link to another one.</p>
<p>Globals are also able to define what should happen during a split operation.&#160; Possible values are:</p>
<ul>
<li>Empty: clear all values from the global in the new processors </li>
<li>Duplicate: create duplicates from the content of the globals. A duplicate is a neuron with the same incoming and outgoing links, same value (in case of Int-, double- and Text-Neurons) and same children, but a different ID and not clustered by any item (so the clustered-by list is not duplicated, cause the clusters don’t get new neurons added because of a split). </li>
<li>Copy: simply copy the content of the global to the new processors. </li>
</ul>
<h4>ByRef</h4>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image10.png"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb10.png" width="85" height="30" /></a></p>
<p>The ByRef statement can best be compared with C’s ‘&amp;’ operator, but instead of getting the address of the memory location, in a neural network, it prevents a statement that return a result (like a variable, result statement, bool expression) from calculating that result, but instead returns the statement itself.</p>
<p>Although this statement probably wont be used that much, it is very important for the split instruction to work properly, since this requires a variable neuron as one of it’s arguments.&#160; Often, this statement is the only way to provide this value.&#160; There are other situations where this statement can be used, but less often.</p>
<h4>Lock</h4>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/07/image2.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px 10px 0px 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="left" src="http://janbogaerts.name/wp-content/uploads/2010/07/image_thumb2.png" width="184" height="96" /></a> (Added 11/July/2010) The lock is used to combine a number of statements into a single&#160; unit of execution, relative to 1 or more neurons and/or links. This statement can best be compared with C#’s <em>lock</em> keyword. When you lock a link, you need to specify <em>from</em> and <em>to</em>, but not the meaning, so each link lock actually requires 2 neurons to lock.</p>
<p>When you lock a neuron, the entire object is locked: incoming and outgoing links, value, parent cluster list and children. When you lock a link, only the incoming or outgoing section of the neuron is locked. This is important to keep in mind, if the locked items are operated on from other processors.</p>
<p>Don’t use the ‘duplicate’ instruction or perform any splits (with the split instruction) inside the lock. Although technically possible and allowed, it is not advised since this can and probably will cause deadlocks. Any object that needs to be duplicated during a split and which references the locked object, will cause the network the hang in a deadlock (although you can still terminate all the processors from the designer). </p>
<p>This concludes the overview of all the different statements.&#160; Up next, some <a href="http://janbogaerts.name/index.php/2009/06/05/designing-code-tips-and-tricks/" target="_blank">tips and tricks</a>.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=103" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/06/05/designing-code-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Designing code: Editing techniques</title>
		<link>http://janbogaerts.name/index.php/2009/06/05/designing-code-editing-techniques/</link>
		<comments>http://janbogaerts.name/index.php/2009/06/05/designing-code-editing-techniques/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 15:09:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[code editor]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2009/06/05/designing-code-editing-techniques/</guid>
		<description><![CDATA[Note: Deprecated! Today, I&#8217;d like to talk a bit about the code editor which is used to create and view executable data. Notice that I used the verb &#8216;designing&#8216; instead of &#8216;writing&#8216; code in the title. There&#8217;s a very simple reason for this: N2D doesn&#8217;t yet define a syntax for textual input of code, instead, <a href='http://janbogaerts.name/index.php/2009/06/05/designing-code-editing-techniques/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>Today, I&#8217;d like to talk a bit about the code editor which is used to create and view executable data. Notice that I used the verb &#8216;<em>designing</em>&#8216; instead of <em>&#8216;writing</em>&#8216; code in the title. There&#8217;s a very simple reason for this: N2D doesn&#8217;t yet define a syntax for textual input of code, instead, there is the code designer which provides a visual view on the raw assembly code (so there is no complex conversion required). The idea is that it will eventually (I hope sooner rather than later) be able to understand natural language, making a custom syntax not necessary.  Because designing a good language, with accompanying parser can be tricky and time consuming, I opted to skip this step and instead rely on WPF for me to build a powerful designer with.  This has sort of worked.</p>
<p>Before you get started with this post, might I suggest you to check the <a href="http://janbogaerts.name/index.php/2009/03/12/demos-explained-echo/" target="_blank">Echo words demo explanation</a> for a more general introduction on how to use the code editor. This provides a good introduction for most of the general concepts. This post will deal with some more technical details.  Because of the length, I decided to split it into 3 posts:</p>
<ul>
<li>editing techniques: that’s this post</li>
<li>all the different <a href="http://janbogaerts.name/index.php/2009/06/05/designing-code-statements/" target="_blank">code statements</a></li>
<li>and: <a href="http://janbogaerts.name/index.php/2009/06/05/designing-code-tips-and-tricks/" target="_blank">tips and tricks</a>.</li>
</ul>
<h4>Editing techniques</h4>
<p>Code editing is currently based on a drag drop paradigm in which you drag statements to the editor and drop them at the appropriate location.</p>
<ul>
<li>Drop locations are indicated using a gray, rounded border, containing the name of the drop target, like &#8216;Args&#8217;, &#8216;Children&#8217;,&#8230;</li>
<li>To add statements at the bottom, simply drop them somewhere in the white space below or at the side.</li>
<li>To insert items, drop them on the little black line above the statement.  The previous statement will be moved down.</li>
<li>When you drag an item and drop it somewhere else, it will be moved, except if the &#8216;shift&#8217; key is pressed, in which case the item will remain at it&#8217;s original position and will be copied to the drop target (no duplicate, but the same neuron is referenced. <strong>This is important</strong>!)</li>
<li>You can also copy and paste items. During the copy process, the id&#8217;s of all the selected items are placed on the clipboard.  A paste will get the id&#8217;s from the clipboard, transform them into neurons which are put in the selected place.  You paste in drop targets, simply click in the drop target (there is no visual queue yet to indicate that the drop target is selected, this still needs some work) and paste. Note that copy-paste doesn&#8217;t yet work across multiple applications.</li>
<li>If you press delete while an item is selected, it&#8217;s reference will be removed from the editor.  If the underlying neuron is no longer referenced anywhere else, it is removed.  All neurons that it references which are also no longer referenced are also removed (cascading delete).  This is the most used deletion method in code editing.  This means that when you delete a statement, all the parameter values that are no longer used, are also deleted. Or, if you delete a code block, all the statements that are no longer used anywhere else, are also deleted from the network.</li>
<li>If you want more deletions options, use the &#8216;Delete special&#8217; (ctrl+del)  command.  This shows a dialog which allows you to specify the deletion method you want:
<ul>
<li>simply remove the reference, but always leave the neuron in the network</li>
<li>Remove the reference and when  no longer used, delete it (as with the normal delete)</li>
<li>Always delete the neuron.Referenced neurons can be</li>
<li>left alone: they are not deleted</li>
<li>deleted when no longer referenced</li>
<li>always deleted</li>
</ul>
</li>
<li>All neurons can have a &#8216;<em>display title</em>&#8216;. When the designer finds one for a neuron, this is displayed when possible.  You can easily change this name by pressing &#8216;F2&#8242; or through the context menu of the selected item.  This is very useful for variables and globals.</li>
<li>Most statements have a little circle in the front of the image.  This is a toggle button to enable/disable a breakpoint on the item. This is part of the debugger integration into the editor (more on that later).</li>
<li>It’s also possible to change a statement from one type to another one through the context menu.  A warning though about this command, you might loose data with this command, that can’t yet be undone (no proper undo support yet for this command).</li>
<li>If you simply need to move a statement up or down, you can also use the context menu, which has a submenu for moving items around.</li>
</ul>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=82" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/06/05/designing-code-editing-techniques/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NND 0.1.1 released</title>
		<link>http://janbogaerts.name/index.php/2009/06/03/nnd-011-released/</link>
		<comments>http://janbogaerts.name/index.php/2009/06/03/nnd-011-released/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 18:41:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2009/06/03/nnd-011-released/</guid>
		<description><![CDATA[It was itching to much, I had to do a new release.&#160; Lots of things have been updated behind the scene, so not much visually new to report (except for the debugger perhaps, that&#8217;s definitely visual). As I mentioned in a previous post, I was expecting some serious coding requirements to get the scanner-parser routines <a href='http://janbogaerts.name/index.php/2009/06/03/nnd-011-released/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>It was itching to much, I had to do a new release.&#160; Lots of things have been updated behind the scene, so not much visually new to report (except for the debugger perhaps, that&#8217;s definitely visual). As I mentioned <a href="http://janbogaerts.name/index.php/2009/04/05/update-flow-editor-take-2/">in a previous post</a>, I was expecting some serious coding requirements to get the scanner-parser routines working that transform input streams into output using flows. This definitely turned out to be a slash and dash marathon.&#160; perhaps best to be compared with a hiking trip from point A to B through a jungle with nothing but a machete and a compass: all you know is where you&#8217;re heading and the bug that&#8217;s directly in front of you, nothing else.&#160; Well, I eventually got to point b, only to find a big bear to wrestle with: threading deadlocks.<img alt="Confused" src="http://messenger.msn.com/MMM2006-04-19_17.00/Resource/emoticons/confused_smile.gif" /> Although this might turn out to be nothing but a pesky mosquito, easily rectified.</p>
<p>Anyway, here are some of the most significant changes:</p>
<ul>
<li>Cut/copy paste system: this was still missing.&#160; The backbone is done, the code and flow editors already have a working implementation, the rest should follow. </li>
<li>Deletion system: I updated the deletion system so as to better reflect common editing practices.&#160; This is again done for the code and flow editors, the rest will be done later. </li>
<li>undo system: There were still some issues with undoing network operations.&#160; This should be fixed.&#160; The mind-map editor still requires some redoing in this area (and many more by the way). </li>
<li>Debugger: This is starting to become really useful.&#160; I would not have been able to get the scanner demo working without this. I&#8217;ll explain more about this one in a later post cause it definitely needs some explanation. </li>
<li>Demos updated:
<ul>
<ul>
<li>I have split the echo demo in 2: a word echo demo and letter echo demo. Both give a very basic implementation of 2 different coding techniques to use in neural networks: a singular operation, and a collector. </li>
<li>The English language&#160; def demo is currently able to scan incoming letters and turn them into words and numbers (although there&#8217;s still a problem with the numbers).&#160; This scanner algorithm (which really is a general purpose flow interpreter) will be explained later, cause it&#8217;s a bit funky (to say the least). You&#8217;ll also probably notice that the UI needs some serious speed tuning in order to keep up with the engine. </li>
</ul>
</ul>
</li>
<li>Execution engine: this is where the major hacking had to be done, the axe is still glowing red hot, but it&#8217;s running, oh yea, it&#8217;s running. </li>
<li>Some new instructions: More will probably follow, but I&#8217;m beginning to get a better picture of instruction requirements.&#160; This is starting to stable out. </li>
<li>lots and lots of small fixes. </li>
</ul>
<p>The new release can be downloaded from <a href="http://www.janbogaerts.name/files/setup.exe">here</a>, or through the usual links in the menu. I&#8217;ll probably be spending some more time on posting new entries to explain the debugger and some algorithms. I might also need to start explaining how you actually do you&#8217;re own coding in NND. I&#8217;d say: stay tuned.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=76" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/06/03/nnd-011-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Floating flows</title>
		<link>http://janbogaerts.name/index.php/2009/05/11/floating-flows/</link>
		<comments>http://janbogaerts.name/index.php/2009/05/11/floating-flows/#comments</comments>
		<pubDate>Mon, 11 May 2009 19:08:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[flows]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2009/05/11/floating-flows/</guid>
		<description><![CDATA[Note: Deprecated! Just a quick &#8216;in between&#8217; note. I had to make a small change to the flow editor because a flow can now have an attribute &#8216;FlowIsFloating&#8217; assigned (through a link pointing to &#8216;True&#8217; or &#8216;False&#8217;). It is used by the scanner and parser routines to find flows that can appear anywhere in a <a href='http://janbogaerts.name/index.php/2009/05/11/floating-flows/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>Just a quick &#8216;in between&#8217; note. I had to make a small change to the flow editor because a flow can now have an attribute &#8216;FlowIsFloating&#8217; assigned (through a link pointing to &#8216;True&#8217; or &#8216;False&#8217;). It is used by the scanner and parser routines to find flows that can appear anywhere in a stream.&#160; This provides a generalized manner of defining this property without having to create custom routines for each set of flows. Spaces between words are good examples where this is used. The context menu for the flow name in the overview list on the editor contains a toggable menu item to activate/deactivate this attribute.&#160; A green line in front of the flow indicates it is floating.&#160; Here&#8217;s a screenshot:</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/05/image.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="389" alt="image" src="http://janbogaerts.name/wp-content/uploads/2009/05/image-thumb.png" width="502" border="0" /></a></p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=69" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/05/11/floating-flows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New location</title>
		<link>http://janbogaerts.name/index.php/2009/05/08/new-location/</link>
		<comments>http://janbogaerts.name/index.php/2009/05/08/new-location/#comments</comments>
		<pubDate>Fri, 08 May 2009 19:12:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://janbogaerts.name/index.php/2009/05/08/new-location/</guid>
		<description><![CDATA[Well, I hope&#160; you like the new engine, it should be much better.&#160; The new address should be easier to find.]]></description>
			<content:encoded><![CDATA[<p>Well, I hope&#160; you like the new engine, it should be much better.&#160; The new address should be easier to find.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=59" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/05/08/new-location/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>flow editor, take 2</title>
		<link>http://janbogaerts.name/index.php/2009/04/05/update-flow-editor-take-2/</link>
		<comments>http://janbogaerts.name/index.php/2009/04/05/update-flow-editor-take-2/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 19:29:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[flow recoginition]]></category>
		<category><![CDATA[flows]]></category>

		<guid isPermaLink="false">http://bragisoft.com/blog/PermaLink,guid,53baa899-23c8-4710-90eb-3970277d27f3.aspx</guid>
		<description><![CDATA[Note: Deprecated! After using the flow editor a bit, some of the more annoying errors became pretty obvious, so it&#8217;s time for a new update (well, full install again) to the flow editor. Besides the more obvious bug fixes, I&#8217;ve also introduced some new functionality, notably: shortcuts &#8216;N&#8217; &#38; &#8216;ctrl+N&#8217;: add/insert a new neuron. shortcut <a href='http://janbogaerts.name/index.php/2009/04/05/update-flow-editor-take-2/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>After using the flow editor a bit, some of the more annoying errors became pretty obvious, so it&#8217;s time for a new update (well, <a href="http://www.bragisoft.com/files/setup.exe">full install</a> again) to the flow editor. Besides the more obvious bug fixes, I&#8217;ve also introduced some new functionality, notably:</p>
<ul>
<li>shortcuts &#8216;N&#8217; &amp; &#8216;ctrl+N&#8217;: add/insert a new neuron. </li>
<li>shortcut &#8216;R&#8217;: toggle &#8216;selection Required&#8217; for current option/loop.&#160; This is an important feature that I missed (in gene this was no problem since you could use an empty condition which is not possible here).&#160; The problem is this: sometimes,      <br />an option or loop has to require at least 1 selection between a part (so you can&#8217;t skip the condition or flow), sometimes this is not required.&#160; To allow a distinction between the 2, an extra &#8216;attribute&#8217; is attached to the conditional (the loop or option), much the same as how a selection between loop and option is done. </li>
<li>I changed the layout from wrap-panel to horizontal stack-panel, which is more logical to work with. </li>
</ul>
<p>Note: I have updated the table on the <a href="http://bragisoft.com/blog/2009/03/31/UpdateFlowEditor.aspx">first post</a> about the flow editor so it contains the new shortcuts.</p>
<p>I will probably also have to implement a new statement type, to allow for grouping very soon.&#160; It&#8217;s not really needed for defining the flows, but I think it can be useful later on, during the parsing. For instance, the expression: (verb &quot;ing&quot;) means that you are expecting a verb, with ing behind (standing, listening,&#8230;).&#160; You don&#8217;t need the brackets to define it, but it makes more sense while parsing, if the grouping statement has an attribute attached to it that indicates how it needs to be interpreted.</p>
<p>I have also noticed a &#8216;logical&#8217; error in the way that I implemented keyboard navigation: some keys have been reversed. So when you are on an item inside a part and need to get to that part, use the left arrow instead of the right.&#160; Being able to select    <br />a part is important to continue adding items at the end again when you have added a conditional like in the next image. It&#8217;s annoying, but fuck it, this is one for later on.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/08/image9.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://janbogaerts.name/wp-content/uploads/2010/08/image_thumb9.png" width="259" height="303" /></a> </p>
<p>I&#8217;m also not yet very happy with the deletion functionality.&#160; As it is at the moment, you can remove or delete.&#160; Removing simply takes away the reference to a neuron in a list, deleting, will remove the neuron from the brain.&#160; This is annoying, cause you usually want to remove statics and delete conditionals and parts.&#160; If you want to remove an entire condition, you need to first delete all the parts separately.&#160; A better scheme would be as that of the code editor, which will check for this type of situation.&#160; Again, this is a minor thing, so I will add it to the feature list. At the moment, there are more important things to do though.</p>
<p>A bit more interesting, I have also began work on an English grammar definition.&#160; Here&#8217;s a screenshot of a part:</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/08/image10.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://janbogaerts.name/wp-content/uploads/2010/08/image_thumb10.png" width="664" height="993" /></a> </p>
<p>It&#8217;s off course not a definition that covers the complete language, but I think it should be enough to build a natural language interface <em>(update: Oh boy, was I wrong with this one <img src='http://janbogaerts.name/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )</em>, which should be interesting. I&#8217;m certain I missed a bunch, I still need to define adverb handling (which will be treated in a pre parser, a bit like how comments are handled in more traditional parsers) and the scanner also needs commencing.&#160; And expect some shuffling around and updates as I implement the parser for this definition.&#160; At this stage, extra attributes will probably be added, to handle more semantically oriented parsing. I have no idea how long this is going to take me, but I expect some issues with the debugger, so I might be out for a week or 2 for the next update.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=37" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/04/05/update-flow-editor-take-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlowEditor</title>
		<link>http://janbogaerts.name/index.php/2009/03/31/update-floweditor/</link>
		<comments>http://janbogaerts.name/index.php/2009/03/31/update-floweditor/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 19:11:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>
		<category><![CDATA[flow recoginition]]></category>
		<category><![CDATA[flows]]></category>

		<guid isPermaLink="false">http://bragisoft.com/blog/PermaLink,guid,ec819077-366f-4a55-ab7d-ad514d9a0a05.aspx</guid>
		<description><![CDATA[Note: Deprecated! I&#8217;ve added support for flow editing, which should be the final &#8216;big&#8217; editor required to create useful networks. From now on, only finishing functionality and bugfixes. It took a little longer than I had originally planned, mostly because of a struggle with WPF&#8217;s keyboard navigational system, which is crap. I finally got it <a href='http://janbogaerts.name/index.php/2009/03/31/update-floweditor/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>I&#8217;ve added support for flow editing, which should be the final &#8216;big&#8217; editor required to create useful networks. From now on, only finishing functionality and bugfixes. It took a little longer than I had originally planned, mostly because of a struggle    <br />with WPF&#8217;s keyboard navigational system, which is crap. I finally got it working though (it also supports drag and drop, copy-paste still needs implementing), hope you like it.&#160; You can download the program from <a href="http://www.janbogaerts.name/files/setup.exe">here</a>. Unfortunately it&#8217;s still a full install, so it&#8217;s the whole 40 and some megs download.&#160; I&#8217;ll try to find some time to create an update installer so that the download size can be minimized.</p>
<p>The editor is still a bit rough, but it should be useful. I&#8217;ve tried to make it more text oriented, so you can easily navigate/add/remove items from the keyboard.&#160; In the background though it&#8217;s still listboxes so coding the view and data was easy and fast, just that creepy WPF navigation system, off course more importantly, it makes certain no illegal input can be provided.</p>
<p>Anyway, here&#8217;s a screenshot:</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/08/image8.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://janbogaerts.name/wp-content/uploads/2010/08/image_thumb8.png" width="524" height="334" /></a> </p>
<p>Basically, this Flow editor describes how a noun can be found in a stream: a noun should start either with an article (which is either &#8216;a&#8217; or &#8216;the&#8217;) or a number, followed by 0 or more adjectives finalized with a single noun.&#160; Ok, there are gaps here (it&#8217;s still a sketch to show the editor): what&#8217;s a number, adjective or noun and how to find them.&#160; These things will be explained in the demo, but basically, you use converters (functions that can transform a neuron into another one, like the object &#8216;house&#8217; into the neuron &#8216;noun&#8217;) or some other info that can be used in a search function which can be attached to the flow items.</p>
<p>To create one yourself, go to &#8216;<em>Insert/Flow editor</em>&#8216;, use the toolbar button &#8216;<em>Create new flow editor</em>&#8216;, use the toolbar button on the &#8216;<em>Project</em>&#8216; overview tool frame or use it&#8217;s context menu. Press &#8216;F&#8217; to create a new flow followed by a &#8216;.&#8217; to select a static or &#8216;['/'{' for an option/loop (press '|' to add new parts in a loop or option). Here's a complete list of available short cuts:</p>
<table border="0" cellspacing="0" cellpadding="2" width="633">
<tbody>
<tr>
<td valign="top" width="135">
<p align="right"><strong><u>Shortcut</u></strong></p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p><strong><u>Meaning</u></strong></p>
</td>
</tr>
<tr>
<td valign="top" width="136">
<p align="right">arrow left</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>go to the previous flow item</p>
</td>
</tr>
<tr>
<td valign="top" width="136">
<p align="right">arrow right</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>go to the next flow item.</p>
</td>
</tr>
<tr>
<td valign="top" width="136">
<p align="right">arrow down</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<ul>
<li>When on a conditional block: go to the next conditional block </li>
<li>When on a static item: go to the first item of the next conditional block. </li>
</ul>
</td>
</tr>
<tr>
<td valign="top" width="135">
<p align="right">arrow up</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<ul>
<li>When on a conditional block: go to the previous conditional block </li>
<li>When on a static item: go to the first item of the previous conditional block. </li>
</ul>
</td>
</tr>
<tr>
<td valign="top" width="135">
<p align="right">end</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>go to the end of the current list, when at end of current list, go to end of parent list, until the end of the flow is reached.</p>
</td>
</tr>
<tr>
<td valign="top" width="134">
<p align="right">home</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>go to the start of the current list, when at start of current list, go to start of parent list, until the start of the flow is reached.</p>
</td>
</tr>
<tr>
<td valign="top" width="134">
<p align="right">Ctrl + arrow/end/home/mouse click on item</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>select multiple neurons.</p>
</td>
</tr>
<tr>
<td valign="top" width="134">
<p align="right">Alt+arrow down</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>go to the next flow</p>
</td>
</tr>
<tr>
<td valign="top" width="134">
<p align="right">Alt+arrow up</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>go to the previous flow</p>
</td>
</tr>
<tr>
<td valign="top" width="134">
<p align="right">.</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>open a popup for selecting a 'named' neuron to add at the end of the current list as static.</p>
</td>
</tr>
<tr>
<td valign="top" width="134">
<p align="right">ctrl+.</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>open a popup for selecting a 'named' neuron to insert at the current pos as static.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">{</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>add a loop at the end of the current list.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">ctrl+<strong>{</strong></p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>insert a loop at the current position.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">[</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>add an option at the end of the current list.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">ctrl+[</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>insert an option at the current position.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">}</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>change the currently surrounding option to a loop.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">]</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>change the currently surrounding loop to an option.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">R</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>toggle &#8216;selection Required&#8217; for current option/loop</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">|</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>add a new part in the first parent loop or option of the currently selected item.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">ctrl + |</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>insert a new part in the first parent loop or option of the currently selected item.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">del</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>remove the currently selected item from the list, but don&#8217;t delete the actual neuron.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">ctrl+del</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>delete the actual neuron.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">O</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>Add a new object (neuron cluster with meaning &#8216;Object&#8217;) at the end of the current list.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">ctrl+O</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>insert a new object (neuron cluster with meaning &#8216;Object&#8217;) at the current position.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">N</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>Add a new neuron at the end of the current list.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">ctrl+N</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>Insert a new neuron at the current position.</p>
</td>
</tr>
<tr>
<td valign="top" width="133">
<p align="right">Double click on static</p>
</td>
<td valign="top" width="10">&#160;</td>
<td valign="top" width="481">
<p>Go to the flow.&#160; This is only available when the static is a reference to another flow.&#160; This is indicated by a line underneath the static.</p>
</td>
</tr>
</tbody>
</table>
<p>A final note perhaps on how to use these flows in a neural network.&#160; The thing is, this is really up to you, the application doesn&#8217;t make any hard-coded use of them. Though, there will probably be a couple of default algorithms that can be reused.&#160; <br />The basic idea is relatively simple: when the first neuron comes in, search all the clusters to which it belongs with the meaning &#8216;Flow&#8217;, &#8216;FlowItemConditional&#8217; or &#8216;FlowItemConditionalPart&#8217; and store the result list in a cluster.&#160; When the second comes in, try to find all the clusters of the previous result set that allow the new neuron to follow the previous one, all clusters that don&#8217;t allow this are removed from the result set.&#160; Various clean ups / lookups can be performed during 2 incoming points. When a &#8216;flow&#8217; cluster is found with code attached to it, execute this. This off course, can be made as simple or as complex as you want. More on this in a later post. Fuel is depleted for today.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=38" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/03/31/update-floweditor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update: Splits working</title>
		<link>http://janbogaerts.name/index.php/2009/03/20/update-splits-working/</link>
		<comments>http://janbogaerts.name/index.php/2009/03/20/update-splits-working/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 19:53:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://bragisoft.com/blog/PermaLink,guid,f02b8633-7e6f-4d20-9960-8e5ce000ab9e.aspx</guid>
		<description><![CDATA[There&#8217;s a new update available for N&#178;D. The major change is with regards to how the split functionality works. In the original design, the processor&#8217;s stack was used to return any results at the end of a split. This was causing problems, especially with nested splits where stack contents get duplicated.&#160; In the original design, <a href='http://janbogaerts.name/index.php/2009/03/20/update-splits-working/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a new update available for <a href="http://www.janbogaerts.name/files/setup.exe">N&#178;D</a>. The major change is with regards to how the split functionality works. In the original design, the processor&#8217;s stack was used to return any results at the end of a split. This was causing problems, especially with nested splits where stack contents get duplicated.&#160; In the original design, stack duplications didn&#8217;t generate new id&#8217;s for the neurons, which was changed, for good reasons.&#160; Unfortunately, this created a problem for the split: split result were unwanted getting duplicated.&#160; You now how it goes, pull the sheet a bit on this side, only to uncover it on the other    <br />one.</p>
<p>The solution was very simple and pretty elegant: use a different list to store the result of a split. So now a processor has 2 internal lists: the execution stack used to build the code that should be executed next and a list with the split results (<em>unique </em>neurons) and their weights. A couple of new instructions had to be created to control this list.&#160; No biggie: an Add, Remove, Get and Clear.</p>
<p>Anyway, I&#8217;m updating all the documentation now.&#160; If I mist something, don&#8217;t forget: 2 separate lists. The next post will probably be a Demos explained on the split.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=39" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/03/20/update-splits-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About sandboxes</title>
		<link>http://janbogaerts.name/index.php/2009/03/17/about-sandboxes/</link>
		<comments>http://janbogaerts.name/index.php/2009/03/17/about-sandboxes/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 16:26:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Getting started]]></category>
		<category><![CDATA[N²D]]></category>

		<guid isPermaLink="false">http://bragisoft.com/blog/PermaLink,guid,2e12442f-ff13-4a85-ac6f-40a71a5758e8.aspx</guid>
		<description><![CDATA[As a child, I remember playing quite a lot in the sand by the coast in the summers. I don&#8217;t think I cared very much about sandboxes though, except maybe for growing stuff in. Anyway, that&#8217;s totally besides the point with regards to today&#8217;s topic, which is about N2D&#8217;s sandbox, used to test out a <a href='http://janbogaerts.name/index.php/2009/03/17/about-sandboxes/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>As a child, I remember playing quite a lot in the sand by the coast in the summers. I don&#8217;t think I cared very much about sandboxes though, except maybe for growing stuff in. Anyway, that&#8217;s totally besides the point with regards to today&#8217;s topic, which is about N2D&#8217;s sandbox, used to test out a project in development.</p>
<p>The problem, you see, is the fact that N2D is a <em>Designer</em>, running on top of a neural network, accessing it&#8217;s services.&#160; So when you are designing the network, it is also running.&#160; This means that all the stuff you type into the text-channels, will also be stored in the project. Something you don&#8217;t want while performing tests.</p>
<p>To overcome this issue, N2D can use a special directory as a sandbox in which it can copy projects that need testing. The sandbox project will be started in it&#8217;s own designer so you can play with it, with all of it&#8217;s features (including neuron streaming) without messing up the actual data.</p>
<p>To run the current project in a sandbox, use the &#8216;<em>Sandbox</em>&#8216; toolbar button or menu item <em>Debug/Sandbox</em>. This will save the project, copy it over to a temp directory (selectable in the &#8216;Tools/O<em>ptions</em>&#8216; window) and start a new session.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/08/image6.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://janbogaerts.name/wp-content/uploads/2010/08/image_thumb6.png" width="671" height="254" /></a> </p>
<p>When N2D is started in Sandbox mode, it will show this in the lower right corner, like so:</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/08/image7.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://janbogaerts.name/wp-content/uploads/2010/08/image_thumb7.png" width="181" height="74" /></a></p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=40" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/03/17/about-sandboxes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Demos explained: Echo words</title>
		<link>http://janbogaerts.name/index.php/2009/03/12/demos-explained-echo/</link>
		<comments>http://janbogaerts.name/index.php/2009/03/12/demos-explained-echo/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 20:04:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[demos]]></category>
		<category><![CDATA[Getting started]]></category>
		<category><![CDATA[N²D]]></category>

		<guid isPermaLink="false">http://bragisoft.com/blog/PermaLink,guid,75617674-4b23-47b3-99c4-0d7d4431c2b7.aspx</guid>
		<description><![CDATA[Note: Deprecated! Most development tutorials start out with an &#8216;Hello world&#8216; type of application.  This one doesn&#8217;t.  The issue I had was the fact that a neural network is inherently a responsive system, that is, everything it does is a reaction to input.  So, I figured, to illustrate this better, I could show a simple <a href='http://janbogaerts.name/index.php/2009/03/12/demos-explained-echo/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated</strong></em>!</p></blockquote>
<p>Most development tutorials start out with an &#8216;<em>Hello world</em>&#8216; type of application.  This one doesn&#8217;t.  The issue I had was the fact that a neural network is inherently a <em>responsive system</em>, that is, everything it does is a reaction to input.  So, I figured, to illustrate this better, I could show a simple echo application.  It&#8217;s just as simple to make as a &#8216;Hello world&#8217; thingy, but actually does something:<br />
echo back everything sent to it.</p>
<p>To start the demo, go to <em>{Windows start}/N²D/Demos/Echo words</em> if N²D isn&#8217;t already running, otherwise, do <em>File/Open </em>and browse to the folder <em>{My documents}/NND/Demos/Echo</em>. Note that a project is opened by selecting a folder, not through a file (this might still change in the future, if required).  If the project has already been opened, you can reopen it using <em>File/Recent projects</em>. Once opened, you should see something like this:</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2011/01/echowordsDemo.jpg"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="echowordsDemo" src="http://janbogaerts.name/wp-content/uploads/2011/01/echowordsDemo_thumb.jpg" alt="echowordsDemo" width="600" height="476" border="0" /></a></p>
<p>Note that the echo channel (a text channel) is shown by default. This is because I saved the project with the channel opened: visibility of a channel is stored, not for other items at the moment.  You can close this window by right clicking on the tab and selecting the <em>close</em> command. You can also control which channels are visible through the menu: <em>View/Communication Channels</em>. The designer will<br />
create a communication channel for each sensory interface in the network.</p>
<p>The Text channel contains the following items:</p>
<ul>
<li>In the bottom: a Text box to enter text you want to send to the network</li>
<li>in the middle is a list box containing the current conversation: all the text you sent interleaved with the answers of the network.</li>
<li>the top row contains 2 listboxes which contain visualizations for the neurons that were processed as input by the sin (left one) and received for output (right part).  Note: selecting a line in any of these 2 lists will also select the corresponding line in the <em>conversation section </em>and visa versa.</li>
<li>with a toolbar on top of it containing
<ul>
<li>a button to send the text to the sin.</li>
<li>a combo box to select the way the sin splits up the input strings into neurons</li>
<li>Some editing commands to cut, save or clean the conversation log</li>
<li><!--EndFragment-->a toggle button for turning the speakers on/off</li>
</ul>
</li>
</ul>
<p>If you make certain that &#8216;<em>Speaker</em>&#8216; is pressed and your loud speakers are turned on, you should hear &#8216;Type here&#8217; once you press the &#8216;<em>send</em>&#8216; button (and haven&#8217;t changed the input text). Some items should also appear on the screen, something like:</p>
<p>&nbsp;</p>
<p>What just happened? Well, a whole lot really:</p>
<ul>
<li>The text channel displays the string &#8216;Type here&#8217; in the central dialog overview.  This is done by the designer.</li>
<li>next, it sends the string to the Echo channel&#8217;s backing sensory interface which splits it up into 2 words: &#8216;type&#8217; and &#8216;here&#8217;.  This is because it is in &#8216;Use Words&#8217; mode.  There is another echo demo, called &#8216;echo letters&#8217; which is programmed to &#8216;Use letters&#8217; by the way.  If you want, you can open this and try it to see the difference. In the &#8216;echo words&#8217; demo, the 2 words are converted into text neurons (by searching a dictionary of already created text neurons or by creating a new one, which is stored in the dictionary. These 2 text neurons are linked to a newly created neuron which represents the input event.  This conversion is done by the sin itself.</li>
<li>The sin also raises an event to let the channel know about the neuron it just created as input value which is displayed in the top left list.  A processor is created and the neuron representing the input event is pushed on it&#8217;s stack, which starts of the network. Up until now, we haven&#8217;t really used the neural network yet, everything was done using traditional code. This changes once the processor is started.</li>
<li>The processor &#8216;<em>executes</em>&#8216; the code attached to the links between the &#8216;input event&#8217; neuron and the text neurons (how this code gets there and how it looks like will be dealt with later).  This is the neural network doing it&#8217;s thing which will eventually execute several &#8216;<em>Output</em>&#8216; instructions, sending neurons back to the sin.</li>
<li>When the sensory interface receives these neurons, it converts them back into a string and raises an event. And so we get back into the world of regular code.</li>
<li>The communication channel, which receives this event, displays the text in the conversation dialog and the neuron(s) that represent the string in the top right list box.</li>
</ul>
<p>Ok, but what exactly happened in the neural network itself? Truth is, not much as you will see. It&#8217;s time to show some code. If you select the &#8216;<em>Project</em>&#8216; tool-frame, you will notice 3 items: a mind map (more on that later) and 2 code items, each one is simply a reference to a neuron in the network. To open them, double click on the item.  Let&#8217;s start with &#8216;<em>Code: ContainsWord(in)</em>&#8216;.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2009/06/image.png"><img style="border-width: 0px;" src="http://janbogaerts.name/wp-content/uploads/2009/06/image-thumb.png" alt="image" width="604" height="358" border="0" /></a></p>
<p>Mmm, interesting. All GUI-like is probably the first thing you&#8217;ll notice. Indeed, there is currently no textual method for entering code, as more traditional development environments tend to use.  I choose this way for 2 reasons: first, it&#8217;s faster to develop (at least, in WPF that is) and it lowers the entry barrier since you can visually put items together instead of having to conceptually create a peace of text in your mind, requiring a grater level of knowledge. In the long run though, this technique tends to be slower than writing code and it also somewhat limits the amount of code displayed, but be patient, there is a solution for this.</p>
<p>Lets first go over the 2 lower tabs.  These represent the 2 different code lists that can be assigned to the neuron: the &#8216;<em>Rules</em>&#8216; and &#8216;<em>Actions</em>&#8216; list. Note that these lists are only created if there is code, for as long as you don&#8217;t drop any objects on the design surface, there isn&#8217;t actually a code list assigned to the neuron. The bottom tab-strip also has a context-menu which allows you to toggle wether this neuron is shown in the project tree (under the currently active folder, or the root if there is no folder). You can also create new code clusters from the sub toolbar, but remember these are code clusters (which can also point to other code clusters).</p>
<p>Both lists are called at different times, and serve a different purpose. Code in the <em>Rules</em> section, is called when this neuron is used as the meaning for a link that is currently being processed by the processor. The <em>Actions</em> code list is called by the processor when <strong>this</strong> neuron was processed by the processor and all other links have already been handled. Usually, you don&#8217;t program on the last tab (actions), it is provided to &#8216;view&#8217; the code that was attached to it by the sin that generated it (see further). Note that there are other tab possibilities, but these have no importance for now and will be explained later on.</p>
<p>So what does this actually mean for our example: well, the &#8216;<em>ContainsWord(in)</em>&#8216; neuron is used by the sin as the meaning for the link between the generated neuron and each word in the input string (this is pre defined), so for each word in the input text, it will call this little peace of code.</p>
<p>As you can see there are only 2 statements in this code list. The second statement calls an &#8216;Output&#8217; instruction which will send the content of the &#8216;<em>CurrentTo</em>&#8216; variable to the content of the &#8216;<em>CurrentSin</em>&#8216; variable, in other words, this is the actual echo. Both variables are system defined and are filled in by the processor, they can not be modified, unlike normal variables. You&#8217;ll notice that they appear to be multiple variables stacked on top of each other.  This is to indicate that the same neuron is used in multiple places.  It&#8217;s a visual cue to indicate if a code item is used somewhere else or not (ahh yes, unlike regular code, these are neurons, all linked to each other, there is nothing preventing you from literally using the same statement in different places). That&#8217;s it for doing the echo really.  The rest of the code is simply to make certain that the sin will put all the words in 1 line with spaces in between them. This is spread out over 2 locations: the first statement and the &#8216;<em>Input actions</em>&#8216; code list of the sin.</p>
<p>The first one, is a &#8216;<em>Block</em>&#8216; statement, which can best be compared to a &#8216;Function call&#8217; except that there are no parameters or return value allowed. To view it&#8217;s content, use the drop down arrow for an inline visualization, or &#8216;<em>View code</em>&#8216;  in the context menu to display the code in a new window. You should see something like this:</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2011/01/echoWordsDemo2.jpg"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="echoWordsDemo2" src="http://janbogaerts.name/wp-content/uploads/2011/01/echoWordsDemo2_thumb.jpg" alt="echoWordsDemo2" width="745" height="407" border="0" /></a></p>
<p>Note that the code is located in the &#8216;<em>Statements</em>&#8216; tab this time if you opened a new view. That&#8217;s because a code block has an extra known code cluster attached to it: the code for the block.  It can also have a rules and actions list, but these are not used in this example (and probably will rarely be used this way on code itself).</p>
<p>Ok, and what exactly does this code do? To explain that, perhaps a note first on how a text sin converts output data. Whenever it receives a neuron, it is converted to a string which is than sent as an event to the outside world.  Of course, in our example, we don&#8217;t show each word on a separate row, instead, we show the entire input statement on a single line with spaces between the words.  This can only be done if the sin knows where a sentence starts and where it ends, otherwise it simply sees a stream of output data. So to accomplish this, there are 2 special neurons that it recognizes: &#8216;<em>BeginTextBlock</em>&#8216; and &#8216;<em>EndTextBlock</em>&#8216;. When these are sent to a text-sin, they are not converted, but instead, BeginTextBlock will make it accumulate all the strings until the EndTextBlock neuron is received. So that&#8217;s what this little bit of code does: it checks if this is the first word being processed, if so, the &#8216;BeginTextBlock&#8217; neuron is sent and we store a switch so we know of this event.  If it wasn&#8217;t the first one, we sent a space to the sin, so we don&#8217;t concatenate the words. The &#8216;EndTextBlock&#8217; is handled in a different way, we&#8217;ll get back to that later on.</p>
<p>First a bit about the different statements that were used in this little code block.  The top most one is a conditional statement, set to &#8216;if&#8217;.  N²D takes conditional statements even further than <a href="http://users.telenet.be/GeneCompiler/Language_specification.html#Options">Gene</a> and completely unites all different conditionals into 1 and the same statement type, with an option to switch between them.  So a Do-while, While-Until, For-Each, For, if, case, and case-loop (not possible in other languages) are all combined into 1 statement, with a single neuron that switches between the 2. This approach is taken because of it&#8217;s ease in coding: it becomes a lot easier to change an if statement to a loop with multiple if&#8217;s: simply make it a loop (yes, you can have multiple conditions in a while loop). To design this bit of code, you can simply drag a &#8216;Conditional statement&#8217; to the designer and drop &#8216;Conditional parts&#8217; in the &#8216;Children&#8217; area to the right. A conditional part forms a single trunk of the evaluation tree. It contains a list of code items (which can also be dropped on it&#8217;s respective &#8216;<em>Children</em>&#8216; drop area) and possibly a condition that determines if the part&#8217;s code is executed or not. This condition should evaluate to the &#8216;True&#8217; or &#8216;False&#8217; neurons.  Usually this is done by a Boolean expression (as has been done in this example), but this is not required, it could just as well have been a result statement that returns &#8216;True&#8217; or &#8216;False&#8217;.<a href="http://janbogaerts.name/wp-content/uploads/2011/01/image.png"><img style="background-image: none; margin: 21px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; padding-top: 0px; border-width: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2011/01/image_thumb.png" alt="image" width="105" height="32" align="left" border="0" /></a></p>
<p>A word perhaps on the little arrows found on the variables to the right of the name.  These allow you to assign a default value to the variables.  In our example, we can&#8217;t use this cause all of them are system variables who&#8217;s values are controlled by the processor.  Regular variables however don&#8217;t have a value the first time they are accessed in the context of a processor.  You can use this little drop target to assign a default value.  This can be a constant, or another statement that can be resolved to one or more neurons.</p>
<p>Another important fact about these variables is that they can point to 1 or more neurons.  They actually function as buckets.  This is very useful in that there is only 1 known type: a list of neurons.  This list can contain 1 item or more.  Often times, you will use a split to resolve multiple values to 1.</p>
<p>The last part of this demo can be found in the &#8216;<em>Code: Echo channel</em>&#8216; Project item, which is actually a reference to the text sin.  If you open the &#8216;Input actions&#8217; tab, you&#8217;ll see the final 2 statements for this demo. This tab represents a code cluster that the text-sin attaches to each input neuron it generates so the code can be called after all other links were executed.  In our example, we do 2 things: let the sin know the sentence is closed so the string can be displayed and delete the input neuron, so we don&#8217;t let the network grow indefinitely. By default, all data is always stored, if you don&#8217;t want this, like in this example, you will need to manually delete the neuron.  All of it&#8217;s links and stuff will be cleaned<br />
up automatically.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2011/01/echoWordsDemo3.jpg"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="echoWordsDemo3" src="http://janbogaerts.name/wp-content/uploads/2011/01/echoWordsDemo3_thumb.jpg" alt="echoWordsDemo3" width="504" height="360" border="0" /></a></p>
<p>The notion that the code is spread out over different locations and called at different times is an important point: a neuron network can not be programmed in a monolithic fashion as a single code block. Code is always divided into small chunks, which run at different times, in an undetermined but predictable order.  This is where a lot of it&#8217;s power comes from.  Once you grasp this, you are a long way into designing something truly beautiful.</p>
<p>Gosh, dear all mighty, this was a climb indeed. I&#8217;m glad you were able to get till here, all the way to the end. Even though this is a small demo, it packs a punch when it comes to new ideas. There are plenty more areas to cover, but I am certain that once you become more familiar with the basic concepts explained in this demo, the rest of the ride will be downhill. More demo explanations to come soon&#8230;</p>
<blockquote><p>Editorial Note: This was one of the first neural algorithms I ever wrote. In fact, it was even used to get the initial engine running. As the core and my skills progressed, it became clear that this little example can actually be written in many different ways, some of which better and faster then this example. As of version 0.6 of the designer, I’ve included an <em>improved</em> version of this algorithm, which uses the minimum nr of statements (I can think of) to achieve a simple echo: 4</p>
<ul>
<li>Output(CurrentSin, BeginTextBlock)</li>
<li>Output(CurrentSin, CurrentTo, ‘ ‘)</li>
<li>Output(CurrentSin, EndTextBlock)</li>
<li>Delete(CurrentFrom)</li>
</ul>
</blockquote>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=41" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/03/12/demos-explained-echo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Neural network Designer: getting your feet wet</title>
		<link>http://janbogaerts.name/index.php/2009/03/09/nnd-getting-your-feet-wet/</link>
		<comments>http://janbogaerts.name/index.php/2009/03/09/nnd-getting-your-feet-wet/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 19:20:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Getting started]]></category>
		<category><![CDATA[N²D]]></category>

		<guid isPermaLink="false">http://bragisoft.com/blog/PermaLink,guid,46d967bb-edac-400b-aefd-c4a488cf2b9a.aspx</guid>
		<description><![CDATA[Note: Deprecated! Despite it&#8217;s youth, N²D is already quite a large and rather complex application. Things like this tend to have a steep learning curve.  Of course, climbing a mountain is a lot easier if you have a map and proper control over your equipment.  I am working on the map, tools are up to <a href='http://janbogaerts.name/index.php/2009/03/09/nnd-getting-your-feet-wet/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<blockquote><p><em><strong>Note: Deprecated!</strong></em></p></blockquote>
<p>Despite it&#8217;s youth, N²D is already quite a large and rather complex application. Things like this tend to have a steep learning curve.  Of course, climbing a mountain is a lot easier if you have a map and proper control over your equipment.  I am working on the map, tools are up to you though.  There are many ways you can play with the application without actually having to design a proper neural network. Here&#8217;s a short guide.</p>
<h4>Viewing and importing thesaurus data</h4>
<p>N²D has access to the English version of the <a href="http://www.ebswift.com/OpenSource/WordNetSQLServer/">WordNet</a> database through a sensory interface (input/output port). Apparently there are WordNet databases for <a href="http://www.illc.uva.nl/EuroWordNet/">other languages</a>, but these are not yet available. To open the view for the WordNet data activate the menu item: <em>View/Communication Channels/WordNet </em>(<span style="text-decoration: line-through;">note: opening for the first time can take a little time as the database needs to be opened, should get fixed somehow in the future:</span>done).  This should show something similar to (although with less text):</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/08/image.png"><img style="margin: 0px; display: inline; border: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/08/image_thumb.png" alt="image" width="574" height="490" border="0" /></a></p>
<p>You can search for words in the database.  All known meanings will be displayed. You can also select to show a specific relationship type with the drop down list.  If &#8216;As Part&#8217; is pressed, all entries that contain the specified text will be shown.  You can either import a single meaning separately or the whole lot, including all the relationships (advised) and see the network grow.  The system should be able to do multiple imports at the same time (you&#8217;ll notice that a single import can take a long time, depending on how many relationships there are for the word). While the network is <em>learning, </em>the green box in the right bottom corner is filled.</p>
<p>You can browse through all the imported items from the thesaurus view.  You can select the type of relationship you want to see.  All root tree items represent root neurons for the specified relationship. With the text box, you can search for words in the tree. All neurons can be dragged to other locations (like mind maps for instance, see further).  It is also possible to add items to the tree by dropping them on the level they should reside.</p>
<blockquote><p>Update: Aici doesn’t use words that are imported from this data source. I have found the thesaurus tree a bit awkward to use, and more importantly, lots of relations, useful to Aici are missing, while hordes of others remain unused.</p></blockquote>
<h4>Creating Mind maps</h4>
<p>Mind maps allow you to <em>draw</em> neurons in a free form manner, similar like vector graphics. There are multiple ways to create new mind maps, you can:</p>
<ul>
<li>use the menu: Insert/Mind map</li>
<li>use the toolbar button (<span style="text-decoration: line-through;">4th from left: </span>only valid in image, App has been updated)</li>
<li>or when on the &#8216;Project&#8217; tool window, use the local toolbar button.  From here, you can also create sub directories, change the name of the project items (F2),&#8230;<br />
Note: Mind maps (and all other project items) are added to the currently selected folder or the folder that contains the currently selected item.</li>
</ul>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/08/image1.png"><img style="margin: 0px; display: inline; border: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/08/image_thumb1.png" alt="image" width="578" height="375" border="0" /></a></p>
<p>Most of the mind map commands are currently only accessible through it&#8217;s context menu. For creating new items, you can also use the toolbox. You can add different types of neurons or change them to another one.  Watch out with changing the type though, cause this might loose data sometimes (for instance, when you change a cluster into a regular neuron).</p>
<p>If you select a neuron, you can use different ways for showing &#8216;<em>related</em>&#8216; items, like children, incoming or outgoing links and clusters to which the selected item belongs. You can also manage the clusters to which it belongs.  If you have multiple items selected, you can quickly create a cluster for them through the &#8216;<em>Make cluster</em>&#8216; command.</p>
<p>The easiest way to create a link between 2 items is by selecting them both (the first will be &#8216;<em>From</em>&#8216;, the second &#8216;<em>To</em>&#8216;) and activating the &#8216;<em>Link</em>&#8216; command. This will show a dialog with From and To already filled in, so you only have to select the meaning of the link.</p>
<p>As a side note, &#8216;<em>Sync with explorer</em>&#8216;: a very useful command, accessible from the main toolbar, allows you to quickly find the selected item in the explorer.  This can be used from most places in the designer (all items that have a neuron as backing).</p>
<h4>Drawing</h4>
<blockquote><p>Note: Drawing features have been moved to the next version.</p></blockquote>
<p>Yes, N²D is also a drawing application, although some further evolution is clearly needed in this area.  Drawing capability is provided so you can work with the visual sensory interfaces. To create a new image channel, activate the menu command <em>Insert/New Image channel</em>.</p>
<p>Perhaps a word about the difference between a sensory interface and a communication channel: the underlying network has sins, which are also just neurons and have no &#8216;<em>functionality</em>&#8216;. N²D, the designer, creates a &#8216;<em>communication channel</em>&#8216; for sins so you can work with them. If you use the network in a different application, the communication channel might look completely different, but the sin is still the same.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/08/image2.png"><img style="margin: 0px; display: inline; border: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/08/image_thumb2.png" alt="image" width="578" height="443" border="0" /></a></p>
<p>An image channel currently has 2 sections: the left part to manage/import multiple images (which is not yet fully functional) and a right part that will eventually contain 2 sections: an input and output section.  The output is currently not yet visible, but is supposed to function as the output part of the sin, so you can see images/videos that the network generates.</p>
<p>The input section works as an ink canvas, so you can use a pen table, and apply pen pressure (this can be toggled). The shape, size and color of the pen point can be selected. It is also possible to switch to a gum or selector.</p>
<h4>Commenting</h4>
<p>All neurons and some other types (like mind maps and frame editors) can have a description.  This is a FlowDocument (rich text format), so you format the text. Spell check is also provided. The description of the currently focused item is shown, you will have to make certain that the &#8216;Description&#8217; Tool window is visible.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/08/image3.png"><img style="margin: 0px; display: inline; border: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/08/image_thumb3.png" alt="image" width="578" height="452" border="0" /></a></p>
<p>Standard text editing functionality is present:</p>
<ul>
<li>Select the font type</li>
<li>and font size</li>
<li>Bold/Italic/underline and Outline</li>
<li>Bullets and numbering</li>
<li>Spell check</li>
</ul>
<p>As a side note: The selected item is a NeuronCluster, so it can have child neurons.  The explorer in this screenshot, is set to display it&#8217;s side panel which contains all the children of the selected cluster. Just like from the explorer, you are able to drag items from the left panel.  It&#8217;s also possible to drop neurons on the panel, which will add them as children to the selected cluster.</p>
<h4>Creating frames</h4>
<p>Frames are a form of compound objects (a group of neurons that form a single unit) which can be used to translate input from one form to another and to connect code to these compound objects. They are created in a similar way like mind maps, and can also be managed from within the project tool window.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/08/image4.png"><img style="margin: 0px; display: inline; border: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/08/image_thumb4.png" alt="image" width="579" height="481" border="0" /></a></p>
<p>To create a new frame, you basically push the toolbar buttons in sequence:</p>
<ul>
<li>The first one will create a new frame (a frame editor can contain multiple frames,usually they are related to each other somehow).</li>
<li>Next, you create a frame element for the selected frame (make certain there is one selected, there are still some bugs in this area). You can also drop items to be used as frame elements.</li>
<li><span style="text-decoration: line-through;">The third button creates a new frame evoker (all neurons in this list are put in a cluster &#8216;Evokers&#8217;, so you can easily do searches on them, more on that later). Like frame elements, you can also drop already existing items in there. </span> Evoker specifications are now done on the same page as the frame elements.</li>
<li>On the last tab, you can edit all the sequences for the frame.  Use the 4th toolbar button to add a new sequence, make certain it is selected and use the buttons to add/remove or move up and down the frame elements from the first tab to build a sequence.</li>
<li><span style="text-decoration: line-through;">The last toolbar button is used to display the &#8216;<em>Import from FrameNet</em>&#8216; dialog, with this frame editor already selected.</span> FrameNet has proven to be somewhat incompatible. You can still view this data, but no longer perform an import.</li>
</ul>
<blockquote><p>Note: although frames have expanded considerably since this was written, most is still valid, except where indicated (5th august 2010)</p></blockquote>
<h4>Importing frames</h4>
<blockquote><p>As already mentioned, FrameNet’s data structure hasn’t been found very useful in the creation of Aici. Frame format definitions have drifted since, so import is no longer available.</p></blockquote>
<p>If you don&#8217;t feel like creating your own frames, you can always see if they have already been included in <a href="http://framenet.icsi.berkeley.edu/">FrameNet</a>, which you can import, either from the menu <em>Tools/Import from FrameNet </em>or from the<br />
toolbar of a frame editor.</p>
<p><a href="http://janbogaerts.name/wp-content/uploads/2010/08/image5.png"><img style="margin: 0px; display: inline; border: 0px;" title="image" src="http://janbogaerts.name/wp-content/uploads/2010/08/image_thumb5.png" alt="image" width="643" height="522" border="0" /></a></p>
<p>You can search FrameNet using the textbox in the upper right corner. The first time you select a row in the upper list might take a little time, this is because he is loading the WordNet database (which takes a little time). This is required to provide a mapping between FrameNet and WordNet data (not provided by default). Some mappings have already been created but most still need to be defined.  Each time you display this dialog and change some mappings, these will be saved.</p>
<p>There are many more things to discover in the designer, but I&#8217;m all out of words for today, so I&#8217;ll continue this on another occasion.  In the mean time, lot&#8217;s of fun playing with your new toy.</p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=42" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/03/09/nnd-getting-your-feet-wet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>System requirements</title>
		<link>http://janbogaerts.name/index.php/2009/03/07/system-requirements/</link>
		<comments>http://janbogaerts.name/index.php/2009/03/07/system-requirements/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 13:30:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[N²D]]></category>

		<guid isPermaLink="false">http://bragisoft.com/blog/PermaLink,guid,0ba48c15-0e3b-4bee-aae2-ae6511348eac.aspx</guid>
		<description><![CDATA[A note about the system requirements for N&#178;D. The installer is about 45 meg to download, but the app itself takes up over 440 MB and projects may also explode fairly fast so be prepared for a large peace of real estate usage on the hard disk.&#160; This is largely due to the WordNet and <a href='http://janbogaerts.name/index.php/2009/03/07/system-requirements/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>A note about the system requirements for <a href="http://www.janbogaerts.name/files/setup.exe">N&#178;D</a>. The installer is about 45 meg to download, but the app itself takes up over 440 MB and projects may also explode fairly fast so be prepared for a large peace of real estate usage on the hard disk.&#160; This is largely due to the <a href="http://www.ebswift.com/OpenSource/WordNetSQLServer/">WordNet</a> and <a href="http://framenet.icsi.berkeley.edu/">FrameNet</a> databases.</p>
<p>The whole thing is written in C#, the designer in WPF.&#160; So for the time being it is strictly windows stuff (XP or vista). The core neural network and sensory interface libraries should be portable to <a href="http://www.mono-project.com/Main_Page">Mono</a> but    <br />the designer will be a tat difficult. I don&#8217;t know yet how to tackle this one.</p>
<p>With regards to processors I can be simple: the more the better.&#160; This is a massively multi threaded application, so the more cores the faster it should run.&#160; I only have a dual core here, so I haven&#8217;t had the change yet to see it running on lots of threads simultaneously, but I would love to find out.&#160; As I am writing this, I am sure there will still be a lot of bugs to filter out.</p>
<p>So to recap:</p>
<p>OS: Win XPSP2/Vista   <br />Platform: .net/WPF    <br />Hard Disk: + 450 MB    <br />CPU Cores: as many as you can find <img alt="Tongue out" src="http://messenger.msn.com/MMM2006-04-19_17.00/Resource/emoticons/tongue_smile.gif" /></p>
 <img src="http://janbogaerts.name/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=43" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://janbogaerts.name/index.php/2009/03/07/system-requirements/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: janbogaerts.name @ 2012-05-20 04:28:44 -->
