Skip to content

Support in the API multiple correction options for the same range #35

@DavidMulder0

Description

@DavidMulder0

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 definitive correctedInput.
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions