MediaPipeTasksText Framework Reference

TextProofreader

class TextProofreader : NSObject

Performs proofreading on text using a LiteRT-LM model asset bundle.

  • Creates a new instance of TextProofreader from an absolute path to a model asset bundle.

    Declaration

    Swift

    convenience init(modelPath: String) throws

    Parameters

    modelPath

    Absolute path to a model file on the device.

    Return Value

    A new instance of TextProofreader.

  • Creates a new instance of TextProofreader from the given TextProofreaderOptions.

    Declaration

    Swift

    init(options: TextProofreaderOptions) throws

    Parameters

    options

    The TextProofreaderOptions used to configure the proofreader.

    Return Value

    A new instance of TextProofreader.

  • Performs proofreading on the input text.

    Declaration

    Swift

    func proofread(text: String) throws -> TextProofreaderResult

    Parameters

    text

    The String on which proofreading is to be performed.

    Return Value

    A TextProofreaderResult containing the proofread text and corrections.

  • Performs proofreading on the input text and delivers incremental results via the completion handler.

    Declaration

    Swift

    func proofreadStreaming(text: String, completion: @escaping (TextProofreaderResult?, Error?) -> Void) throws

    Parameters

    text

    The input text to proofread.

    completion

    Callback invoked with incremental proofreading results.

  • Shuts down the TextProofreader when all work is done.

    Declaration

    Swift

    func close() throws