TextProofreader
class TextProofreader: NSObjectPerforms proofreading on text.
This API expects a LiteRT-LM model asset bundle.
-
Creates a new instance of
MPPTextProofreaderfrom an absolute path to a model asset bundle stored locally on the device and the defaultMPPTextProofreaderOptions.Declaration
Swift
convenience init(modelPath: String) throwsParameters
modelPathAn absolute path to a model file stored locally on the device.
Return Value
A new instance of
MPPTextProofreaderwith the given model path.nilif there is an error in initializing the text proofreader. -
Creates a new instance of
MPPTextProofreaderfrom the givenMPPTextProofreaderOptions.Declaration
Swift
init(options: TextProofreaderOptions) throwsParameters
optionsThe options of type
MPPTextProofreaderOptionsto use for configuring theMPPTextProofreader.Return Value
A new instance of
MPPTextProofreaderwith the given options.nilif there is an error in initializing the text proofreader. -
Shuts down the
MPPTextProofreaderwhen all the work is done.Declaration
Swift
func close() throws -
Performs proofreading on the input text.
Declaration
Swift
func proofread(text: String) throws -> TextProofreaderResultParameters
textThe
NSStringon which proofreading is to be performed.Return Value
A
MPPTextProofreaderResultobject that contains the complete proofread result. -
Performs proofreading on the input
textand returns the result incrementally via the callback.Declaration
Swift
func proofreadStreaming(text: String, completion completionHandler: @escaping (TextProofreaderStreamResult?, (any Error)?) -> Void) throwsParameters
textThe input text to be proofread.
completionHandlerThe completion handler invoked with the incremental proofreading result or an error.