public string DisplaySummarize() { string result = "------------------------WORD COUNT-------------------\n"; string document = BuildTheDocument(); string[] allWords = KeywordResearcher.splitTheWordInString(document); Dictionary <string, int> wordCount = KeywordResearcher.WordsCount(allWords); foreach (KeyValuePair <string, int> d in wordCount) { result += d.Key + " : " + d.Value + " \n"; } result += "\n------------------QUESTION KEYWORD--------------------------------\n"; string[] questionKeyword = KeywordResearcher.GetKeywordArray(PageList[0].Question); foreach (string question in questionKeyword) { result += "question keyword : " + question + "\n"; } result += "\n----------------------SENTENCES--------------------------------------\n"; List <string> predictSentenceAllPage = CollectAllPredictSentenceAllPages(); foreach (string sentence in predictSentenceAllPage) { result += sentence + "\n***************\n"; } result += "\n--------------------------sentence analysis----------------\n"; List <string> sentences = FindBestPredictSentenceAllPages(); foreach (string sen in sentences) { result += sen + "\n********\n"; } return(result); }
public Dictionary <string, int> WordsCount() { //Dictionary<string, int> wordCountDic = new Dictionary<string, int>(); //string[] allWords = SplitWords(); //foreach (string word in allWords) //{ // if (!wordCountDic.ContainsKey(word)) // { // wordCountDic.Add(word, 1); // } // else // { // wordCountDic[word] = wordCountDic[word] +1; // } //} //wordCountDic = wordCountDic.OrderByDescending(x => x.Value).ToDictionary(x => x.Key, x => x.Value); //return wordCountDic; string[] allWords = SplitWords(); return(KeywordResearcher.WordsCount(allWords)); }