Summarizer: length 属性
Summarizer
接口的只读属性 length
返回生成摘要的相对长度。
值
一个枚举值,指定生成摘要的相对长度,其确切含义取决于 Summarizer
的 type
值。
可能的值是
short
-
“短”摘要
- 对于
type
为tldr
和teaser
,摘要应包含在一个句子中。 - 对于
type
为key-points
,摘要不应超过三个要点。 - 对于
type
为headline
,摘要不应超过 12 个单词。
- 对于
medium
-
“中等”摘要
- 对于
type
为tldr
和teaser
,摘要应包含在一个短段落中。 - 对于
type
为key-points
,摘要不应超过五个要点。 - 对于
type
为headline
,摘要不应超过 17 个单词。
- 对于
long
-
“长”摘要
- 对于
type
为tldr
和teaser
,摘要应包含在一个段落中。 - 对于
type
为key-points
,摘要不应超过七个要点。 - 对于
type
为headline
,摘要不应超过 22 个单词。
- 对于
示例
js
const summarizer = await Summarizer.create({
length: "medium",
// ...
});
// Logs "medium"
console.log(summarizer.length);
规范
规范 |
---|
写作辅助 API # dom-summarizer-length |
浏览器兼容性
加载中…
另见
- 使用 Summarizer API
- chrome.dev 上的 Web AI 演示。