Пример #1
0
        //TODO: create a better name
        public bool PlResolution(string kbs, string alphaString)
        {
            KnowledgeBase kb = new KnowledgeBase();

            kb.Tell(kbs);
            Sentence alpha = (Sentence) new PEParser().Parse(alphaString);

            return(this.PlResolution(kb, alpha));
        }
Пример #2
0
        public Sentence AsSentence()
        {
            ISet <Symbol> Asyms  = GetAssignedSymbols();
            KnowledgeBase tempKB = new KnowledgeBase();

            if (Asyms == null)
            {
                Console.WriteLine("ERR: AsSentence() Asyms is null!!!");
            }
            else
            {
                Console.WriteLine("DBG: Asyms.Count={0}", Asyms.Count);
            }
            foreach (Symbol k in Asyms)
            {
                try
                {
                    if (IsTrue(k))
                    {
                        tempKB.Tell("(" + k.Value + ")");
                    }
                    else
                    {
                        tempKB.Tell("(NOT " + k.Value + ")");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("ERR: AsSentence() ", e.Message, e.StackTrace);
                }
            }
            if (tempKB.Size() == 0)
            {
                Console.WriteLine("ERR: AsSentence() tempKB.Size==0");
            }
            return(tempKB.AsSentence());
        }