-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Summary
The current Proofreader API
proposal provides a powerful general-purpose tool for correcting text. However, in many real-world applications (e.g., technical documentation, brand communications, specialized forums), there are specific words, acronyms, or proper nouns that are correct in context but would be flagged as errors by a general model.
This proposal suggests adding support for a user-provided custom dictionary to prevent the proofreader from incorrectly "correcting" these specific terms. This aligns with the "Alternatives considered" section, which mentions deferring this feature, and serves to formally open the discussion.
Problem & Use Case
A developer building a note-taking app for software engineers or a content editor for a specific brand would face a common problem:
- Technical Jargon: Terms like
WebAssembly
,DOMString
,shim
,polyfill
, or internal project codenames would be flagged as spelling errors. - Brand/Product Names: Company or product names like
Figma
,Asana
, or even a user's own company name might be incorrectly corrected. - Acronyms: Industry-specific acronyms (e.g.,
SRE
,KPI
,OKR
) could be flagged.
Currently, the developer has no way to tell the API, "This word is correct, please ignore it." This leads to a poor user experience where users are shown incorrect suggestions for words they use every day.
Proposed Solution
Introduce a new option in the Proofreader.create()
method, tentatively named customDictionary
, which would accept an array of strings.
dictionary ProofreaderCreateCoreOptions {
boolean includeCorrectionTypes = false;
boolean includeCorrectionExplanations = false;
DOMString correctionExplanationLanguage;
sequence<DOMString> expectedInputLanguages;
sequence<DOMString> customDictionary; // Proposed addition
};
// Example Usage:
const proofreader = await Proofreader.create({
expectedInputLanguages: ["en"],
customDictionary: ["WebAssembly", "Figma", "SRE", "MyProjectCodename"]
});
// The proofreader would now avoid flagging "WebAssembly", "Figma", etc.
const result = await proofreader.proofread("I am using Figma to design the MyProjectCodename UI. It uses WebAssembly.");
// Expected: No corrections would be suggested for the custom dictionary words.
The underlying implementation would ensure that any word present in the customDictionary is not treated as a spelling or grammar error. The explainer notes that this could be tricky if ignoring a word changes the sentence structure. The initial implementation could focus on the most common use case: preventing spelling corrections for specific nouns.
## Benefits
Increased Accuracy: Reduces false positives, making the tool more reliable and trustworthy for specialized content.
Greatly Improved UX: Empowers developers to tailor the proofreading experience to their specific domain, preventing user frustration.
Enables New Applications: Makes the API viable for technical documentation editors, internal knowledge bases, and other professional writing tools.
This feature is a common and essential part of most existing proofreading tools (e.g., "Add to dictionary") and would be a critical addition for widespread adoption of this API.