Exemple #1
0
        public override bool isTruth(Hypothesis hyp)
        {
            List <Boolean> boolList = new List <bool>();

            foreach (AbstractCondition condition in conditions)
            {
                boolList.Add(condition.isTruth(hyp));
            }
            return(boolList.Where(p => p == true).ToList().Count == boolList.Count);
        }
Exemple #2
0
 public bool checkHypothesis(string obj, string value)
 {
     try
     {
         var hypothesis     = new Hypothesis(obj, value);
         var startCondition = KnowledgeBase.Conditions.Where(p => p.result == hypothesis.Value).ToList()[0];
         return(startCondition.isTruth(hypothesis));
     }
     catch
     {
         return(false);
     }
 }
Exemple #3
0
        public override bool isTruth(Hypothesis hyp)
        {
            var isInFacts = KnowledgeBase.Facts.
                            Where(p => p.Property == hyp.Obj + " " + condition).
                            ToList().Count > 0;

            if (isInFacts)
            {
                return(true);
            }
            var nextCondition = KnowledgeBase.Conditions.Where(p => p.result == condition).ToList();

            if (nextCondition.Count == 0)
            {
                return(false);
            }
            return(nextCondition[0].isTruth(hyp));
        }
 public virtual bool isTruth(Hypothesis hyp)
 {
     return(true);
 }