Пример #1
0
        public void PromptChoice(RuleEngine env, ProAi.Clips.DataObject obj)
        {
            //规则中回调函数的参数说明:

            //RtnString(1):QuestionContent 问题详细内容,提示用户的信息
            //RtnString(2):QuestionContent 问题简要内容,提示用户的信息
            //RtnString(3):QuestionFactName问题,在规则中用到的事实的名称

            //RtnString(4):Choice1  可选项1,提示用户的信息
            //RtnString(5):AllowedValue1 可选项1,在规则中用到的值

            //RtnString(6):Choice2
            //RtnString(7):AllowedValue2

            //......

            //RtnString(2N+2):ChoiceN
            //RtnString(2N+3):AllowedValueN
            QuestionChoices stQC = new QuestionChoices();

            stQC.Question = new CodeFull(env.UserFunctionManager.RtnString(1), env.UserFunctionManager.RtnString(2), env.UserFunctionManager.RtnString(3));

            stQC.Choices = new List <CodeSimple>();
            int nStart = 4;//参数从第4个开始为choice,每2个为一组

            for (int i = nStart; i < env.UserFunctionManager.ArgCount; i = i + 2)
            {
                stQC.Choices.Add(new CodeSimple(env.UserFunctionManager.RtnString(i), env.UserFunctionManager.RtnString(i + 1)));
            }

            m_stInferResult.InterChoices.Questions.Add(stQC);
        }
Пример #2
0
 public void FactUsed(RuleEngine env, ProAi.Clips.DataObject obj)
 {
     for (int i = 1; i <= env.UserFunctionManager.ArgCount; i++)
     {
         m_stInferResult.lstInInterpretation[m_stInferResult.lstInInterpretation.Count - 1].lstFactUsed.Add(env.UserFunctionManager.RtnString(i));
     }
 }
Пример #3
0
        public void OperateFact(RuleEngine env, ProAi.Clips.DataObject obj)
        {
            //规则中回调函数的参数说明:

            //RtnString(1):事实名
            //RtnString(2):事实值

            OperateFact(env.UserFunctionManager.RtnString(1), env.UserFunctionManager.RtnString(2).ToString());
        }
Пример #4
0
 public void DataNotify(RuleEngine env, ProAi.Clips.DataObject obj)
 {
     String[] strData = env.UserFunctionManager.RtnString(1).Split('+');
     for (int i = 0; i < strData.Length; i++)
     {
         string strDatum = strData.GetValue(i).ToString();
         if (strDatum != "NULL" && !m_stInferResult.DataNotice.Data.Contains(strDatum))
         {
             m_stInferResult.DataNotice.Data.Add(strDatum);
         }
     }
 }
Пример #5
0
        public void FileLoadNotify(RuleEngine env, ProAi.Clips.DataObject obj)
        {
            switch (env.UserFunctionManager.RtnString(2))
            {
            case "DataNotify":
                m_stInferResult.DataNotice.CurrentRuleFile = env.UserFunctionManager.RtnString(1);
                break;

            case "PromptChoice":
                m_stInferResult.InterChoices.NextRuleFiles.Add(env.UserFunctionManager.RtnString(1));
                break;
            }
        }
Пример #6
0
        public void PreDiagnose(RuleEngine env, ProAi.Clips.DataObject obj)
        {
            string strDiseaseName = env.UserFunctionManager.RtnString(1);
            string strCriterion   = env.UserFunctionManager.RtnString(2);

            for (int i = 0; i < m_stInferResult.lstPreDiagnose.Count; i++)
            {
                //如果已经拟诊此疾病,则添加到诊断依据中
                if (m_stInferResult.lstPreDiagnose[i].strDisease == strDiseaseName)
                {
                    m_stInferResult.lstPreDiagnose[i].lstCriterion.Add(strCriterion);
                    return;
                }
            }

            //如果是新拟诊,则创建新的结构体,添加到推理结果中。
            DiseaseCriterion oDC = new DiseaseCriterion();

            oDC.strDisease   = strDiseaseName;
            oDC.lstCriterion = new List <string>();
            oDC.lstCriterion.Add(strCriterion);
            m_stInferResult.lstPreDiagnose.Add(oDC);
        }
Пример #7
0
        public void InterpretationIndex(RuleEngine env, ProAi.Clips.DataObject obj)
        {
            Interpretation oInterpret = new Interpretation(env.UserFunctionManager.RtnString(1));

            m_stInferResult.lstInInterpretation.Add(oInterpret);
        }
Пример #8
0
 public void Recommendation(RuleEngine env, ProAi.Clips.DataObject obj)
 {
     m_stInferResult.Recommendations.Add(env.UserFunctionManager.RtnString(1));
     //m_stInferResult.lstInInterpretation[m_stInferResult.lstInInterpretation.Count - 1].lstRecomm.Add(env.UserFunctionManager.RtnString(1));
 }
Пример #9
0
 public void OperateNumberFact(RuleEngine env, ProAi.Clips.DataObject obj)
 {
     OperateFact(env.UserFunctionManager.RtnString(1), env.UserFunctionManager.RtnDouble(2).ToString());
 }