public static SummarizedDocument Summarize(SummarizerArguments args) { if (args == null) { return(null); } Article article; if (args.InputString.Length > 0 && args.InputFile.Length == 0) { article = ParseDocument(args.InputString, args); } else { article = ParseFile(args.InputFile, args); } Grader.Grade(article); Highlighter.Highlight(article, args); SummarizedDocument summarizedDocument = CreateSummarizedDocument(article); return(summarizedDocument); }
private static SummarizedDocument CreateSummarizedDocument(Article article, SummarizerArguments args) { SummarizedDocument sumDoc = new SummarizedDocument(); sumDoc.Concepts = article.Concepts; foreach (Sentence sentence in article.Sentences) { if (sentence.Selected) { sumDoc.Sentences.Add(sentence.OriginalSentence); } } return(sumDoc); }
/// <summary> /// encapsulates the algorithm for summarizing the help files /// </summary> /// <param name="toSummarize">responses from data access tier that will be summarized</param> public string[] summarize(string[] toSummarize)//List<QueryResponseList> toSummarize) { List <string> sumList = new List <string>(); /*foreach (string input in getInputStringList(toSummarize)) * { * OpenTextSummarizer.SummarizerArguments args = new OpenTextSummarizer.SummarizerArguments(); * args.InputString = input; * OpenTextSummarizer.SummarizedDocument sd = OpenTextSummarizer.Summarizer.Summarize(args); * sumList.Add(sd.Sentences.Aggregate((x,y)=> { return x + y; })); * } * return sumList.ToArray();*/ OpenTextSummarizer.SummarizerArguments args = new OpenTextSummarizer.SummarizerArguments(); args.InputString = String.Join(" ", toSummarize); OpenTextSummarizer.SummarizedDocument sd = OpenTextSummarizer.Summarizer.Summarize(args); return(sd.Sentences.ToArray()); }