You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The static <dfn method for="Proofreader">create(|options|)</dfn> method steps are:
100
+
101
+
1. Return the result of [=creating an AI model object=] given |options|, "{{proofreader}}", [=validate and canonicalize proofreader options=], [=computing proofreader options availability=], [=download the proofreader model=], [=initialize the proofreader model=], [=create a proofreader object=], and false.
102
+
</div>
103
+
104
+
<div algorithm>
105
+
To <dfn>validate and canonicalize proofreader options</dfn> given a {{ProofreaderCreateCoreOptions}} |options|, perform the following steps. They mutate |options| in place to canonicalize and deduplicate language tags, and throw an exception if any are invalid.
106
+
107
+
1. [=Validate and canonicalize language tags=] given |options| and "{{ProofreaderCreateCoreOptions/expectedInputLanguages}}".
108
+
109
+
1. [=Validate and canonicalize language tags=] given |options| and "{{ProofreaderCreateCoreOptions/correctionExplanationLanguage}}".
110
+
</div>
111
+
112
+
<div algorithm>
113
+
To <dfn>download the proofreader model</dfn>, given a {{ProofreaderCreateCoreOptions}} |options|:
114
+
115
+
1. [=Assert=]: these steps are running [=in parallel=].
116
+
117
+
1. Initiate the download process for everything the user agent needs to proofread text according to |options|. This could include a base AI model, fine-tunings for specific languages or option values, or other resources.
118
+
119
+
1. If the download process cannot be started for any reason, then return false.
120
+
121
+
1. Return true.
122
+
</div>
123
+
124
+
<div algorithm>
125
+
To <dfn>initialize the proofreader model</dfn>, given a {{ProofreaderCreateOptions}} |options|:
126
+
127
+
1. [=Assert=]: these steps are running [=in parallel=].
128
+
129
+
1. Perform any necessary initialization operations for the AI model backing the user agent's proofreading capabilities.
130
+
131
+
This could include loading the model into memory, or loading any fine-tunings necessary to support the other options expressed by |options|.
132
+
133
+
1. If initialization failed for any other reason, then return a [=DOMException error information=] whose [=DOMException error information/name=] is "{{OperationError}}" and whose [=DOMException error information/details=] contain appropriate detail.
134
+
135
+
1. Return null.
136
+
</div>
137
+
138
+
<div algorithm>
139
+
To <dfn>create a proofreader object</dfn>, given a [=ECMAScript/realm=] |realm| and a {{ProofreadererCreateOptions}} |options|:
140
+
141
+
1. [=Assert=]: these steps are running on |realm|'s [=ECMAScript/surrounding agent=]'s [=agent/event loop=].
142
+
143
+
1. Return a new {{Proofreader}} object, created in |realm|, with
144
+
145
+
<dl class="props">
146
+
boolean includeCorrectionTypes = false;
147
+
boolean includeCorrectionExplanations = false;
148
+
: [=Proofreader/whether to include correction types=]
149
+
:: |options|["{{ProofreaderCreateCoreOptions/includeCorrectionTypes}}"] default to false
150
+
151
+
: [=Proofreader/whether to include correction explanations=]
152
+
:: |options|["{{ProofreaderCreateCoreOptions/includeCorrectionExplanations}}"] default to false
153
+
154
+
: [=Proofreader/expected input languages=]
155
+
:: the result of [=creating a frozen array=] given |options|["{{ProofreaderCreateCoreOptions/expectedInputLanguages}}"] if it [=set/is empty|is not empty=]; otherwise null
156
+
157
+
: [=Proofreader/output language=]
158
+
:: |options|["{{ProofreaderCreateCoreOptions/outputLanguage}}"] if it [=map/exists=]; otherwise null
0 commit comments