Effectively reviewing long documents is now easier than ever with the new AI-powered document summarization feature in Aspose.Words. Whether you’re preparing abstracts, generating quick insights, or simplifying content review, this feature lets you create concise summaries in seconds using advanced generative AI models from OpenAI and Google.

How to Summarize a Document in Aspose.Words

Aspose.Words makes document summarization simple with its Aspose.Words.AI namespace. By using the Create method, developers can connect to AI models and set API keys. Then, using the Summarize method and the SummaryLength property, they can summarize the text, configuring options such as the desired summary length.

With just a few lines of code, you can integrate powerful AI capabilities directly into your application. The following code example shows how to summarize a document using Aspose.Words with a GPT-4o model:

Document firstDoc = new Document(MyDir + "Big document.docx");
Document secondDoc = new Document(MyDir + "Document.docx");

string apiKey = Environment.GetEnvironmentVariable("API_KEY");
// Use OpenAI or Google generative language models.
IAiModelText model = (IAiModelText)AiModel.Create(AiModelType.Gpt4OMini).WithApiKey(apiKey);

Document oneDocumentSummary = model.Summarize(firstDoc, new SummarizeOptions() { SummaryLength = SummaryLength.Short });
oneDocumentSummary.Save(ArtifactsDir + "AI.AiSummarize.One.docx");

Document multiDocumentSummary = model.Summarize(new Document[] { firstDoc, secondDoc }, new SummarizeOptions() { SummaryLength = SummaryLength.Long });
multiDocumentSummary.Save(ArtifactsDir + "AI.AiSummarize.Multi.docx");

Why Use Aspose.Words for Summarization?

  • Streamlined Process: summarize documents with minimal code
  • Customizable Summaries: adjust summary length to meet specific needs
  • AI Integration: use cutting-edge models from OpenAI and Google

Get started today and let Aspose.Words handle your document summarization needs with ease and precision. For more details, visit the Aspose.Words API documentation.

See Also