
有效審查長文件現在比以往任何時候都更容易,因為 Aspose.Words 中新增的 AI 驅動文件摘要功能。無論您是在準備摘要、生成快速見解,還是簡化內容審查,這個功能都可以讓您使用來自 OpenAI 和 Google 的先進生成 AI 模型在幾秒鐘內創建簡潔的摘要。
如何在 Aspose.Words 中摘要文件
Aspose.Words 通過其 Aspose.Words.AI 命名空間使文件摘要變得簡單。通過使用 Create 方法,開發人員可以連接到 AI 模型並設置 API 密鑰。然後,使用 Summarize 方法和 SummaryLength 屬性,他們可以摘要文本,配置所需的摘要長度等選項。
只需幾行代碼,您就可以將強大的 AI 功能直接集成到您的應用程序中。以下代碼示例顯示了如何使用 Aspose.Words 和 GPT-4o 模型摘要文件:
Document firstDoc = new Document(MyDir + "Big document.docx");
Document secondDoc = new Document(MyDir + "Document.docx");
string apiKey = Environment.GetEnvironmentVariable("API_KEY");
// 使用 OpenAI 或 Google 生成語言模型。
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");
為什麼使用 Aspose.Words 進行摘要?
- 流程簡化:以最少的代碼摘要文件
- 可自定義摘要:調整摘要長度以滿足特定需求
- AI 集成:使用來自 OpenAI 和 Google 的尖端模型
今天就開始,讓 Aspose.Words 輕鬆精確地處理您的文件摘要需求。欲了解更多詳情,請訪問 Aspose.Words API 文檔。