Aspose::Words::AI::CheckGrammarOptions class

CheckGrammarOptions class

Allows to specify various options while checking grammar of a document using AI.

class CheckGrammarOptions : public System::Object

Methods

MethodDescription
CheckGrammarOptions()
get_ImproveStylistics() constAllows to specify either AI will try to improve stylistics of the text being proofed. Default value is false.
get_MakeRevisions() constAllows to specify either final or revised document to be returned with proofed text. Default value is false.
get_PreserveFormatting() constAllows to specify either CheckGrammar() will try to preserve layout and formatting of the original document, or not. Default value is true.
GetType() const override
Is(const System::TypeInfo&) const override
set_ImproveStylistics(bool)Allows to specify either AI will try to improve stylistics of the text being proofed. Default value is false.
set_MakeRevisions(bool)Allows to specify either final or revised document to be returned with proofed text. Default value is false.
set_PreserveFormatting(bool)Allows to specify either CheckGrammar() will try to preserve layout and formatting of the original document, or not. Default value is true.
static Type()

Examples

Shows how to check the grammar of a document.

auto doc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Big document.docx");

System::String apiKey = System::Environment::GetEnvironmentVariable(u"API_KEY");
// Use OpenAI generative language models.
System::SharedPtr<Aspose::Words::AI::AiModel> model = Aspose::Words::AI::AiModel::Create(Aspose::Words::AI::AiModelType::Gpt4OMini)->WithApiKey(apiKey);

auto grammarOptions = System::MakeObject<Aspose::Words::AI::CheckGrammarOptions>();
grammarOptions->set_ImproveStylistics(true);

System::SharedPtr<Aspose::Words::Document> proofedDoc = model->CheckGrammar(doc, grammarOptions);
proofedDoc->Save(get_ArtifactsDir() + u"AI.AiGrammar.docx");

See Also