Beispiel #1
0
        private void Register(AnnotatedQuestionActionEntry action)
        {
            if (action.IsDialogStart)
            {
                _question = action.ParseQuestion();
                _answerId = _questions.GetAnswerMid(_question);
            }

            if (!action.IsRegularTurn)
            {
                //we want regular turns only
                return;
            }

            if (action.Act != null && action.Act.StartsWith("RequestAnswer"))
            {
                _isAnswerPhase = true;
            }

            if (_isAnswerPhase)
            {
                _answerTurns.Add(action);
            }
            else
            {
                _explanationTurns.Add(action);
            }
        }
        internal KnowledgeReport(ExtractionKnowledge knowledge, LinkBasedExtractor extractor, QuestionCollection questions, bool fruitOnly)
        {
            StoragePath   = knowledge.StoragePath;
            QuestionCount = knowledge.Questions.Count();
            var reports = new List <QuestionReport>();

            foreach (var question in knowledge.Questions)
            {
                if (!question.AnswerHints.Any())
                {
                    continue;
                }

                var answerId = FreebaseDbProvider.GetId(questions.GetAnswerMid(question.Utterance.OriginalSentence));
                var report   = new QuestionReport(question, answerId, extractor);
                if (fruitOnly)
                {
                    if (report.TopDenotationEvidence < 2 || report.CollectedDenotations.Count() - report.TopDenotationEvidence * 2 >= 0)
                    {
                        //not enough evidence
                        continue;
                    }
                }

                reports.Add(report);
            }

            Questions = reports.OrderByDescending(r => r.CollectedDenotations.Count());
        }