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., GeminiPro), and Anthropic (e.g., ClaudeInstant). Choose the appropriate enum value when calling checkGrammar.

  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 collection of GrammarError objects. If the collection is empty, no issues were detected. You can check result.length (or the equivalent in your language) to determine this.