CheckGrammarOptions class

CheckGrammarOptions class

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

Constructors

NameDescription
CheckGrammarOptions()The default constructor.

Properties

NameDescription
improve_stylisticsAllows to specify either AI will try to improve stylistics of the text being proofed. Default value is False.
make_revisionsAllows to specify either final or revised document to be returned with proofed text. Default value is False.
preserve_formattingAllows to specify either IAiModelText.check_grammar() 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.

doc = aw.Document(file_name=MY_DIR + 'Big document.docx')
api_key = system_helper.environment.Environment.get_environment_variable('API_KEY')
# Use OpenAI generative language models.
model = aw.ai.AiModel.create(aw.ai.AiModelType.GPT_4O_MINI).with_api_key(api_key).as_open_ai_model()
grammar_options = aw.ai.CheckGrammarOptions()
grammar_options.improve_stylistics = True
proofed_doc = model.check_grammar(doc, grammar_options)
proofed_doc.save(file_name=ARTIFACTS_DIR + 'AI.AiGrammar.docx')

See Also