Grammatikprüfung von Word‑, PDF‑ und Web‑Dokumenten in JavaScript

Grammatikprüfung von Dokumenten mit JavaScript.

Nahtlose Integration mit großen Sprachmodellen wie OpenAI, Claude und Gemini bietet umfangreiche KI-basierte Dokumentenverarbeitungsfunktionen für Node.js-Anwendungen.

Codeausschnitt anzeigen

KI-Grammatikprüfung für Dokumente in JavaScript

Erkennen und markieren Sie Grammatikfehler in Dokumenten mithilfe von KI-Modellen von OpenAI, Google und Claude mit Aspose.Words für Node.js via .NET. Die Methode CheckGrammar analysiert DOC-, DOCX-, RTF-, PDF-, HTML-, Markdown-, ODT-, TXT- und EPUB-Dateien und kennzeichnet grammatikalische Probleme – so erhalten Sie fehlerfreie, professionelle Inhalte ohne manuelles Korrekturlesen.

Warum Entwickler Aspose.Words für die Grammatikprüfung wählen

  • Ein einziger API-Aufruf zur Grammatikprüfung eines gesamten Dokuments
  • Unterstützung für die Modellfamilien OpenAI (GPT-4o), Google (Gemini) und Claude
  • Markierte Fehler im Ausgabedokument zur einfachen Überprüfung
  • Unterstützung für DOC, DOCX, RTF, PDF, ODT, HTML, Markdown, TXT, EPUB und mehr

Für die Authentifizierung ist ein API-Schlüssel Ihres gewählten KI-Anbieters erforderlich. Eine vollständige Liste der unterstützten Modelle finden Sie in der API-Referenz.

Beginnen Sie noch heute mit der Grammatikprüfung in JavaScript – testen Sie die Live-Demo oben.

Beispielcode in JavaScript zur Grammatikprüfung
Wählen Sie das Zielformat aus der Liste
Code ausführen
npm install @aspose/words
Kopieren
const aw = require('@aspose/words');

const doc = new aw.Document("Document.docx");
const apiKey = process.env.API_KEY;

// Verwenden Sie generative Sprachmodelle von 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;
    }
}
Code ausführen

Wie prüfe ich die Grammatik in einem Dokument mit JavaScript

  1. Installieren Sie Aspose.Words for Node.js via .NET.
  2. Fügen Sie Ihrem JavaScript‑Projekt einen Bibliotheksverweis (Import der Bibliothek) hinzu.
  3. Öffnen Sie die Quelldatei in JavaScript.
  4. Rufen Sie die Methode CheckGrammar auf und übergeben Sie Ihr Dokument.
  5. Nach Abschluss werden die grammatikalischen Probleme im Dokument hervorgehoben, und Sie können das Ergebnis als neue Datei im gewünschten Format speichern.

Node.js via .NET‑Bibliothek zur Grammatikprüfung

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.

System Requirements

This package is compatible with Node.js 14.17.0 or higher.

5%

Abonnieren Sie Produkt-Updates von Aspose

Erhalten Sie monatliche Newsletter und Angebote direkt in Ihre Mailbox.

© Aspose Pty Ltd 2001-2026. Alle Rechte vorbehalten.