@@ -14,7 +14,84 @@ Assume Explicit For: yes
1414Die On : warning
1515</pre>
1616
17- Introduction {#intro}
18- =====================
17+ <pre class="anchors">
18+ urlPrefix: https://tc39.es/ecma402/; spec: ECMA-402
19+ type: dfn
20+ text: [[AvailableLocales]] ; url: sec-internal-slots
21+ text: Unicode canonicalized locale identifier; url: sec-language-tags
22+ type: abstract-op
23+ text: LookupMatchingLocaleByBestFit; url: sec-lookupmatchinglocalebybestfit
24+ text: IsStructurallyValidLanguageTag; url: sec-isstructurallyvalidlanguagetag
25+ text: CanonicalizeUnicodeLocaleId; url: sec-canonicalizeunicodelocaleid
26+ urlPrefix: https://tc39.es/ecma262/; spec: ECMA-262
27+ type: abstract-op
28+ text: floor; url: eqn-floor
29+ type: dfn
30+ text: current realm; url: current-realm
31+ </pre>
32+
33+ <style>
34+ dl.props { display: grid; grid-template-columns: max-content auto; row-gap: 0.25em; column-gap: 1em; }
35+ dl.props > dt { grid-column-start: 1; margin: 0; }
36+ dl.props > dd { grid-column-start: 2; margin: 0; }
37+ p + dl.props { margin-top: -0.5em; }
38+
39+ .enum-table tbody th { white-space: nowrap; }
40+ </style>
41+
42+ <h2 id="intro">Introduction</h2>
43+
44+ For now, see the [explainer] (https://github.com/webmachinelearning/proofreader-api/blob/main/README.md).
45+
46+ <h2 id="proofreader-api">The proofreader API</h2>
47+
48+ <xmp class="idl">
49+ [Exposed=Window, SecureContext]
50+ interface Proofreader {
51+ static Promise<Proofreader> create(optional ProofreaderCreateOptions options = {});
52+ static Promise<Availability> availability(optional ProofreaderCreateCoreOptions options = {});
53+
54+ Promise<ProofreadResult> proofread(
55+ DOMString input,
56+ optional ProofreaderProofreadOptions options = {}
57+ );
58+
59+ readonly attribute boolean includeCorrectionTypes;
60+ readonly attribute boolean includeCorrectionExplanations;
61+
62+ readonly attribute FrozenArray<DOMString>? expectedInputLanguages;
63+ readonly attribute DOMString? outputLanguage;
64+ };
65+
66+ dictionary ProofreaderCreateCoreOptions {
67+ boolean includeCorrectionTypes = false;
68+ boolean includeCorrectionExplanations = false;
69+
70+ sequence<DOMString> expectedInputLanguages;
71+ DOMString outputLanguage;
72+ };
73+
74+ dictionary ProofreaderCreateOptions : ProofreaderCreateCoreOptions {
75+ AbortSignal signal;
76+ CreateMonitorCallback monitor;
77+ };
78+
79+ dictionary ProofreaderProofreadOptions {
80+ AbortSignal signal;
81+ };
82+
83+ dictionary ProofreadResult {
84+ DOMString correctedInput;
85+ sequence<ProofreadCorrection> corrections;
86+ }
87+
88+ dictionary ProofreadCorrection {
89+ unsigned long long startIndex;
90+ unsigned long long endIndex;
91+ DOMString correction;
92+ sequence<CorrectionType> type;
93+ DOMString explanation;
94+ }
1995
20- For now, see the [explainer] (https://github.com/webmachinelearning/proofreader-api).
96+ enum CorrectionType { "spelling", "punctuation", "capitalization", "preposition", "missing-words", "grammar" };
97+ </xmp>
0 commit comments