Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Summarizing documents is a valuable tool for content review, quick insights, or preparing abstracts. Aspose.Words supports document summarization using AI-powered models, making it easier to process long text. This feature, available in the aspose.words.ai module, integrates advanced generative language models from OpenAI and Google, as well as Claude’s anthropic generative language models. The list of supported models is available in the AiModelType enumeration.
You can specify various options for summarizing document content. Use the summarize method to generate a summary of your document. You can also set summary length using the summary_length property.
With Aspose.Words, implementing document summarization is straightforward. The following code example shows how to summarize a document using GPT-4o model:
first_doc = aw.Document(MyDir + "Big document.docx")
second_doc = aw.Document(MyDir + "Document.docx")
api_key = os.getenv("API_KEY")
# Use OpenAI or Google generative language models.
model = aw.ai.AiModel.create(aw.ai.AiModelType.GPT_4O_MINI).with_api_key(api_key).as_open_ai_model()
options = aw.ai.SummarizeOptions()
options.summary_length = aw.ai.SummaryLength.SHORT
one_document_summary = model.summarize(first_doc, options)
oneDocumentSummary.save(ArtifactsDir + "AI.AiSummarize.One.docx")
options.summary_length = aw.ai.SummaryLength.LONG
multi_document_summary = model.summarize([first_doc, second_doc], options)
multiDocumentSummary.save(ArtifactsDir + "AI.AiSummarize.Multi.docx")Q: Which AI models can I use for document summarization?
A: Aspose.Words for Python via .NET supports OpenAI models (e.g., GPT‑4o, GPT‑4o‑mini), Google Gemini models, and Anthropic Claude models. The full list is defined in the aw.ai.AiModelType enumeration.
Q: How do I control the length of the generated summary?
A: Set the summary_length property of aw.ai.SummarizeOptions to one of the values in aw.ai.SummaryLength (e.g., SHORT, MEDIUM, LONG). The chosen value influences how concise or detailed the summary will be.
Q: Can I summarize more than one document in a single request?
A: Yes. Pass a list of aw.Document objects to the summarize method. The model will generate a combined summary for all supplied documents.
Q: Do I need a separate license for using the AI summarization feature?
A: No additional license is required beyond a valid Aspose.Words for Python via .NET license. The AI features are included with the standard product license.
Q: Is the summarization feature available on Linux platforms?
A: Yes. Aspose.Words for Python via .NET runs on Linux, and the AI summarization APIs work the same way as on Windows, provided the required runtime dependencies are installed.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.