Пример #1
0
        public List <string> FindBestPredictSentenceAllPages()
        {
            string document = BuildTheDocument();

            string[]         allWords               = KeywordResearcher.splitTheWordInString(document);
            string[]         questionKeyword        = KeywordResearcher.GetKeywordArray(PageList[0].Question);
            List <string>    predictSentenceAllPage = CollectAllPredictSentenceAllPages();
            QuestionAnalysis questionAnalysis       = new QuestionAnalysis(PageList[0].Question);
            int           count     = questionKeyword.Length;
            List <string> sentences = new List <string>();
            string        key       = "";

            if (questionAnalysis.isShortAnswer())
            {
                int num = PageList[0].Question.Split(' ').Count();
                if (num > 8)
                {
                    while (count > 0)
                    {
                        //sentences = KeywordResearcher.FindTheBestPredictSentence(count, questionKeyword, predictSentenceAllPage);
                        key       = QuestionWordCombine(count, questionKeyword);
                        sentences = SentencesContainKeyCombine(key, predictSentenceAllPage);

                        count = (sentences.Count != 0) ? 0 : --count;
                    }
                }
                else
                {
                    List <string> allquestionPosibleCombine = QuestionWordConbime2(PageList[0].Question);
                    int           predict = 0;
                    for (int i = 0; i < allquestionPosibleCombine.Count; i++)
                    {
                        sentences.AddRange(SentencesContainKeyCombine(allquestionPosibleCombine[i], predictSentenceAllPage));
                        if (predict == 0 || predict <= allquestionPosibleCombine[i].Split(' ').Count() - 1 || sentences.Count == 0)
                        {
                            predict = allquestionPosibleCombine[i].Split(' ').Count() - 1;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                while (count > 0)
                {
                    sentences = KeywordResearcher.FindTheBestPredictSentence(count, questionKeyword, predictSentenceAllPage);
                    count     = (sentences.Count != 0) ? 0 : --count;
                }
            }
            return(sentences);
        }
Пример #2
0
        public List <string> Priority2()
        {
            List <string>    priority2       = new List <string>();
            QuestionAnalysis questionFactory = new QuestionAnalysis(Question);

            string[] questionKeyword = questionFactory.FindKeywordInQuestion();

            foreach (string s in Sentences)
            {
                if (KeywordResearcher.IsContainAtLeastOneKeyword(s, questionKeyword))
                {
                    priority2.Add(s);
                }
            }

            return(priority2);
        }