CheckGrammar

IAiModelText.CheckGrammar method

Überprüft die Grammatik des bereitgestellten Dokuments. Dieser Vorgang nutzt das verbundene KI-Modell zur Überprüfung der Grammatik des Dokuments.

public Document CheckGrammar(Document sourceDocument, CheckGrammarOptions options = null)
ParameterTypBeschreibung
sourceDocumentDocumentDas Dokument wird auf Grammatik geprüft.
optionsCheckGrammarOptionsOptionale Einstellungen zur Steuerung der Grammatikprüfung.

Rückgabewert

Ein neuesDocument mit geprüfter Grammatik.

Beispiele

Zeigt, wie die Grammatik eines Dokuments überprüft wird.

Document doc = new Document(MyDir + "Big document.docx");

string apiKey = Environment.GetEnvironmentVariable("API_KEY");
// Verwenden Sie generative Sprachmodelle von OpenAI.
IAiModelText model = (OpenAiModel)AiModel.Create(AiModelType.Gpt4OMini).WithApiKey(apiKey);

CheckGrammarOptions grammarOptions = new CheckGrammarOptions();
grammarOptions.ImproveStylistics = true;

Document proofedDoc = model.CheckGrammar(doc, grammarOptions);
proofedDoc.Save(ArtifactsDir + "AI.AiGrammar.docx");

Siehe auch