<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/text/text_proofreader.py#L226-L393) |

Performs proofreading on text.

    mp.tasks.text.TextProofreader(
        lib: serial_dispatcher.SerialDispatcher, handle: ctypes.c_void_p
    )

## Methods

### `close`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/text/text_proofreader.py#L376-L382)

    close()

Shuts down the MediaPipe task instance.

### `create_from_model_path`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/text/text_proofreader.py#L270-L288)

    @classmethod
    create_from_model_path(
        model_path: str
    ) -> 'TextProofreader'

Creates a `TextProofreader` object from model path.

<br />

<br />

<br />

| Args ||
|---|---|
| `model_path` | Path to the model. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| `TextProofreader` object that's created from the model file and the default `TextProofreaderOptions`. ||

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ValueError` | If failed to create `TextProofreader` object from the provided file such as invalid file path. |
| `RuntimeError` | If other types of error occurred. |

<br />

### `create_from_options`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/text/text_proofreader.py#L290-L316)

    @classmethod
    create_from_options(
        options: https://developers.google.com/edge/api/mediapipe/python/mp/tasks/text/TextProofreaderOptions
    ) -> 'TextProofreader'

Creates the `TextProofreader` object from text proofreader options.

<br />

<br />

<br />

| Args ||
|---|---|
| `options` | Options for the text proofreader task. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| `TextProofreader` object that's created from `options`. ||

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ValueError` | If failed to create `TextProofreader` object from `TextProofreaderOptions` such as missing the model. |
| `RuntimeError` | If other types of error occurred. |

<br />

### `proofread`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/text/text_proofreader.py#L318-L342)

    proofread(
        text: str
    ) -> https://developers.google.com/edge/api/mediapipe/python/mp/tasks/text/TextProofreaderResult

Performs proofreading on the input `text`.

<br />

<br />

<br />

| Args ||
|---|---|
| `text` | The input text. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A `TextProofreaderResult` object that contains the proofread text. ||

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ValueError` | If any of the input arguments is invalid. |
| `RuntimeError` | If proofreading failed to run. |

<br />

### `proofread_async`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/text/text_proofreader.py#L344-L374)

    proofread_async(
        text: str,
        result_callback: Callable[[Optional[TextProofreaderResult], Optional[str]], None]
    ) -> None

Performs proofreading on the input `text` asynchronously.

<br />

<br />

<br />

| Args ||
|---|---|
| `text` | The input text. |
| `result_callback` | A callback function that will be called with the TextProofreaderResult and an error message (if any). |

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ValueError` | If any of the input arguments is invalid, or if proofread_async is called before the previous call has finished. |
| `RuntimeError` | If proofreading failed to run. |

<br />

### `__enter__`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/text/text_proofreader.py#L384-L386)

    __enter__()

Returns `self` upon entering the runtime context.

### `__exit__`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/text/text_proofreader.py#L388-L390)

    __exit__(
        unused_exc_type, unused_exc_value, unused_traceback
    )

Shuts down the MediaPipe task instance on exit of the context manager.