GrammarChecker.CheckGrammarToImages

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

CheckGrammarToImages(string, ImageSaveOptionsAiModelCheckGrammarOptions)

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

public static Stream[] CheckGrammarToImages(string inputFile, ImageSaveOptions saveOptions, 
    AiModel model, CheckGrammarOptions options = null)
ParameterTypeDescription
inputFileStringThe input file name.
saveOptionsImageSaveOptionsImage save options.
modelAiModelSpecifies the AI model responsible for generating the summary of a document.
optionsCheckGrammarOptionsSet of options used while checking grammar of a document using AI.

Return Value

Returns array of image streams. The streams should be disposed by the end user.

Examples

Demonstrates how to check grammar in a document and save the result as an array of image streams.

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() { PreserveFormatting = true };

Stream[] pages = GrammarChecker.CheckGrammarToImages(MyDir + "SimpleAI.docx", new ImageSaveOptions(SaveFormat.Png), model, options);

See Also


CheckGrammarToImages(Stream, ImageSaveOptionsAiModelCheckGrammarOptions)

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

public static Stream[] CheckGrammarToImages(Stream inputStream, ImageSaveOptions saveOptions, 
    AiModel model, CheckGrammarOptions options = null)
ParameterTypeDescription
inputStreamStreamThe input stream.
saveOptionsImageSaveOptionsImage save options.
modelAiModelSpecifies the AI model responsible for generating the summary of a document.
optionsCheckGrammarOptionsSet of options used while checking grammar of a document using AI.

Return Value

Returns array of image streams. The streams should be disposed by the end user.

See Also