Document AI
The Aspose.Words Document AI for .NET plugin cho phép các nhà phát triển dịch hoặc tóm tắt tài liệu và kiểm tra ngữ pháp của chúng. Tích hợp với các LLM như Gemini, Claude và OpenAI.
Cài đặt và Thiết lập
- Cài đặt Aspose.Words cho gói .NET qua NuGet hoặc Console Trình quản lý Gói.
- Cấu hình Giấy phép Định mức trước khi thực hiện các thao tác hợp nhất thư.
Tương thích với Windows, Linux, macOS và các nền tảng di động sử dụng .NET Framework, .NET Core, hoặc Mono. Các IDE được hỗ trợ bao gồm Visual Studio (2010–2026), Xamarin và MonoDevelop 2.4+.
IDE: Visual Studio 2017–2026, JetBrains Rider, MonoDevelop.
Các định dạng mẫu / đầu ra được hỗ trợ: DOC, DOCX, RTF, DOT, DOTX, DOTM, DOCM, Word 2003 XML và Word 2007 XML.
Dịch một tài liệu
Dịch tài liệu của bạn sang bất kỳ ngôn ngữ nào được biểu thị trong Ngôn ngữ liệt kê:
Document doc = new Document(MyDir + "Document.docx");
string apiKey = Environment.GetEnvironmentVariable("API_KEY");
// Use Google generative language models.
AiModel model = AiModel.Create(AiModelType.GeminiFlashLatest).WithApiKey(apiKey);
Document translatedDoc = model.Translate(doc, Language.Arabic);
translatedDoc.Save(ArtifactsDir + "AI.AiTranslate.docx");Tóm tắt một tài liệu
Tạo bản tóm tắt tài liệu, chỉ định độ dài:
- Rất ngắn – 1-2 câu
- Ngắn – 3-4 câu
- Trung bình – 5-6 câu
- Dài – 7-10 câu
- Rất dài – 11-20 câu
Document firstDoc = new Document("Big document.docx");
Document secondDoc = new Document("Document.docx");
string apiKey = Environment.GetEnvironmentVariable("API_KEY");
// Use OpenAI or Google generative language models.
AiModel model = ((OpenAiModel)AiModel.Create(AiModelType.Gpt4OMini).WithApiKey(apiKey)).WithOrganization("Organization").WithProject("Project");
SummarizeOptions options = new SummarizeOptions();
options.SummaryLength = SummaryLength.Short;
Document oneDocumentSummary = model.Summarize(firstDoc, options);
oneDocumentSummary.Save("AI.AiSummarize.One.docx");
options.SummaryLength = SummaryLength.Long;
Document multiDocumentSummary = model.Summarize(new Document[] { firstDoc, secondDoc }, options);
multiDocumentSummary.Save("AI.AiSummarize.Multi.docx");Kiểm tra ngữ pháp tài liệu
Kiểm tra ngữ pháp và phát hiện lỗi trong tài liệu:
Document doc = new Document(MyDir + "Big document.docx");
string apiKey = Environment.GetEnvironmentVariable("API_KEY");
// Use OpenAI generative language models.
AiModel model = AiModel.Create(AiModelType.Gpt4OMini).WithApiKey(apiKey);
CheckGrammarOptions grammarOptions = new CheckGrammarOptions();
grammarOptions.ImproveStylistics = true;
Document proofedDoc = model.CheckGrammar(doc, grammarOptions);
proofedDoc.Save("AI.AiGrammar.docx");Câu hỏi thường gặp
- Q: Những định dạng tệp nào có thể sử dụng với Document AI cho .NET? Cái Aspose.Words Document AI for .NET plugin hỗ trợ các định dạng DOC, DOCX, RTF, DOT, DOTX, DOTM, DOCM, Word 2003 XML và Word 2007 XML.
- Q: Tôi có thể sử dụng những mô hình nào với Aspose.Words Document AI cho .NET? Document AI cho .NET có thể được tích hợp với các LLM như Gemini, Claude và OpenAI.