Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: webmachinelearning/writing-assistance-apis
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 92115612533431baf46b95b809940e03c76d0b31
Choose a base ref
..
head repository: webmachinelearning/writing-assistance-apis
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 70d6311fd06605bf4f4bb46ed1eb0205dfdffcd4
Choose a head ref
Showing with 16 additions and 16 deletions.
  1. +16 −16 index.bs
32 changes: 16 additions & 16 deletions index.bs
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ p + dl.props { margin-top: -0.5em; }

<h2 id="intro">Introduction</h2>

For now, see the [explainer]([REPOSITORYURL]).
For now, see the [explainer](https://github.com/webmachinelearning/writing-assistance-apis/blob/main/README.md).

<h2 id="shared-ai-api">Shared AI APIs and infrastructure</h2>

@@ -166,7 +166,7 @@ partial interface AI {
[Exposed=(Window,Worker), SecureContext]
interface AISummarizerFactory {
Promise<AISummarizer> create(optional AISummarizerCreateOptions options = {});
Promise<AICapabilityAvailability> available(optional AISummarizerCreateCoreOptions options = {});
Promise<AICapabilityAvailability> availability(optional AISummarizerCreateCoreOptions options = {});
};

[Exposed=(Window,Worker), SecureContext]
@@ -473,7 +473,7 @@ The <dfn attribute for="AI">summarizer</dfn> getter steps are to return [=this=]
<h3 id="summarizer-availability">Availability</h3>

<div algorithm>
The <dfn method for="AISummarizerFactory">available(|options|)</dfn> method steps are:
The <dfn method for="AISummarizerFactory">availability(|options|)</dfn> method steps are:

1. If [=this=]'s [=relevant global object=] is a {{Window}} whose [=associated Document=] is not [=Document/fully active=], then return [=a promise rejected with=] an "{{InvalidStateError}}" {{DOMException}}.

@@ -649,25 +649,25 @@ All of these [=struct/items=] are [=sets=] of strings representing [=Unicode can

One way this could be implemented would be for [=summarizer language availabilities=] to return that "`zh-Hant`" is in the [=language availabilities/readily available input languages=], and "`zh`" and "`zh-Hans`" are in the [=language availabilities/after-download available input languages=]. This return value conforms to the requirements of the [=language tag set completeness rules=], in ensuring that "`zh`" is present. Per <a class="allow-2119" href="#readily-or-after-download-implementation-defined">the "should"-level guidance</a>, the implementation has determined that "`zh`" belongs in the set of [=language availabilities/after-download available input languages=], with "`zh-Hans`", instead of in the set of [=language availabilities/readily available input languages=], with "`zh-Hant`".

Combined with the use of [$LookupMatchingLocaleByBestFit$], this means {{AISummarizerFactory/available()}} will give the following answers:
Combined with the use of [$LookupMatchingLocaleByBestFit$], this means {{AISummarizerFactory/availability()}} will give the following answers:

<xmp class="language-js">
function inputLangAvailable(languageTag) {
return ai.summarizer.available({
function inputLangAvailability(languageTag) {
return ai.summarizer.availability({
expectedInputLanguages: [languageTag]
});
}

inputLangAvailable("zh") === "after-download";
inputLangAvailable("zh-Hant") === "readily";
inputLangAvailable("zh-Hans") === "after-download";
inputLangAvailability("zh") === "after-download";
inputLangAvailability("zh-Hant") === "readily";
inputLangAvailability("zh-Hans") === "after-download";

inputLangAvailable("zh-TW") === "readily"; // zh-TW will best-fit to zh-Hant
inputLangAvailable("zh-HK") === "readily"; // zh-HK will best-fit to zh-Hant
inputLangAvailable("zh-CN") === "after-download"; // zh-CN will best-fit to zh-Hans
inputLangAvailability("zh-TW") === "readily"; // zh-TW will best-fit to zh-Hant
inputLangAvailability("zh-HK") === "readily"; // zh-HK will best-fit to zh-Hant
inputLangAvailability("zh-CN") === "after-download"; // zh-CN will best-fit to zh-Hans

inputLangAvailable("zh-BR") === "after-download"; // zh-BR will best-fit to zh
inputLangAvailable("zh-Kana") === "after-download"; // zh-Kana will best-fit to zh
inputLangAvailability("zh-BR") === "after-download"; // zh-BR will best-fit to zh
inputLangAvailability("zh-Kana") === "after-download"; // zh-Kana will best-fit to zh
</xmp>
</div>
</div>
@@ -1201,7 +1201,7 @@ Just IDL for now; full spec coming!
[Exposed=(Window,Worker), SecureContext]
interface AIWriterFactory {
Promise<AIWriter> create(optional AIWriterCreateOptions options = {});
Promise<AICapabilityAvailability> available(optional AIWriterCreateCoreOptions options = {});
Promise<AICapabilityAvailability> availability(optional AIWriterCreateCoreOptions options = {});
};

[Exposed=(Window,Worker), SecureContext]
@@ -1268,7 +1268,7 @@ Just IDL for now; full spec coming!
[Exposed=(Window,Worker), SecureContext]
interface AIRewriterFactory {
Promise<AIRewriter> create(optional AIRewriterCreateOptions options = {});
Promise<AICapabilityAvailability> available(optional AIRewriterCreateCoreOptions options = {});
Promise<AICapabilityAvailability> availability(optional AIRewriterCreateCoreOptions options = {});
};

[Exposed=(Window,Worker), SecureContext]