Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
摘要文档是内容审查,快速见解或准备摘要的宝贵工具。 Aspose.Words支持使用AI支持的模型进行文档摘要,从而更容易处理长文本。 此功能在基于AI的Aspose.Words功能中提供,集成了OpenAI和Google的高级生成语言模型以及Claude’s人类生成语言模型。 支持的模型列表在AiModelType枚举中可用。
您可以指定用于汇总文档内容的各种选项。 使用Summarize方法生成文档摘要。 您还可以使用SummaryLength属性设置摘要长度。
使用Aspose.Words,实现文档摘要非常简单。 下面的代码示例演示如何使用GPT-4o模型汇总文档:
Document firstDoc = new Document(getMyDir() + "Big document.docx");
Document secondDoc = new Document(getMyDir() + "Document.docx");
String apiKey = System.getenv("API_KEY");
// Use OpenAI or Google generative language models.
IAiModelText model = (IAiModelText)AiModel.create(AiModelType.GPT_4_O_MINI).withApiKey(apiKey);
Document oneDocumentSummary = model.summarize(firstDoc, new SummarizeOptions(); { oneDocumentSummary.setSummaryLength(SummaryLength.SHORT); });
oneDocumentSummary.save(getArtifactsDir() + "AI.AiSummarize.One.docx");
Document multiDocumentSummary = model.summarize(new Document[] { firstDoc, secondDoc }, new SummarizeOptions(); { multiDocumentSummary.setSummaryLength(SummaryLength.LONG); });
multiDocumentSummary.save(getArtifactsDir() + "AI.AiSummarize.Multi.docx");
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.