Giving your bot &quot;common sense&quot;|Casey|casey@cuvou.net|1206036024|Kirsle|xx|0|69.16.222.179|Some questions that usually stump Alice-based chatterbots are &quot;what color is my black shirt?&quot; and &quot;what color was Napoleon's white horse?&quot;<br /><br />Questions like these are a breeze with RiveScript, because one of RiveScript's biggest advantages over AIML are the use of arrays in place of the standard wildcard. Here are two example sets of code that give RiveScript the ability to answer these &quot;common sense&quot; questions:<br /><br />[code]! array colors = white black orange red blue green yellow cyan fuchsia gray grey brown turquoise pink purple gold silver navy<br /><br />+ what color (is&#124;was&#124;are) my (@colors) *<br />- &#123;sentence&#125;&lt;star2&gt;&#123;/sentence&#125;.<br />- Your &lt;star3&gt; &lt;star1&gt; &lt;star2&gt;.<br />- &#123;sentence&#125;&lt;star2&gt;&#123;/sentence&#125;, silly.<br /><br />+ what color (is&#124;was&#124;are) * (@colors) *<br />- &#123;formal&#125;&lt;star2&gt;&#123;/formal&#125; &lt;star4&gt; &lt;star1&gt; &lt;star3&gt;.[/code]<br /><br />Demonstration:<br /><br />[code]You&gt; What color is my black shirt?<br />Bot&gt; Black, silly.<br /><br />You&gt; What color are my black shoes?<br />Bot&gt; Black.<br /><br />You&gt; What color are my blue jeans?<br />Bot&gt; Your jeans are blue.<br /><br />You&gt; What color was George Washington's white horse?<br />Bot&gt; George Washingtons horse was white.[/code]<br /><br />This kind of reply set could be adapted to answer a lot of logic puzzles.<br /><br />If anybody has any RS code of their own that solves puzzles like this, feel free to reply and share. :) ||||
Re: Giving your bot &quot;common sense&quot;|a2b|roy@wasystems.net|1211703659|a2b|xx|0|76.102.148.130|very nice, i like it &nbsp;:)||||
Re: Giving your bot &quot;common sense&quot;|MikeA|mikejd30@gmail.com|1369739766|mikea|xx|0|88.6.221.157|Hi<br /><br />Im looking into RiveScript. Clearly nice work and nice to see standards more advanced than AIML (or at least aiming to be).<br /><br />One question about arrays. <br /><br />I fully get the usefulness of an array of colors, and also the use of alternatives / options, especially with (is&#124;was&#124;are).<br /><br />However, can these be setup in a separate file and re-used by some call?<br /><br />For example, I could have many rules with (is&#124;was&#124;are) and then later decide I want to include 'were' in that list. I would then have to change every occurrence in every rule.<br /><br />Could (is&#124;was&#124;are) be set up in a separate file and a reference be used to call it? Same for arrays?<br /><br />Otherwise, having to have this per rule takes away a lot of the potential power. Verbots used to cover this with the use of a synonym file.<br /><br /><br />||||
Re: Giving your bot &quot;common sense&quot;|Kirsle|casey@cuvou.net|1369761726|Kirsle|xx|0|76.168.196.14|Yeah, this is what arrays were designed to handle. ;) I usually put all my array definitions in begin.rs, but they can be put anywhere and still work (RiveScript code is all parsed in advance, so the interpreter knows all the code long before you ask it to get a reply to something).<br /><br />[code]! array is = is was are[/code]<br /><br />And then &quot;+ what (@is) *&quot; for example to use it in triggers.||||
Re: Giving your bot &quot;common sense&quot;|MikeA|mikejd30@gmail.com|1369765164|mikea|xx|0|88.6.221.157|Ok, great!<br /><br />And can the same be done with alternatives / options or are they the same thing?<br /><br />Thanks!||||
Re: Giving your bot &quot;common sense&quot;|Kirsle|casey@cuvou.net|1369765239|Kirsle|xx|0|199.87.220.226|Yeah the same works for alternatives/options. :)||||
