From a64d70e7f7dc7804d760c7c489dfe651e00de8bf Mon Sep 17 00:00:00 2001 From: QueenieZqq <46456163+QueenieZqq@users.noreply.github.com> Date: Thu, 20 Nov 2025 14:00:01 -0800 Subject: [PATCH 1/4] Update API shape to support multiple labels per correction. --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 59b5504..b499a7f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Web applications can also benefit from such proofreading capability. This propos 1. Error Correction: Correct input text by the user -2. Error Labeling: For each correction made to each error in the input text, label the error type (e.g. spelling, punctuation, etc.) +2. Error Labeling: For each correction made to each error in the input text, label the error type(s) (e.g. spelling, punctuation, etc.) 3. Error Explanation: Annotates each error with a plain language explanation Note that Labeling & Explanation are independent features that can be either added or dropped. @@ -50,7 +50,7 @@ const proofreader = await Proofreader.create({ const corrections = await proofreader.proofread("I seen him yesterday at the store, and he bought two loafs of bread."); ``` -`proofread()` corrects the input text and returns a list of corrections made. Additional proofreading features can be configured using includeCorrectionTypes and `includeCorrectionExplanations`. When `includeCorrectionTypes` is set to `true`, `proofread()` will provide an error type label for each correction made to each error. When `includeCorrectionExplanations` is set to `true`, `proofread()` will provide an annotation for each error with a plain language explanation. +`proofread()` corrects the input text and returns a list of corrections made. Additional proofreading features can be configured using includeCorrectionTypes and `includeCorrectionExplanations`. When `includeCorrectionTypes` is set to `true`, `proofread()` will provide the error type labels associated for each correction made to each error. When `includeCorrectionExplanations` is set to `true`, `proofread()` will provide an annotation for each error with a plain language explanation. Detailed design for the corrections output is [discussed later](#proofreading-correction-output). @@ -197,7 +197,7 @@ dictionary ProofreadCorrection { unsigned long long startIndex; unsigned long long endIndex; DOMString correction; - CorrectionType type; // exists if proofreader.includeCorrectionTypes === true + sequence type; // exists if proofreader.includeCorrectionTypes === true DOMString explanation; // exists if proofreader.includeCorrectionExplanations === true } @@ -206,6 +206,14 @@ enum CorrectionType { "spelling", "punctuation", "capitalization", "preposition" `type` only exists when the proofreader object is configured with `includeCorrectionTypes = true`, while `explanation` only exists when the proofreader object is configured with `includeCorrectionExplanations = true`. +Each correction could be associated with mutliple correction type labels. For example: + +```js +const original_text = "`thatd` a good amt of time!!! !" // `thatd` is the text to be corrected +const proofread_text = "`That's` a good amount of time!" // `That's` is the corrected text +``` +where the correction from "thatd" to "That's" contains three types of correction - "Captilization", "Spelling" and "Punctuation". When there's only one label, the sequence will be of size 1. + Not all correction types here will be applicable to all languages, and in the future we might propose more specific correction types. The generic catch-all type, if no more-specific type matches, is `"grammar"`. To get an error in the input, use `input.substring(startIndex, endIndex)`. Corrections in the `corrections` list will be organized in ascending order based on the `startIndex` of the correction. From 1f2104d5af8d91fc25be51169f94d313487dc6f6 Mon Sep 17 00:00:00 2001 From: QueenieZqq <46456163+QueenieZqq@users.noreply.github.com> Date: Wed, 10 Dec 2025 21:14:07 -0800 Subject: [PATCH 2/4] Fix typo in README.md Co-authored-by: Reilly Grant --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b499a7f..bcc4110 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ enum CorrectionType { "spelling", "punctuation", "capitalization", "preposition" `type` only exists when the proofreader object is configured with `includeCorrectionTypes = true`, while `explanation` only exists when the proofreader object is configured with `includeCorrectionExplanations = true`. -Each correction could be associated with mutliple correction type labels. For example: +Each correction could be associated with multiple correction type labels. For example: ```js const original_text = "`thatd` a good amt of time!!! !" // `thatd` is the text to be corrected From 6143e1d20f9c3e1ffb9aea2f84cc1fcee2e6eab5 Mon Sep 17 00:00:00 2001 From: QueenieZqq <46456163+QueenieZqq@users.noreply.github.com> Date: Wed, 10 Dec 2025 21:14:23 -0800 Subject: [PATCH 3/4] Fix typo in README.md Co-authored-by: Reilly Grant --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bcc4110..2984ec3 100644 --- a/README.md +++ b/README.md @@ -212,7 +212,7 @@ Each correction could be associated with multiple correction type labels. For ex const original_text = "`thatd` a good amt of time!!! !" // `thatd` is the text to be corrected const proofread_text = "`That's` a good amount of time!" // `That's` is the corrected text ``` -where the correction from "thatd" to "That's" contains three types of correction - "Captilization", "Spelling" and "Punctuation". When there's only one label, the sequence will be of size 1. +where the correction from "thatd" to "That's" contains three types of correction - "Capitalization", "Spelling" and "Punctuation". When there's only one label, the sequence will be of size 1. Not all correction types here will be applicable to all languages, and in the future we might propose more specific correction types. The generic catch-all type, if no more-specific type matches, is `"grammar"`. From 15c27459626a389ea54ab8d5185ce83a686c5d94 Mon Sep 17 00:00:00 2001 From: QueenieZqq <46456163+QueenieZqq@users.noreply.github.com> Date: Wed, 10 Dec 2025 21:17:43 -0800 Subject: [PATCH 4/4] Update full web IDL. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2984ec3..1479dc0 100644 --- a/README.md +++ b/README.md @@ -297,7 +297,7 @@ dictionary ProofreadCorrection { unsigned long long startIndex; unsigned long long endIndex; DOMString correction; - CorrectionType type; + sequence type; DOMString explanation; };