Esempio n. 1
0
        public Unifiable EvalSubL(Unifiable cmd, Unifiable filter)
        {
            Unifiable result = "(EVAL-SUBL " + cmd + ")";
            CycAccess access = GetCycAccess;

            if (!UseCyc)
            {
                writeToLog("NOT USE CYC " + result);
                return(null);// "NIL";
            }
            try
            {
                string str     = "(list " + cmd + ")";
                Object oresult = access.converseList(str).first();
                DLRConsole.DebugWriteLine(str + " => " + oresult);
                result = "" + oresult;
                if (oresult is CycObject)
                {
                    result = ((CycObject)oresult).cyclifyWithEscapeChars();
                }
                if (!Unifiable.IsNullOrEmpty(filter) && filter == "paraphrase")
                {
                    return(this.Paraphrase(result));
                }
            }
            catch (Exception e)
            {
                DLRConsole.DebugWriteLine(result);
                TheBot.writeToLog(e);
                DLRConsole.DebugWriteLine("\n" + e);
                DLRConsole.SystemFlush();
                return(null);
            }
            return(result);
        }
Esempio n. 2
0
        private void populateFromCyc()
        {
            TheBot.AddExcuteHandler("cycl", ExecCycQuery);
            TheBot.AddExcuteHandler("subl", EvalSubLHandler);

            int        id = 1;
            FileStream f  = HostSystem.Open("nodes.txt", FileMode.Create);
            TextWriter tw = new StreamWriter(f);

            foreach (var item in cycAccess.converseList("(ask-template '?R '(#$and (#$genls ?R #$Communicating)(#$not (#$isa ?R #$NonVerbalCommunicating))) #$EverythingPSC)"))
            {
                string text = item.ToString();
                string s    =
                    "<Shape ID='" + id++ +
                    "' NameU='Decision' Type='Shape' Master='0'><XForm><PinX>0.984251968503937</PinX><PinY>11.02362204724409</PinY><Width Unit='MM' F='Inh'>0.984251968503937</Width><Height Unit='MM' F='Inh'>0.5905511811023623</Height><LocPinX Unit='MM' F='Inh'>0.4921259842519685</LocPinX><LocPinY Unit='MM' F='Inh'>0.2952755905511811</LocPinY><Angle F='Inh'>0</Angle><FlipX F='Inh'>0</FlipX><FlipY F='Inh'>0</FlipY><ResizeMode F='Inh'>0</ResizeMode></XForm><Event><TheData F='No Formula'>0</TheData><TheText F='No Formula'>0</TheText><EventDblClick F='Inh'>0</EventDblClick><EventXFMod F='No Formula'>0</EventXFMod><EventDrop F='No Formula'>0</EventDrop></Event><vx:Event xmlns:vx='http://schemas.microsoft.com/visio/2006/extension'><vx:EventMultiDrop F='No Formula'>0</vx:EventMultiDrop></vx:Event><LayerMem><LayerMember>0</LayerMember></LayerMem><Text>" +
                    text + "</Text></Shape>";
                tw.WriteLine(s);
            }
            tw.Close();
            try
            {
                f.Close();
            }
            catch (Exception)
            {
            }
            AltBot.writeDebugLine("!NonVerbalCommunicating = " + id);
            //cycAccess.setCyclist("CycAdministrator");
        }