การตรวจสอบไวยากรณ์
การตรวจสอบไวยากรณ์ในเอกสารเป็นสิ่งสำคัญเพื่อให้แน่ใจว่าชัดเจนความเป็นมืออาชีพและความถูกต้อง เอกสารที่เขียนได้ดีทำให้เกิดความประทับใจในเชิงบวกและหลีกเลี่ยงความเข้าใจผิด การตรวจสอบไวยากรณ์ช่วยระบุและแก้ไขข้อผิดพลาดได้อย่างรวดเร็วช่วยประหยัดเวลาและปรับปรุงคุณภาพ.
Aspose.Wordsช่วยให้ผู้ใช้สามารถตรวจสอบไวยากรณ์และตรวจจับข้อผิดพลาดในเอกสารโดยใช้แบบจำลองOpenAI ใช้วิธีการCheckGrammarที่มีอยู่ในเนมสเปซAspose.Words.AI CheckGrammarวิเคราะห์ข้อความในเอกสารและเน้นปัญหาทางไวยากรณ์.
ตัวอย่างรหัสต่อไปนี้แสดงวิธีใช้GPT-4o miniรุ่นในAspose.Wordsเพื่อตรวจสอบไวยากรณ์:
// 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"); |