Back to Content

Summarizer: expectedContextLanguages property

files/en-us/web/api/summarizer/expectedcontextlanguages/index.md

latest1.0 KB
Original Source

{{APIRef("Summarizer API")}}{{SeeCompatTable}}{{securecontext_header}}

The expectedContextLanguages read-only property of the {{domxref("Summarizer")}} interface returns the languages the context strings should be written in.

Value

An array of strings specifying the expected languages of any provided context strings (either the {{domxref("Summarizer.sharedContext")}}, or a context specified during a {{domxref("Summarizer.summarize", "summarize()")}} or {{domxref("Summarizer.summarizeStreaming", "summarizeStreaming()")}} call).

The strings should be valid {{glossary("BCP 47 language tag", "BCP 47 language tags")}}.

Examples

js
const summarizer = await Summarizer.create({
  expectedContextLanguages: ["en-US", "fr"],
  // ...
});

// Logs "en-US"
console.log(summarizer.expectedContextLanguages[0]);

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also