tune(translation): set latin acceptance floor to 0.80 (#1376)
Calibrated against fresh probes once Interpreter returned real langdetect confidence: genuine German detected at 1.0, a correctly-detected but ambiguous latin string at 0.86. Set _MIN_LATIN_CONFIDENCE to 0.80 (below that band) so legitimate ambiguous non-English still translates while genuinely-unsure guesses are rejected. Real langdetect also fixed the original mis-flag at the source, so this floor is a safety net, not the primary fix. Pin 0.86-accepted in the gate test to guard against bumping the floor back up. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CgZP9v2otxVJymiYsnVuMy
This commit is contained in:
@@ -58,9 +58,16 @@ _INTERRUPT_BACKOFF_MAX = 900
|
||||
# correctly translated). Latin-script detection is a real statistical
|
||||
# probability, so a short English title Interpreter mis-labels as a European
|
||||
# language scores low; require it to clear this floor, else keep the original.
|
||||
# Tune the floor against real titles via the Settings "Test translation" box.
|
||||
# Calibrated 2026-07-09 against fresh (uncached) probes once Interpreter returned
|
||||
# real langdetect confidence: genuine German detected at 1.0, while a correctly-
|
||||
# detected but ambiguous latin string dipped to 0.86 — so the floor sits at 0.80,
|
||||
# below that band, to keep legitimate ambiguous non-English while still rejecting
|
||||
# genuinely-unsure guesses. Real langdetect also fixed the original mis-flag at
|
||||
# the source (short English titles now detect as English → passthrough), so this
|
||||
# floor is a safety net, not the primary fix. Re-tune via the "Test translation"
|
||||
# box (send fresh text — cache hits report 1.0).
|
||||
_CJK_LANGS = frozenset({"ja", "ko", "zh"})
|
||||
_MIN_LATIN_CONFIDENCE = 0.90
|
||||
_MIN_LATIN_CONFIDENCE = 0.80
|
||||
|
||||
|
||||
def _interrupt_backoff(retry_after) -> int:
|
||||
|
||||
@@ -17,6 +17,7 @@ def test_accept_trusts_cjk_regardless_of_confidence():
|
||||
|
||||
def test_accept_requires_floor_for_latin():
|
||||
assert _accept("de", 0.98) is True
|
||||
assert _accept("de", 0.86) is True # calibrated: ambiguous-but-correct German stays
|
||||
assert _accept("de", _MIN_LATIN_CONFIDENCE) is True # exactly at floor
|
||||
assert _accept("de", _MIN_LATIN_CONFIDENCE - 0.01) is False
|
||||
assert _accept("fr", 0.40) is False # short mis-flag
|
||||
|
||||
Reference in New Issue
Block a user