/// <summary> /// Runs the content summarizing part of the summarizing algorithm /// </summary> /// <param name="analyzedDocument"></param> /// <param name="contentSummarizer"></param> /// <param name="arguments"></param> /// <returns></returns> public SummarizedDocument SummarizeAnalyzedContent(AnalyzedDocument analyzedDocument, IContentSummarizer contentSummarizer, ISummarizerArguments arguments) { if (analyzedDocument == null) { throw new ArgumentNullException(nameof(analyzedDocument)); } if (contentSummarizer == null) { throw new ArgumentNullException(nameof(contentSummarizer)); } if (arguments == null) { throw new ArgumentNullException(nameof(arguments)); } // Range adjustment if (arguments.FilteringConceptsCap < 0) { arguments.FilteringConceptsCap = 0; } if (arguments.MaxSummarySentences < 0) { arguments.MaxSummarySentences = 0; } if (arguments.MaxSummarySizeInPercent < 0) { arguments.MaxSummarySizeInPercent = 0; } if (arguments.MaxSummarySizeInPercent > 100) { arguments.MaxSummarySizeInPercent = 100; } List <string> summarizedConcepts = contentSummarizer.GetConcepts(analyzedDocument, arguments); if (summarizedConcepts == null) { throw new InvalidOperationException($"{contentSummarizer.GetType().FullName}.GetConcepts must not return null"); } List <string> summarizedSentences = contentSummarizer.GetSentences(analyzedDocument, arguments); if (summarizedSentences == null) { throw new InvalidOperationException($"{contentSummarizer.GetType().FullName}.GetSentences must not return null"); } return(new SummarizedDocument { Concepts = summarizedConcepts, Sentences = summarizedSentences }); }
/// <summary> /// Runs the content summarizing part of the summarizing algorithm /// </summary> /// <param name="analyzedDocument"></param> /// <param name="contentSummarizer"></param> /// <param name="arguments"></param> /// <returns></returns> public SummarizedDocument SummarizeAnalysedContent(AnalyzedDocument analyzedDocument, IContentSummarizer contentSummarizer, ISummarizerArguments arguments) { if (analyzedDocument == null) { throw new ArgumentNullException("analyzedDocument"); } if (contentSummarizer == null) { throw new ArgumentNullException("contentSummarizer"); } if (arguments == null) { throw new ArgumentNullException("arguments"); } // Range adjustment if (arguments.FilteringConceptsCap < 0) { arguments.FilteringConceptsCap = 0; } if (arguments.MaxSummarySentences < 0) { arguments.MaxSummarySentences = 0; } if (arguments.MaxSummarySizeInPercent < 0) { arguments.MaxSummarySizeInPercent = 0; } if (arguments.MaxSummarySizeInPercent > 100) { arguments.MaxSummarySizeInPercent = 100; } var summarizedConcepts = contentSummarizer.GetConcepts(analyzedDocument, arguments); if (summarizedConcepts == null) { throw new InvalidOperationException(string.Format("{0}.GetConcepts must not return null", contentSummarizer.GetType().FullName)); } var summarizedSentences = contentSummarizer.GetSentences(analyzedDocument, arguments); if (summarizedSentences == null) { throw new InvalidOperationException(string.Format("{0}.GetSentences must not return null", contentSummarizer.GetType().FullName)); } return(new SummarizedDocument() { Concepts = summarizedConcepts, Sentences = summarizedSentences }); }
/// <summary> /// Runs the content summarizing part of the summarizing algorithm /// </summary> /// <param name="analyzedDocument"></param> /// <param name="contentSummarizer"></param> /// <param name="arguments"></param> /// <returns></returns> public SummarizedDocument SummarizeAnalysedContent(AnalyzedDocument analyzedDocument, IContentSummarizer contentSummarizer, ISummarizerArguments arguments) { if (analyzedDocument == null) { throw new ArgumentNullException(nameof(analyzedDocument)); } if (contentSummarizer == null) { throw new ArgumentNullException(nameof(contentSummarizer)); } if (arguments == null) { throw new ArgumentNullException(nameof(arguments)); } // Range adjustment if (arguments.FilteringConceptsCap < 0) { arguments.FilteringConceptsCap = 0; } if (arguments.MaxSummarySentences < 0) { arguments.MaxSummarySentences = 0; } if (arguments.MaxSummarySizeInPercent < 0) { arguments.MaxSummarySizeInPercent = 0; } if (arguments.MaxSummarySizeInPercent > 100) { arguments.MaxSummarySizeInPercent = 100; } var summarizedConcepts = contentSummarizer.GetConcepts(analyzedDocument, arguments); if (summarizedConcepts == null) { throw new InvalidOperationException( $"{contentSummarizer.GetType().FullName}.GetConcepts must not return null"); } var summarizedSentences = contentSummarizer.GetSentences(analyzedDocument, arguments); if (summarizedSentences == null) { throw new InvalidOperationException( $"{contentSummarizer.GetType().FullName}.GetSentences must not return null"); } return new SummarizedDocument() { Concepts = summarizedConcepts, Sentences = summarizedSentences }; }