public string[] FindKeyPhrases(string inputText) { string[] tokens = Tokenize(inputText); string[] phrases = ToPhrases(tokens); WordCooccurrenceMatrix matrix = new WordCooccurrenceMatrix(this.UniqueWordIndex); matrix.CompileOccurrences(phrases); SortedList <string, WordScore> leagueTable = matrix.LeagueTable; SortedList <string, double> aggregatedLeagueTable = WordCooccurrenceMatrix.AggregateLeagueTable(leagueTable, phrases); int count = (int)Math.Ceiling((double)phrases.Length / (double)3); //Take the top 1/3 of the key phrases //TODO: make scoring system configurable (for now, just use the Ratio). return(aggregatedLeagueTable.OrderByDescending(x => x.Value).Take(count).Select(x => x.Key).ToArray()); }
public string[] FindKeyPhrases(string inputText) { string[] tokens = Tokenize(inputText); string[] phrases = ToPhrases(tokens); WordCooccurrenceMatrix matrix = new WordCooccurrenceMatrix(this.UniqueWordIndex); matrix.CompileOccurrences(phrases); SortedList<string, WordScore> leagueTable = matrix.LeagueTable; SortedList<string, double> aggregatedLeagueTable = WordCooccurrenceMatrix.AggregateLeagueTable(leagueTable, phrases); int count = (int)Math.Ceiling((double)phrases.Length / (double)3); //Take the top 1/3 of the key phrases //TODO: make scoring system configurable (for now, just use the Ratio). return aggregatedLeagueTable.OrderByDescending(x => x.Value).Take(count).Select(x => x.Key).ToArray(); }