Grammar Checking

Contents
[ ]

Checking grammar in documents is important to ensure clarity, professionalism, and accuracy. Well-written documents leave a positive impression and avoid misunderstandings. Grammar checks help identify and correct errors quickly, saving time and improving quality.

Aspose.Words allows users to check grammar and detect errors in documents using the OpenAI, Google, and Anthropic models’ families listed in the AiModelType enumeration. Use the checkGrammar method, available in the Aspose.Words.AI namespace. checkGrammar analyzes the text in a document and highlights grammatical problems.

The following code example shows how to use the GPT‑4o mini model in Aspose.Words to check grammar:


FAQ

  1. Q: Which AI models can I use with checkGrammar?
    A: The AiModelType enumeration lists the supported families: OpenAI (e.g., Gpt4OMini), Google (e.g., GeminiProLatest), and Anthropic (e.g., Claude35Haiku). Pass the value to aw.AI.AiModel.create(...) (or use a factory method such as createGpt4OMini()) and call checkGrammar on the returned model.

  2. Q: Do I need a separate license for the AI features?
    A: No. AI capabilities are included with a regular Aspose.Words license. Ensure your license file is applied before invoking checkGrammar.

  3. Q: What should I do if my document is very large?
    A: checkGrammar works on the whole document, but very large files may exceed service limits. Split the document into smaller sections (e.g., by chapter) and call checkGrammar on each part, then combine the results.

  4. Q: How can I tell whether any grammar issues were found?
    A: The method returns a new Document with the corrected text. With CheckGrammarOptions.makeRevisions set to true, the corrections are made as revisions, and result.revisions.count equal to zero means that no issues were detected.