GrammarChecker.CheckGrammar

GrammarChecker CheckGrammar method. Checks grammar of the provided document. This operation leverages the connected AI model for checking grammar of document.

CheckGrammar(string, string, AiModelCheckGrammarOptions)

Checks grammar of the provided document. This operation leverages the connected AI model for checking grammar of document.

public static void CheckGrammar(string inputFile, string outputFile, AiModel model, 
    CheckGrammarOptions options = null)
ParameterTypeDescription
inputFileStringThe input file name.
outputFileStringThe output file name.
modelAiModelSpecifies the AI model responsible for generating the summary of a document.
optionsCheckGrammarOptionsSet of options used while checking grammar of a document using AI.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.

Examples

Shows how to create custom OpenAiModel and perform grammar checking.

string apiUrl = Environment.GetEnvironmentVariable("CUSTOM_OPENAI_URL", EnvironmentVariableTarget.User);
string apiName = Environment.GetEnvironmentVariable("CUSTOM_OPENAI_NAME", EnvironmentVariableTarget.User);
string apiKey = Environment.GetEnvironmentVariable("CUSTOM_OPENAI_KEY", EnvironmentVariableTarget.User);

AiModel model = OpenAiModel.Create(apiUrl, apiName, apiKey);

CheckGrammarOptions options = new CheckGrammarOptions() { MakeRevisions = true };

GrammarChecker.CheckGrammar(MyDir + "SimpleAI.docx", ArtifactsDir + "CheckGrammar.docx", model, options);

See Also


CheckGrammar(string, string, SaveFormatAiModelCheckGrammarOptions)

Checks grammar of the provided document. This operation leverages the connected AI model for checking grammar of document.

public static void CheckGrammar(string inputFile, string outputFile, SaveFormat saveFormat, 
    AiModel model, CheckGrammarOptions options = null)
ParameterTypeDescription
inputFileStringThe input file name.
outputFileStringThe output file name.
saveFormatSaveFormatThe save format.
modelAiModelSpecifies the AI model responsible for generating the summary of a document.
optionsCheckGrammarOptionsSet of options used while checking grammar of a document using AI.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.

See Also


CheckGrammar(Stream, Stream, SaveFormatAiModelCheckGrammarOptions)

Checks grammar of the provided document. This operation leverages the connected AI model for checking grammar of document.

public static void CheckGrammar(Stream inputStream, Stream outputStream, SaveFormat saveFormat, 
    AiModel model, CheckGrammarOptions options = null)
ParameterTypeDescription
inputStreamStreamThe input stream.
outputStreamStreamThe output stream.
saveFormatSaveFormatThe save format.
modelAiModelSpecifies the AI model responsible for generating the summary of a document.
optionsCheckGrammarOptionsSet of options used while checking grammar of a document using AI.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.

See Also