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.

1 · get a detector without downloading

No detector yet.

2 · inspect one result

Raw detect() output, in the order the browser returned it
#detectedLanguageconfidencebar
No result yet.
    Waiting for a detector.

    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.

    Top result per prefix length
    charsprefixtopconfidence
    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:

    1. Results are in descending confidence order.
    2. The last entry is always und (undetermined) with the leftover probability, so the confidences add up to 1.
    3. The empty string returns exactly [{ detectedLanguage: "und", confidence: 1 }].
    4. The model's old Hebrew code iw is rewritten to he.
    5. inputQuota is Infinity and measureInputUsage() resolves to 0, 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