TextProofreader

public final class TextProofreader

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

Nested Classes

class TextProofreader.TextProofreaderOptions Options for setting up a TextProofreader. 

Public Methods

static TextProofreader
createFromFile(Context context, String modelPath)
Creates a TextProofreader instance from a model file and default TextProofreader.TextProofreaderOptions.
static TextProofreader
createFromFile(Context context, File modelFile)
Creates a TextProofreader instance from a model file and default TextProofreader.TextProofreaderOptions.
static TextProofreader
TextProofreaderResult
proofread(String text)
Performs proofreading on the input text and returns the proofread text and diff corrections.
void
proofreadAsync(String text, OutputHandler.ProgressListener<TextProofreaderStreamingResult> listener)
Performs streaming proofreading on the input text and invokes the listener with incremental chunks.
void
close()
Closes and cleans up the MediaPipe TextProofreader task.

Inherited Methods

Public Methods

public static TextProofreader createFromFile (Context context, String modelPath)

Creates a TextProofreader instance from a model file and default TextProofreader.TextProofreaderOptions.

Parameters
contextan Android Context.
modelPathpath to the text proofreader model.

public static TextProofreader createFromFile (Context context, File modelFile)

Creates a TextProofreader instance from a model file and default TextProofreader.TextProofreaderOptions.

Parameters
contextan Android Context.
modelFilethe text proofreader model File instance.

public static TextProofreader createFromOptions (Context context, TextProofreader.TextProofreaderOptions taskOptions)

Parameters
contextan Android Context.
taskOptionsa TextProofreaderOptions instance.

public TextProofreaderResult proofread (String text)

Performs proofreading on the input text and returns the proofread text and diff corrections.

Parameters
textthe input text to proofread.

public void proofreadAsync (String text, OutputHandler.ProgressListener<TextProofreaderStreamingResult> listener)

Performs streaming proofreading on the input text and invokes the listener with incremental chunks.

Parameters
textthe input text to proofread.
listenerprogress listener receiving streaming chunks.

public void close ()

Closes and cleans up the MediaPipe TextProofreader task.