v157 · concept 3 · inspection tool
Confidence inspector
detect() returns a ranked list, not one answer. Chromium cuts the list once the confidences add up to 0.99, drops anything less likely than “unknown”, and always ends it with und carrying the leftover probability. This tool shows the raw array from the on-device model, checks it against those rules, and shows how confidence changes as text gets longer. Short messages are common on phones, and they're where detection is weakest.
LanguageDetector is exposed…1 · get a detector without downloading
2 · inspect one result
| # | detectedLanguage | confidence | bar |
|---|---|---|---|
| No result yet. | |||
3 · how length changes confidence
Runs detect() on growing prefixes of the text above (word by word) and records the top language and its confidence for each. This is how you pick the minimum length before you trust a result.
| chars | prefix | top | confidence |
|---|---|---|---|
| Not run. | |||
the rules being checked
From LanguageDetector::ConvertResult in Chromium's language_detector.cc. The spec only says results are ordered by descending confidence; the rest is Chromium's implementation:
- Results are in descending confidence order.
- The last entry is always
und(undetermined) with the leftover probability, so the confidences add up to 1. - The empty string returns exactly
[{ detectedLanguage: "und", confidence: 1 }]. - The model's old Hebrew code
iwis rewritten tohe. inputQuotaisInfinityandmeasureInputUsage()resolves to0, so there's no per-call size budget to track for this API (unlike Translator on Android, which caps each call at 256 KiB).
see also
- Download on a constrained device: get the model onto the device first
- Confidence meter (v148), the desktop take on thresholds
- ChromeStatus entry (5087964794322944)
- Spec: detect()