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">availability(|options|)</dfn> method steps are:
166
166
167
167
1. Return the result of [=computing AI model availability=] given |options|, "{{Proofreader}}", [=validate and canonicalize proofreader options=], and [=compute proofreader options availability=].
168
-
</div>
168
+
</div>
169
169
170
170
<div algorithm>
171
171
To <dfn>compute proofreader options availability</dfn> given a {{ProofreaderCreateCoreOptions}} |options|, perform the following steps. They return either an {{Availability}} value or null, and they mutate |options| in place to update language tags to their best-fit matches.
1. Set |options|["{{ProofreaderCreateCoreOptions/correctionExplanationLanguage}}"] to |correctionExplanationLanguagesList|[0].
188
188
189
-
1. Return the [=Availability/minimum availability=] given « |availability|, |inputLanguageAvailability|, |contextLanguagesAvailability|, |correctionExplanationLanguageAvailability| ».
190
-
</div>
189
+
1. Return the [=Availability/minimum availability=] given « |availability|, |inputLanguageAvailability|, |correctionExplanationLanguageAvailability| ».
190
+
</div>
191
191
192
192
<div algorithm>
193
193
The <dfn>proofreader non-language options availability</dfn>, given a boolean |includeCorrectionTypes| and a boolean |includeCorrectionExplanations|, is given by the following steps. They return an {{Availability}} value or null.
1. If the user agent believes it will be able to [=model availability/support=] proofreading text according to |includeCorrectionTypes| and |includeCorrectionExplanations|, but only after performing a not-currently-ongoing download, then return "{{Availability/downloadable}}".
:: the result of [=getting the language availabilities partition=] given the purpose of producing text explanations of proofreading corrections in that language
A common setup seen in today's software is to support two types of written Chinese: "traditional Chinese" and "simplified Chinese". Let's suppose that the user agent supports summarizing text written in traditional Chinese with no downloads, and simplified Chinese after a download.
A <dfn>language availabilities partition</dfn> is a [=map=] whose [=map/keys=] are "{{Availability/downloading}}", "{{Availability/downloadable}}", or "{{Availability/available}}", and whose [=map/values=] are [=sets=] of strings representing [=Unicode canonicalized locale identifiers=]. [[!ECMA-402]]
256
+
257
+
A <dfn>language availabilities double</dfn> is a [=struct=] with the following [=struct/items=]:
258
+
259
+
* <dfn for="language availabilities double">input languages</dfn>, a [=language availabilities partition=]
To <dfn export>get the language availabilities partition</dfn> given a description |purpose| of the purpose for which we're checking language availability:
264
+
265
+
1. Let |partition| be «[ "{{Availability/available}}" → an empty [=set=], "{{Availability/downloading}}" → an empty [=set=], "{{Availability/downloadable}}" → an empty [=set=] ]».
266
+
267
+
1. [=list/For each=] human language |languageTag|, represented as a [=Unicode canonicalized locale identifier=], for which the user agent [=model availability/currently supports=] |purpose|:
268
+
269
+
1. [=set/Append=] |languageTag| to |partition|["{{Availability/available}}"].
270
+
271
+
1. [=list/For each=] human language |languageTag|, represented as a [=Unicode canonicalized locale identifier=], for which the user agent believes it will be able to [=model availability/support=] |purpose|, but only after finishing a download that is already ongoing:
272
+
273
+
1. [=set/Append=] |languageTag| to |partition|["{{Availability/downloading}}"].
274
+
275
+
1. [=list/For each=] human language |languageTag|, represented as a [=Unicode canonicalized locale identifier=], for which the user agent believes it will be able to [=model availability/support=] |purpose|, but only after performing a not-currently-ongoing download:
276
+
277
+
1. [=set/Append=] |languageTag| to |partition|["{{Availability/downloadable}}"].
278
+
279
+
1. [=Assert=]: |partition|["{{Availability/available}}"], |partition|["{{Availability/downloading}}"], and |partition|["{{Availability/downloadable}}"] are disjoint.
280
+
281
+
1. If the [=set/union=] of |partition|["{{Availability/available}}"], |partition|["{{Availability/downloading}}"], and |partition|["{{Availability/downloadable}}"] does not meet the [=language tag set completeness rules=], then:
282
+
283
+
1. Let |missingLanguageTags| be the [=set=] of missing language tags necessary for that union to meet the [=language tag set completeness rules=].
284
+
285
+
1. [=set/For each=] |languageTag| of |missingLanguageTags|:
286
+
287
+
1. <span id="language-tag-completeness-implementation-defined"></span>[=set/Append=] |languageTag| to one of the three sets. Which of the sets to append to is [=implementation-defined=], and should be guided by considerations similar to that of [$LookupMatchingLocaleByBestFit$] in terms of keeping "best fallback languages" together.
288
+
289
+
1. Return |partition|.
290
+
</div>
291
+
292
+
<div algorithm>
293
+
To <dfn export>compute language availability</dfn> given an [=ordered set=] of strings |requestedLanguages| and a [=language availabilities partition=] |partition|, perform the following steps. They return an {{Availability}} value, and they mutate |requestedLanguages| in place to update language tags to their best-fit matches.
294
+
295
+
1. Let |availability| be "{{Availability/available}}".
296
+
297
+
1. [=set/For each=] |language| of |requestedLanguages|:
298
+
299
+
1. Let |unavailable| be true.
300
+
301
+
1. [=list/For each=] |availabilityToCheck| of « "{{Availability/available}}", "{{Availability/downloading}}", "{{Availability/downloadable}}" »:
302
+
303
+
1. Let |languagesWithThisAvailability| be |partition|[|availabilityToCheck|].
304
+
305
+
1. Let |bestMatch| be [$LookupMatchingLocaleByBestFit$](|languagesWithThisAvailability|, « |language| »).
306
+
307
+
1. If |bestMatch| is not undefined, then:
308
+
309
+
1. [=list/Replace=] |language| with |bestMatch|.\[[locale]] in |requestedLanguages|.
310
+
311
+
1. Set |availability| to the [=Availability/minimum availability=] given |availability| and |availabilityToCheck|.
312
+
313
+
1. Set |unavailable| to false.
314
+
315
+
1. [=iteration/Break=].
316
+
317
+
1. If |unavailable| is true, then return "{{Availability/unavailable}}".
0 commit comments