Summarizer: thuộc tính expectedContextLanguages
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Thuộc tính expectedContextLanguages chỉ đọc của giao diện Summarizer trả về các ngôn ngữ mà các chuỗi ngữ cảnh nên được viết bằng.
Giá trị
Một mảng các chuỗi chỉ định các ngôn ngữ dự kiến của bất kỳ chuỗi ngữ cảnh nào được cung cấp (hoặc Summarizer.sharedContext, hoặc context được chỉ định trong lần gọi summarize() hoặc summarizeStreaming()).
Các chuỗi phải là thẻ ngôn ngữ BCP 47 hợp lệ.
Ví dụ
js
const summarizer = await Summarizer.create({
expectedContextLanguages: ["en-US", "fr"],
// ...
});
// Ghi log "en-US"
console.log(summarizer.expectedContextLanguages[0]);
Thông số kỹ thuật
| Specification |
|---|
| Writing Assistance APIs> # dom-summarizer-expectedcontextlanguages> |
Tương thích trình duyệt
Xem thêm
- Sử dụng Summarizer API
- Web AI demos trên chrome.dev