コード例 #1
0
        private QuestionInfo selectTopic()
        {
            var    newQuestionProbability = Math.Max(0.1, (100 - _knowledge.QuestionCount) / 100.0);
            string topicCandidate;

            while (true)
            {
                if (_rnd.NextDouble() < newQuestionProbability)
                {
                    do
                    {
                        topicCandidate = _questions.GetRandomQuestion();
                    } while (!isGoodQuestion(topicCandidate));

                    _extractor.Linker.LinkUtterance(topicCandidate); //cache linked information
                    _knowledge.AddQuestion(topicCandidate);
                }
                else
                {
                    topicCandidate = _knowledge.GetRandomQuestion();
                }

                if (!_discussedTopics.Contains(topicCandidate))
                {
                    break;
                }
            }

            return(_knowledge.GetInfo(topicCandidate));
        }
コード例 #2
0
 public void RandomizeQuestion (){
     //get a new random question
     currentQuestion = questions.GetRandomQuestion();
 }