Summarize
Contents
[
Hide
]Summarize(Document, SummarizeOptions)
Generates a summary of the specified document, with options to adjust the length of the summary.
public override Document Summarize(Document sourceDocument, SummarizeOptions options = null)
Examples
Shows how to summarize documents with a local model, so the content never leaves the machine.
// Aspose.LLM is a separate package with its own license, for example:
// new Aspose.LLM.License().SetLicense("Aspose.Total.lic");
Document firstDoc = new Document(MyDir + "Big document.docx");
Document secondDoc = new Document(MyDir + "Document.docx");
// Disposing the model releases the local model and its native resources.
using (AsposeLlmModel model = new AsposeLlmModel("Qwen25_3BPresetCpu"))
{
SummarizeOptions summarizeOptions = new SummarizeOptions();
summarizeOptions.SummaryLength = SummaryLength.Short;
Document summary = model.Summarize(firstDoc, summarizeOptions);
summary.Save(ArtifactsDir + "AI.AsposeLlmSummarize.One.docx");
summarizeOptions.SummaryLength = SummaryLength.Medium;
Document combinedSummary = model.Summarize(new Document[] { firstDoc, secondDoc }, summarizeOptions);
combinedSummary.Save(ArtifactsDir + "AI.AsposeLlmSummarize.Multiple.docx");
}
See Also
- class Document
- class SummarizeOptions
- class AsposeLlmModel
- namespace Aspose.Words.AI
- assembly Aspose.Words
Summarize(Document[], SummarizeOptions)
Generates a summary for an array of documents, with options to adjust the length of the summary.
public override Document Summarize(Document[] sourceDocuments, SummarizeOptions options = null)
Examples
Shows how to summarize documents with a local model, so the content never leaves the machine.
// Aspose.LLM is a separate package with its own license, for example:
// new Aspose.LLM.License().SetLicense("Aspose.Total.lic");
Document firstDoc = new Document(MyDir + "Big document.docx");
Document secondDoc = new Document(MyDir + "Document.docx");
// Disposing the model releases the local model and its native resources.
using (AsposeLlmModel model = new AsposeLlmModel("Qwen25_3BPresetCpu"))
{
SummarizeOptions summarizeOptions = new SummarizeOptions();
summarizeOptions.SummaryLength = SummaryLength.Short;
Document summary = model.Summarize(firstDoc, summarizeOptions);
summary.Save(ArtifactsDir + "AI.AsposeLlmSummarize.One.docx");
summarizeOptions.SummaryLength = SummaryLength.Medium;
Document combinedSummary = model.Summarize(new Document[] { firstDoc, secondDoc }, summarizeOptions);
combinedSummary.Save(ArtifactsDir + "AI.AsposeLlmSummarize.Multiple.docx");
}
See Also
- class Document
- class SummarizeOptions
- class AsposeLlmModel
- namespace Aspose.Words.AI
- assembly Aspose.Words