Skip to content

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

The existing API only supports basic proofreading functionality - given
an input, execute the model to return the fully corrected text and
algorithmically find the list of corrections made on input that would
produce the corrected text.

This CL implements additional model executions for getting correction
type labels for all corrections and return as part of ProofreadResult if
requested by user.

-proofread(): If correction types are requested, after finding the list
of corrections, execute the model to get correction type one-by-one.
Once all correction type labels are received, resolve the promise for
proofread() with the final result.

The model execution for fetching correction types expects requests in
the following format:

Input: "can you profread fir me",
Corrected input: "Can you proofread for me?",
Correction instruction: "Correcting can to Can".

The model is trained with the above format, where backticks are used to
annotate the error and correction.

Minor change:
-GetCorrections() is added to get the raw corrections
(describing locations of both the errors in the original text and the
corresponding correction in the corrected text). This is refactored from
previous GetProofreadingCorrections() which sets the relevant fields of
ProofreadResult directly. We need the raw corrections' locations to help
annotate the model execution request for fetching correction types.

For more context about the API, please see the explainer published here:
https://github.com/webmachinelearning/proofreader-api/blob/main/README.md

Bug: 403313556, 429259028
Change-Id: I058518a8da37ca94b44620dbecf40438bb8ba63f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6863178
Reviewed-by: Mike Wasserman <msw@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Commit-Queue: Queenie Zhang <queeniezhang@google.com>
Cr-Commit-Position: refs/heads/main@{#1508070}

The existing API only supports basic proofreading functionality - given
an input, execute the model to return the fully corrected text and
algorithmically find the list of corrections made on input that would
produce the corrected text.

This CL implements additional model executions for getting correction
type labels for all corrections and return as part of ProofreadResult if
requested by user.

-proofread(): If correction types are requested, after finding the list
of corrections, execute the model to get correction type one-by-one.
Once all correction type labels are received, resolve the promise for
proofread() with the final result.

The model execution for fetching correction types expects requests in
the following format:

Input: "`can` you profread fir me",
Corrected input: "`Can` you proofread for me?",
Correction instruction: "Correcting `can` to `Can`".

The model is trained with the above format, where backticks are used to
annotate the error and correction.

Minor change:
-GetCorrections() is added to get the raw corrections
(describing locations of both the errors in the original text and the
corresponding correction in the corrected text). This is refactored from
previous GetProofreadingCorrections() which sets the relevant fields of
ProofreadResult directly. We need the raw corrections' locations to help
annotate the model execution request for fetching correction types.

For more context about the API, please see the explainer published here:
https://github.com/webmachinelearning/proofreader-api/blob/main/README.md

Bug: 403313556, 429259028
Change-Id: I058518a8da37ca94b44620dbecf40438bb8ba63f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6863178
Reviewed-by: Mike Wasserman <msw@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Commit-Queue: Queenie Zhang <queeniezhang@google.com>
Cr-Commit-Position: refs/heads/main@{#1508070}
@chromium-wpt-export-bot chromium-wpt-export-bot marked this pull request as ready for review August 28, 2025 23:26
@wpt-pr-bot wpt-pr-bot added the ai label Aug 28, 2025
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot merged commit abd72b9 into master Aug 28, 2025
23 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-a33a7e6d4a branch August 28, 2025 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants