Summarizer API
The length read-only property of the Summarizer interface returns the relative length of the generated summaries.
Value
An enumerated value specifying the relative length of the generated summaries, the exact nature of which depends on the Summarizer Summarizer.type value.
Possible values are:
short- : A "short" summary
- For
typetldrandteaser, the summary should fit into one sentence. - For
typekey-points, the summary should be no more than three bullet points. - For
typeheadline, the summary should be no more than 12 words.
- For
- : A "short" summary
medium- : A "medium" summary
- For
typetldrandteaser, the summary should fit into one short paragraph. - For
typekey-points, the summary should be no more than five bullet points. - For
typeheadline, the summary should be no more than 17 words.
- For
- : A "medium" summary
long- : A "long" summary
- For
typetldrandteaser, the summary should fit into one paragraph. - For
typekey-points, the summary should be no more than seven bullet points. - For
typeheadline, the summary should be no more than 22 words.
- For
- : A "long" summary
Examples
const summarizer = await Summarizer.create({
length: "medium",
// ...
});
// Logs "medium"
console.log(summarizer.length);
Specifications
Browser compatibility
See also
- Using the Summarizer API
- Web AI demos on chrome.dev.
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
