CheckGrammarOptions
Inheritance: java.lang.Object
public class CheckGrammarOptions
Allows to specify various options while checking grammar of a document using AI.
Examples:
Shows how to check the grammar of a document.
Document doc = new Document(getMyDir() + "Big document.docx");
String apiKey = System.getenv("API_KEY");
// Use OpenAI generative language models.
IAiModelText model = (OpenAiModel)AiModel.create(AiModelType.GPT_4_O_MINI).withApiKey(apiKey);
CheckGrammarOptions grammarOptions = new CheckGrammarOptions();
grammarOptions.setImproveStylistics(true);
Document proofedDoc = model.checkGrammar(doc, grammarOptions);
proofedDoc.save(getArtifactsDir() + "AI.AiGrammar.docx");
Methods
Method | Description |
---|---|
getImproveStylistics() | Allows to specify either AI will try to improve stylistics of the text being proofed. |
getMakeRevisions() | Allows to specify either final or revised document to be returned with proofed text. |
getPreserveFormatting() | Allows to specify either IAiModelText.checkGrammar(com.aspose.words.Document, com.aspose.words.CheckGrammarOptions) will try to preserve layout and formatting of the original document, or not. |
setImproveStylistics(boolean value) | Allows to specify either AI will try to improve stylistics of the text being proofed. |
setMakeRevisions(boolean value) | Allows to specify either final or revised document to be returned with proofed text. |
setPreserveFormatting(boolean value) | Allows to specify either IAiModelText.checkGrammar(com.aspose.words.Document, com.aspose.words.CheckGrammarOptions) will try to preserve layout and formatting of the original document, or not. |
getImproveStylistics()
public boolean getImproveStylistics()
Allows to specify either AI will try to improve stylistics of the text being proofed. Default value is false .
Returns: boolean - The corresponding boolean value.
getMakeRevisions()
public boolean getMakeRevisions()
Allows to specify either final or revised document to be returned with proofed text. Default value is false .
Returns: boolean - The corresponding boolean value.
getPreserveFormatting()
public boolean getPreserveFormatting()
Allows to specify either IAiModelText.checkGrammar(com.aspose.words.Document, com.aspose.words.CheckGrammarOptions) will try to preserve layout and formatting of the original document, or not. Default value is true .
Remarks:
When the option is set to false , the quality of grammar checking is higher than when this option is set to true . However, the original formatting of the text is not preserved in this case.
Returns: boolean - The corresponding boolean value.
setImproveStylistics(boolean value)
public void setImproveStylistics(boolean value)
Allows to specify either AI will try to improve stylistics of the text being proofed. Default value is false .
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The corresponding boolean value. |
setMakeRevisions(boolean value)
public void setMakeRevisions(boolean value)
Allows to specify either final or revised document to be returned with proofed text. Default value is false .
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The corresponding boolean value. |
setPreserveFormatting(boolean value)
public void setPreserveFormatting(boolean value)
Allows to specify either IAiModelText.checkGrammar(com.aspose.words.Document, com.aspose.words.CheckGrammarOptions) will try to preserve layout and formatting of the original document, or not. Default value is true .
Remarks:
When the option is set to false , the quality of grammar checking is higher than when this option is set to true . However, the original formatting of the text is not preserved in this case.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | The corresponding boolean value. |