TextProofreader
final class TextProofreaderCorrects spelling and grammatical errors in input text and computes token-level diffs.
-
Creates a
TextProofreaderwith default options using the model file atmodelPath.Declaration
Swift
convenience init(modelPath: String) throws -
Creates a
TextProofreaderconfigured withoptions.Declaration
Swift
init(options: TextProofreaderOptions) throws -
Releases the underlying engine; subsequent calls are no-ops, and later proofreading calls throw
TasksErrorwith.failedPrecondition.Declaration
Swift
final func close() throws -
Proofreads
textsynchronously and returns the corrected text and edit segments.Declaration
Swift
final func proofread(text: String) throws -> TextProofreaderResult -
Streams incremental proofread chunks for
text, concluding with a final element whereisDoneistrueandcorrectionsis populated.Cancelling the returned
AsyncThrowingStreamstops yielding elements immediately while the underlying C engine finishes draining the active generation, during which overlapping proofreading calls orclose()throwTasksErrorwith.failedPrecondition.Declaration
Swift
final func proofreadStreaming(text: String) -> AsyncThrowingStream<TextProofreaderStreamResult, any Error>