LanguageDetector: thuộc tính expectedInputLanguages
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 chỉ đọc expectedInputLanguages của giao diện LanguageDetector trả về các ngôn ngữ dự kiến sẽ được phát hiện trong văn bản đầu vào. Việc chỉ định các ngôn ngữ đầu vào dự kiến giúp cải thiện độ chính xác của việc phát hiện ngôn ngữ.
expectedInputLanguages của phiên bản LanguageDetector được đặt khi tạo nó thông qua lệnh gọi create().
Giá trị
Một mảng các chuỗi chỉ định các ngôn ngữ đầu vào dự kiến. Đây sẽ là các thẻ ngôn ngữ BCP 47 hợp lệ.
Ví dụ
const detector = await LanguageDetector.create({
expectedInputLanguages: ["en-US", "zh"],
});
// Logs ["en-US", "zh"]
console.log(detector.expectedInputLanguages);
Thông số kỹ thuật
| Specification |
|---|
| Translator and Language Detector APIs> # dom-languagedetector-expectedinputlanguages> |