Exemple #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);
        }
Exemple #2
0
        public List <string> FindTheBestPredictSentence(int NumberOfWords)
        {
            //int topWord = NumberOfWords;
            //List<string> priority1 = new List<string>();

            //string[] keys = BestPredictWord(topWord);
            //foreach (string s in Sentences)
            //{
            //    if (IsContainAllQuestionKeyword(s, keys))
            //    {
            //        priority1.Add(s + "\nTOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOP: "+ topWord +"The Words : " + DisplayTopWord(keys));
            //    }
            //}

            //return priority1;
            return(KeywordResearcher.FindTheBestPredictSentence(NumberOfWords, SplitWords(), Sentences));
        }