• Jen Garrett

    Jen Garrett - 2008-03-29

    Anyone working with a custom tag library or idea on OpenCyc integration? Ive got some things working, but its all jerry rigged (no offense to anyone named Jerry). I am looking for a way to do queries, assertions, etc...

    Great project Nicholas!


    • Nicholas Tollervey


      Have you seen the following paper?

      Very interesting "howto" for what you're proposing.


    • Jen Garrett

      Jen Garrett - 2008-03-29

      Yes, thats how I jerry rigged it, to use that as a proxy, I have started something similar in C#, as it will be much better to tie directly in as Cyn does, rather than using Cyn as a proxy. I can get basic stuff out of Cyc, but Im ready to take things to the next level, auto learning and whatnot.


    • Douglas R. Miles

      I am working on implementing these tags:

      <cycterm> translates an English word/phrase into a Cyc symbol
      <cycsystem> executes a CycL statement and returns the result
      <cycrandom> executes a CycL query and returns one response at random
      <cycassert> simple way to assert a CycL statement
      <cycretract> simple way to retract a CycL statement
      <cyccondition> controls the flow execution in a category template
            - if then else if then else if then else

      However this tag is giving me trouble:
      <guard> processes a template only if the CycL expression is true

      Kino did this for "Bitoflife AIML interpreter in java".

      The way it worked is when a <pattern> was fully matched (stars bound), the <guard> tags from inside <template> had to be checked.  This means a small side-effect free version if <template> has to be rendered.. So if a guard fails, then the <pattern> can be considered unmatched and the process moves onto the next <category>.

      Now I'm looking to do this to the Program# SVN 2.5 Tagged version.

      What I need to find is where in the Node.cs/SubQuery it commits that a <catagory>s <pattern> was matched well enough that it can move onto the <template> phase.  and be able to back out and move onto the next <category>..

      Maybe Graphmaster implemenation wise when all the nodes along the <pattern> is matched and its time to look at the "string Template" the <template> can be ran <guard> and the guard tag will have left a boolean arround saying this was a non matching node.


      Thanks in advance.

      • Nicholas Tollervey

        Take a look in Bot.cs around 639 in the "Chat" method. This basically controls the workflow of the reponse to a request. Perhaps this is what you are looking for...?

        • Douglas R. Miles

          Thank you, after inspecting Chat in Bot.cs,
            It looks like the new <guard> tag i am working on would be implemented simular to a <that> tag.

          I couldn't tell for sure, but do you check the conformity of <that> against the bot's last reponse before confirming the <pattern> against the user's input?

    • Nicholas Tollervey


      If I understand you correctly, you're asking if I validate "that" in some way before matching user input in the graphmaster.

      Short answer: no. :-)

      Sorry I can't be more helpful,


      • Douglas R. Miles

        Actually that was helpfull.. I ended up getting <guard> to work as well!  one thing i learned, is the words in sentences are matched backwards from the end.
        In the form below, the <pattern> is only validated "I" first word is matched, and then I call <guard>'s OuterXML which is stored in the node where node.word is "I" evaluation is true, otherwise i return String.Empty

            <pattern>I AM IN * </pattern>
            <guard>(#$isa <cycterm filter="Location" ><star index="1"/></cycterm> #$Location)</guard>
                <think><cycassert>(#$objectFoundInLocation #$TheUser <cycterm filter="Location" ><star index="1"/></cycterm> ) <get name="assertmt" default="#$AimlContextMt"/> )</cycassert></think> I will remember can be found at <star index="1"/>.


    • Nicholas Tollervey


      I have a question for you... Are you going to release the source code for your OpenCyc integration under an open-source license?

      I'm about to start work on a release for version 3.0 of AIMLBot and having OpenCyc capabilities built in from the start (perhaps as an optional plugin) would be awesome.

      I quite understand if you can't or don't want to. :-)

      Best wishes,


    • Douglas R. Miles

      That would be great if OpenCyc was part of the AIMLBot.

      I ended up starting with the 2.5 tag first becasue the 3.0 seemed like it was in the early stages of a complete rewrite.  But the design looked very good for 3.0 and would have rather used it.

      My code is integrated with yours into a project opensim4opencog

      I renamed the namespace AIMLBot -> RTParser (recursive template parser). 
      I was secretly afraid to have a top-level SVN directory containing the word "AIML" mainly becasue we wanted the bot to use some AIML methodology for selecting engine rules but not be yet another AIML bot for secondlife.  For example, feeding low level server events and letting AIML translating them to high-level events.

      Other renames in Code:
      Bot --> RTBot
      Three members called ".bot" became ".Processor",".Proc",".RProcessor"
        Mainly to avoid accidental conflicts later.

      It's totally opensrc:

      The base DLL

      The "Main"

      The Interesting AIML files:

      Some wilder changes:
      <get>foo</get> is equiv to <get name="foo"/>
      (this is so things like)  <get><star/></get> was possible.

      The same with:
      <set>abc a b c</set> is equiv to <set name="abc">a b c</set>
      Just the first token becomes the "name"

      Added to Bot:
      myBot.AddExecHandler(string lang,delegate string(string cmd, User user ));

      for things like <system lang="lisp"> <system lang="subl"> <system lang="shell"> <system lang="c#"> <system lang="secondlife"> etc

      (<guard> implicitly assumes it is also surrounded by a <system> tag)

      <cycsystem> is pretty much a <system lang="subl">

      That is a quick/incomplete overview of some of the things.

      I tried to be a good boy at first using the CustomTagHandlers .. Added a the default constructor and things but couldn't quite get it working plus with some of the hacks to get/set ended up not loading the extra cyc tags thru the custom tag handlers.  But possible I could give it a try again.

      Although there will be some footprints anyways to AIMLBot such as the loading of custom <system> tag handler hooks I mentioned above.

      The guard requires saving at each leaf node (where we save the template.OuterXML) maybe save the ref to additional XMLElements that were held inside <category> .

      How ready is 3.0 right now? Can you write a quick ConsoleChat Program.cs wrapper around it? If so, I can probably help with some patches. We can go over decide how how much could be late loaded (Tag handlers or whatnot) vs the impact to the the final AIMLBot.dlls... Our hope is the lowest possible changes needed .. but any changes we do we make it even easier for people to support other things like SQL and other database interactions.


Log in to post a comment.