语法检查
Contents
[
Hide
]
检查文档中的语法对于确保清晰度,专业性和准确性非常重要。 写得好的文件给人留下积极的印象,避免误解. 语法检查有助于快速识别和纠正错误,节省时间并提高质量。
Aspose.Words允许用户使用OpenAI生成模型检查语法并检测文档中的错误。 使用CheckGrammar方法,在Aspose.Words.AI命名空间中可用。 CheckGrammar分析文档中的文本并突出语法问题。
下面的代码示例演示如何使用Aspose.Words中的GPT-4o mini模型来检查语法:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git. | |
Document doc = new Document(MyDir + "Big document.docx"); | |
string apiKey = Environment.GetEnvironmentVariable("API_KEY"); | |
// Use OpenAI generative language models. | |
IAiModelText model = (IAiModelText)AiModel.Create(AiModelType.Gpt4OMini).WithApiKey(apiKey); | |
CheckGrammarOptions grammarOptions = new CheckGrammarOptions(); | |
grammarOptions.ImproveStylistics = true; | |
Document proofedDoc = model.CheckGrammar(doc, grammarOptions); | |
proofedDoc.Save("AI.AiGrammar.docx"); |
使用Aspose.Words检查语法可以提高工作质量,并可以轻松地将校对集成到项目中。 有关更多信息,请查看Aspose.Words.AIAPI文档。