-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Fundamentally, the Proofreader API functions similarly to a traditional Spellchecking API. Across the ecosystem, spellcheckers consistently handle ambiguity by providing multiple alternative suggestions for a single problematic text range. While LLMs are generally better at context, ambiguity remains inevitable (e.g., "Teh sheep" could imply either "Ten sheep" or "The sheep").
The current specification theoretically handles this by potentially returning multiple ProofreadCorrection objects for the same index range, but this creates significant friction:
correctedInput. This field implies a single, canonical result. If multiple corrections exist for the same span, it is mathematically impossible to construct a definitivecorrectedInput.- Ordering: It is unclear which correction object represents the "best" or "primary" suggestion.
- Redundant Streaming: Explaining the error should happen once, not repeatedly for every possible solution.
Proposal
I suggest grouping alternate suggestions within a single correction object. This allows correctedInput to deterministically apply the first suggestion in the list while preserving alternatives for the UI.
dictionary ProofreadCorrection {
unsigned long long startIndex;
unsigned long long endIndex;
sequence<DOMString> suggestions;
CorrectionType type; // exists if proofreader.includeCorrectionTypes === true
DOMString explanation; // exists if proofreader.includeCorrectionExplanations === true
}
Just to clarify, I am not suggesting that every implementation would support this. The point is merely to support such suggestions if the proofreading engine supports it.