ตรวจจับและไฮไลท์ข้อผิดพลาดด้านไวยากรณ์ในเอกสารโดยใช้โมเดล AI ของ OpenAI, Google และ Claude ร่วมกับ Aspose.Words สำหรับ Node.js via .NET วิธีการ CheckGrammar จะวิเคราะห์ไฟล์ DOC, DOCX, RTF, PDF, HTML, Markdown, ODT, TXT และ EPUB และทำเครื่องหมายข้อผิดพลาดด้านไวยากรณ์ — ช่วยให้คุณสร้างเนื้อหาที่เรียบหรูและเป็นมืออาชีพโดยไม่ต้องตรวจทานด้วยตนเอง
การรับรองความถูกต้องต้องใช้คีย์ API จากผู้ให้บริการ AI ที่คุณเลือก สำหรับรายการโมเดลที่รองรับทั้งหมด ดูที่ เอกสารอ้างอิง API.
เริ่มตรวจสอบไวยากรณ์ใน JavaScript วันนี้ — ลองดูเดโมสดด้านบน
npm install @aspose/words
สำเนา
const aw = require('@aspose/words');
const doc = new aw.Document("Document.docx");
const apiKey = process.env.API_KEY;
// ใช้โมเดลภาษาเชิงกำเนิดของ OpenAI
const model = aw.AI.AiModel.createGpt4OMini();
model.setApiKey(apiKey);
const grammarOptions = new aw.AI.CheckGrammarOptions();
grammarOptions.improveStylistics = true;
const proofedDoc = model.checkGrammar(doc, grammarOptions);
proofedDoc.save("Output.docx");
const aw = require('@aspose/words');
const doc = new aw.Document("Document.docx");
// Pass an empty string if the self-hosted model does not require an API key.
const model = new CustomAiModel("my-model-24b", "https://your-server.com/v1");
model.setApiKey("");
const grammarOptions = new aw.AI.CheckGrammarOptions();
grammarOptions.improveStylistics = true;
const proofedDoc = model.checkGrammar(doc, grammarOptions);
proofedDoc.save("Output.docx");
class CustomAiModel extends aw.AI.OpenAiModel {
constructor(name, url) {
super(name);
this._url = url;
}
get url() {
return this._url;
}
}
We host our Node.js via .Net packages in NPM repositories. Please follow the step-by-step instructions on how to install "Aspose.Words for Node.js via .NET" to your developer environment.
This package is compatible with Node.js 14.17.0 or higher.