Exemple #1
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");
        }
 public NatLangDb(AltBot p)
 {
     bot = p;
     bot.AddExcuteHandler("pos", (SystemExecHandler)NatLangTestHandler);
     googleTranslator = new GoogleTranslator(p);
     NatLangProc      = this;
     initNatLangDb();
 }
Exemple #3
0
        public WebGetFactiodEngine(IEnglishFactiodEngine fallback, AltBot AltBot)
        {
            TheBot   = AltBot;
            assertTo = fallback;
// ReSharper disable DoNotCallOverridableMethodsInConstructor
            string named = GetServiceName();

// ReSharper restore DoNotCallOverridableMethodsInConstructor

            TheBot.AddExcuteHandler(named, AskTextString);
        }
Exemple #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="indexDir"></param>
        /// <param name="fieldName">usually "TEXT_MATTER"</param>
        public MyLuceneIndexer(string indexDir, string fieldName, AltBot myBot, WordNetEngine myWNEngine)
        {
            SearchSources = new List <IDocSearch>()
            {
                this
            };
            _indexDir     = indexDir;
            _fieldName    = fieldName;
            TheBot        = myBot;
            wordNetEngine = myWNEngine;
            IEnglishFactiodEngine assertTo = this;

            SearchSources.Add(new TrueKnowledgeFactiodEngine(assertTo, TheBot));
            SearchSources.Add(new AskDotComFactiodEngine(assertTo, TheBot));
            SearchSources.Add(new WikiAnswersFactoidEngine(assertTo, TheBot));
            TheBot.AddExcuteHandler("asklucene", AskTextStringJustHere);
            TheBot.AddExcuteHandler("askall", AskTextStringAll);
            //WNUser2Cache();

            //_path = new System.IO.FileInfo(indexDir);
            //_directory = new RAMDirectory();
            _analyzer = new StandardAnalyzer();
            try
            {
                InitDatabase();
            }
            catch (Exception e)
            {
                writeToLog("ERROR {0}", e);
                IsDbPresent = false;
                if (_directory == null)
                {
                    // in ram because of disk error?!
                    _directory = new RAMDirectory();
                }
            }
            TripleStoreProxy = new TripleStoreFromEnglish(this, TheBot, WordNetExpand);
            EntityFilter     = TripleStoreProxy.EntityFilter;
        }
Exemple #5
0
 public GoogleTranslator(AltBot bot)
 {
     TheBot = bot;
     TheBot.AddExcuteHandler("gpara", GetParaphrase);
 }