CheckGrammarOptions class
CheckGrammarOptions class
Allows to specify various options while checking grammar of a document using AI.
Constructors
Name | Description |
---|---|
CheckGrammarOptions() | The default constructor. |
Properties
Name | Description |
---|---|
improveStylistics | Allows to specify either AI will try to improve stylistics of the text being proofed. Default value is false . |
makeRevisions | Allows to specify either final or revised document to be returned with proofed text. Default value is false . |
preserveFormatting | Allows to specify either Aspose.Words.AI.IAiModelText.CheckGrammar(Aspose.Words.Document,Aspose.Words.AI.CheckGrammarOptions) will try to preserve layout and formatting of the original document, or not. Default value is true . |
Examples
Shows how to check the grammar of a document.
let doc = new aw.Document(base.myDir + "Big document.docx");
const apiKey = process.env.API_KEY;
if (!apiKey) {
console.warn("API_KEY environment variable is not set.");
return;
}
// Use OpenAI generative language models.
let model = aw.AI.AiModel.createGpt4OMini();
model.setApiKey(apiKey);
let grammarOptions = new aw.AI.CheckGrammarOptions();
grammarOptions.improveStylistics = true;
let proofedDoc = model.checkGrammar(doc, grammarOptions);
proofedDoc.save(base.artifactsDir + "AI.AiGrammar.docx");
See Also
- module Aspose.Words.AI